-
Notifications
You must be signed in to change notification settings - Fork 95
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
TRP.js v0.4.2(?) release draft #180
Merged
Merged
Conversation
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
Extend list/iterContent() methods to support run-time filtering by chosen block types. Unit tests now fully cover content.ts!
Enable filtering top-level and nested layout items by block type, as a pre-requisite for filtering specific layout block types out of HTML representations. To facilitate this, also added support for `iter/listRelatedItemsByRelType()` to `Page`.
Add initial draft includeBlockTypes & skipBlockTypes support to html() rendering: Only for layout items (+page, document) and only supporting filtering on LAYOUT_* API block types.
Extend block type filtering to cover all `IRenderable.html()` interfaces, and build more sensible render filtering for non-Layout block types. By convention, html() and other rendering methods now check for the *component's own* block type, whereas accessors like listContent() only consider the children they're scanning through.
Make page.layout stateless: Traversing PAGE child relationships from constructor rather than receiving a list of blocks. Move `_parse` into body of Page constructor to facilitate this (can't create Layout until other Page child blocks have parsed). {iter/list}RelatedItemsByRelType now go via Blocks first, providing a route to more standardised+configurable missing block handling behaviour (currently at `error`).
Add initial SelectionElement.isSelected, and Field+FieldValue properties isSelection & isSelected - to help navigate selection element (checkbox/radio) based K-V results.
While `isSelection` was more semantically representative of the underlying API, `isCheckbox` is more discoverable to users with the primary intended use-case.
from rename of `isSelection` to `isCheckbox`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available: #179, a little pre-work for #183
Description of changes:
(Detailed also in the draft
CHANGELOG.md
).html({...})
rendering as requested by .html() function to support skipping certain blocks #179, withincludeBlockTypes
(allow-list) andskipBlockTypes
(deny-list) options. The main expected use-case for this is to filter on the Layout* types... Other block types kinda work but can yield counter-intuitive results because of the nature of the Textract API.iter/listContent()
,Layout.iter/listItems()
, andLayoutItem.iter/ListLayoutChildren()
methods now support full Block type filtering withincludeBlockTypes
(allow-list) and/orskipBlockTypes
(deny-list) options, and control over what happens when unexpected block types (not in either include or skip) are encountered.SelectionElement.isSelected
, in convenient boolean format (versus the 2-member.selectionStatus
enumeration)Field.isCheckbox
andFieldValue.isCheckbox
, to check if a K->V field corresponds to a (label)->(selectionElement) pair. Also added{Field/FieldValue}.isSelected
and.selectionStatus
, which returnnull
for non-'checkbox' fields. (Pre-work for #183)iter/listRelatedItemsByRelType()
is now supported fromPage
s (PAGE blocks)WithContent
mixin options refactored to more closely mirrorIBlockTypeFilterOpts
, because WithContent now aligns toiter/listRelatedItemsByRelType()
under the hood. This will give us more fine-grained but standardised control of unexpected non-content child block type handling, per item class.Layout
no longer keeps any internal list-of-items state, instead referring to the parentPAGE
block's child relationships directly.Initial alpha release available at amazon-textract-response-parser v0.4.2-alpha.3 on NPM - please share your feedback!
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.