Skip to content

Commit 59c3f74

Browse files
committed
feat(ui-engine-bugs): edit on 2.7.x
1 parent 8b66265 commit 59c3f74

6 files changed

Lines changed: 62 additions & 20 deletions

File tree

packages/canvas/DesignCanvas/src/DesignCanvas.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export default {
8787
footData.value = useCanvas().getNodePath(node?.id)
8888
pageState.currentSchema = {}
8989
pageState.properties = null
90+
// 删除节点后,重置pageState中组件的属性
91+
// 后续需要改造
92+
useProperties().getProps(null, null)
9093
}
9194
9295
const isBlock = useCanvas().isBlock
@@ -106,9 +109,9 @@ export default {
106109
empty: () => '应用下暂无页面,需新建页面后体验画布功能',
107110
release: (type) => `当前${componentType[type]}未锁定,点击右上角 “锁定” 图标后编辑${componentType[type]}`,
108111
lock: (type) =>
109-
`当前${componentType[type]}${pageInfo?.username || ''} 锁定,如需编辑请先联系他解锁文件,然后再锁定该${
112+
`当前${componentType[type]}${pageInfo?.username || ''} 锁定,您可以创建新页面,如需编辑请先联系他解锁${
110113
componentType[type]
111-
}后编辑!`
114+
},然后再锁定该${componentType[type]}后编辑!`
112115
}
113116
114117
const renderMsg = message[pageStatus.state](pageSchema.componentName)

packages/canvas/container/src/components/CanvasAction.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ export default {
252252
253253
const hide = () => {
254254
if (getCurrent().schema?.id) {
255+
const { clearSelect } = useCanvas().canvasApi.value
255256
getRenderer().setCondition(getCurrent().schema.id, false)
256257
useCanvas().pageState.nodesStatus[getCurrent().schema.id] = false
258+
clearSelect()
257259
}
258260
updateRect()
259261
}

packages/canvas/container/src/container.ts

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,41 @@ const setSelectRect = (
466466
)
467467
}
468468

469+
const getElementDurationTime = (elementId?: string) => {
470+
const element = elementId ? querySelectById(elementId) : getDocument().body
471+
const durationTime = window.getComputedStyle(element).getPropertyValue('transition-duration')
472+
const delayTime = window.getComputedStyle(element).getPropertyValue('transition-delay')
473+
const transition = window.getComputedStyle(element).getPropertyValue('transition')
474+
let delayArray: string[] = []
475+
if (transition) {
476+
const delayRegex = /([0-9]+(\.[0-9]+)?)(s|ms|S|MS)/
477+
const transitions = transition.split(',')
478+
transitions.forEach((item) => {
479+
const parts = item.trim().split(' ')
480+
delayArray = delayArray.concat(parts)
481+
})
482+
delayArray = delayArray.filter((delay) => delayRegex.test(delay))
483+
}
484+
485+
if (durationTime) {
486+
delayArray.push(durationTime)
487+
}
488+
489+
if (delayTime) {
490+
delayArray.push(delayTime)
491+
}
492+
493+
const delayTimes: any[] = delayArray.map((item) => {
494+
const unit = item.slice(-2)
495+
if (unit === 'ms') {
496+
return parseFloat(item)
497+
} else {
498+
return parseFloat(item) * 1000
499+
}
500+
})
501+
return delayTimes.length ? Math.max(...delayTimes) : 300
502+
}
503+
469504
export const updateRect = (id?: string) => {
470505
id = (typeof id === 'string' && id) || getCurrent().schema?.id
471506
clearHover()
@@ -481,17 +516,7 @@ export const updateRect = (id?: string) => {
481516
const isBodySelected = !selectState.componentName && selectState.width > 0
482517

483518
if (id || isBodySelected) {
484-
const element = querySelectById(id) || getDocument().body
485-
const duration = window.getComputedStyle(element).getPropertyValue('transition-duration')
486-
let waitTime = 300
487-
if (duration) {
488-
const unit = duration.slice(-2)
489-
if (unit === 'ms') {
490-
waitTime = parseFloat(duration)
491-
} else {
492-
waitTime = parseFloat(duration) * 1000
493-
}
494-
}
519+
const waitTime = getElementDurationTime(id)
495520
setTimeout(() => setSelectRect(id), waitTime)
496521
} else {
497522
clearSelect()

packages/configurator/src/variable-configurator/VariableConfigurator.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@
110110

111111
<template #footer>
112112
<div class="bind-dialog-footer">
113-
<tiny-button type="danger" plain @click="remove">移除绑定</tiny-button>
113+
<tiny-button type="danger" plain :disabled="modelValue?.type !== 'JSExpression'" @click="remove"
114+
>移除绑定</tiny-button
115+
>
114116
<div class="right">
115117
<tiny-button @click="cancel">取 消</tiny-button>
116118
<tiny-button type="info" :disabled="confirmDisabled" @click="confirm">确 定</tiny-button>

packages/plugins/materials/src/composable/useResource.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ const initBlock = async (blockId: string) => {
119119
const initPageOrBlock = async () => {
120120
const { pageId, blockId } = getMetaApi(META_SERVICE.GlobalService).getBaseInfo()
121121
const pagePluginApi = getMetaApi(META_APP.AppManage)
122+
const globalState = getMetaApi(META_SERVICE.GlobalService).getState()
122123

123124
if (pageId) {
124125
const data = await pagePluginApi.getPageById(pageId)
@@ -132,11 +133,14 @@ const initPageOrBlock = async () => {
132133
return
133134
}
134135

135-
// url 没有 pageid 或 blockid,到页面首页或第一页
136+
// url 没有 pageid 或 blockid,到当前用户创建的页面顺位第一位,如果没有则停留在全部公共页面顺位第一页或者页面首页
136137
const pageInfo = appSchemaState.pageTree.find((page) => page?.meta?.isHome) ||
137-
appSchemaState.pageTree.find(
138-
(page) => page.componentName === COMPONENT_NAME.Page && page?.meta?.group !== 'publicPages'
139-
) || {
138+
appSchemaState.pageTree.find((page) => {
139+
if (page.componentName === COMPONENT_NAME.Page && globalState.userInfo.id === page.meta.occupier.id) {
140+
return true
141+
}
142+
return page.componentName === COMPONENT_NAME.Page && page?.meta?.group !== 'publicPages'
143+
}) || {
140144
page_content: {
141145
componentName: COMPONENT_NAME.Page
142146
}

packages/plugins/tree/src/Main.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
row.label
2828
}}</span>
2929
<template v-if="row.id !== 'body'">
30-
<svg-icon :name="eyeOpen(row.id) ? 'eye' : 'eye-invisible'" @mouseup="showNode(row.rawData)"></svg-icon>
30+
<svg-icon
31+
:name="eyeOpen(row.id) ? 'eye' : 'eye-invisible'"
32+
@click="showNode($event, row.rawData)"
33+
></svg-icon>
3134
<svg-icon name="delete" @mouseup="delNode(row.rawData)"></svg-icon>
3235
</template>
3336
</div>
@@ -156,7 +159,10 @@ export default {
156159
const { getRenderer, clearSelect } = useCanvas().canvasApi.value
157160
158161
getRenderer().setCondition(data.id, data.show)
159-
clearSelect()
162+
if (!data.show) {
163+
event?.stopPropagation()
164+
clearSelect()
165+
}
160166
}
161167
162168
const delNode = (data) => {

0 commit comments

Comments
 (0)