diff --git a/frontend/src/components/ConditionObjects.vue b/frontend/src/components/ConditionObjects.vue index 3719bab..9939b08 100644 --- a/frontend/src/components/ConditionObjects.vue +++ b/frontend/src/components/ConditionObjects.vue @@ -19,7 +19,7 @@ - + @@ -30,7 +30,7 @@ + } +}; + + +export default defineComponent({ + name: 'FieldInput', + inheritAttrs: false, + components: { + ConditionEditor + }, + props: { + context: { + type: Array, + default: '', + }, + displayName: { + type: String, + default: '', + }, + name: { + type: String, + default: '', + }, + placeholder: { + type: String, + default: '', + }, + hint: { + type: String, + default: '', + }, + modelValue: { + type: String, + default: null + }, + }, + + setup(props, { emit }) { + const source = props.context.find(element => element?.props?.name === 'sources') + + if (source) { + provide('sourceFields', computed( () => source.props?.modelValue?.fields ?? [])); + } + + const appDg = ref(); + const show = ref(false); + const tree = reactive(new ConditionTree()); + if (props.modelValue && props.modelValue !== '') { + tree.fromJson(props.modelValue); + } else { + const newNode = new ConditionNode({}, Operator.Equal, '', tree.root); + tree.addNode(tree.root, newNode); + } + + const isSetted = ref(props.modelValue && props.modelValue !== ''); + + const conditionString = computed(() => { + return tree.buildConditionString(tree.root); + }); + + const showDg = () => { + show.value = true; + }; + + const onClosed = (val: string) => { + if (val == 'OK') { + const conditionJson = tree.toJson(); + isSetted.value = true; + emit('update:modelValue', conditionJson); + } + }; + + watchEffect(() => { + const conditionJson = tree.toJson(); + emit('update:modelValue', conditionJson); + }); + + return { + appDg, + isSetted, + show, + showDg, + onClosed, + tree, + conditionString + }; + } +}); + diff --git a/frontend/src/components/right/DataProcessing.vue b/frontend/src/components/right/DataProcessing.vue new file mode 100644 index 0000000..87ceb24 --- /dev/null +++ b/frontend/src/components/right/DataProcessing.vue @@ -0,0 +1,95 @@ + + + + \ No newline at end of file diff --git a/frontend/src/components/right/PropertyList.vue b/frontend/src/components/right/PropertyList.vue index 1c7357c..f19bf98 100644 --- a/frontend/src/components/right/PropertyList.vue +++ b/frontend/src/components/right/PropertyList.vue @@ -1,7 +1,7 @@ @@ -21,6 +21,7 @@ import ConditionInput from '../right/ConditionInput.vue'; import EventSetter from '../right/EventSetter.vue'; import ColorPicker from './ColorPicker.vue'; import NumInput from './NumInput.vue'; +import DataProcessing from './DataProcessing.vue'; import { IActionNode,IActionProperty,IProp } from 'src/types/ActionTypes'; export default defineComponent({ @@ -35,7 +36,8 @@ export default defineComponent({ ConditionInput, EventSetter, ColorPicker, - NumInput + NumInput, + DataProcessing }, props: { nodeProps: { @@ -50,7 +52,7 @@ export default defineComponent({ setup(props, context) { const properties=ref(props.nodeProps); const connectProps=(props:IProp)=>{ - const connProps:any={}; + const connProps:any={context:properties}; if(props && "connectProps" in props && props.connectProps!=undefined){ for(let connProp of props.connectProps){ let targetProp = properties.value.find((prop)=>prop.props.name===connProp.propName);