Skip to content

Commit

Permalink
Merge branch 'refactor/develop' of github.com:opentiny/tiny-engine in…
Browse files Browse the repository at this point in the history
…to feat/outline-tree-enhanced
  • Loading branch information
gene9831 committed Jan 14, 2025
2 parents bd577c7 + 931918b commit 35c285f
Show file tree
Hide file tree
Showing 121 changed files with 2,043 additions and 744 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
release:
if: github.repository == 'opentiny/tiny-engine'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Run Build
run: pnpm run build:plugin && pnpm run build:alpha > build-alpha.log 2>&1

- name: Upload build logs
uses: actions/upload-artifact@v4
with:
name: build-alpha-log
path: build-alpha.log

- name: Parse Publish tag
id: parse_tag
run: |
tag_name="${GITHUB_REF#refs/tags/}"
if [[ "$tag_name" == *alpha* ]]; then
echo "dist_tag=alpha" >> "$GITHUB_OUTPUT"
elif [[ "$tag_name" == *beta* ]]; then
echo "dist_tag=beta" >> "$GITHUB_OUTPUT"
elif [[ "$tag_name" == *rc* ]]; then
echo "dist_tag=rc" >> "$GITHUB_OUTPUT"
else
echo "dist_tag=latest" >> "$GITHUB_OUTPUT"
fi
- name: Verify clean working directory
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "Working directory is not clean"
exit 1
fi
- name: Verify package version match tag
run: |
tag_name="${GITHUB_REF#refs/tags/}"
package_version=$(pnpm lerna list --scope=@opentiny/tiny-engine --json | jq -r '.[0].version')
if [[ "$tag_name" != "v$package_version" ]]; then
echo "Tag name $tag_name does not match package version $package_version"
exit 1
fi
- name: Publish package to npm
run: pnpm lerna publish from-package --dist-tag ${{steps.parse_tag.outputs.dist_tag}} --yes
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
15 changes: 14 additions & 1 deletion designer-demo/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,20 @@ export default {
Fullscreen,
Lang
],
plugins: [Materials, Tree, Page, Block, Datasource, Bridge, I18n, Script, State, Schema, Help, Robot],
plugins: [
Materials,
Tree,
Page,
[Block, { options: { ...Block.options, mergeCategoriesAndGroups: true } }],
Datasource,
Bridge,
I18n,
Script,
State,
Schema,
Help,
Robot
],
dsls: [{ id: 'engine.dsls.dslvue' }],
settings: [Props, Styles, Events],
canvas: Canvas
Expand Down
4 changes: 2 additions & 2 deletions packages/canvas/DesignCanvas/src/api/useCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const resetCanvasState = async (state = {}) => {

const diffPatch = jsonDiffPatchInstance.diff(previousSchema, pageState.pageSchema)

canvasApi.value?.clearSelect?.()
publish({ topic: 'schemaImport', data: { current: pageState.pageSchema, previous: previousSchema, diffPatch } })
}

Expand Down Expand Up @@ -518,8 +519,6 @@ const importSchema = (data) => {
resetCanvasState({
pageSchema: importData
})

canvasApi.value?.clearSelect?.()
}

const exportSchema = () => {
Expand Down Expand Up @@ -560,6 +559,7 @@ export default function () {
setSaved,
clearCanvas,
getPageSchema,
resetCanvasState,
resetPageCanvasState,
resetBlockCanvasState,
clearCurrentState,
Expand Down
3 changes: 2 additions & 1 deletion packages/canvas/common/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export const copyObject = (node) => {
*/
export const dynamicImportComponents = async ({ package: pkg, script, components }) => {
if (!script) return
const scriptUrl = script.startsWith('.') ? new URL(script, location.href).href : script
const href = window.parent.location.href || location.href // 这里要取父窗口的地址,因为在iframe中href是about:srcdoc
const scriptUrl = script.startsWith('.') ? new URL(script, href).href : script

if (!window.TinyComponentLibs[pkg]) {
const modules = await import(/* @vite-ignore */ scriptUrl)
Expand Down
11 changes: 5 additions & 6 deletions packages/canvas/container/src/components/CanvasAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,20 @@ export default {
const findParentHasClass = (target) => {
let parent = target.parentNode
let flag = false
if (parent.className === undefined) {
return false
}
let name = JSON.stringify(parent.className)
if (name && name.indexOf('short-cut-set') === -1 && name.indexOf('tiny-dialog-box') === -1) {
flag = findParentHasClass(parent)
} else {
flag = true
const preventClassNameList = ['short-cut-set', 'tiny-dialog-box', 'icon-popover', 'i18n-input-popover']
if (preventClassNameList.some((item) => name?.includes(item))) {
return true
}
return flag
return findParentHasClass(parent)
}
const onMousedown = (event, horizontal, vertical) => {
Expand Down
7 changes: 6 additions & 1 deletion packages/common/component/BindI18n.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
:filter-method="filterMethod"
@change="selectI18n"
>
<tiny-option v-for="item in langData" :key="item.key" :label="item.key + item[currentLang]" :value="item.key">
<tiny-option
v-for="item in langData"
:key="item.key"
:label="`${item[currentLang]} (${item.key})`"
:value="item.key"
>
</tiny-option>
</tiny-select>
<div v-if="paramsForm.length" class="params-form">
Expand Down
12 changes: 11 additions & 1 deletion packages/common/component/BlockDeployDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import {
Popover as TinyPopover,
FormItem as TinyFormItem
} from '@opentiny/vue'
import { useNotify, getMetaApi, META_APP } from '@opentiny/tiny-engine-meta-register'
import { useBlock, useCanvas, useNotify, getMetaApi, META_APP } from '@opentiny/tiny-engine-meta-register'
import { constants } from '@opentiny/tiny-engine-utils'
import VueMonaco from './VueMonaco.vue'
Expand Down Expand Up @@ -172,6 +172,13 @@ export default {
const setVisible = (visible) => emit('update:visible', visible)
const { setSaved } = useCanvas()
const isSameBlock = () => {
const currentBlock = useBlock().getCurrentBlock()
return props.block?.id === currentBlock?.id
}
const deployBlock = async () => {
deployBlockRef.value.validate((valid) => {
const { publishBlock } = getMetaApi(META_APP.BlockManage)
Expand All @@ -186,6 +193,9 @@ export default {
}
publishBlock(params)
setVisible(false)
if (formState.needToSave && isSameBlock()) {
setSaved(true)
}
formState.deployInfo = ''
formState.version = ''
formState.needToSave = true
Expand Down
105 changes: 38 additions & 67 deletions packages/common/component/BlockHistoryList.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<template>
<ul>
<li v-for="item in history" :key="item.id" class="item">
<block-history-template :blockHistory="item" :is-block-manage="isBlockManage"></block-history-template>
<span class="item-icon">
<span @click="$emit('preview', item)"
><svg-button class="svg-item-icon" name="text-page-review"></svg-button><span>预览</span></span
>
<span v-if="!isBlockManage" @click="$emit('restore', item)"
><svg-button class="svg-item-icon" name="text-page-revert"></svg-button><span>还原</span></span
>
</span>
</li>
</ul>
<tiny-grid v-if="history.length" :data="history" height="300">
<tiny-grid-column v-if="isBlockManage" field="version" title="版本号">
<template v-slot="data">
{{ data.row.version }}
<span v-if="data.row.version === lastVersion.versions" class="version-v">最新</span>
</template>
</tiny-grid-column>
<tiny-grid-column field="updated_at" title="发布时间">
<template v-slot="data">
{{ format(data.row.updated_at, 'yyyy/MM/dd hh:mm:ss') }}
</template>
</tiny-grid-column>
<tiny-grid-column field="message" title="描述"></tiny-grid-column>
<tiny-grid-column width="90" field="operation" title="操作">
<template v-slot="data">
<span class="operation-text" @click="$emit('preview', data.row)">预览</span>
<span v-if="!isBlockManage" class="operation-text" @click="$emit('restore', data.row)">还原</span>
</template>
</tiny-grid-column>
</tiny-grid>
<div v-if="!history.length" class="empty">暂无数据</div>
</template>

<script setup>
import { defineEmits, defineProps } from 'vue'
import { SvgButton } from '../index'
// 引入组件在template上使用
import BlockHistoryTemplate from './BlockHistoryTemplate.vue'
import { format } from '@opentiny/vue-renderless/common/date'
import { Grid as TinyGrid, GridColumn as TinyGridColumn } from '@opentiny/vue'
defineProps({
history: {
Expand All @@ -30,67 +35,33 @@ defineProps({
isBlockManage: {
type: Boolean,
default: false
},
lastVersion: {
type: Object,
default: () => ({})
}
})
defineEmits(['preview', 'restore'])
</script>

<style lang="less" scoped>
.item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0px 16px;
&:not(:last-child) {
border-bottom: 1px solid
var(--ti-lowcode-component-block-history-list-item-border-color, --ti-lowcode-tabs-border-color);
}
&:hover {
background-color: var(--ti-lowcode-component-block-history-list-item-hover-bg);
.item-icon {
display: block;
}
}
.version-v {
font-size: 12px;
padding: 2px 8px;
margin-left: 5px;
background-color: var(--te-common-bg-tag);
color: var(--te-common-color-success);
border-radius: var(--te-base-border-radius-1);
}
.item-icon {
display: none;
> span {
border: 1px solid var(--ti-lowcode-component-block-history-list-item-btn-border-color);
height: 28px;
color: var(--ti-lowcode-component-block-history-list-item-btn-color);
font-size: 12px;
border-radius: 2px;
cursor: pointer;
display: inline-flex;
justify-content: center;
align-items: center;
transition: 0.3s;
padding: 0 10px;
.svg-item-icon {
color: var(--ti-lowcode-component-block-history-list-item-btn-color);
}
.svg-item-icon:hover {
color: var(--ti-lowcode-component-block-history-list-item-btn-hover-color);
}
&:hover {
color: var(--ti-lowcode-component-block-history-list-item-btn-hover-color);
background: var(--ti-lowcode-component-block-history-list-item-btn-hover-bg);
}
&:last-child {
margin-left: 4px;
}
> span {
margin-left: 4px;
}
.operation-text {
color: var(--te-common-text-emphasize);
& + .operation-text {
margin-left: 8px;
}
}
.empty {
color: var(--ti-lowcode-common-empty-text-color);
color: var(--te-common-text-weaken);
}
</style>
1 change: 0 additions & 1 deletion packages/common/component/BlockLinkField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export default {
confirm({
title: '属性名称',
status: 'custom',
message: {
render() {
return (
Expand Down
15 changes: 14 additions & 1 deletion packages/common/component/ButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,25 @@
.button-group {
display: grid;
grid-auto-flow: column;
column-gap: 8px;
column-gap: 4px;
align-items: center;
:deep(.svg-button),
:deep(.tiny-button) {
margin: 0;
}
:deep(.tiny-button) {
padding: 0;
min-width: 40px;
}
:deep(.tiny-button + .svg-button) {
margin-left: 4px;
}
:deep(.tiny-button + .tiny-button) {
margin-left: 8px;
}
:deep(.tiny-button.tiny-button.tiny-button--default) {
border-color: var(--te-common-border-secondary);
}
}
</style>
5 changes: 5 additions & 0 deletions packages/common/component/ConfigItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,11 @@ export default {
:deep(.tiny-select .tiny-input__inner) {
padding-right: 26px;
}
:deep(.tiny-input-suffix) {
.tiny-input__inner {
padding-right: 28px;
}
}
}
.prop-description {
Expand Down
Loading

0 comments on commit 35c285f

Please sign in to comment.