feat(vtable): support componentLayoutOrder to control title/legend la… #4969
+108
−5
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.
…yout priority
Summary
componentLayoutOrderoption onBaseTableConstructorOptionsto control layout priority betweentitleandlegendwhile preserving existing default behavior.BaseTable.resize()to apply layout (and available drawing area shrinking) in the order defined bycomponentLayoutOrder, so thattitleand legends sharing the same orient (such astop) can be stacked deterministically.Details
BaseTableConstructorOptionsinpackages/vtable/src/ts-types/base-table.tswith:componentLayoutOrder?: ('legend' | 'title')[]including JSDoc explaining default behavior and compatibility.BaseTable.resize()inpackages/vtable/src/core/BaseTable.ts:_updateSize(), iterate overthis.options.componentLayoutOrder ?? ['legend', 'title'].legend, callresize()on each legend inthis.internalProps.legends.title, callresize()onthis.internalProps.titlewhen present.emptyTipresize andscenegraph.resize()behavior unchanged.ListTable,PivotChart, andPivotTableconstructors to clarify that the first layout after initialization also goes throughBaseTable.resize()and therefore respectscomponentLayoutOrder.packages/vtable/examples/components/legend-title-order.tsusingListTablethat demonstratescomponentLayoutOrder: ['title', 'legend']with both title and legends atorient: 'top'so legend is laid out below the title.packages/vtable/README.mdto add a "Component Layout Priority" section after the Usage chapter, documentingcomponentLayoutOrder, its default value, and a small code snippet in English showing how to place the title above legends.Testing & Quality
standard-lintrun against the modified TS files inpackages/vtable.byted_s_ts_no_unused_varsandbyted_s_js_guard_for_in) inBaseTable.tsandts-types/base-table.ts, unrelated to this change and impacting large legacy sections.npx @byted/tsc-files-monoon the same TS files.TS6053: File '@internal/ts-config/tsconfig.base.json' not found.@internal/ts-configwhich is not available in the current environment (monorepo dependencies are not fully installed), sotsc-filescannot 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.
Change-Id: If2b110b4443dc1fba58acfa9bc2f0e97759a4b7c
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough