Skip to content

Commit

Permalink
feat: 节点操作增加收起/展开按钮, 方便处理多个操作
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Apr 19, 2024
1 parent 1dc4215 commit dc2f2d8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.219",
"version": "2.14.220",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
1 change: 1 addition & 0 deletions src/components/PreviewPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
background-color: transparent;
border: none;
padding: 0;
cursor: pointer;
}
}
}
Expand Down
38 changes: 36 additions & 2 deletions src/views/editor/ActionBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
<div class="form-block-wrapper">
<div v-if="sourceType !== 'file'" class="sticky-title-wrapper actions-title-wrapper">
<p>{{ $t(`editorPage.subConfig.actions.label`) }}</p>
<font-awesome-icon
v-if="isCollapsed"
@click.stop="setCollapsed(false)"
class="toggle fa-toggle"
icon="fa-solid fa-toggle-on "
/>
<font-awesome-icon
v-else
@click.stop="setCollapsed(true)"
class="toggle fa-toggle"
icon="fa-solid fa-toggle-off"
/>
<button @click="popActionsHelp">
<font-awesome-icon icon="fa-solid fa-circle-question" />
{{ $t(`editorPage.subConfig.basic.nodeActionsHelp`) }}
Expand All @@ -21,7 +33,7 @@
}" @end="drag = false" @start="drag = true" item-key="id">
<template #item="{ element }">
<nut-cell class="list-group-item" aria-hidden="true">
<div class="list-group-item-title">
<div :class="{ 'list-group-item-title': true, 'collapsed': isCollapsed }">
<div class="title-text left">
<span>{{
$t(`editorPage.subConfig.nodeActions['${element.type}'].label`)
Expand All @@ -47,7 +59,7 @@
</div>
</div>
</div>
<Component :is="element.component" :type="element.type" :id="element.id" :sourceType="sourceType"/>
<Component v-show="!isCollapsed" :is="element.component" :type="element.type" :id="element.id" :sourceType="sourceType"/>
</nut-cell>
</template>
</Draggable>
Expand Down Expand Up @@ -125,6 +137,7 @@ const { t } = useI18n();
const pasteboard = ref("");
const showPasteboard = ref(false);
const drag = ref(true);
const isCollapsed = ref(localStorage.getItem('actions-block-collapsed') === '1');
const form = inject<Sub | Collection>('form');
// 列表渲染的数据
// 预览开关数组,数组第一项为 id,对应 list 中的同 id 项目,控制该 id 开启关闭预览
Expand Down Expand Up @@ -152,6 +165,14 @@ const columns = ref(items);
// useMousePicker();
const setCollapsed = (v) => {
isCollapsed.value = v;
if (v) {
localStorage.setItem('actions-block-collapsed', '1')
} else {
localStorage.removeItem('actions-block-collapsed')
}
};
const onButtonClick = (item) => {
emit('addAction', [item]);
};
Expand Down Expand Up @@ -342,6 +363,12 @@ const pop = (type: string, tipsDes: string) => {
color: var(--comment-text-color);
border-bottom: 1px solid var(--divider-color);
&.collapsed {
padding-bottom: 0;
margin-bottom: 0;
border-bottom: none;
}
.left {
font-size: 12px;
font-weight: bold;
Expand Down Expand Up @@ -435,6 +462,13 @@ const pop = (type: string, tipsDes: string) => {
.actions-title-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
.toggle {
cursor: pointer;
margin-left: 18px;
margin-right: auto;
}
button {
background: none;
Expand Down

0 comments on commit dc2f2d8

Please sign in to comment.