Filter business blocks by page scope
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
ref="designerRef"
|
||||
:designs="pageDesigns"
|
||||
:database="database"
|
||||
:block-definitions="scope === 'frontend' ? businessBlockDefinitions : []"
|
||||
:block-definitions="businessBlockDefinitions"
|
||||
:mode="scope"
|
||||
:show-header="false"
|
||||
:saving="saving"
|
||||
@@ -150,7 +150,7 @@ async function loadDesignerData() {
|
||||
getProject(projectId.value),
|
||||
getDatabase(projectId.value),
|
||||
listPageDesigns(projectId.value, scope.value),
|
||||
listBusinessBlocks(projectId.value)
|
||||
listBusinessBlocks(projectId.value, scope.value)
|
||||
])
|
||||
projectName.value = projectResult?.projectName || ''
|
||||
database.value = normalizeDatabase(databaseResult)
|
||||
@@ -443,7 +443,7 @@ onBeforeRouteUpdate(async () => {
|
||||
|
||||
.designer-card {
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.designer-card :deep(.page-designer-body) {
|
||||
|
||||
@@ -11,6 +11,14 @@ function readSource(relativePath) {
|
||||
return readFileSync(resolve(srcDir, relativePath), 'utf8')
|
||||
}
|
||||
|
||||
function cssBlock(source, selector, offset = 0) {
|
||||
const start = source.indexOf(`${selector} {`, offset)
|
||||
assert.notEqual(start, -1)
|
||||
const end = source.indexOf('\n}', start)
|
||||
assert.notEqual(end, -1)
|
||||
return source.slice(start, end)
|
||||
}
|
||||
|
||||
test('router exposes standalone page designer route', () => {
|
||||
const routerSource = readSource('router/index.js')
|
||||
|
||||
@@ -34,13 +42,27 @@ test('standalone page designer wraps the focused designer component', () => {
|
||||
assert.equal(source.includes('预览页面'), true)
|
||||
})
|
||||
|
||||
test('standalone page designer does not trap sticky designer sidebars', () => {
|
||||
const source = readSource('views/PageDesignerView.vue')
|
||||
const sharedCardStyleStart = source.indexOf('.designer-card {')
|
||||
const cardStyle = cssBlock(source, '.designer-card', sharedCardStyleStart + 1)
|
||||
|
||||
assert.equal(cardStyle.includes('overflow: hidden'), false)
|
||||
assert.equal(cardStyle.includes('overflow: visible'), true)
|
||||
})
|
||||
|
||||
test('standalone page designer loads scope-specific designs and business blocks', () => {
|
||||
const source = readSource('views/PageDesignerView.vue')
|
||||
const apiSource = readSource('api/project.js')
|
||||
|
||||
assert.equal(source.includes('const scope = computed'), true)
|
||||
assert.equal(source.includes("route.query.scope === 'admin'"), true)
|
||||
assert.equal(source.includes('listPageDesigns(projectId.value, scope.value)'), true)
|
||||
assert.equal(source.includes('listBusinessBlocks(projectId.value)'), true)
|
||||
assert.equal(source.includes('listBusinessBlocks(projectId.value, scope.value)'), true)
|
||||
assert.equal(source.includes(':block-definitions="businessBlockDefinitions"'), true)
|
||||
assert.equal(source.includes("scope === 'frontend' ? businessBlockDefinitions : []"), false)
|
||||
assert.equal(apiSource.includes("export function listBusinessBlocks(projectId, scope = 'frontend')"), true)
|
||||
assert.equal(apiSource.includes('params: { scope }'), true)
|
||||
assert.equal(source.includes('initPageDesigns(projectId.value, scope.value)'), true)
|
||||
assert.equal(source.includes('createPageDesign(projectId.value, design, scope.value)'), true)
|
||||
assert.equal(source.includes('savePageDesign(projectId.value, design.designId, design, scope.value)'), true)
|
||||
|
||||
Reference in New Issue
Block a user