Skip to content

Commit 648596f

Browse files
committed
Merge remote-tracking branch 'upstream/refactor/develop' into refactor/theme-rest
2 parents 57697e8 + 8295c3f commit 648596f

File tree

115 files changed

+1929
-669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1929
-669
lines changed

.github/workflows/Release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
if: github.repository == 'opentiny/tiny-engine'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
id-token: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: 9
23+
run_install: false
24+
25+
- name: Install Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 18
29+
cache: 'pnpm'
30+
registry-url: 'https://registry.npmjs.org'
31+
32+
- name: Install dependencies
33+
run: pnpm install
34+
35+
- name: Run Build
36+
run: pnpm run build:plugin && pnpm run build:alpha > build-alpha.log 2>&1
37+
38+
- name: Upload build logs
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: build-alpha-log
42+
path: build-alpha.log
43+
44+
- name: Parse Publish tag
45+
id: parse_tag
46+
run: |
47+
tag_name="${GITHUB_REF#refs/tags/}"
48+
if [[ "$tag_name" == *alpha* ]]; then
49+
echo "dist_tag=alpha" >> "$GITHUB_OUTPUT"
50+
elif [[ "$tag_name" == *beta* ]]; then
51+
echo "dist_tag=beta" >> "$GITHUB_OUTPUT"
52+
elif [[ "$tag_name" == *rc* ]]; then
53+
echo "dist_tag=rc" >> "$GITHUB_OUTPUT"
54+
else
55+
echo "dist_tag=latest" >> "$GITHUB_OUTPUT"
56+
fi
57+
58+
- name: Verify clean working directory
59+
run: |
60+
if [[ -n "$(git status --porcelain)" ]]; then
61+
echo "Working directory is not clean"
62+
exit 1
63+
fi
64+
65+
- name: Verify package version match tag
66+
run: |
67+
tag_name="${GITHUB_REF#refs/tags/}"
68+
package_version=$(pnpm lerna list --scope=@opentiny/tiny-engine --json | jq -r '.[0].version')
69+
if [[ "$tag_name" != "v$package_version" ]]; then
70+
echo "Tag name $tag_name does not match package version $package_version"
71+
exit 1
72+
fi
73+
74+
- name: Publish package to npm
75+
run: pnpm lerna publish from-package --dist-tag ${{steps.parse_tag.outputs.dist_tag}} --yes
76+
env:
77+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

packages/canvas/DesignCanvas/src/api/useCanvas.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ const resetCanvasState = async (state = {}) => {
140140

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

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

@@ -518,8 +519,6 @@ const importSchema = (data) => {
518519
resetCanvasState({
519520
pageSchema: importData
520521
})
521-
522-
canvasApi.value?.clearSelect?.()
523522
}
524523

525524
const exportSchema = () => {

packages/canvas/common/src/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export const copyObject = (node) => {
6262
*/
6363
export const dynamicImportComponents = async ({ package: pkg, script, components }) => {
6464
if (!script) return
65-
const scriptUrl = script.startsWith('.') ? new URL(script, location.href).href : script
65+
const href = window.parent.location.href || location.href // 这里要取父窗口的地址,因为在iframe中href是about:srcdoc
66+
const scriptUrl = script.startsWith('.') ? new URL(script, href).href : script
6667

6768
if (!window.TinyComponentLibs[pkg]) {
6869
const modules = await import(/* @vite-ignore */ scriptUrl)

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,21 +253,20 @@ export default {
253253
254254
const findParentHasClass = (target) => {
255255
let parent = target.parentNode
256-
let flag = false
257256
258257
if (parent.className === undefined) {
259258
return false
260259
}
261260
262261
let name = JSON.stringify(parent.className)
263262
264-
if (name && name.indexOf('short-cut-set') === -1 && name.indexOf('tiny-dialog-box') === -1) {
265-
flag = findParentHasClass(parent)
266-
} else {
267-
flag = true
263+
const preventClassNameList = ['short-cut-set', 'tiny-dialog-box', 'icon-popover', 'i18n-input-popover']
264+
265+
if (preventClassNameList.some((item) => name?.includes(item))) {
266+
return true
268267
}
269268
270-
return flag
269+
return findParentHasClass(parent)
271270
}
272271
273272
const onMousedown = (event, horizontal, vertical) => {

packages/common/component/BindI18n.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
:filter-method="filterMethod"
1111
@change="selectI18n"
1212
>
13-
<tiny-option v-for="item in langData" :key="item.key" :label="item.key + item[currentLang]" :value="item.key">
13+
<tiny-option
14+
v-for="item in langData"
15+
:key="item.key"
16+
:label="`${item[currentLang]} (${item.key})`"
17+
:value="item.key"
18+
>
1419
</tiny-option>
1520
</tiny-select>
1621
<div v-if="paramsForm.length" class="params-form">

packages/common/component/BlockDeployDialog.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ import {
8181
Popover as TinyPopover,
8282
FormItem as TinyFormItem
8383
} from '@opentiny/vue'
84-
import { useNotify, getMetaApi, META_APP } from '@opentiny/tiny-engine-meta-register'
84+
import { useBlock, useCanvas, useNotify, getMetaApi, META_APP } from '@opentiny/tiny-engine-meta-register'
8585
import { constants } from '@opentiny/tiny-engine-utils'
8686
import VueMonaco from './VueMonaco.vue'
8787
@@ -172,6 +172,13 @@ export default {
172172
173173
const setVisible = (visible) => emit('update:visible', visible)
174174
175+
const { setSaved } = useCanvas()
176+
177+
const isSameBlock = () => {
178+
const currentBlock = useBlock().getCurrentBlock()
179+
return props.block?.id === currentBlock?.id
180+
}
181+
175182
const deployBlock = async () => {
176183
deployBlockRef.value.validate((valid) => {
177184
const { publishBlock } = getMetaApi(META_APP.BlockManage)
@@ -186,6 +193,9 @@ export default {
186193
}
187194
publishBlock(params)
188195
setVisible(false)
196+
if (formState.needToSave && isSameBlock()) {
197+
setSaved(true)
198+
}
189199
formState.deployInfo = ''
190200
formState.version = ''
191201
formState.needToSave = true
Lines changed: 38 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
<template>
2-
<ul>
3-
<li v-for="item in history" :key="item.id" class="item">
4-
<block-history-template :blockHistory="item" :is-block-manage="isBlockManage"></block-history-template>
5-
<span class="item-icon">
6-
<span @click="$emit('preview', item)"
7-
><svg-button class="svg-item-icon" name="text-page-review"></svg-button><span>预览</span></span
8-
>
9-
<span v-if="!isBlockManage" @click="$emit('restore', item)"
10-
><svg-button class="svg-item-icon" name="text-page-revert"></svg-button><span>还原</span></span
11-
>
12-
</span>
13-
</li>
14-
</ul>
2+
<tiny-grid v-if="history.length" :data="history" height="300">
3+
<tiny-grid-column v-if="isBlockManage" field="version" title="版本号">
4+
<template v-slot="data">
5+
{{ data.row.version }}
6+
<span v-if="data.row.version === lastVersion.versions" class="version-v">最新</span>
7+
</template>
8+
</tiny-grid-column>
9+
<tiny-grid-column field="updated_at" title="发布时间">
10+
<template v-slot="data">
11+
{{ format(data.row.updated_at, 'yyyy/MM/dd hh:mm:ss') }}
12+
</template>
13+
</tiny-grid-column>
14+
<tiny-grid-column field="message" title="描述"></tiny-grid-column>
15+
<tiny-grid-column width="90" field="operation" title="操作">
16+
<template v-slot="data">
17+
<span class="operation-text" @click="$emit('preview', data.row)">预览</span>
18+
<span v-if="!isBlockManage" class="operation-text" @click="$emit('restore', data.row)">还原</span>
19+
</template>
20+
</tiny-grid-column>
21+
</tiny-grid>
1522
<div v-if="!history.length" class="empty">暂无数据</div>
1623
</template>
1724

1825
<script setup>
1926
import { defineEmits, defineProps } from 'vue'
20-
import { SvgButton } from '../index'
21-
22-
// 引入组件在template上使用
23-
import BlockHistoryTemplate from './BlockHistoryTemplate.vue'
27+
import { format } from '@opentiny/vue-renderless/common/date'
28+
import { Grid as TinyGrid, GridColumn as TinyGridColumn } from '@opentiny/vue'
2429
2530
defineProps({
2631
history: {
@@ -30,67 +35,33 @@ defineProps({
3035
isBlockManage: {
3136
type: Boolean,
3237
default: false
38+
},
39+
lastVersion: {
40+
type: Object,
41+
default: () => ({})
3342
}
3443
})
3544
3645
defineEmits(['preview', 'restore'])
3746
</script>
3847

3948
<style lang="less" scoped>
40-
.item {
41-
display: flex;
42-
justify-content: space-between;
43-
align-items: center;
44-
padding: 0px 16px;
45-
46-
&:not(:last-child) {
47-
border-bottom: 1px solid
48-
var(--ti-lowcode-component-block-history-list-item-border-color, --ti-lowcode-tabs-border-color);
49-
}
50-
51-
&:hover {
52-
background-color: var(--ti-lowcode-component-block-history-list-item-hover-bg);
53-
.item-icon {
54-
display: block;
55-
}
56-
}
49+
.version-v {
50+
font-size: 12px;
51+
padding: 2px 8px;
52+
margin-left: 5px;
53+
background-color: var(--te-common-bg-tag);
54+
color: var(--te-common-color-success);
55+
border-radius: var(--te-base-border-radius-1);
5756
}
58-
59-
.item-icon {
60-
display: none;
61-
> span {
62-
border: 1px solid var(--ti-lowcode-component-block-history-list-item-btn-border-color);
63-
height: 28px;
64-
color: var(--ti-lowcode-component-block-history-list-item-btn-color);
65-
font-size: 12px;
66-
border-radius: 2px;
67-
cursor: pointer;
68-
display: inline-flex;
69-
justify-content: center;
70-
align-items: center;
71-
transition: 0.3s;
72-
padding: 0 10px;
73-
.svg-item-icon {
74-
color: var(--ti-lowcode-component-block-history-list-item-btn-color);
75-
}
76-
.svg-item-icon:hover {
77-
color: var(--ti-lowcode-component-block-history-list-item-btn-hover-color);
78-
}
79-
&:hover {
80-
color: var(--ti-lowcode-component-block-history-list-item-btn-hover-color);
81-
background: var(--ti-lowcode-component-block-history-list-item-btn-hover-bg);
82-
}
83-
84-
&:last-child {
85-
margin-left: 4px;
86-
}
87-
> span {
88-
margin-left: 4px;
89-
}
57+
.operation-text {
58+
color: var(--te-common-text-emphasize);
59+
& + .operation-text {
60+
margin-left: 8px;
9061
}
9162
}
9263
9364
.empty {
94-
color: var(--ti-lowcode-common-empty-text-color);
65+
color: var(--te-common-text-weaken);
9566
}
9667
</style>

packages/common/component/BlockLinkField.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export default {
6565
6666
confirm({
6767
title: '属性名称',
68-
status: 'custom',
6968
message: {
7069
render() {
7170
return (

packages/common/component/ButtonGroup.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,25 @@
88
.button-group {
99
display: grid;
1010
grid-auto-flow: column;
11-
column-gap: 8px;
11+
column-gap: 4px;
1212
align-items: center;
1313
1414
:deep(.svg-button),
1515
:deep(.tiny-button) {
1616
margin: 0;
1717
}
18+
:deep(.tiny-button) {
19+
padding: 0;
20+
min-width: 40px;
21+
}
22+
:deep(.tiny-button + .svg-button) {
23+
margin-left: 4px;
24+
}
25+
:deep(.tiny-button + .tiny-button) {
26+
margin-left: 8px;
27+
}
28+
:deep(.tiny-button.tiny-button.tiny-button--default) {
29+
border-color: var(--te-common-border-secondary);
30+
}
1831
}
1932
</style>

packages/common/component/ConfigItem.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,11 @@ export default {
600600
:deep(.tiny-select .tiny-input__inner) {
601601
padding-right: 26px;
602602
}
603+
:deep(.tiny-input-suffix) {
604+
.tiny-input__inner {
605+
padding-right: 28px;
606+
}
607+
}
603608
}
604609
605610
.prop-description {

0 commit comments

Comments
 (0)