-
Notifications
You must be signed in to change notification settings - Fork 439
Feat/component layout order #4970
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
Open
fangsmile
wants to merge
7
commits into
develop
Choose a base branch
from
feat/component-layout-order
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+196
−31
Conversation
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
…yout priority
### Summary
- Introduce `componentLayoutOrder` option on `BaseTableConstructorOptions` to control layout priority between `title` and `legend` while preserving existing default behavior.
- Update `BaseTable.resize()` to apply layout (and available drawing area shrinking) in the order defined by `componentLayoutOrder`, so that `title` and legends sharing the same orient (such as `top`) can be stacked deterministically.
### Details
- **Types**
- Extended `BaseTableConstructorOptions` in `packages/vtable/src/ts-types/base-table.ts` with:
- `componentLayoutOrder?: ('legend' | 'title')[]` including JSDoc explaining default behavior and compatibility.
- **Runtime behavior**
- Updated `BaseTable.resize()` in `packages/vtable/src/core/BaseTable.ts`:
- After `_updateSize()`, iterate over `this.options.componentLayoutOrder ?? ['legend', 'title']`.
- For `legend`, call `resize()` on each legend in `this.internalProps.legends`.
- For `title`, call `resize()` on `this.internalProps.title` when present.
- Keep `emptyTip` resize and `scenegraph.resize()` behavior unchanged.
- Added comments in `ListTable`, `PivotChart`, and `PivotTable` constructors to clarify that the first layout after initialization also goes through `BaseTable.resize()` and therefore respects `componentLayoutOrder`.
- **Examples & docs**
- Added a new example `packages/vtable/examples/components/legend-title-order.ts` using `ListTable` that demonstrates `componentLayoutOrder: ['title', 'legend']` with both title and legends at `orient: 'top'` so legend is laid out below the title.
- Updated `packages/vtable/README.md` to add a "Component Layout Priority" section after the Usage chapter, documenting `componentLayoutOrder`, its default value, and a small code snippet in English showing how to place the title above legends.
### Testing & Quality
- **standard-lint**
- Command (Node 18.20.0):
- `standard-lint` run against the modified TS files in `packages/vtable`.
- Result:
- Failed due to multiple pre-existing lint issues (e.g. `byted_s_ts_no_unused_vars` and `byted_s_js_guard_for_in`) in `BaseTable.ts` and `ts-types/base-table.ts`, unrelated to this change and impacting large legacy sections.
- I did not modify unrelated legacy logic to avoid introducing risky changes.
- **tsc-files**
- Command (Node 18.20.0):
- `npx @byted/tsc-files-mono` on the same TS files.
- Result:
- Failed with `TS6053: File '@internal/ts-config/tsconfig.base.json' not found.`
- Root cause: the repo's TypeScript configuration depends on internal package `@internal/ts-config` which is not available in the current environment (monorepo dependencies are not fully installed), so `tsc-files` cannot resolve the shared base tsconfig.
Given these constraints, the new feature is implemented and wired into examples and docs, while lint/tsc failures are due to existing repository configuration and historical issues rather than the new code.
Co-Authored-By: Aime <aime@bytedance.com>
Change-Id: If2b110b4443dc1fba58acfa9bc2f0e97759a4b7c
…out-order feat(vtable): support componentLayoutOrder to control title/legend la…
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.
from #4969
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough