Adam Shaw 6 лет назад
Родитель
Сommit
2e9ca438ae

+ 1 - 1
packages-premium

@@ -1 +1 @@
-Subproject commit 9d340fbe09cac773793cf34ea06838a74355a255
+Subproject commit 0caceda5a288d1f10598e5ce5b9e3c7ba47c6c51

+ 1 - 0
packages/core/src/main.ts

@@ -168,6 +168,7 @@ export * from './vdom'
 export { BaseComponent, setRef } from './vdom-util'
 export { DelayedRunner } from './util/runner'
 
+export { ScrollGridProps, ScrollGridSectionConfig, ColGroupConfig, ScrollGridImpl } from './scrollgrid/ScrollGridImpl'
 export { default as SimpleScrollGrid, SimpleScrollGridSection } from './scrollgrid/SimpleScrollGrid'
 export {
   CssDimValue, ScrollerLike, SectionConfig, ColProps, ChunkConfig, hasShrinkWidth, renderMicroColGroup,

+ 9 - 3
packages/core/src/plugin-system.ts

@@ -20,6 +20,7 @@ import { NamedTimeZoneImplClass } from './datelib/timezone'
 import { ElementDraggingClass } from './interactions/ElementDragging'
 import { guid } from './util/misc'
 import { ComponentChildren } from './vdom'
+import { ScrollGridImpl } from './scrollgrid/ScrollGridImpl'
 
 // TODO: easier way to add new hooks? need to update a million things
 
@@ -50,6 +51,7 @@ export interface PluginDefInput {
   defaultView?: string
   elementDraggingImpl?: ElementDraggingClass
   optionChangeHandlers?: OptionChangeHandlerMap
+  scrollGridImpl?: ScrollGridImpl
 }
 
 export interface PluginHooks {
@@ -78,6 +80,7 @@ export interface PluginHooks {
   defaultView: string
   elementDraggingImpl?: ElementDraggingClass
   optionChangeHandlers: OptionChangeHandlerMap
+  scrollGridImpl: ScrollGridImpl | null
 }
 
 export interface PluginDef extends PluginHooks {
@@ -122,7 +125,8 @@ export function createPlugin(input: PluginDefInput): PluginDef {
     namedTimeZonedImpl: input.namedTimeZonedImpl,
     defaultView: input.defaultView || '',
     elementDraggingImpl: input.elementDraggingImpl,
-    optionChangeHandlers: input.optionChangeHandlers || {}
+    optionChangeHandlers: input.optionChangeHandlers || {},
+    scrollGridImpl: input.scrollGridImpl || null
   }
 }
 
@@ -157,7 +161,8 @@ export class PluginSystem {
       namedTimeZonedImpl: null,
       defaultView: '',
       elementDraggingImpl: null,
-      optionChangeHandlers: {}
+      optionChangeHandlers: {},
+      scrollGridImpl: null
     }
     this.addedHash = {}
   }
@@ -202,6 +207,7 @@ function combineHooks(hooks0: PluginHooks, hooks1: PluginHooks): PluginHooks {
     namedTimeZonedImpl: hooks1.namedTimeZonedImpl || hooks0.namedTimeZonedImpl,
     defaultView: hooks0.defaultView || hooks1.defaultView, // put earlier plugins FIRST
     elementDraggingImpl: hooks0.elementDraggingImpl || hooks1.elementDraggingImpl, // "
-    optionChangeHandlers: { ...hooks0.optionChangeHandlers, ...hooks1.optionChangeHandlers }
+    optionChangeHandlers: { ...hooks0.optionChangeHandlers, ...hooks1.optionChangeHandlers },
+    scrollGridImpl: hooks1.scrollGridImpl || hooks0.scrollGridImpl
   }
 }

+ 23 - 0
packages/core/src/scrollgrid/ScrollGridImpl.ts

@@ -0,0 +1,23 @@
+import { SectionConfig, ChunkConfig, ColProps, CssDimValue } from './util'
+import { Component } from '../vdom'
+
+
+export interface ScrollGridProps {
+  colGroups?: ColGroupConfig[]
+  sections: ScrollGridSectionConfig[]
+  vGrow?: boolean
+  forPrint?: boolean
+}
+
+export interface ScrollGridSectionConfig extends SectionConfig {
+  key?: string
+  chunks: ChunkConfig[]
+}
+
+export interface ColGroupConfig {
+  width?: CssDimValue
+  cols: ColProps[]
+}
+
+
+export type ScrollGridImpl = Component<ScrollGridProps>

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

@@ -6,7 +6,7 @@ import { isPropsEqual } from '../util/object'
 import { isArraysEqual } from '../util/array'
 
 
-export type CssDimValue = string | number
+export type CssDimValue = string | number // TODO: move to more general file
 
 
 export interface ColProps {