Просмотр исходного кода

fix: print view cut off for wide liquid-width calendar. fixes #5707

Adam Shaw 4 лет назад
Родитель
Сommit
a447a7976e

+ 1 - 0
CHANGELOG.md

@@ -4,6 +4,7 @@ v5.6.0
 
 - feature: icalendar events receive URL (#6173)
 - feature: icalendar events receive location, organizer, description in extendedProps (#6097)
+- fix: print view cut off for wide liquid-width calendar (#5707)
 - fix: event start time is limited by what is visible by slotMinTime (#6162)
 - fix: Event::setProp can't change the id (#4730)
 - fix: icalendar event source does not update on refreshEvents (#6194)

+ 1 - 1
packages-premium

@@ -1 +1 @@
-Subproject commit 0f6212091235c7aa023b91ddd9c1840f6d99416c
+Subproject commit 3ea0c36608cf0fc5d510571bda06af1ac691835b

+ 2 - 1
packages/common/src/scrollgrid/ScrollGridImpl.ts

@@ -5,7 +5,8 @@ import { ViewContext } from '../ViewContext'
 export interface ScrollGridProps {
   colGroups?: ColGroupConfig[]
   sections: ScrollGridSectionConfig[]
-  liquid: boolean
+  liquid: boolean // liquid *height*
+  collapsibleWidth: boolean // can ALL sections be fully collapsed in width?
   elRef?: Ref<any>
 }
 

+ 7 - 2
packages/common/src/scrollgrid/SimpleScrollGrid.tsx

@@ -15,7 +15,8 @@ import { getScrollbarWidths } from '../util/scrollbar-width'
 export interface SimpleScrollGridProps {
   cols: ColProps[]
   sections: SimpleScrollGridSection[]
-  liquid: boolean
+  liquid: boolean // liquid *height*
+  collapsibleWidth: boolean // can ALL sections be fully collapsed in width?
   height?: CssDimValue // TODO: give to real ScrollGrid
 }
 
@@ -55,6 +56,10 @@ export class SimpleScrollGrid extends BaseComponent<SimpleScrollGridProps, Simpl
     let microColGroupNode = this.renderMicroColGroup(cols, state.shrinkWidth)
     let classNames = getScrollGridClassNames(props.liquid, context)
 
+    if (props.collapsibleWidth) {
+      classNames.push('fc-scrollgrid-collapsible')
+    }
+
     // TODO: make DRY
     let configCnt = sectionConfigs.length
     let configI = 0
@@ -136,7 +141,7 @@ export class SimpleScrollGrid extends BaseComponent<SimpleScrollGridProps, Simpl
     let content = renderChunkContent(sectionConfig, chunkConfig, {
       tableColGroupNode: microColGroupNode,
       tableMinWidth: '',
-      clientWidth: scrollerClientWidths[sectionKey] !== undefined ? scrollerClientWidths[sectionKey] : null,
+      clientWidth: (!props.collapsibleWidth && scrollerClientWidths[sectionKey] !== undefined) ? scrollerClientWidths[sectionKey] : null,
       clientHeight: scrollerClientHeights[sectionKey] !== undefined ? scrollerClientHeights[sectionKey] : null,
       expandRows: sectionConfig.expandRows,
       syncRowHeights: false,

+ 2 - 0
packages/daygrid/src/TableView.tsx

@@ -58,6 +58,7 @@ export abstract class TableView<State=Dictionary> extends DateComponent<ViewProp
           <div ref={rootElRef} className={['fc-daygrid'].concat(classNames).join(' ')}>
             <SimpleScrollGrid
               liquid={!props.isHeightAuto && !props.forPrint}
+              collapsibleWidth={props.forPrint}
               cols={[] /* TODO: make optional? */}
               sections={sections}
             />
@@ -126,6 +127,7 @@ export abstract class TableView<State=Dictionary> extends DateComponent<ViewProp
           <div ref={rootElRef} className={['fc-daygrid'].concat(classNames).join(' ')}>
             <ScrollGrid
               liquid={!props.isHeightAuto && !props.forPrint}
+              collapsibleWidth={props.forPrint}
               colGroups={[{ cols: [{ span: colCnt, minWidth: dayMinWidth }] }]}
               sections={sections}
             />

+ 2 - 0
packages/timegrid/src/TimeColsView.tsx

@@ -112,6 +112,7 @@ export abstract class TimeColsView extends DateComponent<ViewProps, TimeColsView
           <div className={['fc-timegrid'].concat(classNames).join(' ')} ref={rootElRef}>
             <SimpleScrollGrid
               liquid={!props.isHeightAuto && !props.forPrint}
+              collapsibleWidth={props.forPrint}
               cols={[{ width: 'shrink' }]}
               sections={sections}
             />
@@ -278,6 +279,7 @@ export abstract class TimeColsView extends DateComponent<ViewProps, TimeColsView
           <div className={['fc-timegrid'].concat(classNames).join(' ')} ref={rootElRef}>
             <ScrollGrid
               liquid={!props.isHeightAuto && !props.forPrint}
+              collapsibleWidth={false}
               colGroups={[
                 { width: 'shrink', cols: [{ width: 'shrink' }] }, // TODO: allow no specify cols
                 { cols: [{ span: colCnt, minWidth: dayMinWidth }] },