File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
src/main/resources/META-INF/resources/frontend/src Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -135,16 +135,38 @@ export class DaysOfWeekSelector extends ResizeMixin(ThemableMixin(LitElement)) {
135135 this . _updateOnOverflow ( ) ;
136136 }
137137
138+ /**
139+ * Returns overflow button width.
140+ *
141+ * @private
142+ */
143+ private _getOverflowButtonWidth ( ) {
144+ let overflowWidth = 0 ;
145+ const badge = this . _overflowBadge ;
146+ if ( badge ) {
147+ const wasHidden = badge . hasAttribute ( 'hidden' ) ;
148+ if ( wasHidden ) {
149+ badge . removeAttribute ( 'hidden' ) ;
150+ }
151+ overflowWidth = badge . getBoundingClientRect ( ) . width || 0 ;
152+ if ( wasHidden ) {
153+ badge . setAttribute ( 'hidden' , '' ) ;
154+ }
155+ }
156+ return overflowWidth ;
157+ }
158+
138159 private _updateOnOverflow ( ) {
139160 const containerWidth = this . getBoundingClientRect ( ) . width ;
140161 let usedWidth = 0 ;
141162 const overflowButtons : Node [ ] = [ ] ;
163+ const overflowButtonWidth = this . _getOverflowButtonWidth ( ) ;
142164
143165 for ( const button of this . _daysOfWeek ) {
144166 button . style . display = '' ;
145167 const width = button . getBoundingClientRect ( ) . width ;
146168
147- if ( usedWidth + width > containerWidth - 50 ) {
169+ if ( usedWidth + width > containerWidth - overflowButtonWidth ) {
148170 const clonedButton = this . _cloneButton ( button ) ;
149171 overflowButtons . push ( clonedButton ) ;
150172
You can’t perform that action at this time.
0 commit comments