Skip to content

Commit

Permalink
feat: 节点操作中的正则支持拖拽排序
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Dec 24, 2023
1 parent 2cd0ebb commit 305f8fc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 19 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.24",
"version": "2.14.25",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<GlobalNotify />
<!-- <GlobalNotify /> -->
<NavBar />
<main class="page-body">
<router-view />
</main>
</template>

<script setup lang="ts">
import GlobalNotify from '@/components/GlobalNotify.vue';
// import GlobalNotify from '@/components/GlobalNotify.vue';
import NavBar from '@/components/NavBar.vue';
import { useThemes } from '@/hooks/useThemes';
import { useGlobalStore } from '@/store/global';
Expand Down
1 change: 0 additions & 1 deletion src/store/appNotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const useAppNotifyStore = defineStore('appNotify', {
// primary,success ,danger,warning
// info, success, warning, error, default
const types = {primary: 'INFO', success: 'SUCCESS', danger: 'ERROR', warning: 'WARNING'};
console.log(`html`, html)
toast(html, {
theme: 'colored',
type: toast.TYPE[types[type] || 'DEFAULT'],
Expand Down
54 changes: 39 additions & 15 deletions src/views/editor/components/Regex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,28 @@
{{ $t(`editorPage.subConfig.nodeActions['${type}'].des[0]`) }}
</p>
<div class="tag-wrapper">
<nut-tag
@click="onClickTag"
class="tag-item"
v-for="(content, index) in value"
closeable
@close="deleteRegexItem(index)"
>
<span>{{
type === 'Regex Rename Operator'
? `${content.expr}${content.now}`
: content
}}</span>
</nut-tag>
<draggable
item-key="id"
v-model="dragData"
:force-fallback="true"
:scroll="true"
>
<template #item="{ element, index }">
<nut-tag
@click="onClickTag"
class="tag-item"
closeable
@close="deleteRegexItem(index)"
>
<span>{{
type === 'Regex Rename Operator'
? `${element.value.expr}${element.value.now}`
: element.value
}}
</span>
</nut-tag>
</template>
</draggable>
</div>
<div class="input-wrapper">
<nut-input
Expand All @@ -54,10 +63,11 @@

<script lang="ts" setup>
import { Dialog } from '@nutui/nutui';
import { inject, onMounted, ref, watch } from 'vue';
import { inject, onMounted, ref, watch, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { onBeforeRouteLeave, useRouter } from 'vue-router';
import draggable from "vuedraggable";
const { t } = useI18n();
const router = useRouter();
const { type, id } = defineProps<{
Expand All @@ -78,6 +88,19 @@
const mode = ref();
const value = ref();
const dragData = computed({
get() {
return Array.isArray(value.value) ? value.value.map((item, index) => ({
id: index + JSON.stringify(item),
value: item,
})) : []
},
set(val) {
val.map((item, index) => {
value.value[index] = item.value
})
}
})
const onClickTag = el => {
const index = [...el.currentTarget.parentElement.children].indexOf(
Expand Down Expand Up @@ -208,6 +231,7 @@
span {
max-width: 95%;
min-width: 20px;
display: -webkit-box;
white-space: normal !important;
overflow: hidden;
Expand Down

0 comments on commit 305f8fc

Please sign in to comment.