Last active
October 29, 2018 15:14
-
-
Save shibukawa/363dbf3ca1c58584334c4a0c03b7a24c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ICommonColumn<T> { | |
width?: number | string; | |
minWidth?: number | string; | |
maxWidth?: number | string; | |
caption?: string; | |
style?: IStyle | styleFunction<T>; | |
padding?: string | number[]; | |
textOverflow?: "clip" | "ellipsis"; | |
action?: string; | |
icon?: IFontIcon | IImageIcon; | |
} | |
interface IFontIcon<T> { | |
font: string; | |
content: keyof T; | |
className: string; | |
width?: number; | |
color?: string; | |
} | |
interface IImageIcon<T> { | |
src: keyof T; | |
className: string; | |
width?: number; | |
color?: string; | |
} | |
declare function styleFunction<T>(rec: T): IStyle; | |
type StyleFunc = (per: value) => string; | |
interface IStyle { | |
color?: string | StyleFunc; | |
textAlign?: string | StyleFunc; | |
textBaseline?: string | StyleFunc; | |
bgColor?: string | StyleFunc; | |
font?: string | StyleFunc; | |
} | |
interface IDataColumn<T> extends ICommonColumn<T> { | |
field: keyof T; | |
} | |
export namespace columns { | |
namespace types { | |
// Column | |
declare class Column<T> {} | |
// NumberColumn | |
interface INumberColumnParam { | |
format: INumberFormat; | |
} | |
declare class NumberColumn<T> { | |
constructor(param: INumberColumnParam); | |
} | |
// CheckColumn | |
declare class CheckColumn {} | |
// ButtonColumn | |
declare class ButtonColumn {} | |
// ImageColumn | |
declare class ImageColumn {} | |
// MenuColumn | |
interface IMenuColumnOption { | |
value: any; | |
caption: string; | |
} | |
declare class MenuColumn { | |
constructor(options: IMenuColumnOption[]); | |
} | |
// PercentCompleteBarColumn | |
interface IPercentCompleteBarColumnParam { | |
min?: number; | |
max?: number; | |
formatter?: (v: number) => string; | |
} | |
declare class PercentCompleteBarColumn { | |
constructor(param: IPercentCompleteBarColumnParam); | |
} | |
// IconColumn | |
interface IIconColumnParam { | |
className: string; | |
content: string; | |
} | |
declare class IconColumn { | |
constructor(param: IIconColumnParam); | |
} | |
// BranchGraphColumn | |
interface IBranchGraphColumnParam { | |
start?: "top" | "bottom"; | |
cache?: boolean; | |
} | |
declare class BranchGraphColumn { | |
constructor(param: IBranchGraphColumnParam); | |
} | |
// MultilineTextColumn | |
declare class MultilineTextColumn {} | |
} | |
} | |
interface IColumn<T> extends IDataColumn<T> { | |
columnType?: 'default' | columns.types.Column<T>; | |
} | |
interface INumberFormat{ | |
format(number: Number): string; | |
} | |
interface INumberColumn<T> extends IDataColumn<T> { | |
columnType: 'number' | columns.types.NumberColumn<T>; | |
} | |
interface ICheckColumn<T> extends IDataColumn<T> { | |
columnType: 'check' | columns.types.CheckColumn<T>; | |
} | |
interface IButtonStyle extends IStyle { | |
buttonBgColor?: string; | |
} | |
interface IButtonColumn<T> extends IDataColumn<T> { | |
columnType: 'button' | columns.types.ButtonColumn<T>; | |
styles?: IButtonStyle; | |
} | |
interface IImageColumnStyle extends IStyle { | |
imageSizing?: string; | |
margin?: number; | |
} | |
interface IImageColumn<T> extends IDataColumn<T> { | |
columnType: 'image' | columns.types.ImageColumn<T>; | |
styles?: IImageColumnStyle; | |
} | |
interface IPercentCompleteBarColumnStyle extends IStyle { | |
barColor?: string | StyleFunc; | |
barBgColor?: string | StyleFunc; | |
barHeight?: string | StyleFunc; | |
} | |
interface IPercentCompleteBarColumn<T> extends IDataColumn<T> { | |
columnType: columns.types.PercentCompleteBarColumn; | |
styles?: IPercentCompleteBarColumnStyle | |
} | |
interface IIconColumn<T> extends IDataColumn<T> { | |
coloumnType: columns.types.IconColumn; | |
} | |
type BranchStyleFunc = (branchName: value, index: number) => string; | |
interface IBranchGraphColumnStyle extends IStyle { | |
branchColors?: BranchStyleFunc; | |
margin?: number; | |
circleSize?: number; | |
branchLineWidth?: number; | |
mergeStyle?: 'bezier' | 'straight' | |
} | |
interface BranchGraphColumn<T> extends IDataColumn<T> { | |
coloumnType: columns.types.BranchGraphColumn; | |
styles?: IBranchGraphColumnStyle; | |
} | |
interface IMenuColumnStyle extends IStyle { | |
appearance?: 'menulist-button' | 'none'; | |
} | |
interface IMenuColumn<T> extends IDataColumn<T> { | |
columnType: columns.types.MenuColumn; | |
styles?: IMenuColumnStyle | |
} | |
interface IMultilineTextColumnStyle { | |
lineHeight?: string; | |
autoWrapText?: string; | |
lineClamp?: string; | |
} | |
interface IMultilineTextColumn<T> extends IDataColumn<T> { | |
columnType: "multilinetext" | columns.types.MultilineTextColumn; | |
styles?: IMultilineTextColumnStyle | |
} | |
type IAllColumn<T> = IColumn<T> | | |
INumberColumn<T> | | |
ICheckColumn<T> | | |
IButtonColumn<T> | | |
IImageColumn<T> | | |
IPercentCompleteBarColumn<T> | | |
IIconColumn<T> | | |
BranchGraphColumn<T> | | |
IMenuColumn<T> | | |
IMultilineTextColumn<T> | | |
IMultipleColumn<T>; | |
// multiple column | |
interface IMultipleColumn<T> extends ICommonColumn<T> { | |
columns: IAllColumn<T>[]; | |
} | |
interface IListGridParma<T> { | |
parentElement: HTMLElement | null; | |
header: IAllColumn<T>[]; | |
records?: T[]; | |
frozenColCount: number; | |
defaultColWidth?: number | string; | |
} | |
export declare class ListGrid<T> { | |
constructor(otps: IListGridParma<T>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment