Skip to content

Conversation

@fangsmile
Copy link
Contributor

from #4969

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Site / documentation update
  • Demo update
  • Workflow
  • Chore
  • Release
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

liufangfang.jane and others added 2 commits January 28, 2026 14:55
…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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants