瀏覽代碼

fix vGrow, some bugs, some renames

Adam Shaw 6 年之前
父節點
當前提交
40be2e8d34

+ 1 - 1
packages-premium

@@ -1 +1 @@
-Subproject commit 69d9563a66a68786e7ee307de77336853fd1537f
+Subproject commit 169ce0b61b23017cddfe83373d531185d629032b

+ 1 - 0
packages/core/src/scrollgrid/SimpleScrollGrid.tsx

@@ -98,6 +98,7 @@ export default class SimpleScrollGrid extends BaseComponent<SimpleScrollGridProp
       tableMinWidth: '',
       tableMinWidth: '',
       clientWidth: state.scrollerClientWidths[sectionI] || '',
       clientWidth: state.scrollerClientWidths[sectionI] || '',
       clientHeight: state.scrollerClientHeights[sectionI] || '',
       clientHeight: state.scrollerClientHeights[sectionI] || '',
+      vGrowRows: sectionConfig.vGrowRows || chunkConfig.vGrowRows,
       rowSyncHeights: []
       rowSyncHeights: []
     })
     })
 
 

+ 1 - 0
packages/core/src/scrollgrid/util.tsx

@@ -42,6 +42,7 @@ export interface ChunkContentCallbackArgs { // TODO: util for wrapping tables!?
   tableMinWidth: CssDimValue
   tableMinWidth: CssDimValue
   clientWidth: CssDimValue
   clientWidth: CssDimValue
   clientHeight: CssDimValue
   clientHeight: CssDimValue
+  vGrowRows: boolean
   rowSyncHeights: number[]
   rowSyncHeights: number[]
 }
 }
 
 

+ 4 - 2
packages/timegrid/src/DayTimeCols.tsx

@@ -35,9 +35,10 @@ export interface DayTimeColsProps {
   tableMinWidth: CssDimValue
   tableMinWidth: CssDimValue
   clientWidth: CssDimValue
   clientWidth: CssDimValue
   clientHeight: CssDimValue
   clientHeight: CssDimValue
+  vGrowRows: boolean
   renderBgIntro: () => VNode[]
   renderBgIntro: () => VNode[]
   renderIntro: () => VNode[]
   renderIntro: () => VNode[]
-  onScrollTop?: (scrollTop: number) => void
+  onScrollTopRequest?: (scrollTop: number) => void
   forPrint: boolean
   forPrint: boolean
 }
 }
 
 
@@ -72,11 +73,12 @@ export default class DayTimeCols extends DateComponent<DayTimeColsProps, DayTime
         tableMinWidth={props.tableMinWidth}
         tableMinWidth={props.tableMinWidth}
         clientWidth={props.clientWidth}
         clientWidth={props.clientWidth}
         clientHeight={props.clientHeight}
         clientHeight={props.clientHeight}
+        vGrowRows={props.vGrowRows}
         renderBgIntro={props.renderBgIntro}
         renderBgIntro={props.renderBgIntro}
         renderIntro={props.renderIntro}
         renderIntro={props.renderIntro}
         nowIndicatorDate={state.nowIndicatorDate}
         nowIndicatorDate={state.nowIndicatorDate}
         nowIndicatorSegs={state.nowIndicatorDate && this.slicer.sliceNowDate(state.nowIndicatorDate, this.context.calendar, this.dayRanges)}
         nowIndicatorSegs={state.nowIndicatorDate && this.slicer.sliceNowDate(state.nowIndicatorDate, this.context.calendar, this.dayRanges)}
-        onScrollTop={props.onScrollTop}
+        onScrollTopRequest={props.onScrollTopRequest}
         forPrint={props.forPrint}
         forPrint={props.forPrint}
       />
       />
     )
     )

+ 2 - 1
packages/timegrid/src/DayTimeColsView.tsx

@@ -62,7 +62,8 @@ export default class DayTimeColsView extends TimeColsView {
           tableMinWidth={contentArg.tableMinWidth}
           tableMinWidth={contentArg.tableMinWidth}
           clientWidth={contentArg.clientWidth}
           clientWidth={contentArg.clientWidth}
           clientHeight={contentArg.clientHeight}
           clientHeight={contentArg.clientHeight}
-          onScrollTop={this.handleScrollTop}
+          vGrowRows={contentArg.vGrowRows}
+          onScrollTopRequest={this.handleScrollTopRequest}
         />
         />
       )
       )
     )
     )

+ 6 - 5
packages/timegrid/src/TimeCols.tsx

@@ -42,11 +42,12 @@ export interface TimeColsProps {
   tableMinWidth: CssDimValue
   tableMinWidth: CssDimValue
   clientWidth: CssDimValue
   clientWidth: CssDimValue
   clientHeight: CssDimValue
   clientHeight: CssDimValue
+  vGrowRows: boolean
   renderBgIntro: () => VNode[]
   renderBgIntro: () => VNode[]
   renderIntro: () => VNode[]
   renderIntro: () => VNode[]
   nowIndicatorDate: DateMarker
   nowIndicatorDate: DateMarker
   nowIndicatorSegs: TimeColsSeg[]
   nowIndicatorSegs: TimeColsSeg[]
-  onScrollTop?: (scrollTop: number) => void
+  onScrollTopRequest?: (scrollTop: number) => void
   forPrint: boolean
   forPrint: boolean
 }
 }
 
 
@@ -99,7 +100,7 @@ export default class TimeCols extends BaseComponent<TimeColsProps, TimeColsState
           dateProfile={dateProfile}
           dateProfile={dateProfile}
           slotDuration={slotDuration}
           slotDuration={slotDuration}
           clientWidth={props.clientWidth}
           clientWidth={props.clientWidth}
-          clientHeight={props.clientHeight}
+          minHeight={props.vGrowRows ? props.clientHeight : ''}
           tableMinWidth={props.tableMinWidth}
           tableMinWidth={props.tableMinWidth}
           tableColGroupNode={props.tableColGroupNode}
           tableColGroupNode={props.tableColGroupNode}
           onCoords={this.handleSlatCoords}
           onCoords={this.handleSlatCoords}
@@ -143,17 +144,17 @@ export default class TimeCols extends BaseComponent<TimeColsProps, TimeColsState
 
 
 
 
   handleScrollRequest = (request: ScrollRequest) => {
   handleScrollRequest = (request: ScrollRequest) => {
-    let { onScrollTop } = this.props
+    let { onScrollTopRequest } = this.props
     let { slatCoords } = this.state
     let { slatCoords } = this.state
 
 
-    if (onScrollTop && slatCoords) {
+    if (onScrollTopRequest && slatCoords) {
 
 
       if (request.time) {
       if (request.time) {
         let top = slatCoords.computeTimeTop(request.time)
         let top = slatCoords.computeTimeTop(request.time)
         top = Math.ceil(top) // zoom can give weird floating-point values. rather scroll a little bit further
         top = Math.ceil(top) // zoom can give weird floating-point values. rather scroll a little bit further
         if (top) { top++ } // to overcome top border that slots beyond the first have. looks better
         if (top) { top++ } // to overcome top border that slots beyond the first have. looks better
 
 
-        onScrollTop(top)
+        onScrollTopRequest(top)
       }
       }
 
 
       return true
       return true

+ 2 - 1
packages/timegrid/src/TimeColsEvents.ts

@@ -256,6 +256,7 @@ function computeSegHorizontals(segs: Seg[], context: ComponentContext) {
   for (let seg of segs) {
   for (let seg of segs) {
     seg.forwardCoord = null
     seg.forwardCoord = null
     seg.backwardCoord = null
     seg.backwardCoord = null
+    seg.forwardPressure = null
   }
   }
 
 
   levels = buildSlotSegLevels(segs)
   levels = buildSlotSegLevels(segs)
@@ -396,7 +397,7 @@ function computeSlotSegPressures(seg: Seg) {
   let i
   let i
   let forwardSeg
   let forwardSeg
 
 
-  if (seg.forwardPressure === undefined) { // not already computed
+  if (seg.forwardPressure == null) { // not already computed
 
 
     for (i = 0; i < forwardSegs.length; i++) {
     for (i = 0; i < forwardSegs.length; i++) {
       forwardSeg = forwardSegs[i]
       forwardSeg = forwardSegs[i]

+ 3 - 3
packages/timegrid/src/TimeColsSlats.tsx

@@ -21,7 +21,7 @@ import {
 
 
 export interface TimeColsSlatsProps extends TimeColsSlatsContentProps {
 export interface TimeColsSlatsProps extends TimeColsSlatsContentProps {
   clientWidth: CssDimValue
   clientWidth: CssDimValue
-  clientHeight: CssDimValue
+  minHeight: CssDimValue
   tableMinWidth: CssDimValue
   tableMinWidth: CssDimValue
   tableColGroupNode: VNode
   tableColGroupNode: VNode
   onCoords?: (coords: PositionCache | null) => void
   onCoords?: (coords: PositionCache | null) => void
@@ -64,7 +64,7 @@ export default class TimeColsSlats extends BaseComponent<TimeColsSlatsProps> {
           style={{
           style={{
             minWidth: props.tableMinWidth,
             minWidth: props.tableMinWidth,
             width: props.clientWidth,
             width: props.clientWidth,
-            height: props.clientHeight
+            height: props.minHeight
           }}
           }}
         >
         >
           {props.tableColGroupNode /* relies on there only being a single <col> for the axis */}
           {props.tableColGroupNode /* relies on there only being a single <col> for the axis */}
@@ -102,7 +102,7 @@ export default class TimeColsSlats extends BaseComponent<TimeColsSlatsProps> {
   handleSizing = () => {
   handleSizing = () => {
     let { props } = this
     let { props } = this
 
 
-    if (props.onCoords && props.clientHeight) {
+    if (props.onCoords && props.clientWidth) { // clientWidth means sizing has stabilized
       props.onCoords(
       props.onCoords(
         new PositionCache(
         new PositionCache(
           this.rootElRef.current,
           this.rootElRef.current,

+ 1 - 1
packages/timegrid/src/TimeColsView.tsx

@@ -91,7 +91,7 @@ export default abstract class TimeColsView extends View {
   }
   }
 
 
 
 
-  handleScrollTop = (scrollTop: number) => {
+  handleScrollTopRequest = (scrollTop: number) => {
     this.scrollerElRef.current.scrollTop = scrollTop
     this.scrollerElRef.current.scrollTop = scrollTop
   }
   }