♻️ refactor(vscode): 卡片里的子块只留挂在子行上、点了才展开的一种,测试假数据换掉旧 React 卡片的名字
This commit is contained in:
1 parent
f6bc217e91
commit
5e994cd90e
16 files changed
+121
-130
No files matched your search
@@ -56,10 +56,10 @@ function readViewState(saved: unknown): ViewState {
|
||||
|
||||
/**
|
||||
* 块默认折叠吗:函数、类、枚举、异常块和库规则的卡片收起子块(属性表照常显示),其余块展开。属性行和带下一层的子行默认都展开。
|
||||
* 父卡片里点子行才展开的子块(BlockSlot.item)默认收着:它折叠着就是整张不画。
|
||||
* 挂在父卡片子行上、点子行才展开的子块(BlockSlot)默认收着:它折叠着就是整张不画。
|
||||
*/
|
||||
export function foldedByDefault(block: Pick<BlockView, 'kind' | 'badge' | 'slot'>): boolean {
|
||||
return block.slot?.item !== undefined || block.badge !== undefined || ['function', 'class', 'enum', 'exception'].includes(block.kind)
|
||||
return block.slot !== undefined || block.badge !== undefined || ['function', 'class', 'enum', 'exception'].includes(block.kind)
|
||||
}
|
||||
|
||||
/** 眼下折叠着的块、属性行和子行:用户点过的按他点的,没点过的按 foldedByDefault;opened 里的块(标了改动的)默认展开。 */
|
||||
@@ -104,10 +104,10 @@ export function tableId(ownerId: string): string {
|
||||
|
||||
/**
|
||||
* 父块看得见时,要让它的一个子块也看得见得展开的(块 id、属性行 id):一般的子块是父块自己(收起子块时不画);
|
||||
* 放进父卡片属性表里的子块(BlockSlot)是它所在的那一行,点子行才展开的还有它自己。
|
||||
* 挂在父卡片子行上的子块(BlockSlot)是它所在的那一行和它自己。
|
||||
*/
|
||||
export function unfoldToShow(parentId: string, child: Pick<BlockView, 'id' | 'slot'>): string[] {
|
||||
if (!child.slot)
|
||||
return [parentId]
|
||||
return [propertyRowId(parentId, child.slot.row), ...(child.slot.item !== undefined ? [child.id] : [])]
|
||||
return [propertyRowId(parentId, child.slot.row), child.id]
|
||||
}
|
||||
Reference in new issue
Block a user