Skip to content

Commit

Permalink
chore: sync dev to refactor (opentiny#808)
Browse files Browse the repository at this point in the history
* fix(mockServer): mockServer page preview can't render element-plus element (opentiny#503)

* fix(style): fix render error caused by inline style breaks (opentiny#526)

* fix(metaComp): fix bug where metaHtmlText could set value to incorret schema children (opentiny#473)

* fix(vue-generator): fix globalstate codegen error (opentiny#547)

* fix(material): add componentsMap to app Schema after material build (opentiny#527)

* fix: slot params missing double quote (opentiny#605)

* fix: slot params missing double quote

* fix: exclude nodemodule test case

* fix: 修复onMouseover拼写错误 (opentiny#662)

* fix: esbuild install failed on node v16 (opentiny#668)

* fix: esbuild install failed on nodev16

* fix: esbuild install failed on nodev16

* fix: builtin components can't generate import statement with genSFCWithDefaultPlugin method (opentiny#656)

* fix: esbuild install failed on nodev16 (opentiny#671)

* fix: esbuild install failed on nodev16

* fix: esbuild install failed on nodev16

* fix: remove deps on root pkg.json

* fix(preview): multiple nested blocks cannot preview opentiny#663 (opentiny#665)

* fix(material): add missing componentsMap to mockServer (opentiny#701)

* fix(setting): fix bindEvent dialog visible can't work on tinyvue 3.17 (opentiny#715)

* feat(download-code): support download zip for not support browsers (opentiny#703)

* feat(download-code): support download zip for not support browsers

* feat(download-code): support download zip for not support browsers - review

* feat(download-code): support download zip for not support browsers - review

* docs: update milestone (opentiny#728)

* docs: update milestone

* fix: tab

* fix: abaolute canvas init inlineStyle should be string (opentiny#730)

* fix(download): Optimize download logic and adapt to iframe (opentiny#739)

* fix(download): Optimize download logic and adapt to iframe

* feat(cdn): change cdn from onmicrosoft to unpkg (opentiny#750)

* fix: 隐藏画布根节点的包裹元素的操作选项 (opentiny#492)

* fix(script): translate log (opentiny#549)

* fix: translate log

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update scripts/connection.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: reset spacing cannot generate correct source code (opentiny#657)

* fix: jsx slot modelvalue can't update value (opentiny#734)

* fix: jsx slot modelvalue can't update value

* fix: add unit test for updateModel event

* fix(canvas): absolute dnd update position to schema. close opentiny#664 (opentiny#751)

* fix(generate-vue):修复出码文件选择界面打包后样式丢失问题 (opentiny#789)

Co-authored-by: wangwenbing <[email protected]>

* fix(stylePanel): fix setting border-radius could not work on first time (opentiny#481)

* fix(common): fix verify required (opentiny#787)

* fix: mixed lifeCyclesContent when empty lifecycles (opentiny#810)

close opentiny#806
修复生命周期为空时,取当前页面schema生命周期值的 bug

---------

Co-authored-by: chilingling <[email protected]>
Co-authored-by: yeser <[email protected]>
Co-authored-by: wenmine <[email protected]>
Co-authored-by: Gene <[email protected]>
Co-authored-by: yaoyun8 <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: bwrong <[email protected]>
Co-authored-by: wangwenbing <[email protected]>
Co-authored-by: Xie Jay <[email protected]>
  • Loading branch information
10 people authored Sep 24, 2024
1 parent 4acdb21 commit 7e7b3a4
Show file tree
Hide file tree
Showing 43 changed files with 876 additions and 126 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ gantt
dateFormat YYYY-MM-DD
axisFormat %Y-%m-%d
1.0.0-beta.x version :active,2023-09-25, 2024-03-31
1.0.0-rc version : 2024-04-01, 2024-06-30
1.0.0 version : 2024-07-01, 2024-07-31
1.0.0-beta.x version : 2023-09-25, 2024-05-20
1.0.0-rc version(refactor version) : 2024-10-01
1.0.0 version : 2024-11-01
```

Expand Down
8 changes: 4 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ pnpm run build:alpha 或 build:prod
## 里程碑

```mermaid
gantt
gantt
dateFormat YYYY-MM-DD
axisFormat %Y-%m-%d
1.0.0-beta.x version :active,2023-09-25, 2024-03-31
1.0.0-rc version : 2024-04-01, 2024-06-30
1.0.0 version : 2024-07-01, 2024-07-31
1.0.0-beta.x version : 2023-09-25, 2024-05-20
1.0.0-rc version(refactor version) : 2024-10-01
1.0.0 version : 2024-11-01
```

Expand Down
35 changes: 35 additions & 0 deletions mockServer/src/mock/get/app-center/v1/apps/schema/918.json
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,13 @@
"destructuring": true,
"version": "0.1.17"
},
{
"componentName": "TinyCheckbox",
"package": "@opentiny/vue",
"exportName": "Checkbox",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinySelect",
"package": "@opentiny/vue",
Expand Down Expand Up @@ -1974,6 +1981,34 @@
"destructuring": true,
"version": "0.1.16"
},
{
"componentName": "TinyCollapse",
"package": "@opentiny/vue",
"exportName": "Collapse",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinyCollapseItem",
"package": "@opentiny/vue",
"exportName": "CollapseItem",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinyBreadcrumb",
"package": "@opentiny/vue",
"exportName": "Breadcrumb",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinyBreadcrumbItem",
"package": "@opentiny/vue",
"exportName": "BreadcrumbItem",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "ElInput",
"package": "element-plus",
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.21.3",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@types/node": "^18.0.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^3.1.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/canvas/container/src/components/CanvasAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ export default {
}
const showAction = computed(() => {
const { parent } = getCurrent()
const { schema, parent } = getCurrent()
if (schema?.props?.['data-id'] === 'root-container') {
return false
}
return !props.resize && parent && parent?.type !== 'JSSlot'
})
Expand Down
23 changes: 18 additions & 5 deletions packages/canvas/container/src/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ export const dragEnd = () => {
if (element && canvasState.type === 'absolute') {
data.props = data.props || {}
data.props.style = element.style.cssText

getController().addHistory()
}

// 重置拖拽状态
Expand Down Expand Up @@ -541,6 +543,8 @@ const setHoverRect = (element, data) => {
return undefined
}

let moveUpdateTimer = null

// 绝对布局
const absoluteMove = (event, element) => {
const { clientX, clientY } = event
Expand Down Expand Up @@ -572,6 +576,19 @@ const absoluteMove = (event, element) => {
element.style.height = `${clientY - y}px`
}
}

clearTimeout(moveUpdateTimer)

const { data } = dragState
data.props = data.props || {}

// 防抖更新位置信息到 schema
moveUpdateTimer = setTimeout(() => {
data.props.style = element.style.cssText

getController().addHistory()
}, 100)

updateRect()
}

Expand Down Expand Up @@ -716,11 +733,7 @@ export const onMouseUp = () => {
if (absolute) {
targetNode.node = getSchema()
data.props = data.props || {}
data.props.style = {
position: 'absolute',
top: dragState.mouse.y + 'px',
left: dragState.mouse.x + 'px'
}
data.props.style = `position: absolute; top: ${dragState.mouse.y}px; left: ${dragState.mouse.x}px`
}

insertNode(targetNode, position)
Expand Down
3 changes: 2 additions & 1 deletion packages/canvas/render/src/RenderMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ const defaultRenderer = function () {
// 渲染画布增加根节点,与出码和预览保持一致
const rootChildrenSchema = {
componentName: 'div',
props: schema.props,
// 手动添加一个唯一的属性,后续在画布选中此节点时方便处理额外的逻辑。由于没有修改schema,不会影响出码
props: { ...schema.props, 'data-id': 'root-container' },
children: schema.children
}

Expand Down
2 changes: 1 addition & 1 deletion packages/canvas/render/src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ const getBindProps = (schema, scope) => {
...parseData(schema.props, scope),
[DESIGN_UIDKEY]: id,
[DESIGN_TAGKEY]: componentName,
onMoseover: stopEvent,
onMouseover: stopEvent,
onFocus: stopEvent
}
if (scope) {
Expand Down
15 changes: 6 additions & 9 deletions packages/common/component/ConfigItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,13 @@ export default {
result.message = typeof message === 'string' ? message : message?.[locale.value]
}
const isEmptyInputValue = (value) => {
// 通过 value == null 做隐式类型转换
// 空值约定为 undefined | null | ''
return value == null || (typeOf(value) === TYPES.StringType && value.trim() === '')
}
const verifyRequired = (value) => {
if (typeOf(value) === TYPES.BooleanType) {
return true
}
if (typeOf(value) === TYPES.StringType) {
return value.trim()
}
return value
return !isEmptyInputValue(value)
}
const verifyValue = (value = '', rules = []) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/component/LifeCycles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default {
})
watchEffect(() => {
state.bindLifeCycles = props.bindLifeCycles || useCanvas().canvasApi.value?.getSchema()?.lifeCycles || {}
state.bindLifeCycles = props.bindLifeCycles || {}
})
const searchLifeCyclesList = (value) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
</div>
<div class="head-content">
<input-configurator v-model="state.text" type="textarea" @change="change"></input-configurator>
<input-configurator v-model="state.text" type="textarea" @update:modelValue="change"></input-configurator>
</div>
</template>
<script>
Expand Down
1 change: 0 additions & 1 deletion packages/design-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"eslint-linter-browserify": "8.57.0",
"file-saver": "^2.0.5",
"html2canvas": "^1.4.1",
"jszip": "^3.10.1",
"monaco-editor": "0.33.0",
"prettier": "2.7.1",
"sortablejs": "^1.14.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/design-core/src/preview/src/preview/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default {
},
...(blocks || []).map((blockSchema) => {
return {
panelName: blockSchema.fileName,
panelName: `${blockSchema.fileName}.vue`,
panelValue: generatePageCode(blockSchema, appData?.componentsMap || [], { blockRelativePath: './' }) || '',
panelType: 'vue',
index: true
Expand Down
32 changes: 14 additions & 18 deletions packages/engine-cli/template/designer/public/mock/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"script": "https://unpkg.com/[email protected]/dist/index.full.mjs",
"css": "https://unpkg.com/[email protected]/dist/index.css",
"dependencies": null,
"exportName": "ElInput"
"exportName": "ElInput",
"destructuring": true
},
"group": "表单组件",
"category": "element-plus",
Expand Down Expand Up @@ -303,7 +304,8 @@
"script": "https://unpkg.com/[email protected]/dist/index.full.mjs",
"css": "https://unpkg.com/[email protected]/dist/index.css",
"dependencies": null,
"exportName": "ElButton"
"exportName": "ElButton",
"destructuring": true
},
"group": "基础组件",
"category": "element-plus",
Expand Down Expand Up @@ -624,6 +626,7 @@
"script": "https://unpkg.com/[email protected]/dist/index.full.mjs",
"css": "https://unpkg.com/[email protected]/dist/index.css",
"dependencies": null,
"destructuring": true,
"exportName": "ElForm"
},
"group": "表单组件",
Expand Down Expand Up @@ -1081,6 +1084,7 @@
"script": "https://unpkg.com/[email protected]/dist/index.full.mjs",
"css": "https://unpkg.com/[email protected]/dist/index.css",
"dependencies": null,
"destructuring": true,
"exportName": "ElFormItem"
},
"group": "表单组件",
Expand Down Expand Up @@ -1431,6 +1435,7 @@
"script": "https://unpkg.com/[email protected]/dist/index.full.mjs",
"css": "https://unpkg.com/[email protected]/dist/index.css",
"dependencies": null,
"destructuring": true,
"exportName": "ElTable"
},
"group": "数据展示",
Expand Down Expand Up @@ -2669,6 +2674,7 @@
"script": "https://unpkg.com/[email protected]/dist/index.full.mjs",
"css": "https://unpkg.com/[email protected]/dist/index.css",
"dependencies": null,
"destructuring": true,
"exportName": "ElTableColumn"
},
"group": "表单组件",
Expand Down Expand Up @@ -8939,7 +8945,7 @@
"devMode": "proCode",
"npm": {
"package": "@opentiny/vue",
"exportName": "Select",
"exportName": "Breadcrumb",
"version": "3.14.0",
"destructuring": true,
"script": "https://unpkg.com/@opentiny/vue@~3.14/runtime/tiny-vue.mjs",
Expand Down Expand Up @@ -14071,20 +14077,10 @@
"schema": {
"componentName": "TinyBreadcrumb",
"props": {
"options": [
{
"to": "{ path: '/' }",
"label": "首页"
},
{
"to": "{ path: '/breadcrumb' }",
"label": "产品"
},
{
"replace": "true",
"label": "软件"
}
]
"options": {
"type": "JSExpression",
"value": "[{to: { path: '/' },label: '首页'},{to: { path: '/breadcrumb' },label: '产品'},{'replace': true,'label': '软件'}]"
}
}
}
},
Expand Down Expand Up @@ -14339,7 +14335,7 @@
"schema": {
"componentName": "TinyTimeLine",
"props": {
"active": "2",
"active": 2,
"data": [
{
"name": "已下单"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<tiny-dialog-box
v-show="dialogVisible"
:visible="dialogVisible"
title="事件绑定"
width="50%"
:append-to-body="true"
Expand Down
3 changes: 1 addition & 2 deletions packages/settings/styles/src/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ import { ref, watch } from 'vue'
import { Collapse, CollapseItem, Input } from '@opentiny/vue'
import { useHistory, useCanvas, useProperties } from '@opentiny/tiny-engine-meta-register'
import { CodeConfigurator, VariableConfigurator } from '@opentiny/tiny-engine-configurator'
import { formatString } from '@opentiny/tiny-engine-common/js/ast'
import {
SizeGroup,
LayoutGroup,
Expand Down Expand Up @@ -128,7 +127,7 @@ export default {
const { getSchema: getCanvasPageSchema, updateRect } = useCanvas().canvasApi.value
const pageSchema = getCanvasPageSchema()
const schema = getSchema() || pageSchema
const styleString = formatString(styleStrRemoveRoot(content), 'css')
const styleString = styleStrRemoveRoot(content)
const currentSchema = getCurrentSchema() || pageSchema
state.styleContent = content
Expand Down
24 changes: 12 additions & 12 deletions packages/settings/styles/src/components/border/BorderGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ export default {
const state = reactive({
showModal: false,
activedRadius: RADIUS_SETTING.Single,
activedBorder: BORDER_SETTING.All,
// 标记是否从 props 来的更新
isUpdateFromProps: false
activedBorder: BORDER_SETTING.All
})
const { setPosition } = useModal()
Expand Down Expand Up @@ -336,12 +334,13 @@ export default {
watch(
() => props.style,
() => {
state.isUpdateFromProps = true
borderRadius.BorderRadius = parseInt(props.style.borderRadius || 0)
borderRadius.BorderTopLeftRadius = parseInt(props.style.borderTopLeftRadius || 0)
borderRadius.BorderTopRightRadius = parseInt(props.style.borderTopRightRadius || 0)
borderRadius.BorderBottomLeftRadius = parseInt(props.style.borderBottomLeftRadius || 0)
borderRadius.BorderBottomRightRadius = parseInt(props.style.borderBottomRightRadius || 0)
borderRadius.BorderRadius = parseInt(props.style[BORDER_RADIUS_PROPERTY.BorderRadius] || 0)
borderRadius.BorderTopLeftRadius = parseInt(props.style[BORDER_RADIUS_PROPERTY.BorderTopLeftRadius] || 0)
borderRadius.BorderTopRightRadius = parseInt(props.style[BORDER_RADIUS_PROPERTY.BorderTopRightRadius] || 0)
borderRadius.BorderBottomLeftRadius = parseInt(props.style[BORDER_RADIUS_PROPERTY.BorderBottomLeftRadius] || 0)
borderRadius.BorderBottomRightRadius = parseInt(
props.style[BORDER_RADIUS_PROPERTY.BorderBottomRightRadius] || 0
)
},
{ immediate: true }
)
Expand Down Expand Up @@ -386,12 +385,13 @@ export default {
* 1. 用户在 monacoEditor 更新了样式 border-radius: 9px 然后保存,该组件接收并同步改值
* 2. 用户在 monacoEditor 删除了 border-radius: 9px 的样式,然后 watch 函数(props.style),重新计算得到值 0
* 3. 0 更新后,会再触发改函数更新,导致自动加上了 border-radius: 0px 的样式
* 所以从 props 来的更新不需要再调用一遍 updateStyle(更新 props 数据)
* 所以从如果当前值为 0 且 props.style[BORDER_RADIUS_PROPERTY.BorderRadius] 不存在值,不需要触发更新
*/
if (state.isUpdateFromProps) {
state.isUpdateFromProps = false
if (!value && !props.style[BORDER_RADIUS_PROPERTY.BorderRadius]) {
return
}
borderRadius.BorderRadius = value
updateStyle({
Expand Down
Loading

0 comments on commit 7e7b3a4

Please sign in to comment.