|
@@ -2,7 +2,7 @@
|
|
<div
|
|
<div
|
|
v-for="(item, index) in inputsData"
|
|
v-for="(item, index) in inputsData"
|
|
:key="item.id"
|
|
:key="item.id"
|
|
- class="condition-input"
|
|
|
|
|
|
+ class="condition-input scroll"
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
v-if="item.category === 'value'"
|
|
v-if="item.category === 'value'"
|
|
@@ -10,6 +10,7 @@
|
|
>
|
|
>
|
|
<ui-select
|
|
<ui-select
|
|
:model-value="item.type"
|
|
:model-value="item.type"
|
|
|
|
+ class="flex-shrink-0"
|
|
@change="updateValueType($event, index)"
|
|
@change="updateValueType($event, index)"
|
|
>
|
|
>
|
|
<optgroup
|
|
<optgroup
|
|
@@ -22,19 +23,33 @@
|
|
</option>
|
|
</option>
|
|
</optgroup>
|
|
</optgroup>
|
|
</ui-select>
|
|
</ui-select>
|
|
- <edit-autocomplete
|
|
|
|
- v-for="(_, name) in item.data"
|
|
|
|
- :key="item.id + name + index"
|
|
|
|
- class="flex-1"
|
|
|
|
- >
|
|
|
|
- <ui-input
|
|
|
|
- v-model="inputsData[index].data[name]"
|
|
|
|
- :title="conditionBuilder.inputTypes[name].label"
|
|
|
|
- :placeholder="conditionBuilder.inputTypes[name].label"
|
|
|
|
- autocomplete="off"
|
|
|
|
- class="w-full"
|
|
|
|
|
|
+ <template v-for="(_, name) in item.data" :key="item.id + name + index">
|
|
|
|
+ <v-remixicon
|
|
|
|
+ v-if="name === 'code'"
|
|
|
|
+ :title="t('workflow.conditionBuilder.topAwait')"
|
|
|
|
+ name="riInformationLine"
|
|
/>
|
|
/>
|
|
- </edit-autocomplete>
|
|
|
|
|
|
+ <edit-autocomplete
|
|
|
|
+ :disabled="name === 'code'"
|
|
|
|
+ :class="[name === 'code' ? 'w-full' : 'flex-1']"
|
|
|
|
+ :style="{ marginLeft: name === 'code' ? 0 : null }"
|
|
|
|
+ >
|
|
|
|
+ <shared-codemirror
|
|
|
|
+ v-if="name === 'code'"
|
|
|
|
+ v-model="inputsData[index].data[name]"
|
|
|
|
+ class="code-condition mt-2"
|
|
|
|
+ style="margin-left: 0"
|
|
|
|
+ />
|
|
|
|
+ <ui-input
|
|
|
|
+ v-else
|
|
|
|
+ v-model="inputsData[index].data[name]"
|
|
|
|
+ :title="conditionBuilder.inputTypes[name].label"
|
|
|
|
+ :placeholder="conditionBuilder.inputTypes[name].label"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ class="w-full"
|
|
|
|
+ />
|
|
|
|
+ </edit-autocomplete>
|
|
|
|
+ </template>
|
|
</div>
|
|
</div>
|
|
<ui-select
|
|
<ui-select
|
|
v-else-if="item.category === 'compare'"
|
|
v-else-if="item.category === 'compare'"
|
|
@@ -52,11 +67,17 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
-import { ref, watch } from 'vue';
|
|
|
|
|
|
+import { ref, watch, defineAsyncComponent } from 'vue';
|
|
import { nanoid } from 'nanoid';
|
|
import { nanoid } from 'nanoid';
|
|
|
|
+import { useI18n } from 'vue-i18n';
|
|
|
|
+import cloneDeep from 'lodash.clonedeep';
|
|
import { conditionBuilder } from '@/utils/shared';
|
|
import { conditionBuilder } from '@/utils/shared';
|
|
import EditAutocomplete from '../../workflow/edit/EditAutocomplete.vue';
|
|
import EditAutocomplete from '../../workflow/edit/EditAutocomplete.vue';
|
|
|
|
|
|
|
|
+const SharedCodemirror = defineAsyncComponent(() =>
|
|
|
|
+ import('../SharedCodemirror.vue')
|
|
|
|
+);
|
|
|
|
+
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
data: {
|
|
data: {
|
|
type: Array,
|
|
type: Array,
|
|
@@ -69,7 +90,8 @@ const props = defineProps({
|
|
});
|
|
});
|
|
const emit = defineEmits(['update']);
|
|
const emit = defineEmits(['update']);
|
|
|
|
|
|
-const inputsData = ref(JSON.parse(JSON.stringify(props.data)));
|
|
|
|
|
|
+const { t } = useI18n();
|
|
|
|
+const inputsData = ref(cloneDeep(props.data));
|
|
|
|
|
|
function getDefaultValues(items) {
|
|
function getDefaultValues(items) {
|
|
const defaultValues = {
|
|
const defaultValues = {
|
|
@@ -131,3 +153,8 @@ watch(
|
|
{ deep: true }
|
|
{ deep: true }
|
|
);
|
|
);
|
|
</script>
|
|
</script>
|
|
|
|
+<style>
|
|
|
|
+.code-condition .cm-content {
|
|
|
|
+ white-space: pre-wrap;
|
|
|
|
+}
|
|
|
|
+</style>
|