-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Table] Add Regions/IRegion docs #1666
Conversation
Add Region docsPreview: documentation | table |
Delete unnecessary IRegion description linePreview: documentation | table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Question before approving, is it me or the docs nav is kinda broken? Blue item doesn't change on scroll, kinda flickers when scrolling
@llorca it repros on blueprintjs.com, so this PR isn't the source. But file an issue if you want to track. 👍 |
@@ -89,12 +89,21 @@ export type ICellInterval = [number, number]; | |||
export type ICellCoordinate = [number, number]; | |||
|
|||
/** | |||
* A ZERO-indexed region of cells. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this knowledge into the props descriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not clear how RegionCardinality
is used.
packages/table/src/docs.md
Outdated
[`Table.scrollToRegion`](#table-js.instance-methods) instance method. | ||
|
||
There are four different types of regions, each represented by a different | ||
`RegionCardinality`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this object used in code? you mention it here but never show examples that use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it would make more sense to introduce this enum after explaining IRegion
? be like, "ok now that you know all that, here's the shorthand we developed for it."
packages/table/src/docs.md
Outdated
const multiColumnRegion = Regions.column(0, 2); // { rows: null, cols: [0, 2] } | ||
const multiRowRegion = Regions.row(0, 2); // { rows: [0, 2], cols: null } | ||
|
||
const tableRegion = Regions.table(); // { rows: null, cols: null } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do these functions relate to RegionCardinality
?
packages/table/src/regions.ts
Outdated
* The first and last column indices in the region, inclusive and | ||
* zero-indexed. If `cols` is `null`, then all columns are understood to be | ||
* included in the region. | ||
*/ | ||
cols?: ICellInterval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps add | null
to these types to match docs? or does it support undefined
(cuz of optional prop)?
I know we don't use sNC
in blueprint but these annotations are useful in the outside world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe the type should be cols: ICellInterval | null
? not optional, just nullable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree, but I'm hesitant to make that change in an otherwise docs-only PR. Might break people who are manually constructing their regions if they happened to pass undefined
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added | null
but left the ?
for now to keep allowing undefined
. The existing code and comments are actually out-of-sync on this point: code uses undefined
but comments mention null
. Can fix later.
Respond to CR feedbackPreview: documentation | table |
Fixes #902
Checklist
Changes proposed in this pull request:
Table
documentation now includes a section about Regions and theIRegion
interface.Reviewers should focus on: