feat: 组件的数据结构调整

This commit is contained in:
2026-06-05 11:35:06 +08:00
parent 1be97986df
commit 3e06ae544b
7 changed files with 575 additions and 231 deletions

View File

@@ -42,9 +42,16 @@ for (const snippet of forbiddenCompatibilitySnippets) {
const requiredStrictRenderingSnippets = [
"LONG_TEXT_KEYS.sceneImage",
"LONG_TEXT_KEYS.contentImage",
"LONG_TEXT_KEYS.commodityList",
"LONG_TEXT_KEYS.photoList",
"LONG_TEXT_KEYS.aigcComponet",
"shouldRenderSpotLocate",
"shouldRenderQuestionSuggest",
"shouldRenderCommodityList",
"shouldRenderPhotoList",
"shouldRenderAigcComponet",
"getRenderEntriesForObject",
"commodity.commodity_id",
"commodity.commodity_name",
"commodity.commodity_price",
@@ -62,9 +69,7 @@ const requiredStrictRenderingSnippets = [
"jumpAigcClick",
"getAccessToken",
"navigateTo",
"content-body-list-marker",
"entry.value.length > 1",
"formatListMarker(index)",
"content-body-list-card",
];
for (const snippet of requiredStrictRenderingSnippets) {
@@ -75,4 +80,71 @@ for (const snippet of requiredStrictRenderingSnippets) {
);
}
const removedInnerSpecialEntrySnippets = [
"createSpecialFieldEntry",
"entry.type === 'question-suggest'",
"entry.type === 'photo-list'",
"entry.type === 'aigc-componet'",
"entry.type === 'commodity-list'",
"entry.type === 'spot-locate'",
];
for (const snippet of removedInnerSpecialEntrySnippets) {
assert.equal(
source.includes(snippet),
false,
`ParsedValueView should keep special fields at the top level only: ${snippet}`
);
}
const removedFlatFieldSnippets = [
"preparationSectionTitle",
"preparationSectionItems",
"sectionSuggestionTitle",
"sectionSuggestionContent",
"pitfallSectionTitle",
"pitfallSectionItems",
"viewSectionTitle",
"viewSectionItems",
"suggestionSectionTitle",
"suggestionSectionContent",
"lightReminderTitle",
"lightReminderItems",
];
for (const snippet of removedFlatFieldSnippets) {
assert.equal(
source.includes(`LONG_TEXT_KEYS.${snippet}`),
false,
`ParsedValueView should not reference removed flat field: ${snippet}`
);
}
const removedStructuredConfigSnippets = [
"STRUCTURED_SECTION_CONFIG",
"isGenericObjectSectionField",
"content-body-section-dot",
"content-body-section-list",
"LONG_TEXT_KEYS.preparationSection",
"LONG_TEXT_KEYS.sectionSuggestion",
"LONG_TEXT_KEYS.pitfallSection",
"LONG_TEXT_KEYS.viewSection",
"LONG_TEXT_KEYS.suggestionSection",
"LONG_TEXT_KEYS.lightReminder",
"LONG_TEXT_KEYS.photoSpotSection",
"LONG_TEXT_KEYS.phoneSection",
"LONG_TEXT_KEYS.decisionSection",
"LONG_TEXT_KEYS.routeWarning",
"LONG_TEXT_KEYS.tourRoutes",
"LONG_TEXT_KEYS.facilitiesAlongTheWay",
];
for (const snippet of removedStructuredConfigSnippets) {
assert.equal(
source.includes(snippet),
false,
`ParsedValueView should use generic section rendering instead of configured field: ${snippet}`
);
}
console.log("ParsedValueView strict field checks passed");