P1-4 修复: bigscreen validProp 源改为 dicOption.dataList (2026-07-02)
FINDING-B5: validProp 源错, 旧版走 option/components/*.vue 目录扫描 (36 个) - 漏 code/imgList/imgTabs/rectangle (web 真实支持但 components/ 目录下没有) - 用户 --prop=code → 误报'不在 36 个有效列表里', 但 web 设计器完全允许 - 反向逻辑: configData 当 prop 冲突黑名单, 实际是 mixins/index.js:35 的 config 顶层字段标识 修复: - 新加 webapi/datascreen.ts:getValidProps() 函数 - 读 jnpf-web-datascreen-vue3/src/option/config.js:268 dicOption.dataList - 正则提取 hardcoded 30 个 (含 code/imgList/imgTabs/rectangle) - 跳过后续 .concat(website.componentsList...) (需登录态) - construct.ts: 优先 getValidProps(), 兜底 listComponentProps() - testspace 验证: 29 个有效 prop (30 - img 重复), 旧版 36 审计: dacli/docs/cmd-review/v0.14-rollout-audit-2026-07-02.md §1.1 B5
This commit is contained in:
1 parent
9760a03743
commit
c79169de06
2 files changed
+49
-1
No files matched your search
@@ -35,6 +35,7 @@ import { initWebapi, loadVisualData } from '../../webapi/visualdata.ts'
|
||||
import {
|
||||
getBaseConfig,
|
||||
listComponentProps,
|
||||
getValidProps, // v0.15+ (P1-4): 镜像 web 端 dicOption.dataList 真值源
|
||||
constructConfigDetail,
|
||||
constructComponentJson,
|
||||
NavEntryInput,
|
||||
@@ -217,7 +218,15 @@ async function runConstruct(opts: ConstructOpts): Promise<void> {
|
||||
const nav = constructComponentJson(navInput)
|
||||
|
||||
// === step 3: 校验 ===
|
||||
const validProps = listComponentProps()
|
||||
// v0.15+ (P1-4): 优先用 getValidProps() (镜像 web 端 dicOption.dataList 30 个硬编码 + 动态)
|
||||
// 兜底用 listComponentProps() (option/components/*.vue 目录扫描, 36 个但漏 code/imgList/rectangle)
|
||||
let validProps: string[]
|
||||
try {
|
||||
validProps = getValidProps()
|
||||
if (validProps.length === 0) throw new Error('empty')
|
||||
} catch {
|
||||
validProps = listComponentProps()
|
||||
}
|
||||
const validation = validateConstruct({
|
||||
baseConfig,
|
||||
nav: nav as unknown as Array<Record<string, unknown>>,
|
||||
|
||||
@@ -410,6 +410,45 @@ export function listComponentProps(): string[] {
|
||||
return listComponentFiles()
|
||||
}
|
||||
|
||||
/**
|
||||
* v0.15+ (P1-4, 2026-07-02): 镜像 web 端 build.vue:1040-1042 validProp 真值源
|
||||
*
|
||||
* 镜像源: jnpf-web-datascreen-vue3/src/option/config.js:268 dicOption.dataList
|
||||
* - 30 hardcoded props (含 code/imgList/imgTabs/rectangle 等 components/*.vue 目录里没有的)
|
||||
* - + website.componentsList.filter(ele => ele.data === true).map(ele => ele.name)
|
||||
*
|
||||
* 旧版 listComponentProps() 走 option/components/*.vue 目录扫描, 漏 code/imgList/imgTabs/rectangle
|
||||
* → 误报 "prop=code 不在 36 个有效列表里", 但 web 设计器完全允许
|
||||
*
|
||||
* 实现: 正则读 dicOption.dataList 数组字面量, 取 hardcoded 部分 (website.componentsList 需要登录态)
|
||||
*
|
||||
* @returns 30 个硬编码 valid props
|
||||
*/
|
||||
export function getValidProps(): string[] {
|
||||
if (!existsSync(DATASCREEN_OPTION_CONFIG_SRC)) {
|
||||
return listComponentFiles() // 兜底走旧逻辑
|
||||
}
|
||||
try {
|
||||
const code = readFileSync(DATASCREEN_OPTION_CONFIG_SRC, 'utf-8')
|
||||
// 找 dicOption.dataList 数组字面量
|
||||
// 匹配: dataList: ['xxx', 'yyy', ...].concat(...)
|
||||
const m = code.match(/dataList:\s*\[([^\]]+)\]/)
|
||||
if (!m) return listComponentFiles()
|
||||
// 提取 hardcoded 部分 ('xxx' 形式), 跳过后续 .concat(...)
|
||||
const arr = m[1]
|
||||
const props: string[] = []
|
||||
const re = /'([^']+)'/g
|
||||
let mm: RegExpExecArray | null
|
||||
while ((mm = re.exec(arr)) !== null) {
|
||||
props.push(mm[1])
|
||||
}
|
||||
// 去重
|
||||
return Array.from(new Set(props))
|
||||
} catch {
|
||||
return listComponentFiles()
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// Phase 3: 镜像 save 数据结构 (header.vue:200-211) → constructConfigDetail + constructComponentJson
|
||||
// 详见 dacli/docs/cmd-review/v0.13-webapi-form-workflow-refactor.md §8.2.4 阶段 3
|
||||
|
||||
Reference in new issue
Block a user