-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typing): add missing item metadata interface (#299)
* feat(typing): add missing item metadata interface * refactor: fix build error with typings * refactor: fix example typing issue - nonetheless, tsc seems to be doing something wrong here, it should infer that '*' is valid, we'll have to check back in future version of tsc
- Loading branch information
1 parent
721a6c5
commit 7cf0a21
Showing
6 changed files
with
95 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
36 changes: 33 additions & 3 deletions
36
packages/common/src/interfaces/groupItemMetadataProviderOption.interface.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,50 @@ | ||
import { FormatterResultObject } from './formatterResultObject.interface'; | ||
import { Formatter } from './formatter.interface'; | ||
import { GroupTotalsFormatter } from './groupTotalsFormatter.interface'; | ||
import { SlickCheckboxSelectColumn } from './slickCheckboxSelectColumn.interface'; | ||
|
||
export interface GroupItemMetadataProviderOption { | ||
/** Whether or not we want to use group select checkbox. */ | ||
checkboxSelect: boolean; | ||
|
||
/** Defaults to "slick-group-select-checkbox" */ | ||
checkboxSelectCssClass: string; | ||
|
||
/** Plugin to select row(s) via checkboxes typically shown as the 1st column in the grid. */ | ||
checkboxSelectPlugin: SlickCheckboxSelectColumn; | ||
|
||
/** Defaults to "slick-group" */ | ||
groupCssClass: string; | ||
|
||
/** Defaults to "slick-group-title" */ | ||
groupTitleCssClass: string; | ||
|
||
/** Defaults to "slick-group-totals" */ | ||
totalsCssClass: string; | ||
|
||
/** Whether or not the group is focusable. */ | ||
groupFocusable: boolean; | ||
|
||
/** Whether or not the group totals is focusable. */ | ||
totalsFocusable: boolean; | ||
|
||
/** Defaults to "slick-group-toggle" */ | ||
toggleCssClass: string; | ||
|
||
/** Defaults to "expanded" */ | ||
toggleExpandedCssClass: string; | ||
|
||
/** Defaults to "collapsed" */ | ||
toggleCollapsedCssClass: string; | ||
|
||
/** Whether or not we want to enable the group expanding/collapsing */ | ||
enableExpandCollapse: boolean; | ||
groupFormatter: HTMLElement, | ||
totalsFormatter: string | FormatterResultObject; | ||
|
||
/** A custom group cell formatter. */ | ||
groupFormatter: Formatter; | ||
|
||
/** A custom total formatter. */ | ||
totalsFormatter: GroupTotalsFormatter; | ||
|
||
/** Whether or not we want to include header totals */ | ||
includeHeaderTotals: boolean; | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Editor, Formatter, GroupTotalsFormatter } from './index'; | ||
|
||
/** | ||
* Provides a powerful way of specifying additional information about a data item that let the grid customize the appearance | ||
* and handling of a particular data item. The method should return null if the item requires no special handling, | ||
* or an object following the ItemMetadata interface | ||
*/ | ||
export interface ItemMetadata { | ||
// properties describing metadata related to the item (i.e. grid row) itself | ||
|
||
/** One or more (space-separated) CSS classes to be added to the entire row. */ | ||
cssClasses?: string; | ||
|
||
/** Whether or not any cells in the row can be set as "active". */ | ||
focusable?: boolean; | ||
|
||
/** A custom group formatter. */ | ||
formatter?: GroupTotalsFormatter; | ||
|
||
/** Whether or not a row or any cells in it can be selected. */ | ||
selectable?: boolean; | ||
|
||
/** column-level metadata */ | ||
columns?: { | ||
// properties describing metadata related to individual columns | ||
|
||
[colIdOrIdx in string | number]: { | ||
/** Number of columns this cell will span. Can also contain "*" to indicate that the cell should span the rest of the row. */ | ||
colspan?: number | string | '*'; | ||
|
||
/** A custom cell editor. */ | ||
editor?: Editor | null; | ||
|
||
/** Whether or not a cell can be set as "active". */ | ||
focusable?: boolean; | ||
|
||
/** A custom cell formatter. */ | ||
formatter?: Formatter | GroupTotalsFormatter; | ||
|
||
/** Whether or not a cell can be selected. */ | ||
selectable?: boolean; | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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