diff --git a/src/actions/adaptive-container.ts b/src/actions/adaptive-container.ts index fbe020b1a1..6391c8cc8f 100644 --- a/src/actions/adaptive-container.ts +++ b/src/actions/adaptive-container.ts @@ -11,22 +11,30 @@ export class AdaptiveActionContainer extends ActionCo public isResponsivenessDisabled = false; private hideItemsGreaterN(visibleItemsCount: number) { - const actionsToHide = this.visibleActions.filter(action => !action.disableHide); + const actionsToHide = this.getActionsToHide(); visibleItemsCount = Math.max(visibleItemsCount, this.minVisibleItemsCount - (this.visibleActions.length - actionsToHide.length)); const hiddenItems: IAction[] = []; actionsToHide.forEach((item) => { if (visibleItemsCount <= 0) { - item.mode = "popup"; - hiddenItems.push(item.innerItem); + if(item.removePriority) { + item.mode = "removed"; + } else { + item.mode = "popup"; + hiddenItems.push(item.innerItem); + } } visibleItemsCount--; }); this.hiddenItemsListModel.setItems(hiddenItems); } + private getActionsToHide() { + return this.visibleActions.filter(action => !action.disableHide).sort((a, b) => a.removePriority || 0 - b.removePriority || 0); + } + private getVisibleItemsCount(availableSize: number): number { this.visibleActions.filter((action) => action.disableHide).forEach(action => availableSize -= action.minDimension); - const itemsSizes: number[] = this.visibleActions.filter(action => !action.disableHide).map((item) => item.minDimension); + const itemsSizes: number[] = this.getActionsToHide().map((item) => item.minDimension); let currSize: number = 0; for (var i = 0; i < itemsSizes.length; i++) { currSize += itemsSizes[i]; @@ -127,7 +135,7 @@ export class AdaptiveActionContainer extends ActionCo } else if (dimension < minSize) { this.setActionsMode("small"); this.hideItemsGreaterN(this.getVisibleItemsCount(dimension - dotsItemSize)); - this.dotsItem.visible = true; + this.dotsItem.visible = !!this.hiddenItemsListModel.actions.length; } else { this.updateItemMode(dimension, maxSize); } @@ -145,7 +153,10 @@ export class AdaptiveActionContainer extends ActionCo } } public setActionsMode(mode: actionModeType) { - this.actions.forEach((action) => (action.mode = mode)); + this.actions.forEach((action) => { + if(mode == "small" && action.disableShrink) return; + action.mode = mode; + }); } public dispose(): void { super.dispose(); diff --git a/src/actions/container.ts b/src/actions/container.ts index 4ee745a112..bb7b5c5a69 100644 --- a/src/actions/container.ts +++ b/src/actions/container.ts @@ -10,6 +10,7 @@ export let defaultActionBarCss = { defaultSizeMode: "sv-action-bar--default-size-mode", smallSizeMode: "sv-action-bar--small-size-mode", item: "sv-action-bar-item", + itemAsIcon: "sv-action-bar-item--icon", itemActive: "sv-action-bar-item--active", itemPressed: "sv-action-bar-item--pressed", itemIcon: "sv-action-bar-item__icon", diff --git a/tests/markup/snapshots/file-mob2-zip-png-ro.snap.html b/tests/markup/snapshots/file-mob2-zip-png-ro.snap.html index 46b172af75..e426bad097 100644 --- a/tests/markup/snapshots/file-mob2-zip-png-ro.snap.html +++ b/tests/markup/snapshots/file-mob2-zip-png-ro.snap.html @@ -30,7 +30,7 @@
-
-
-
-
-