Compare commits
24 Commits
171f0dfa89
...
plugin-inf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3540becf6f | ||
|
|
63099eda8b | ||
|
|
65d89b0462 | ||
|
|
c6ded099fa | ||
|
|
c072233593 | ||
|
|
4e296c1555 | ||
| 016fcaab29 | |||
|
|
bebc1ec9fa | ||
|
|
f71c3d2123 | ||
|
|
d79ce8d06b | ||
|
|
fc9c3a5e81 | ||
|
|
6df72a1ae3 | ||
|
|
372dbe50f7 | ||
|
|
68fde6d490 | ||
|
|
c398dee21e | ||
|
|
f2ab310b6d | ||
|
|
ca0f24465b | ||
|
|
3cc4b65460 | ||
|
|
a6cf95b76d | ||
|
|
484ab9fdae | ||
|
|
78bba2502f | ||
|
|
c78b3cb5c0 | ||
|
|
b25c17ab53 | ||
|
|
a7078b54c5 |
File diff suppressed because one or more lines are too long
152
frontend/src/components/AppFieldSelectBox.vue
Normal file
152
frontend/src/components/AppFieldSelectBox.vue
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div class="q-mx-md q-mb-lg">
|
||||||
|
<div class="q-mb-xs q-ml-md text-primary">アプリ選択</div>
|
||||||
|
|
||||||
|
<div class="q-pa-md row" style="border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 4px;">
|
||||||
|
<div v-if="selField?.app && !showSelectApp">{{ selField.app?.name }}</div>
|
||||||
|
<q-space />
|
||||||
|
<div>
|
||||||
|
<q-btn outline dense label="選 択" padding="none sm" color="primary" @click="() => {
|
||||||
|
showSelectApp = true;
|
||||||
|
}"></q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="!showSelectApp && selField.app?.name">
|
||||||
|
<div>
|
||||||
|
<div class="row q-mb-md">
|
||||||
|
<!-- <div class="col"> -->
|
||||||
|
<div class="q-mb-xs q-ml-md text-primary">フィールド選択</div>
|
||||||
|
<!-- </div> -->
|
||||||
|
<q-space />
|
||||||
|
<!-- <div class="col"> -->
|
||||||
|
<div class="q-mr-md">
|
||||||
|
<q-input dense debounce="300" v-model="fieldFilter" placeholder="フィールド検索" clearable>
|
||||||
|
<template v-slot:before>
|
||||||
|
<q-icon name="search" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<field-select ref="fieldDlg" name="フィールド" :type="selectType" :updateSelects="updateItems"
|
||||||
|
:appId="selField.app?.id" not_page :filter="fieldFilter"
|
||||||
|
:selFields="selField.fields"></field-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="min-width: 45vw;" v-else>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<show-dialog v-model:visible="showSelectApp" name="アプリ選択" @close="closeAppDlg">
|
||||||
|
<template v-slot:toolbar>
|
||||||
|
<q-input dense debounce="300" v-model="filter" placeholder="検索" clearable>
|
||||||
|
<template v-slot:before>
|
||||||
|
<q-icon name="search" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<AppSelectBox ref="appDlg" name="アプリ" type="single" :filter="filter"
|
||||||
|
:updateExternalSelectAppInfo="updateExternalSelectAppInfo"></AppSelectBox>
|
||||||
|
</show-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent, ref, watchEffect, computed ,reactive} from 'vue';
|
||||||
|
import ShowDialog from './ShowDialog.vue';
|
||||||
|
import FieldSelect from './FieldSelect.vue';
|
||||||
|
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||||
|
import AppSelectBox from './AppSelectBox.vue';
|
||||||
|
interface IApp {
|
||||||
|
id: string,
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
interface IField {
|
||||||
|
name: string,
|
||||||
|
code: string,
|
||||||
|
type: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAppFields {
|
||||||
|
app?: IApp,
|
||||||
|
fields: IField[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
inheritAttrs: false,
|
||||||
|
name: 'AppFieldSelectBox',
|
||||||
|
components: {
|
||||||
|
ShowDialog,
|
||||||
|
FieldSelect,
|
||||||
|
AppSelectBox,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
selectedField: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
selectType: {
|
||||||
|
type: String,
|
||||||
|
default: 'single'
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const appDlg = ref();
|
||||||
|
const fieldDlg = ref();
|
||||||
|
const showSelectApp = ref(false);
|
||||||
|
const selField = reactive(props.selectedField);
|
||||||
|
console.log(props.selectedField);
|
||||||
|
|
||||||
|
const store = useFlowEditorStore();
|
||||||
|
|
||||||
|
const isSelected = computed(() => {
|
||||||
|
return selField !== null && typeof selField === 'object' && ('app' in selField)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const closeAppDlg = (val: string) => {
|
||||||
|
if (val == 'OK') {
|
||||||
|
selField.app = appDlg.value.selected[0];
|
||||||
|
selField.fields = [];
|
||||||
|
showSelectApp.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeFieldDialog = (val: string) => {
|
||||||
|
if (val == 'OK') {
|
||||||
|
selField.fields = fieldDlg.value.selected;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const updateExternalSelectAppInfo = (newAppinfo: IApp) => {
|
||||||
|
selField.app = newAppinfo
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateItems = (newFields: IField[]) => {
|
||||||
|
selField.fields = newFields
|
||||||
|
}
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
emit('update:modelValue', selField);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
appDlg,
|
||||||
|
fieldDlg,
|
||||||
|
closeAppDlg,
|
||||||
|
closeFieldDialog,
|
||||||
|
showSelectApp,
|
||||||
|
isSelected,
|
||||||
|
updateExternalSelectAppInfo,
|
||||||
|
filter: ref(),
|
||||||
|
updateItems,
|
||||||
|
fieldFilter: ref(),
|
||||||
|
selField
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -21,7 +21,7 @@ import { ref, onMounted, reactive, watchEffect } from 'vue'
|
|||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AppSelect',
|
name: 'AppSelectBox',
|
||||||
props: {
|
props: {
|
||||||
name: String,
|
name: String,
|
||||||
type: String,
|
type: String,
|
||||||
@@ -113,7 +113,7 @@ import { finished } from 'stream';
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent,ref,reactive, computed } from 'vue';
|
import { defineComponent,ref,reactive, computed, inject } from 'vue';
|
||||||
import { INode,ConditionTree,GroupNode,ConditionNode, LogicalOperator,Operator,NodeType } from '../../types/Conditions';
|
import { INode,ConditionTree,GroupNode,ConditionNode, LogicalOperator,Operator,NodeType } from '../../types/Conditions';
|
||||||
import ConditionObject from './ConditionObject.vue';
|
import ConditionObject from './ConditionObject.vue';
|
||||||
export default defineComponent( {
|
export default defineComponent( {
|
||||||
@@ -143,12 +143,9 @@ export default defineComponent( {
|
|||||||
return opts;
|
return opts;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const operator = inject('Operator')
|
||||||
const operators =computed(()=>{
|
const operators =computed(()=>{
|
||||||
const opts=[];
|
return operator ? operator : Object.values(Operator);
|
||||||
for(const op in Operator){
|
|
||||||
opts.push(Operator[op as keyof typeof Operator]);
|
|
||||||
}
|
|
||||||
return opts;
|
|
||||||
});
|
});
|
||||||
const tree = reactive(props.conditionTree);
|
const tree = reactive(props.conditionTree);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
</template>
|
</template>
|
||||||
<AppSelect ref="appDg" name="アプリ" type="single" :filter="filter"></AppSelect>
|
<AppSelectBox ref="appDg" name="アプリ" type="single" :filter="filter"></AppSelectBox>
|
||||||
</ShowDialog>
|
</ShowDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
import { defineComponent,ref } from 'vue';
|
import { defineComponent,ref } from 'vue';
|
||||||
import {AppInfo} from '../../types/ActionTypes'
|
import {AppInfo} from '../../types/ActionTypes'
|
||||||
import ShowDialog from '../../components/ShowDialog.vue';
|
import ShowDialog from '../../components/ShowDialog.vue';
|
||||||
import AppSelect from '../../components/AppSelect.vue';
|
import AppSelectBox from '../../components/AppSelectBox.vue';
|
||||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||||
import { useAuthStore } from 'src/stores/useAuthStore';
|
import { useAuthStore } from 'src/stores/useAuthStore';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -47,7 +47,7 @@ export default defineComponent({
|
|||||||
"appSelected"
|
"appSelected"
|
||||||
],
|
],
|
||||||
components:{
|
components:{
|
||||||
AppSelect,
|
AppSelectBox,
|
||||||
ShowDialog
|
ShowDialog
|
||||||
},
|
},
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
|
|||||||
@@ -1,48 +1,55 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <div class="q-pa-md q-gutter-sm"> -->
|
<!-- <div class="q-pa-md q-gutter-sm"> -->
|
||||||
<q-tree
|
<q-tree :nodes="store.eventTree.screens" node-key="eventId" children-key="events" no-connectors
|
||||||
:nodes="store.eventTree.screens"
|
v-model:expanded="store.expandedScreen" :dense="true" :ref="tree">
|
||||||
node-key="eventId"
|
<template v-slot:header-EVENT="prop">
|
||||||
children-key="events"
|
<div :ref="prop.node.eventId" class="row col items-center no-wrap event-node">
|
||||||
no-connectors
|
<q-icon v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px"
|
||||||
v-model:expanded="store.expandedScreen"
|
class="q-mr-sm">
|
||||||
:dense="true"
|
</q-icon>
|
||||||
:ref="tree"
|
<div class="no-wrap" @click="onSelected(prop.node)"
|
||||||
>
|
:class="selectedEvent && prop.node.eventId === selectedEvent.eventId ? 'selected-node' : ''">{{
|
||||||
<template v-slot:header-EVENT="prop">
|
prop.node.label }}</div>
|
||||||
<div class="row col items-start no-wrap event-node" @click="onSelected(prop.node)">
|
<q-space></q-space>
|
||||||
<q-icon v-if="prop.node.eventId"
|
<!-- <q-icon v-if="prop.node.hasFlow" name="delete" color="negative" size="16px" class="q-mr-sm"></q-icon> -->
|
||||||
name="play_circle"
|
</div>
|
||||||
:color="prop.node.hasFlow?'green':'grey'"
|
</template>
|
||||||
size="16px" class="q-mr-sm">
|
<template v-slot:header-CHANGE="prop">
|
||||||
</q-icon>
|
<div class="row col items-center no-wrap event-node">
|
||||||
<div class="no-wrap" :class="selectedEvent && prop.node.eventId===selectedEvent.eventId?'selected-node':''">{{ prop.node.label }}</div>
|
<div class="no-wrap">{{ prop.node.label }}</div>
|
||||||
<q-space></q-space>
|
<q-space></q-space>
|
||||||
<!-- <q-icon v-if="prop.node.hasFlow" name="delete" color="negative" size="16px" class="q-mr-sm"></q-icon> -->
|
<q-icon name="add_circle" color="primary" size="16px" class="q-mr-sm"
|
||||||
|
@click="addChangeEvent(prop.node)"></q-icon>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:header-DELETABLE="prop">
|
||||||
|
<div class="row col items-center event-node">
|
||||||
|
<div class="row col items-center" @click="onSelected(prop.node)">
|
||||||
|
<q-icon v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px"
|
||||||
|
class="q-mr-sm">
|
||||||
|
</q-icon>
|
||||||
|
<div>{{ prop.node.label }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div>
|
||||||
<template v-slot:header-CHANGE="prop" >
|
<q-btn class="q-mr-sm delete-btn" flat fab-mini icon="delete_forever" padding="none" color="negative"
|
||||||
<div class="row col items-start no-wrap event-node" >
|
@click="deleteEvent(prop.node)"></q-btn>
|
||||||
<div class="no-wrap">{{ prop.node.label }}</div>
|
|
||||||
<q-space></q-space>
|
|
||||||
<q-icon name="add_circle" color="primary" size="16px" class="q-mr-sm" @click="addChangeEvent(prop.node)"></q-icon>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</div>
|
||||||
</q-tree>
|
</template>
|
||||||
<show-dialog v-model:visible="showDialog" name="フィールド選択" @close="closeDg" widht="400px">
|
</q-tree>
|
||||||
<field-select ref="appDg" name="フィールド" type="single" :appId="store.appInfo?.appId"></field-select>
|
<show-dialog v-model:visible="showDialog" name="フィールド選択" @close="closeDg">
|
||||||
</show-dialog>
|
<field-select ref="appDg" name="フィールド" type="single" :appId="store.appInfo?.appId"></field-select>
|
||||||
|
</show-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, computed, ref } from 'vue';
|
import { QTree, useQuasar } from 'quasar';
|
||||||
import { IKintoneEvent ,IKintoneEventGroup, IKintoneEventNode, kintoneEvent} from '../../types/KintoneEvents';
|
import { ActionFlow, RootAction } from 'src/types/ActionTypes';
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||||
import { ActionFlow, ActionNode, RootAction } from 'src/types/ActionTypes';
|
import { defineComponent, ref } from 'vue';
|
||||||
import ShowDialog from '../ShowDialog.vue';
|
import { IKintoneEvent, IKintoneEventGroup, IKintoneEventNode } from '../../types/KintoneEvents';
|
||||||
import FieldSelect from '../FieldSelect.vue';
|
import FieldSelect from '../FieldSelect.vue';
|
||||||
import { QTree } from 'quasar';
|
import ShowDialog from '../ShowDialog.vue';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'EventTree',
|
name: 'EventTree',
|
||||||
components: {
|
components: {
|
||||||
@@ -50,6 +57,7 @@ export default defineComponent({
|
|||||||
FieldSelect,
|
FieldSelect,
|
||||||
},
|
},
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
|
const $q = useQuasar();
|
||||||
const appDg = ref();
|
const appDg = ref();
|
||||||
const store = useFlowEditorStore();
|
const store = useFlowEditorStore();
|
||||||
const showDialog = ref(false);
|
const showDialog = ref(false);
|
||||||
@@ -58,62 +66,79 @@ export default defineComponent({
|
|||||||
// const selectedFlow = store.currentFlow;
|
// const selectedFlow = store.currentFlow;
|
||||||
|
|
||||||
// const expanded=ref();
|
// const expanded=ref();
|
||||||
const selectedEvent = ref<IKintoneEvent|null>(null);
|
const selectedEvent = ref<IKintoneEvent | null>(null);
|
||||||
const selectedChangeEvent=ref<IKintoneEventGroup|null>(null);
|
const selectedChangeEvent = ref<IKintoneEventGroup | null>(null);
|
||||||
const isFieldChange = (node:IKintoneEventNode)=>{
|
const isFieldChange = (node: IKintoneEventNode) => {
|
||||||
return node.header=='EVENT' && node.eventId.indexOf(".change.")>-1;
|
return node.header == 'EVENT' && node.eventId.indexOf(".change.") > -1;
|
||||||
}
|
}
|
||||||
//フィールド値変更イベント追加
|
//フィールド値変更イベント追加
|
||||||
const closeDg = (val:string) => {
|
const closeDg = (val: string) => {
|
||||||
if (val == 'OK') {
|
if (val == 'OK') {
|
||||||
if(!selectedChangeEvent.value){return;}
|
if (!selectedChangeEvent.value) { return; }
|
||||||
const field = appDg.value.selected[0];
|
const field = appDg.value.selected[0];
|
||||||
const eventid = `${selectedChangeEvent.value.eventId}.${field.code}`;
|
const eventid = `${selectedChangeEvent.value.eventId}.${field.code}`;
|
||||||
if(store.eventTree.findEventById(eventid)){
|
if (store.eventTree.findEventById(eventid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedChangeEvent.value?.events.push(
|
selectedChangeEvent.value?.events.push({
|
||||||
new kintoneEvent(
|
eventId: eventid,
|
||||||
field.label,
|
label: field.name,
|
||||||
eventid,
|
parentId: selectedChangeEvent.value.eventId,
|
||||||
selectedChangeEvent.value.eventId)
|
header: 'DELETABLE'
|
||||||
);
|
});
|
||||||
tree.value?.expanded?.push(selectedChangeEvent.value.eventId);
|
tree.value?.expanded?.push(selectedChangeEvent.value.eventId);
|
||||||
tree.value?.expandAll();
|
tree.value?.expandAll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const addChangeEvent=(node:IKintoneEventGroup)=>{
|
const addChangeEvent = (node: IKintoneEventGroup) => {
|
||||||
if(store.appInfo===undefined){
|
if (store.appInfo === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedChangeEvent.value=node;
|
selectedChangeEvent.value = node;
|
||||||
showDialog.value=true;
|
showDialog.value = true;
|
||||||
}
|
}
|
||||||
const onSelected=(node:IKintoneEvent)=>{
|
|
||||||
if(!node.eventId){
|
const deleteEvent = (node: IKintoneEvent) => {
|
||||||
return;
|
if (!node.eventId) {
|
||||||
}
|
return;
|
||||||
selectedEvent.value=node;
|
}
|
||||||
if(store.appInfo===undefined){
|
store.deleteEvent(node);
|
||||||
return;
|
store.selectFlow(undefined)
|
||||||
}
|
|
||||||
const screen = store.eventTree.findEventById(node.parentId);
|
$q.notify({
|
||||||
let flow =store.findFlowByEventId(node.eventId);
|
type: 'positive',
|
||||||
let screenName=screen!==null?screen.label:"";
|
caption: "通知",
|
||||||
let nodeLabel = node.label;
|
message: `イベント ${node.label} 削除`
|
||||||
// if(isFieldChange(node)){
|
})
|
||||||
// screenName=nodeLabel;
|
}
|
||||||
// nodeLabel=`${node.label}の値を変更したとき`;
|
|
||||||
// }
|
const onSelected = (node: IKintoneEvent) => {
|
||||||
if(flow!==undefined && flow!==null ){
|
if (!node.eventId) {
|
||||||
store.selectFlow(flow);
|
return;
|
||||||
}else{
|
}
|
||||||
const root = new RootAction(node.eventId,screenName,nodeLabel)
|
selectedEvent.value = node;
|
||||||
const flow =new ActionFlow(root);
|
if (store.appInfo === undefined) {
|
||||||
store.flows?.push(flow);
|
return;
|
||||||
store.selectFlow(flow);
|
}
|
||||||
selectedEvent.value.flowData=flow;
|
const screen = store.eventTree.findEventById(node.parentId);
|
||||||
}
|
|
||||||
|
let flow = store.findFlowByEventId(node.eventId);
|
||||||
|
let screenName = screen !== null ? screen.label : "";
|
||||||
|
let nodeLabel = node.label;
|
||||||
|
// if(isFieldChange(node)){
|
||||||
|
// screenName=nodeLabel;
|
||||||
|
// nodeLabel=`${node.label}の値を変更したとき`;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (flow !== undefined && flow !== null) {
|
||||||
|
store.selectFlow(flow);
|
||||||
|
} else {
|
||||||
|
const root = new RootAction(node.eventId, screenName, nodeLabel)
|
||||||
|
const flow = new ActionFlow(root);
|
||||||
|
store.flows?.push(flow);
|
||||||
|
store.selectFlow(flow);
|
||||||
|
selectedEvent.value.flowData = flow;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
// eventTree,
|
// eventTree,
|
||||||
@@ -125,6 +150,7 @@ export default defineComponent({
|
|||||||
onSelected,
|
onSelected,
|
||||||
selectedEvent,
|
selectedEvent,
|
||||||
addChangeEvent,
|
addChangeEvent,
|
||||||
|
deleteEvent,
|
||||||
closeDg,
|
closeDg,
|
||||||
store
|
store
|
||||||
}
|
}
|
||||||
@@ -132,20 +158,25 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.nowrap{
|
.nowrap {
|
||||||
flex-wrap:nowarp;
|
flex-wrap: nowarp;
|
||||||
text-wrap:nowarp;
|
text-wrap: nowarp;
|
||||||
}
|
}
|
||||||
.event-node{
|
|
||||||
cursor:pointer;
|
.event-node {
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.selected-node{
|
|
||||||
|
.selected-node {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
.event-node:hover{
|
|
||||||
|
.event-node:hover {
|
||||||
background-color: $light-blue-1;
|
background-color: $light-blue-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -18,121 +18,68 @@
|
|||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section class="q-pa-none q-ma-none">
|
<q-card-section class="q-pa-none q-ma-none">
|
||||||
<div style="">
|
<div style="">
|
||||||
<div v-if="selectedField.fields && selectedField.fields.length > 0 ">
|
<div v-if="selectedField.fields && selectedField.fields.length > 0">
|
||||||
<q-list bordered>
|
<q-list bordered>
|
||||||
<q-virtual-scroll style="max-height: 160px;" :items="selectedField.fields" separator v-slot="{ item, index }">
|
<q-virtual-scroll style="max-height: 160px;" :items="selectedField.fields" separator
|
||||||
<q-item :key="index" dense clickable >
|
v-slot="{ item, index }">
|
||||||
<q-item-section>
|
<q-item :key="index" dense clickable>
|
||||||
|
<q-item-section>
|
||||||
<q-item-label>
|
<q-item-label>
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section side>
|
<q-item-section side>
|
||||||
<q-btn round flat size="sm" icon="clear" @click="removeField(index)" />
|
<q-btn round flat size="sm" icon="clear" @click="removeField(index)" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-virtual-scroll>
|
</q-virtual-scroll>
|
||||||
</q-list>
|
</q-list>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div v-else class="row q-mt-lg">
|
<!-- <div v-else class="row q-mt-lg">
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- <q-separator /> -->
|
<!-- <q-separator /> -->
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section class="q-px-none q-py-xs" v-if="selectedField.fields && selectedField.fields.length===0">
|
<q-card-section class="q-px-none q-py-xs" v-if="selectedField.fields && selectedField.fields.length === 0">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="text-grey text-caption"> {{ $props.placeholder }}</div>
|
<div class="text-grey text-caption"> {{ $props.placeholder }}</div>
|
||||||
<!-- <q-btn flat color="grey" label="clear" @click="clear" /> -->
|
<!-- <q-btn flat color="grey" label="clear" @click="clear" /> -->
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<show-dialog v-model:visible="show" name="フィールド一覧" @close="closeFieldDialog" ref="fieldDlg">
|
<show-dialog v-model:visible="show" name="フィールド一覧" @close="closeFieldDialog" ref="fieldDlg">
|
||||||
|
<AppFieldSelectBox v-model:selectedField="selectedField" :selectType="selectType" />
|
||||||
<div class="q-mx-md q-mb-lg">
|
|
||||||
<div class="q-mb-xs q-ml-md text-primary">アプリ選択</div>
|
|
||||||
|
|
||||||
<div class="q-pa-md row" style="border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 4px;">
|
|
||||||
<div v-if="!showSelectApp && selectedField.app">{{ selectedField.app?.name }}</div>
|
|
||||||
<q-space />
|
|
||||||
<div>
|
|
||||||
<q-btn outline dense label="選 択" padding="none sm" color="primary" @click="() => {
|
|
||||||
showSelectApp = true;
|
|
||||||
}"></q-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="!showSelectApp && selectedField.app?.name">
|
|
||||||
<div>
|
|
||||||
<div class="row q-mb-md">
|
|
||||||
<!-- <div class="col"> -->
|
|
||||||
<div class="q-mb-xs q-ml-md text-primary">フィールド選択</div>
|
|
||||||
<!-- </div> -->
|
|
||||||
<q-space />
|
|
||||||
<!-- <div class="col"> -->
|
|
||||||
<div class="q-mr-md">
|
|
||||||
<q-input dense debounce="300" v-model="fieldFilter" placeholder="フィールド検索" clearable>
|
|
||||||
<template v-slot:before>
|
|
||||||
<q-icon name="search" />
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<field-select ref="fieldDlg" name="フィールド" :type="selectType" :updateSelects="updateItems"
|
|
||||||
:appId="selectedField.app?.id" not_page :filter="fieldFilter" :selectedFields="selectedField.fields"></field-select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="min-width: 45vw;" v-else>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</show-dialog>
|
|
||||||
|
|
||||||
<show-dialog v-model:visible="showSelectApp" name="アプリ選択" @close="closeAppDlg">
|
|
||||||
<template v-slot:toolbar>
|
|
||||||
<q-input dense debounce="300" v-model="filter" placeholder="検索" clearable>
|
|
||||||
<template v-slot:before>
|
|
||||||
<q-icon name="search" />
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<AppSelect ref="appDlg" name="アプリ" type="single" :filter="filter"
|
|
||||||
:updateExternalSelectAppInfo="updateExternalSelectAppInfo"></AppSelect>
|
|
||||||
</show-dialog>
|
</show-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref, watchEffect, computed } from 'vue';
|
import { defineComponent, ref, watchEffect } from 'vue';
|
||||||
|
import AppFieldSelectBox from '../AppFieldSelectBox.vue';
|
||||||
import ShowDialog from '../ShowDialog.vue';
|
import ShowDialog from '../ShowDialog.vue';
|
||||||
import FieldSelect from '../FieldSelect.vue';
|
|
||||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||||
import AppSelect from '../AppSelect.vue';
|
|
||||||
interface IApp{
|
export interface IApp {
|
||||||
id:string,
|
id: string,
|
||||||
name:string
|
name: string
|
||||||
}
|
}
|
||||||
interface IField {
|
export interface IField {
|
||||||
name: string,
|
name: string,
|
||||||
code: string,
|
code: string,
|
||||||
type: string
|
type: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAppFields{
|
export interface IAppFields {
|
||||||
app?:IApp,
|
app?: IApp,
|
||||||
fields:IField[]
|
fields: IField[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
inheritAttrs:false,
|
inheritAttrs: false,
|
||||||
name: 'AppFieldSelect',
|
name: 'AppFieldSelect',
|
||||||
components: {
|
components: {
|
||||||
ShowDialog,
|
ShowDialog,
|
||||||
FieldSelect,
|
AppFieldSelectBox
|
||||||
AppSelect,
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
displayName: {
|
displayName: {
|
||||||
@@ -151,62 +98,30 @@ export default defineComponent({
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
selectType:{
|
selectType: {
|
||||||
type:String,
|
type: String,
|
||||||
default:'single'
|
default: 'single'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const appDlg = ref();
|
|
||||||
const fieldDlg = ref();
|
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const showSelectApp = ref(false);
|
const selectedField = ref<IAppFields>({
|
||||||
const selectedField = ref<IAppFields>({
|
app: undefined,
|
||||||
app:undefined,
|
fields: []
|
||||||
fields:[]
|
});
|
||||||
});
|
if (props.modelValue && "app" in props.modelValue && "fields" in props.modelValue) {
|
||||||
if(props.modelValue && "app" in props.modelValue && "fields" in props.modelValue){
|
selectedField.value = props.modelValue as IAppFields;
|
||||||
selectedField.value=props.modelValue as IAppFields;
|
}
|
||||||
}
|
|
||||||
const store = useFlowEditorStore();
|
const store = useFlowEditorStore();
|
||||||
|
|
||||||
const isSelected = computed(() => {
|
|
||||||
return selectedField.value !== null && typeof selectedField.value === 'object' && ('app' in selectedField.value)
|
|
||||||
});
|
|
||||||
|
|
||||||
const showDg = () => {
|
|
||||||
show.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const clear = () => {
|
const clear = () => {
|
||||||
selectedField.value ={
|
selectedField.value = {
|
||||||
fields:[]
|
fields: []
|
||||||
} ;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const closeAppDlg = (val: string) => {
|
const removeField = (index: number) => {
|
||||||
if (val == 'OK') {
|
selectedField.value.fields.splice(index, 1);
|
||||||
selectedField.value.app = appDlg.value.selected[0];
|
|
||||||
selectedField.value.fields=[];
|
|
||||||
showSelectApp.value=false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeFieldDialog=(val:string)=>{
|
|
||||||
if (val == 'OK') {
|
|
||||||
selectedField.value.fields = fieldDlg.value.selected;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const updateExternalSelectAppInfo = (newAppinfo:IApp) => {
|
|
||||||
// selectedField.value.app = newAppinfo
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateItems = (newFields:IField[]) => {
|
|
||||||
// selectedField.value.fields = newFields
|
|
||||||
}
|
|
||||||
|
|
||||||
const removeField=(index:number)=>{
|
|
||||||
selectedField.value.fields.splice(index,1);
|
|
||||||
}
|
}
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
emit('update:modelValue', selectedField.value);
|
emit('update:modelValue', selectedField.value);
|
||||||
@@ -214,21 +129,11 @@ export default defineComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
store,
|
store,
|
||||||
appDlg,
|
|
||||||
fieldDlg,
|
|
||||||
show,
|
show,
|
||||||
showDg,
|
showDg: () => { show.value = true },
|
||||||
closeAppDlg,
|
|
||||||
closeFieldDialog,
|
|
||||||
selectedField,
|
selectedField,
|
||||||
showSelectApp,
|
|
||||||
isSelected,
|
|
||||||
updateExternalSelectAppInfo,
|
|
||||||
filter: ref(),
|
|
||||||
updateItems,
|
|
||||||
clear,
|
clear,
|
||||||
fieldFilter: ref(),
|
removeField,
|
||||||
removeField
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
93
frontend/src/components/right/AppSelect.vue
Normal file
93
frontend/src/components/right/AppSelect.vue
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<q-field :label="displayName" labelColor="primary" stack-label>
|
||||||
|
<template v-slot:control>
|
||||||
|
<q-card flat class="full-width">
|
||||||
|
<q-card-actions vertical>
|
||||||
|
<q-btn color="grey-3" text-color="black" @click="() => { dgIsShow = true }">アプリ選択</q-btn>
|
||||||
|
</q-card-actions>
|
||||||
|
<q-card-section class="text-caption">
|
||||||
|
<div v-if="selectedField.app.name">
|
||||||
|
{{ selectedField.app.name }}
|
||||||
|
</div>
|
||||||
|
<div v-else>{{ placeholder }}</div>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</template>
|
||||||
|
</q-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ShowDialog v-model:visible="dgIsShow" name="アプリ選択" @close="closeDg" min-width="50vw" min-height="50vh">
|
||||||
|
<template v-slot:toolbar>
|
||||||
|
<q-input dense debounce="300" v-model="filter" placeholder="検索" clearable>
|
||||||
|
<template v-slot:before>
|
||||||
|
<q-icon name="search" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
<AppSelectBox ref="appDg" name="アプリ" type="single" :filter="filter"></AppSelectBox>
|
||||||
|
</ShowDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { computed, defineComponent, reactive, ref, watchEffect } from 'vue';
|
||||||
|
import ShowDialog from '../ShowDialog.vue';
|
||||||
|
import AppSelectBox from '../AppSelectBox.vue';
|
||||||
|
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
inheritAttrs: false,
|
||||||
|
name: 'AppSelect',
|
||||||
|
components: {
|
||||||
|
ShowDialog,
|
||||||
|
AppSelectBox
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
context: {
|
||||||
|
type: Array<Props>,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
displayName: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
modelValue: {
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const appDg = ref()
|
||||||
|
const dgIsShow = ref(false)
|
||||||
|
const selectedField = props.modelValue && props.modelValue.app ? props.modelValue : reactive({app:{}});
|
||||||
|
const closeDg = (state: string) => {
|
||||||
|
dgIsShow.value = false;
|
||||||
|
if (state == 'OK') {
|
||||||
|
selectedField.app = appDg.value.selected[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(selectedField);
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
emit('update:modelValue', selectedField);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
filter: ref(''),
|
||||||
|
dgIsShow,
|
||||||
|
appDg,
|
||||||
|
closeDg,
|
||||||
|
selectedField
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
<template v-slot:control>
|
<template v-slot:control>
|
||||||
<q-card flat class="full-width">
|
<q-card flat class="full-width">
|
||||||
<q-card-actions vertical>
|
<q-card-actions vertical>
|
||||||
<q-btn color="grey-3" text-color="black" @click="showDg()">クリックで設定:{{ isSetted ? '設定済み' : '未設定' }}</q-btn>
|
<q-btn color="grey-3" text-color="black" :disable="btnDisable" @click="showDg()">クリックで設定:{{ isSetted ?
|
||||||
|
'設定済み' : '未設定' }}</q-btn>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
<q-card-section class="text-caption">
|
<q-card-section class="text-caption">
|
||||||
<div v-if="!isSetted">{{ placeholder }}</div>
|
<div v-if="!isSetted">{{ placeholder }}</div>
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ConditionNode, ConditionTree, Operator } from 'app/src/types/Conditions';
|
import { ConditionNode, ConditionTree, Operator, OperatorListItem } from 'app/src/types/Conditions';
|
||||||
import { computed, defineComponent, provide, reactive, ref, watchEffect } from 'vue';
|
import { computed, defineComponent, provide, reactive, ref, watchEffect } from 'vue';
|
||||||
import ConditionEditor from '../ConditionEditor/ConditionEditor.vue';
|
import ConditionEditor from '../ConditionEditor/ConditionEditor.vue';
|
||||||
|
|
||||||
@@ -28,6 +29,10 @@ type Props = {
|
|||||||
props?: {
|
props?: {
|
||||||
name: string;
|
name: string;
|
||||||
modelValue?: {
|
modelValue?: {
|
||||||
|
app: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
},
|
||||||
fields: {
|
fields: {
|
||||||
type: string;
|
type: string;
|
||||||
label: string;
|
label: string;
|
||||||
@@ -72,28 +77,51 @@ export default defineComponent({
|
|||||||
sourceType: {
|
sourceType: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'field'
|
default: 'field'
|
||||||
|
},
|
||||||
|
onlySourceSelect: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
operatorList: {
|
||||||
|
type: Array,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const source = props.context.find(element => element?.props?.name === 'sources')
|
const source = props.context.find(element => element?.props?.name === 'sources')
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
if(props.sourceType === 'field'){
|
if (props.sourceType === 'field') {
|
||||||
provide('sourceFields', computed( () => source.props?.modelValue?.fields ?? []));
|
provide('sourceFields', computed(() => source.props?.modelValue?.fields ?? []));
|
||||||
} else if(props.sourceType === 'app'){
|
} else if (props.sourceType === 'app') {
|
||||||
console.log('sourceApp', source.props?.modelValue);
|
provide('sourceApp', computed(() => source.props?.modelValue?.app?.id));
|
||||||
provide('sourceApp', computed( () => source.props?.modelValue?.app?.id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provide('Operator', props.operatorList);
|
||||||
|
|
||||||
|
const btnDisable = computed(() => {
|
||||||
|
const onlySourceSelect = props.onlySourceSelect;
|
||||||
|
|
||||||
|
if (!onlySourceSelect) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.sourceType === 'field') {
|
||||||
|
return source?.props?.modelValue?.fields?.length ?? 0 > 0;
|
||||||
|
} else if (props.sourceType === 'app') {
|
||||||
|
return source?.props?.modelValue?.app?.id ? false : true
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
|
||||||
const appDg = ref();
|
const appDg = ref();
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const tree = reactive(new ConditionTree());
|
const tree = reactive(new ConditionTree());
|
||||||
if (props.modelValue && props.modelValue !== '') {
|
if (props.modelValue && props.modelValue !== '') {
|
||||||
tree.fromJson(props.modelValue);
|
tree.fromJson(props.modelValue);
|
||||||
} else {
|
} else {
|
||||||
const newNode = new ConditionNode({}, Operator.Equal, '', tree.root);
|
const newNode = new ConditionNode({}, (props.operatorList && props.operatorList.length > 0) ? props.operatorList[0] as OperatorListItem : Operator.Equal, '', tree.root);
|
||||||
tree.addNode(tree.root, newNode);
|
tree.addNode(tree.root, newNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,13 +137,15 @@ export default defineComponent({
|
|||||||
|
|
||||||
const onClosed = (val: string) => {
|
const onClosed = (val: string) => {
|
||||||
if (val == 'OK') {
|
if (val == 'OK') {
|
||||||
const conditionJson = tree.toJson();
|
|
||||||
isSetted.value = true;
|
isSetted.value = true;
|
||||||
|
tree.setQuery(tree.buildConditionQueryString(tree.root));
|
||||||
|
const conditionJson = tree.toJson();
|
||||||
emit('update:modelValue', conditionJson);
|
emit('update:modelValue', conditionJson);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
|
tree.setQuery(tree.buildConditionQueryString(tree.root));
|
||||||
const conditionJson = tree.toJson();
|
const conditionJson = tree.toJson();
|
||||||
emit('update:modelValue', conditionJson);
|
emit('update:modelValue', conditionJson);
|
||||||
});
|
});
|
||||||
@@ -127,7 +157,8 @@ export default defineComponent({
|
|||||||
showDg,
|
showDg,
|
||||||
onClosed,
|
onClosed,
|
||||||
tree,
|
tree,
|
||||||
conditionString
|
conditionString,
|
||||||
|
btnDisable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
202
frontend/src/components/right/DataMapping.vue
Normal file
202
frontend/src/components/right/DataMapping.vue
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<q-field :label="displayName" labelColor="primary" stack-label>
|
||||||
|
<template v-slot:control>
|
||||||
|
<q-card flat class="full-width">
|
||||||
|
<q-card-actions vertical>
|
||||||
|
<q-btn color="grey-3" text-color="black" :disable="btnDisable"
|
||||||
|
@click="() => { dgIsShow = true }">クリックで設定</q-btn>
|
||||||
|
</q-card-actions>
|
||||||
|
<q-card-section class="text-caption">
|
||||||
|
<div v-if="mappingObjectsInputDisplay && mappingObjectsInputDisplay.length > 0">
|
||||||
|
<div v-for="(item) in mappingObjectsInputDisplay" :key="item">{{ item }}</div>
|
||||||
|
</div>
|
||||||
|
<div v-else>{{ placeholder }}</div>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</template>
|
||||||
|
</q-field>
|
||||||
|
<show-dialog v-model:visible="dgIsShow" name="データマッピング" @close="closeDg" min-width="50vw" min-height="60vh">
|
||||||
|
|
||||||
|
<div class="q-mx-md">
|
||||||
|
<div class="row q-col-gutter-x-xs flex-center">
|
||||||
|
<div class="col-5">
|
||||||
|
<div class="q-mx-xs">From</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-1">
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<div class="q-mx-xs">To</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-1"><q-btn flat round dense icon="add" size="sm" @click="addMappingObject" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="q-my-sm" v-for="(item, index) in mappingProps" :key="item.id">
|
||||||
|
<div class="row q-col-gutter-x-xs flex-center">
|
||||||
|
<div class="col-5">
|
||||||
|
<ConditionObject v-model="item.from" />
|
||||||
|
</div>
|
||||||
|
<div class="col-1">
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<q-field v-model="item.vName" type="text" outlined dense>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-icon name="search" class="cursor-pointer"
|
||||||
|
@click="() => { mappingProps[index].to.isDialogVisible = true }" />
|
||||||
|
</template>
|
||||||
|
<template v-slot:control>
|
||||||
|
<div class="self-center full-width no-outline" tabindex="0"
|
||||||
|
v-if="item.to.app?.name && item.to.fields?.length > 0 && item.to.fields[0].label">
|
||||||
|
{{ `${item.to.app?.name} : ${item.to.fields[0].label}` }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-field>
|
||||||
|
</div>
|
||||||
|
<div class="col-1">
|
||||||
|
<q-btn flat round dense icon="delete" size="sm" @click="() => deleteMappingObject(index)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<show-dialog v-model:visible="mappingProps[index].to.isDialogVisible" name="フィールド一覧"
|
||||||
|
@close="closeToDg" ref="fieldDlg">
|
||||||
|
<FieldSelect v-if="onlySourceSelect" ref="fieldDlg" name="フィールド" :appId="sourceAppId" not_page
|
||||||
|
:selectedFields="mappingProps[index].to.fields"
|
||||||
|
:updateSelects="(fields) => { mappingProps[index].to.fields = fields; mappingProps[index].to.app = sourceApp }">
|
||||||
|
</FieldSelect>
|
||||||
|
<AppFieldSelectBox v-else v-model:selectedField="mappingProps[index].to" />
|
||||||
|
</show-dialog>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</show-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import { computed, defineComponent, reactive, ref, watchEffect } from 'vue';
|
||||||
|
import ConditionObject from '../ConditionEditor/ConditionObject.vue';
|
||||||
|
import ShowDialog from '../ShowDialog.vue';
|
||||||
|
import AppFieldSelectBox from '../AppFieldSelectBox.vue';
|
||||||
|
import FieldSelect from '../FieldSelect.vue';
|
||||||
|
import IAppFields from './AppFieldSelect.vue';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
props?: {
|
||||||
|
name: string;
|
||||||
|
modelValue?: {
|
||||||
|
app: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
type ValueType = {
|
||||||
|
id: string;
|
||||||
|
from: object;
|
||||||
|
to: typeof IAppFields & {
|
||||||
|
isDialogVisible: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultMappingProp = () => ({ id: uuidv4(), to: { app: {}, fields: [], isDialogVisible: false } });
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'DataMapping',
|
||||||
|
inheritAttrs: false,
|
||||||
|
components: {
|
||||||
|
ShowDialog,
|
||||||
|
ConditionObject,
|
||||||
|
AppFieldSelectBox,
|
||||||
|
FieldSelect
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
context: {
|
||||||
|
type: Array<Props>,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
displayName: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
modelValue: {
|
||||||
|
type: Object as () => ValueType[],
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
onlySourceSelect: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const closeDg = () => {
|
||||||
|
emit('update:modelValue', mappingProps
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeToDg = () => {
|
||||||
|
emit('update:modelValue', mappingProps
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mappingProps: ValueType[] = props.modelValue
|
||||||
|
? props.modelValue
|
||||||
|
: reactive([defaultMappingProp()]);
|
||||||
|
|
||||||
|
|
||||||
|
const deleteMappingObject = (index: number) => mappingProps.length === 1
|
||||||
|
? mappingProps.splice(0, mappingProps.length, defaultMappingProp())
|
||||||
|
: mappingProps.splice(index, 1);
|
||||||
|
|
||||||
|
const mappingObjectsInputDisplay = computed(() =>
|
||||||
|
mappingProps ?
|
||||||
|
mappingProps
|
||||||
|
.filter(item => item.from?.name && item.to.fields?.length > 0)
|
||||||
|
.map(item => {
|
||||||
|
const name = typeof item.from?.name === 'string'
|
||||||
|
? item.from.name
|
||||||
|
: item.from?.name.name;
|
||||||
|
return `[${name}] - (${item.to.app?.name} : ${item.to.fields[0].label})`;
|
||||||
|
})
|
||||||
|
: []
|
||||||
|
);
|
||||||
|
|
||||||
|
const source = props.context.find(element => element?.props?.name === 'sources')
|
||||||
|
|
||||||
|
const sourceApp = computed(() => source?.props?.modelValue?.app);
|
||||||
|
|
||||||
|
const sourceAppId = computed(() => sourceApp.value?.id);
|
||||||
|
|
||||||
|
const btnDisable = computed(() => props.onlySourceSelect ? !(source?.props?.modelValue?.app?.id) : false);
|
||||||
|
|
||||||
|
//集計処理方法
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
emit('update:modelValue', mappingProps);
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
uuidv4,
|
||||||
|
dgIsShow: ref(false),
|
||||||
|
closeDg,
|
||||||
|
toDgIsShow: ref(false),
|
||||||
|
closeToDg,
|
||||||
|
mappingProps,
|
||||||
|
addMappingObject: () => mappingProps.push(defaultMappingProp()),
|
||||||
|
deleteMappingObject,
|
||||||
|
mappingObjectsInputDisplay,
|
||||||
|
sourceApp,
|
||||||
|
sourceAppId,
|
||||||
|
btnDisable
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss"></style>
|
||||||
@@ -22,6 +22,8 @@ import EventSetter from '../right/EventSetter.vue';
|
|||||||
import ColorPicker from './ColorPicker.vue';
|
import ColorPicker from './ColorPicker.vue';
|
||||||
import NumInput from './NumInput.vue';
|
import NumInput from './NumInput.vue';
|
||||||
import DataProcessing from './DataProcessing.vue';
|
import DataProcessing from './DataProcessing.vue';
|
||||||
|
import DataMapping from './DataMapping.vue';
|
||||||
|
import AppSelect from './AppSelect.vue';
|
||||||
import { IActionNode,IActionProperty,IProp } from 'src/types/ActionTypes';
|
import { IActionNode,IActionProperty,IProp } from 'src/types/ActionTypes';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -37,7 +39,9 @@ export default defineComponent({
|
|||||||
EventSetter,
|
EventSetter,
|
||||||
ColorPicker,
|
ColorPicker,
|
||||||
NumInput,
|
NumInput,
|
||||||
DataProcessing
|
DataProcessing,
|
||||||
|
DataMapping,
|
||||||
|
AppSelect
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
nodeProps: {
|
nodeProps: {
|
||||||
|
|||||||
@@ -1,44 +1,49 @@
|
|||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
import { ActionFlow } from 'src/types/ActionTypes';
|
import { ActionFlow } from 'src/types/ActionTypes';
|
||||||
|
|
||||||
export class FlowCtrl
|
export class FlowCtrl {
|
||||||
{
|
async getFlows(appId: string): Promise<ActionFlow[]> {
|
||||||
|
const flows: ActionFlow[] = [];
|
||||||
async getFlows(appId:string):Promise<ActionFlow[]>
|
try {
|
||||||
{
|
const result = await api.get(`api/flows/${appId}`);
|
||||||
const flows:ActionFlow[]=[];
|
//console.info(result.data);
|
||||||
try{
|
if (!result.data || !Array.isArray(result.data)) {
|
||||||
const result = await api.get(`api/flows/${appId}`);
|
return [];
|
||||||
//console.info(result.data);
|
|
||||||
if(!result.data || !Array.isArray(result.data)){
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
for(const flow of result.data){
|
|
||||||
flows.push(ActionFlow.fromJSON(flow.content));
|
|
||||||
}
|
|
||||||
return flows;
|
|
||||||
}catch(error){
|
|
||||||
console.error(error);
|
|
||||||
return flows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const flow of result.data) {
|
||||||
|
flows.push(ActionFlow.fromJSON(flow.content));
|
||||||
|
}
|
||||||
|
return flows;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
return flows;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async SaveFlow(jsonData:any):Promise<boolean>
|
async SaveFlow(jsonData: any): Promise<boolean> {
|
||||||
{
|
const result = await api.post('api/flow', jsonData);
|
||||||
const result = await api.post('api/flow',jsonData);
|
console.info(result.data);
|
||||||
console.info(result.data)
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* フローを更新する
|
* フローを更新する
|
||||||
* @param jsonData
|
* @param jsonData
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async UpdateFlow(jsonData:any):Promise<boolean>
|
async UpdateFlow(jsonData: any): Promise<boolean> {
|
||||||
{
|
const result = await api.put('api/flow/' + jsonData.flowid, jsonData);
|
||||||
const result = await api.put('api/flow/' + jsonData.flowid,jsonData);
|
console.info(result.data);
|
||||||
console.info(result.data)
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* フローを消去する
|
||||||
|
* @param flowId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
async DeleteFlow(flowId: string): Promise<boolean> {
|
||||||
|
const result = await api.delete('api/flow/' + flowId);
|
||||||
|
console.info(result.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -46,12 +51,9 @@ export class FlowCtrl
|
|||||||
* @param appid
|
* @param appid
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async depoly(appid:string):Promise<boolean>
|
async depoly(appid: string): Promise<boolean> {
|
||||||
{
|
|
||||||
const result = await api.post(`api/v1/createjstokintone?app=${appid}`);
|
const result = await api.post(`api/v1/createjstokintone?app=${appid}`);
|
||||||
console.info(result.data);
|
console.info(result.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<q-btn :label="model+'選択'" color="primary" @click="showDg()" />
|
<q-btn :label="model+'選択'" color="primary" @click="showDg()" />
|
||||||
<show-dialog v-model:visible="show" :name="model" @close="closeDg" width="400px">
|
<show-dialog v-model:visible="show" :name="model" @close="closeDg" width="400px">
|
||||||
<template v-if="model=='アプリ'">
|
<template v-if="model=='アプリ'">
|
||||||
<app-select ref="appDg" :name="model" type="single"></app-select>
|
<app-select-box ref="appDg" :name="model" type="single"></app-select-box>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="model=='フィールド'">
|
<template v-if="model=='フィールド'">
|
||||||
<field-select ref="appDg" :name="model" type="multiple" :appId="1"></field-select>
|
<field-select ref="appDg" :name="model" type="multiple" :appId="1"></field-select>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ShowDialog from 'components/ShowDialog.vue';
|
import ShowDialog from 'components/ShowDialog.vue';
|
||||||
import AppSelect from 'components/AppSelect.vue';
|
import AppSelectBox from 'components/AppSelectBox.vue';
|
||||||
import FieldSelect from 'components/FieldSelect.vue';
|
import FieldSelect from 'components/FieldSelect.vue';
|
||||||
import ActionSelect from 'components/ActionSelect.vue';
|
import ActionSelect from 'components/ActionSelect.vue';
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|||||||
@@ -1,118 +1,142 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { AppInfo ,IActionFlow, IActionNode} from 'src/types/ActionTypes';
|
import { AppInfo, IActionFlow, IActionNode } from 'src/types/ActionTypes';
|
||||||
import { IKintoneEvent,KintoneEventManager } from 'src/types/KintoneEvents';
|
import { IKintoneEvent, KintoneEventManager } from 'src/types/KintoneEvents';
|
||||||
import {FlowCtrl } from '../control/flowctrl';
|
import { FlowCtrl } from '../control/flowctrl';
|
||||||
|
|
||||||
export interface FlowEditorState{
|
export interface FlowEditorState {
|
||||||
flowNames1:string;
|
flowNames1: string;
|
||||||
appInfo?:AppInfo;
|
appInfo?: AppInfo;
|
||||||
flows?:IActionFlow[];
|
flows?: IActionFlow[];
|
||||||
selectedFlow?:IActionFlow|undefined;
|
selectedFlow?: IActionFlow | undefined;
|
||||||
activeNode:IActionNode|undefined;
|
activeNode: IActionNode | undefined;
|
||||||
eventTree:KintoneEventManager;
|
eventTree: KintoneEventManager;
|
||||||
selectedEvent:IKintoneEvent|undefined;
|
selectedEvent: IKintoneEvent | undefined;
|
||||||
expandedScreen:any[];
|
expandedScreen: any[];
|
||||||
}
|
}
|
||||||
const flowCtrl=new FlowCtrl();
|
const flowCtrl = new FlowCtrl();
|
||||||
const eventTree = new KintoneEventManager();
|
const eventTree = new KintoneEventManager();
|
||||||
export const useFlowEditorStore = defineStore("flowEditor",{
|
export const useFlowEditorStore = defineStore('flowEditor', {
|
||||||
state: ():FlowEditorState => ({
|
state: (): FlowEditorState => ({
|
||||||
flowNames1: '',
|
flowNames1: '',
|
||||||
appInfo:undefined,
|
appInfo: undefined,
|
||||||
flows:[],
|
flows: [],
|
||||||
selectedFlow:undefined,
|
selectedFlow: undefined,
|
||||||
activeNode:undefined,
|
activeNode: undefined,
|
||||||
eventTree:eventTree,
|
eventTree: eventTree,
|
||||||
selectedEvent:undefined,
|
selectedEvent: undefined,
|
||||||
expandedScreen:[]
|
expandedScreen: [],
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @returns 現在編集しているフロー
|
* @returns 現在編集しているフロー
|
||||||
*/
|
*/
|
||||||
currentFlow():IActionFlow|undefined{
|
currentFlow(): IActionFlow | undefined {
|
||||||
return this.selectedFlow;
|
return this.selectedFlow;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* KintoneイベントIDから、バンドしているフローを検索する
|
* KintoneイベントIDから、バンドしているフローを検索する
|
||||||
* @param state
|
* @param state
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
findFlowByEventId(state){
|
findFlowByEventId(state) {
|
||||||
return (eventId:string)=>{
|
return (eventId: string) => {
|
||||||
return state.flows?.find((flow)=>{
|
return state.flows?.find((flow) => {
|
||||||
const root=flow.getRoot();
|
const root = flow.getRoot();
|
||||||
return root?.name===eventId
|
return root?.name === eventId;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
|
findEventById(state) {
|
||||||
|
return (eventId: string) => {
|
||||||
|
return state.eventTree.findEventById(eventId);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
setFlows(flows:IActionFlow[]){
|
setFlows(flows: IActionFlow[]) {
|
||||||
this.flows=flows;
|
this.flows = flows;
|
||||||
},
|
},
|
||||||
selectFlow(flow:IActionFlow){
|
selectFlow(flow: IActionFlow | undefined) {
|
||||||
this.selectedFlow=flow;
|
this.selectedFlow = flow;
|
||||||
},
|
},
|
||||||
setActiveNode(node:IActionNode){
|
setActiveNode(node: IActionNode) {
|
||||||
this.activeNode=node;
|
this.activeNode = node;
|
||||||
},
|
},
|
||||||
setApp(app:AppInfo){
|
setApp(app: AppInfo) {
|
||||||
this.appInfo=app;
|
this.appInfo = app;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* DBからフルーを保存する
|
* DBからフルーを保存する
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async loadFlow(){
|
async loadFlow() {
|
||||||
if(this.appInfo===undefined) return;
|
if (this.appInfo === undefined) return;
|
||||||
const actionFlows = await flowCtrl.getFlows(this.appInfo?.appId);
|
const actionFlows = await flowCtrl.getFlows(this.appInfo?.appId);
|
||||||
//eventTreeにバンドする
|
//eventTreeにバンドする
|
||||||
this.eventTree.bindFlows(actionFlows);
|
this.eventTree.bindFlows(actionFlows);
|
||||||
if(actionFlows===undefined || actionFlows.length===0){
|
if (actionFlows === undefined || actionFlows.length === 0) {
|
||||||
this.flows=[];
|
this.flows = [];
|
||||||
this.selectedFlow=undefined;
|
this.selectedFlow = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setFlows(actionFlows);
|
this.setFlows(actionFlows);
|
||||||
if(actionFlows && actionFlows.length>0){
|
if (actionFlows && actionFlows.length > 0) {
|
||||||
this.selectFlow(actionFlows[0]);
|
this.selectFlow(actionFlows[0]);
|
||||||
}
|
}
|
||||||
const expandNames = actionFlows.map(flow=>flow.getRoot()?.title);
|
const expandNames = actionFlows.map((flow) => flow.getRoot()?.title);
|
||||||
// const expandName =actionFlows[0].getRoot()?.title;
|
// const expandName =actionFlows[0].getRoot()?.title;
|
||||||
this.expandedScreen=expandNames;
|
this.expandedScreen = expandNames;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* フローをDBに保存及び更新する
|
* フローをDBに保存及び更新する
|
||||||
*/
|
*/
|
||||||
async saveFlow(flow:IActionFlow){
|
async saveFlow(flow: IActionFlow) {
|
||||||
const root=flow.getRoot();
|
const root = flow.getRoot();
|
||||||
const isNew = flow.id==='';
|
const isNew = flow.id === '';
|
||||||
const jsonData={
|
const jsonData = {
|
||||||
flowid: isNew ? flow.createNewId():flow.id,
|
flowid: isNew ? flow.createNewId() : flow.id,
|
||||||
appid: this.appInfo?.appId,
|
appid: this.appInfo?.appId,
|
||||||
eventid: root?.name,
|
eventid: root?.name,
|
||||||
name: root?.subTitle,
|
name: root?.subTitle,
|
||||||
content: JSON.stringify(flow)
|
content: JSON.stringify(flow),
|
||||||
}
|
};
|
||||||
|
|
||||||
if(isNew){
|
if (isNew) {
|
||||||
return await flowCtrl.SaveFlow(jsonData);
|
return await flowCtrl.SaveFlow(jsonData);
|
||||||
}else{
|
} else {
|
||||||
return await flowCtrl.UpdateFlow(jsonData);
|
return await flowCtrl.UpdateFlow(jsonData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
deleteEvent(event: IKintoneEvent) {
|
||||||
|
const store = useFlowEditorStore();
|
||||||
|
if (event.flowData) {
|
||||||
|
const flow = event.flowData;
|
||||||
|
if (flow.id === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
flowCtrl.DeleteFlow(flow.id)
|
||||||
|
eventTree.deleteEvent(event, store);
|
||||||
|
if(this.flows){
|
||||||
|
this.flows = this.flows.filter((f) => f.id !== flow.id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eventTree.deleteEvent(event, store);
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* デプロイする
|
* デプロイする
|
||||||
*/
|
*/
|
||||||
async deploy():Promise<boolean>{
|
async deploy(): Promise<boolean> {
|
||||||
if(this.appInfo===undefined){
|
if (this.appInfo === undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return await flowCtrl.depoly(this.appInfo?.appId);
|
return await flowCtrl.depoly(this.appInfo?.appId);
|
||||||
}
|
},
|
||||||
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ export class GroupNode implements INode {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type OperatorListItem = {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
// 条件式ノード
|
// 条件式ノード
|
||||||
export class ConditionNode implements INode {
|
export class ConditionNode implements INode {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -83,13 +88,13 @@ export class ConditionNode implements INode {
|
|||||||
return this.parent.logicalOperator;
|
return this.parent.logicalOperator;
|
||||||
};
|
};
|
||||||
object: any; // 比較元
|
object: any; // 比較元
|
||||||
operator: Operator; // 比較子
|
operator: Operator | OperatorListItem; // 比較子
|
||||||
value: any;
|
value: any;
|
||||||
get header():string{
|
get header():string{
|
||||||
return 'generic';
|
return 'generic';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(object: any, operator: Operator, value: any, parent: GroupNode) {
|
constructor(object: any, operator: Operator | OperatorListItem, value: any, parent: GroupNode) {
|
||||||
this.index=0;
|
this.index=0;
|
||||||
this.type = NodeType.Condition;
|
this.type = NodeType.Condition;
|
||||||
this.object = object;
|
this.object = object;
|
||||||
@@ -113,10 +118,12 @@ export class ConditionNode implements INode {
|
|||||||
export class ConditionTree {
|
export class ConditionTree {
|
||||||
root: GroupNode;
|
root: GroupNode;
|
||||||
maxIndex:number;
|
maxIndex:number;
|
||||||
|
queryString:string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.maxIndex=0;
|
this.maxIndex=0;
|
||||||
this.root = new GroupNode(LogicalOperator.AND, null);
|
this.root = new GroupNode(LogicalOperator.AND, null);
|
||||||
|
this.queryString='';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ノード追加
|
// ノード追加
|
||||||
@@ -198,12 +205,49 @@ export class ConditionTree {
|
|||||||
if(value && typeof value ==='object' && ('label' in value)){
|
if(value && typeof value ==='object' && ('label' in value)){
|
||||||
value =condNode.value.label;
|
value =condNode.value.label;
|
||||||
}
|
}
|
||||||
return `${typeof condNode.object.name === 'object' ? condNode.object.name.name : condNode.object.name} ${condNode.operator} '${value}'`;
|
return `${typeof condNode.object.name === 'object' ? condNode.object.name.name : condNode.object.name} ${typeof condNode.operator === 'object' ? condNode.operator.label : condNode.operator} '${value}'`;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildConditionQueryString(node:INode){
|
||||||
|
if (node.type !== NodeType.Condition) {
|
||||||
|
let conditionString = '';
|
||||||
|
if(node.type !== NodeType.Root){
|
||||||
|
conditionString = '(';
|
||||||
|
}
|
||||||
|
|
||||||
|
const groupNode = node as GroupNode;
|
||||||
|
for (let i = 0; i < groupNode.children.length; i++) {
|
||||||
|
const childConditionString = this.buildConditionQueryString(groupNode.children[i]);
|
||||||
|
if (childConditionString !== '') {
|
||||||
|
conditionString += childConditionString;
|
||||||
|
if (i < groupNode.children.length - 1) {
|
||||||
|
conditionString += ` ${groupNode.logicalOperator.toLowerCase()} `;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(node.type !== NodeType.Root){
|
||||||
|
conditionString += ')';
|
||||||
|
}
|
||||||
|
return conditionString;
|
||||||
|
} else {
|
||||||
|
const condNode=node as ConditionNode;
|
||||||
|
if (condNode.object && condNode.operator ) {
|
||||||
|
let value=condNode.value;
|
||||||
|
if(value && typeof value ==='object' && ('label' in value)){
|
||||||
|
value =condNode.value.label;
|
||||||
|
}
|
||||||
|
return `${condNode.object.code} ${typeof condNode.operator === 'object' ? condNode.operator.value : condNode.operator} "${value}"`;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param node ノード移動
|
* @param node ノード移動
|
||||||
@@ -325,7 +369,7 @@ export class ConditionTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toJson():string{
|
toJson():string{
|
||||||
return JSON.stringify(this.root, (key, value) => {
|
return JSON.stringify({queryString :this.queryString, ...this.root}, (key, value) => {
|
||||||
if (key === 'parent') {
|
if (key === 'parent') {
|
||||||
return value ? value.type : null;
|
return value ? value.type : null;
|
||||||
}
|
}
|
||||||
@@ -333,4 +377,7 @@ export class ConditionTree {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setQuery(queryString:string){
|
||||||
|
this.queryString=queryString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {IActionFlow} from './ActionTypes';
|
import { useFlowEditorStore } from 'src/stores/flowEditor';
|
||||||
|
import { IActionFlow } from './ActionTypes';
|
||||||
export interface IKintoneEventNode {
|
export interface IKintoneEventNode {
|
||||||
label: string;
|
label: string;
|
||||||
header:string;
|
header: string;
|
||||||
eventId:string;
|
eventId: string;
|
||||||
parentId:string;
|
parentId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IKintoneEvent extends IKintoneEventNode {
|
export interface IKintoneEvent extends IKintoneEventNode {
|
||||||
@@ -15,60 +16,64 @@ export interface IKintoneEventGroup extends IKintoneEventNode {
|
|||||||
events: IKintoneEventNode[];
|
events: IKintoneEventNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class kintoneEvent implements IKintoneEvent {
|
||||||
export class kintoneEvent implements IKintoneEvent{
|
|
||||||
eventId: string;
|
eventId: string;
|
||||||
parentId:string;
|
parentId: string;
|
||||||
get hasFlow(): boolean{
|
get hasFlow(): boolean {
|
||||||
return this.flowData!==undefined && this.flowData.actionNodes.length>1
|
return this.flowData !== undefined && this.flowData.actionNodes.length > 1;
|
||||||
};
|
}
|
||||||
flowData?: IActionFlow | undefined;
|
flowData?: IActionFlow | undefined;
|
||||||
label: string;
|
label: string;
|
||||||
get header():string{
|
header = 'EVENT';
|
||||||
return "EVENT";
|
constructor(label: string, eventId: string, parentId: string) {
|
||||||
}
|
this.eventId = eventId;
|
||||||
constructor(label:string,eventId:string,parentId:string){
|
this.label = label;
|
||||||
this.eventId=eventId;
|
this.parentId = parentId;
|
||||||
this.label=label;
|
|
||||||
this.parentId=parentId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class kintoneEventGroup implements IKintoneEventGroup{
|
export class kintoneEventGroup implements IKintoneEventGroup {
|
||||||
eventId: string;
|
eventId: string;
|
||||||
parentId:string;
|
parentId: string;
|
||||||
label: string;
|
label: string;
|
||||||
events: IKintoneEventNode[];
|
events: IKintoneEventNode[];
|
||||||
get header():string{
|
get header(): string {
|
||||||
return "EVENTGROUP";
|
return 'EVENTGROUP';
|
||||||
}
|
}
|
||||||
constructor(eventId:string,label:string,events:IKintoneEventNode[],parentId:string){
|
constructor(
|
||||||
this.eventId=eventId;
|
eventId: string,
|
||||||
this.label=label;
|
label: string,
|
||||||
this.events=events;
|
events: IKintoneEventNode[],
|
||||||
this.parentId=parentId;
|
parentId: string
|
||||||
|
) {
|
||||||
|
this.eventId = eventId;
|
||||||
|
this.label = label;
|
||||||
|
this.events = events;
|
||||||
|
this.parentId = parentId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class kintoneEventForChange implements IKintoneEventGroup {
|
||||||
export class kintoneEventForChange implements IKintoneEventGroup{
|
|
||||||
eventId: string;
|
eventId: string;
|
||||||
parentId:string;
|
parentId: string;
|
||||||
label: string;
|
label: string;
|
||||||
events: IKintoneEventNode[];
|
events: IKintoneEventNode[];
|
||||||
get header():string{
|
get header(): string {
|
||||||
return "CHANGE";
|
return 'CHANGE';
|
||||||
}
|
}
|
||||||
constructor(eventId:string,label:string,events:IKintoneEventNode[],parentId:string){
|
constructor(
|
||||||
this.eventId=eventId;
|
eventId: string,
|
||||||
this.label=label;
|
label: string,
|
||||||
this.events=events;
|
events: IKintoneEventNode[],
|
||||||
this.parentId=parentId;
|
parentId: string
|
||||||
|
) {
|
||||||
|
this.eventId = eventId;
|
||||||
|
this.label = label;
|
||||||
|
this.events = events;
|
||||||
|
this.parentId = parentId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class KintoneEventManager {
|
export class KintoneEventManager {
|
||||||
public screens: IKintoneEventGroup[];
|
public screens: IKintoneEventGroup[];
|
||||||
|
|
||||||
@@ -76,28 +81,35 @@ export class KintoneEventManager {
|
|||||||
this.screens = this.getKintoneEvents();
|
this.screens = this.getKintoneEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bindFlows(flows:IActionFlow[]){
|
public bindFlows(flows: IActionFlow[]) {
|
||||||
this.screens=this.getKintoneEvents();
|
this.screens = this.getKintoneEvents();
|
||||||
for (const flow of flows){
|
for (const flow of flows) {
|
||||||
const eventId =flow.getRoot()?.name;
|
const eventId = flow.getRoot()?.name;
|
||||||
if(eventId!==undefined){
|
if (eventId !== undefined) {
|
||||||
const eventNode = this.findEventById(eventId);
|
const eventNode = this.findEventById(eventId);
|
||||||
if(eventNode!==null && eventNode.header==="EVENT"){
|
if (eventNode !== null && eventNode.header === 'EVENT') {
|
||||||
const event =eventNode as kintoneEvent;
|
const event = eventNode as kintoneEvent;
|
||||||
event.flowData=flow;
|
event.flowData = flow;
|
||||||
}else{
|
} else {
|
||||||
//EventGroupのIDを取得
|
//EventGroupのIDを取得
|
||||||
const lastIndex = eventId.lastIndexOf(".");
|
const lastIndex = eventId.lastIndexOf('.');
|
||||||
const groupId=eventId.substring(0,lastIndex);
|
const groupId = eventId.substring(0, lastIndex);
|
||||||
const eventNode = this.findEventById(groupId);
|
const eventNode = this.findEventById(groupId);
|
||||||
if(eventNode && (eventNode.header==="EVENTGROUP" || eventNode.header==="CHANGE")){
|
if (
|
||||||
const groupEvent=eventNode as kintoneEventGroup;
|
eventNode &&
|
||||||
const newEvent =new kintoneEvent(
|
(eventNode.header === 'EVENTGROUP' || eventNode.header === 'CHANGE')
|
||||||
flow.getRoot()?.subTitle || "",
|
) {
|
||||||
eventId,
|
const groupEvent = eventNode as kintoneEventGroup;
|
||||||
groupEvent.parentId
|
|
||||||
);
|
const newEvent = {
|
||||||
newEvent.flowData=flow;
|
label: flow.getRoot()?.subTitle || '',
|
||||||
|
eventId: eventId,
|
||||||
|
parentId: groupId,
|
||||||
|
header: 'DELETABLE',
|
||||||
|
hasFlow: true,
|
||||||
|
flowData: flow,
|
||||||
|
};
|
||||||
|
|
||||||
groupEvent.events.push(newEvent);
|
groupEvent.events.push(newEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,61 +118,193 @@ export class KintoneEventManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public findEventById(eventId: string): IKintoneEventNode | null {
|
public findEventById(eventId: string): IKintoneEventNode | null {
|
||||||
const screen=this.findScreen(eventId);
|
const screen = this.findScreen(eventId);
|
||||||
if(screen) {return screen;}
|
if (screen) {
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
for (const screen of this.screens) {
|
for (const screen of this.screens) {
|
||||||
for (const event of screen.events) {
|
for (const event of screen.events) {
|
||||||
if (event.eventId === eventId) {
|
if (event.eventId === eventId) {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
if(event.header==="EVENTGROUP"||event.header==="CHANGE"){
|
if (event.header === 'EVENTGROUP' || event.header === 'CHANGE') {
|
||||||
const eventGroup = event as IKintoneEventGroup;
|
const eventGroup = event as IKintoneEventGroup;
|
||||||
const targetEvent = eventGroup.events.find((ev)=>{
|
const targetEvent = eventGroup.events.find((ev) => {
|
||||||
return ev.eventId===eventId;
|
return ev.eventId === eventId;
|
||||||
})
|
});
|
||||||
if(targetEvent){
|
if (targetEvent) {
|
||||||
return targetEvent;
|
return targetEvent;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public findScreen(eventId:string):IKintoneEventGroup|undefined{
|
public findScreen(eventId: string): IKintoneEventGroup | undefined {
|
||||||
return this.screens.find(screen=>screen.eventId==eventId);
|
return this.screens.find((screen) => screen.eventId == eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getKintoneEvents():IKintoneEventGroup[]{
|
public deleteEvent(
|
||||||
|
event: kintoneEvent,
|
||||||
|
store: ReturnType<typeof useFlowEditorStore>
|
||||||
|
) {
|
||||||
|
if (event.header !== 'DELETABLE') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parent = store.findEventById(event.parentId);
|
||||||
|
if (parent?.header !== 'CHANGE' && parent?.header !== 'EVENTGROUP') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const realParent = parent as kintoneEventForChange;
|
||||||
|
|
||||||
|
const index = realParent.events.findIndex(
|
||||||
|
(e) => e.eventId === event.eventId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (index !== -1) {
|
||||||
|
realParent.events.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public getKintoneEvents(): IKintoneEventGroup[] {
|
||||||
return [
|
return [
|
||||||
new kintoneEventGroup("app.record.create","レコード追加画面",[
|
new kintoneEventGroup(
|
||||||
new kintoneEvent('レコード追加画面を表示した後','app.record.create.show',"app.record.create"),
|
'app.record.create',
|
||||||
new kintoneEvent('保存をクリックしたとき','app.record.create.submit',"app.record.create"),
|
'レコード追加画面',
|
||||||
new kintoneEvent('保存が成功したとき','app.record.create.submit.success',"app.record.create"),
|
[
|
||||||
new kintoneEventForChange('app.record.create.change','フィールドの値を変更したとき',[],"app.record.create"),
|
new kintoneEvent(
|
||||||
new kintoneEventGroup('app.record.create.show.customButtonClick','ボタンをクリックした時',[],"app.record.create")
|
'レコード追加画面を表示した後',
|
||||||
],""),
|
'app.record.create.show',
|
||||||
new kintoneEventGroup("app.record.detail","レコード詳細画面",[
|
'app.record.create'
|
||||||
new kintoneEvent('レコード詳細画面を表示した後','app.record.detail.show',"app.record.detail"),
|
),
|
||||||
new kintoneEvent('レコードを削除するとき','app.record.detail.delete.submit',"app.record.detail"),
|
new kintoneEvent(
|
||||||
new kintoneEvent('プロセス管理のアクションを実行したとき','app.record.detail.process.proceed',"app.record.detail"),
|
'保存をクリックしたとき',
|
||||||
new kintoneEventGroup('app.record.detail.show.customButtonClick','ボタンをクリックした時',[],"app.record.detail"),
|
'app.record.create.submit',
|
||||||
],""),
|
'app.record.create'
|
||||||
new kintoneEventGroup("app.record.edit","レコード編集画面",[
|
),
|
||||||
new kintoneEvent('レコード編集画面を表示した後','app.record.edit.show',"app.record.edit"),
|
new kintoneEvent(
|
||||||
new kintoneEvent('保存をクリックしたとき','app.record.edit.submit',"app.record.edit"),
|
'保存が成功したとき',
|
||||||
new kintoneEvent('保存が成功したとき','app.record.edit.submit.success',"app.record.edit"),
|
'app.record.create.submit.success',
|
||||||
new kintoneEventForChange('app.record.edit.change','フィールドの値を変更したとき',[],"app.record.edit"),
|
'app.record.create'
|
||||||
new kintoneEventGroup('app.record.edit.show.customButtonClick','ボタンをクリックした時',[],"app.record.edit"),
|
),
|
||||||
],""),
|
new kintoneEventForChange(
|
||||||
new kintoneEventGroup("app.record.index","レコード一覧画面",[
|
'app.record.create.change',
|
||||||
new kintoneEvent('一覧画面を表示した後', 'app.record.index.show',"app.record.index"),
|
'フィールドの値を変更したとき',
|
||||||
new kintoneEvent('インライン編集を開始したとき','app.record.index.edit.show',"app.record.index"),
|
[],
|
||||||
new kintoneEvent('インライン編集の【保存】をクリックしたとき','app.record.index.edit.submit',"app.record.index"),
|
'app.record.create'
|
||||||
new kintoneEvent('インライン編集の保存が成功したとき', 'app.record.index.edit.submit.success',"app.record.index"),
|
),
|
||||||
new kintoneEventForChange('app.record.index.edit.change','インライン編集のフィールド値を変更したとき' ,[],"app.record.index"),
|
new kintoneEventGroup(
|
||||||
new kintoneEventGroup('app.record.detail.show.customButtonClick','ボタンをクリックした時',[],"app.record.index"),
|
'app.record.create.show.customButtonClick',
|
||||||
],"")
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.create'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.detail',
|
||||||
|
'レコード詳細画面',
|
||||||
|
[
|
||||||
|
new kintoneEvent(
|
||||||
|
'レコード詳細画面を表示した後',
|
||||||
|
'app.record.detail.show',
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'レコードを削除するとき',
|
||||||
|
'app.record.detail.delete.submit',
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'プロセス管理のアクションを実行したとき',
|
||||||
|
'app.record.detail.process.proceed',
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.detail.show.customButtonClick',
|
||||||
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.edit',
|
||||||
|
'レコード編集画面',
|
||||||
|
[
|
||||||
|
new kintoneEvent(
|
||||||
|
'レコード編集画面を表示した後',
|
||||||
|
'app.record.edit.show',
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'保存をクリックしたとき',
|
||||||
|
'app.record.edit.submit',
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'保存が成功したとき',
|
||||||
|
'app.record.edit.submit.success',
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEventForChange(
|
||||||
|
'app.record.edit.change',
|
||||||
|
'フィールドの値を変更したとき',
|
||||||
|
[],
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.edit.show.customButtonClick',
|
||||||
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.index',
|
||||||
|
'レコード一覧画面',
|
||||||
|
[
|
||||||
|
new kintoneEvent(
|
||||||
|
'一覧画面を表示した後',
|
||||||
|
'app.record.index.show',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'インライン編集を開始したとき',
|
||||||
|
'app.record.index.edit.show',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'インライン編集の【保存】をクリックしたとき',
|
||||||
|
'app.record.index.edit.submit',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'インライン編集の保存が成功したとき',
|
||||||
|
'app.record.index.edit.submit.success',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEventForChange(
|
||||||
|
'app.record.index.edit.change',
|
||||||
|
'インライン編集のフィールド値を変更したとき',
|
||||||
|
[],
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.detail.show.customButtonClick',
|
||||||
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
plugin/kintone-addins/.env.dev
Normal file
2
plugin/kintone-addins/.env.dev
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
VITE_SOURCE_MAP = inline
|
||||||
|
VITE_PORT = 4173
|
||||||
2
plugin/kintone-addins/.env.production
Normal file
2
plugin/kintone-addins/.env.production
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
VITE_SOURCE_MAP = false
|
||||||
|
VITE_PORT = 4173
|
||||||
@@ -4,19 +4,28 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsc && set \"SOURCE_MAP=true\" && vite build && vite preview",
|
"dev": "run-p watch server ngrok",
|
||||||
"build": "tsc && vite build && xcopy dist\\*.js ..\\..\\backend\\Temp\\ /E /I /Y",
|
"watch": "vite build --watch --mode dev",
|
||||||
"build:dev":"tsc && set \"SOURCE_MAP=true\" && vite build && xcopy dist\\*.js ..\\..\\backend\\Temp\\ /E /I /Y",
|
"server": "vite dev --mode dev",
|
||||||
"preview": "vite preview",
|
"ngrok": "ngrok http 4173",
|
||||||
"ngrok":"ngrok http http://localhost:4173/",
|
"build": "run-s b:production copy:windows",
|
||||||
"vite":"vite dev"
|
"build:dev": "run-s b:dev copy:windows",
|
||||||
|
"build:linux": "run-s b:production copy:linux",
|
||||||
|
"build:linux-dev": "run-s b:dev copy:linux",
|
||||||
|
"b:production": "vite build --mode production",
|
||||||
|
"b:dev": "vite build --mode dev",
|
||||||
|
"copy:windows": "xcopy dist\\*.js ..\\..\\backend\\Temp\\ /E /I /Y",
|
||||||
|
"copy:linux": "cp -ur dist/*.js ../../backend/Temp"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jquery": "^3.5.24",
|
"@types/jquery": "^3.5.24",
|
||||||
"@types/node": "^20.8.9",
|
"@types/node": "^20.8.9",
|
||||||
|
"npm-run-all2": "^6.2.0",
|
||||||
"sass": "^1.69.5",
|
"sass": "^1.69.5",
|
||||||
"typescript": "^5.0.2",
|
"typescript": "^5.0.2",
|
||||||
"vite": "^4.4.5"
|
"vite": "^4.4.5",
|
||||||
|
"vite-plugin-checker": "^0.6.4",
|
||||||
|
"vite-plugin-lib-inject-css": "^2.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "^3.7.1"
|
"jquery": "^3.7.1"
|
||||||
|
|||||||
24
plugin/kintone-addins/src/actions/auto-numbering.css
Normal file
24
plugin/kintone-addins/src/actions/auto-numbering.css
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
.alc-button-normal {
|
||||||
|
display: inline-block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0 16px;
|
||||||
|
margin-left: 16px;
|
||||||
|
margin-top: 8px;
|
||||||
|
min-width: 100px;
|
||||||
|
outline: none;
|
||||||
|
border: 1px solid #e3e7e8;
|
||||||
|
background-color: #f7f9fa;
|
||||||
|
box-shadow: 1px 1px 1px #fff inset;
|
||||||
|
color: #3498db;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
|
.alc-button-normal:hover {
|
||||||
|
background-color: #c8d6dd;
|
||||||
|
box-shadow: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.alc-button-normal:active {
|
||||||
|
color: #f7f9fa;
|
||||||
|
background-color: #54b8eb;
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
import { actionAddins } from ".";
|
import { actionAddins } from ".";
|
||||||
import { IField, IAction,IActionResult, IActionNode, IActionProperty, IContext } from "../types/ActionTypes";
|
import { IField, IAction,IActionResult, IActionNode, IActionProperty, IContext } from "../types/ActionTypes";
|
||||||
import { Formatter } from "../util/format";
|
import { Formatter } from "../util/format";
|
||||||
|
import "./auto-numbering.css";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window { $format: any; }
|
interface Window { $format: any; }
|
||||||
@@ -84,6 +85,7 @@ export class AutoNumbering implements IAction{
|
|||||||
|
|
||||||
execEval(match:string,expr:string):string{
|
execEval(match:string,expr:string):string{
|
||||||
console.log(match);
|
console.log(match);
|
||||||
|
// @ts-ignore
|
||||||
return eval(expr);
|
return eval(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
plugin/kintone-addins/src/actions/button-add.css
Normal file
0
plugin/kintone-addins/src/actions/button-add.css
Normal file
@@ -2,6 +2,8 @@
|
|||||||
import { actionAddins } from ".";
|
import { actionAddins } from ".";
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import { IAction, IActionProperty, IActionNode, IActionResult } from "../types/ActionTypes";
|
import { IAction, IActionProperty, IActionNode, IActionResult } from "../types/ActionTypes";
|
||||||
|
import "./button-add.css";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ボタン配置属性定義
|
* ボタン配置属性定義
|
||||||
*/
|
*/
|
||||||
@@ -51,30 +53,7 @@ export class ButtonAddAction implements IAction {
|
|||||||
if(!menuSpace) return result;
|
if(!menuSpace) return result;
|
||||||
if($("style#alc-button-add").length===0){
|
if($("style#alc-button-add").length===0){
|
||||||
const css=`
|
const css=`
|
||||||
.alc-button-normal {
|
`;
|
||||||
display: inline-block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 0 16px;
|
|
||||||
margin-left: 16px;
|
|
||||||
margin-top: 8px;
|
|
||||||
min-width: 100px;
|
|
||||||
outline: none;
|
|
||||||
border: 1px solid #e3e7e8;
|
|
||||||
background-color: #f7f9fa;
|
|
||||||
box-shadow: 1px 1px 1px #fff inset;
|
|
||||||
color: #3498db;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 32px;
|
|
||||||
}
|
|
||||||
.alc-button-normal:hover {
|
|
||||||
background-color: #c8d6dd;
|
|
||||||
box-shadow: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.alc-button-normal:active {
|
|
||||||
color: #f7f9fa;
|
|
||||||
background-color: #54b8eb;
|
|
||||||
}`;
|
|
||||||
const style = $("<style id='alc-button-add'>/<style>");
|
const style = $("<style id='alc-button-add'>/<style>");
|
||||||
style.text(css);
|
style.text(css);
|
||||||
$("head").append(style);
|
$("head").append(style);
|
||||||
|
|||||||
182
plugin/kintone-addins/src/actions/data-mapping.ts
Normal file
182
plugin/kintone-addins/src/actions/data-mapping.ts
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
import {
|
||||||
|
IAction,
|
||||||
|
IActionResult,
|
||||||
|
IActionNode,
|
||||||
|
IActionProperty,
|
||||||
|
IContext,
|
||||||
|
} from "../types/ActionTypes";
|
||||||
|
import { actionAddins } from ".";
|
||||||
|
|
||||||
|
export type IApp = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
export type IField = {
|
||||||
|
name: string;
|
||||||
|
code: string;
|
||||||
|
type: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type IAppFields = {
|
||||||
|
app?: IApp;
|
||||||
|
fields: IField[];
|
||||||
|
};
|
||||||
|
|
||||||
|
type ValueType = {
|
||||||
|
id: string;
|
||||||
|
from: {
|
||||||
|
objectType: "variable" | "field";
|
||||||
|
name: { name: string };
|
||||||
|
code: string;
|
||||||
|
};
|
||||||
|
to: IAppFields & {
|
||||||
|
isDialogVisible: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type Props = { app: IApp; field: ValueType[] };
|
||||||
|
|
||||||
|
export class DataMappingAction implements IAction {
|
||||||
|
name: string;
|
||||||
|
actionProps: IActionProperty[];
|
||||||
|
dataMappingProps: Props;
|
||||||
|
constructor() {
|
||||||
|
this.name = "DataMapping";
|
||||||
|
this.actionProps = [];
|
||||||
|
this.dataMappingProps = {} as Props;
|
||||||
|
this.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
async process(
|
||||||
|
prop: IActionNode,
|
||||||
|
event: any,
|
||||||
|
context: IContext
|
||||||
|
): Promise<IActionResult> {
|
||||||
|
this.initActionProps(prop);
|
||||||
|
this.initTypedActionProps();
|
||||||
|
let result = {
|
||||||
|
canNext: true,
|
||||||
|
result: "",
|
||||||
|
} as IActionResult;
|
||||||
|
try {
|
||||||
|
for (const item of this.dataMappingProps.field) {
|
||||||
|
if (item.from.objectType === "variable") {
|
||||||
|
if (
|
||||||
|
item.from.name.name &&
|
||||||
|
item.to.app &&
|
||||||
|
item.to.fields &&
|
||||||
|
item.to.fields.length > 0
|
||||||
|
) {
|
||||||
|
const value = getValueByPath(
|
||||||
|
context.variables,
|
||||||
|
item.from.name.name
|
||||||
|
);
|
||||||
|
if (value) {
|
||||||
|
await kintone.api(
|
||||||
|
kintone.api.url("/k/v1/record.json", true),
|
||||||
|
"POST",
|
||||||
|
{
|
||||||
|
app: item.to.app.id,
|
||||||
|
record: {
|
||||||
|
[item.to.fields[0].code]: {
|
||||||
|
value: value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (item.from.objectType === "field") {
|
||||||
|
if (
|
||||||
|
item.from.code &&
|
||||||
|
item.to.app &&
|
||||||
|
item.to.fields &&
|
||||||
|
item.to.fields.length > 0
|
||||||
|
) {
|
||||||
|
const value = await selectData(
|
||||||
|
item.to.app.id,
|
||||||
|
item.to.fields[0].code
|
||||||
|
);
|
||||||
|
if (value && value.type === context.record[item.from.code].type) {
|
||||||
|
await kintone.api(
|
||||||
|
kintone.api.url("/k/v1/records.json", true),
|
||||||
|
"POST",
|
||||||
|
{
|
||||||
|
app: item.to.app.id,
|
||||||
|
records: value.value.map((v) => ({
|
||||||
|
[item.to.fields[0].code]: {
|
||||||
|
value: v,
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("DataMappingAction error", error);
|
||||||
|
result.canNext = false;
|
||||||
|
}
|
||||||
|
console.log("dataMappingProps", this.dataMappingProps);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private initActionProps(nodes: IActionNode) {
|
||||||
|
this.actionProps = nodes.actionProps;
|
||||||
|
}
|
||||||
|
private initTypedActionProps() {
|
||||||
|
for (const action of this.actionProps) {
|
||||||
|
if (action.component === "DataMapping") {
|
||||||
|
this.dataMappingProps.field = action.props.modelValue as ValueType[];
|
||||||
|
} else if (action.component === "AppSelect") {
|
||||||
|
this.dataMappingProps.app = action.props.modelValue.app as IApp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
register(): void {
|
||||||
|
actionAddins[this.name] = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new DataMappingAction();
|
||||||
|
|
||||||
|
const getValueByPath = (obj: any, path: string) => {
|
||||||
|
return path.split(".").reduce((o, k) => (o || {})[k], obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
type Resp = { records: RespRecordType[] };
|
||||||
|
|
||||||
|
type RespRecordType = {
|
||||||
|
[key: string]: {
|
||||||
|
type: string;
|
||||||
|
value: any;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type Result = {
|
||||||
|
type: string;
|
||||||
|
value: any[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectData = async (appid: string, field: string): Promise<Result> => {
|
||||||
|
return kintone
|
||||||
|
.api(kintone.api.url("/k/v1/records", true), "GET", {
|
||||||
|
app: appid ?? kintone.app.getId(),
|
||||||
|
fields: [field],
|
||||||
|
})
|
||||||
|
.then((resp: Resp) => {
|
||||||
|
const result: Result = { type: "", value: [] };
|
||||||
|
resp.records.forEach((element) => {
|
||||||
|
for (const [key, value] of Object.entries(element)) {
|
||||||
|
if (result.type === "") {
|
||||||
|
result.type = value.type;
|
||||||
|
}
|
||||||
|
result.value.push(value.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
};
|
||||||
280
plugin/kintone-addins/src/actions/data-processing.ts
Normal file
280
plugin/kintone-addins/src/actions/data-processing.ts
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
import {
|
||||||
|
IAction,
|
||||||
|
IActionResult,
|
||||||
|
IActionNode,
|
||||||
|
IActionProperty,
|
||||||
|
IContext,
|
||||||
|
} from "../types/ActionTypes";
|
||||||
|
import { actionAddins } from ".";
|
||||||
|
|
||||||
|
|
||||||
|
type DataProcessingProps = {
|
||||||
|
app: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
conditionsQuery: string;
|
||||||
|
propcessing: {
|
||||||
|
varRootName: string;
|
||||||
|
fields: Field[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type Field = {
|
||||||
|
name: string;
|
||||||
|
code: string;
|
||||||
|
type: string;
|
||||||
|
varName: string;
|
||||||
|
operator: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class DataProcessingAction implements IAction {
|
||||||
|
name: string;
|
||||||
|
actionProps: IActionProperty[];
|
||||||
|
dataProcessingProps: DataProcessingProps | null;
|
||||||
|
constructor() {
|
||||||
|
this.name = "データ処理";
|
||||||
|
this.actionProps = [];
|
||||||
|
this.dataProcessingProps = null;
|
||||||
|
this.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
async process(
|
||||||
|
nodes: IActionNode,event: any,context: IContext
|
||||||
|
): Promise<IActionResult> {
|
||||||
|
this.initActionProps(nodes);
|
||||||
|
this.initTypedActionProps();
|
||||||
|
let result = {
|
||||||
|
canNext: true,
|
||||||
|
result: "",
|
||||||
|
} as IActionResult;
|
||||||
|
try {
|
||||||
|
if (!this.dataProcessingProps) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await selectData(this.dataProcessingProps.conditionsQuery);
|
||||||
|
console.log("data ", data);
|
||||||
|
|
||||||
|
context.variables[this.dataProcessingProps.propcessing.varRootName] =
|
||||||
|
this.dataProcessingProps.propcessing.fields.reduce((acc, f) => {
|
||||||
|
const v = calc(f, data);
|
||||||
|
if (v) {
|
||||||
|
acc[f.varName] = calc(f, data);
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {} as Var);
|
||||||
|
|
||||||
|
console.log("context ", context);
|
||||||
|
return result;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
event.error=error;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
register(): void {
|
||||||
|
actionAddins[this.name] = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private initActionProps(nodes: IActionNode) {
|
||||||
|
this.actionProps = nodes.actionProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
private initTypedActionProps() {
|
||||||
|
this.dataProcessingProps = {
|
||||||
|
app: {
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
},
|
||||||
|
conditionsQuery: "",
|
||||||
|
propcessing: {
|
||||||
|
varRootName: "",
|
||||||
|
fields: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
for (const action of this.actionProps) {
|
||||||
|
if (action.component === "AppFieldSelect") {
|
||||||
|
this.dataProcessingProps.app.id = action.props.modelValue.app.id;
|
||||||
|
this.dataProcessingProps.app.name = action.props.modelValue.app.name;
|
||||||
|
} else if (action.component === "DataProcessing") {
|
||||||
|
this.dataProcessingProps.propcessing.varRootName =
|
||||||
|
action.props.modelValue.name;
|
||||||
|
for (const f of action.props.modelValue.vars) {
|
||||||
|
this.dataProcessingProps.propcessing.fields.push({
|
||||||
|
name: f.field.name,
|
||||||
|
code: f.field.code,
|
||||||
|
type: f.field.type,
|
||||||
|
varName: f.vName,
|
||||||
|
operator: f.logicalOperator.operator,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (action.component === "ConditionInput") {
|
||||||
|
this.dataProcessingProps.conditionsQuery = JSON.parse(
|
||||||
|
action.props.modelValue
|
||||||
|
).queryString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new DataProcessingAction();
|
||||||
|
|
||||||
|
const selectData = async (query?: string) => {
|
||||||
|
return kintone
|
||||||
|
.api(kintone.api.url("/k/v1/records", true), "GET", {
|
||||||
|
app: kintone.app.getId(),
|
||||||
|
query: query,
|
||||||
|
})
|
||||||
|
.then((resp: Resp) => {
|
||||||
|
const result: Result = {};
|
||||||
|
resp.records.forEach((element) => {
|
||||||
|
for (const [key, value] of Object.entries(element)) {
|
||||||
|
if (!result[key]) {
|
||||||
|
result[key] = { type: value.type, value: [] };
|
||||||
|
}
|
||||||
|
result[key].value.push(value.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
type Resp = { records: RespRecordType[] };
|
||||||
|
|
||||||
|
type RespRecordType = {
|
||||||
|
[key: string]: {
|
||||||
|
type: string;
|
||||||
|
value: any;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type Result = {
|
||||||
|
[key: string]: {
|
||||||
|
type: string;
|
||||||
|
value: any[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type Var = {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ERROR_TYPE = "ERROR_TYPE";
|
||||||
|
|
||||||
|
const calc = (field: Field, result: Result) => {
|
||||||
|
const type = typeCheck(field.type);
|
||||||
|
if (!type) {
|
||||||
|
return ERROR_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fun =
|
||||||
|
calcFunc[`${type}_${Operator[field.operator as keyof typeof Operator]}`];
|
||||||
|
if (!fun) {
|
||||||
|
return ERROR_TYPE;
|
||||||
|
}
|
||||||
|
const values = result[field.code].value;
|
||||||
|
if (!values) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return fun(values);
|
||||||
|
};
|
||||||
|
|
||||||
|
const typeCheck = (type: string) => {
|
||||||
|
switch (type) {
|
||||||
|
case "RECORD_NUMBER":
|
||||||
|
case "NUMBER":
|
||||||
|
return CalcType.NUMBER;
|
||||||
|
case "SINGLE_LINE_TEXT":
|
||||||
|
case "MULTI_LINE_TEXT":
|
||||||
|
case "RICH_TEXT":
|
||||||
|
return CalcType.STRING;
|
||||||
|
case "DATE":
|
||||||
|
return CalcType.DATE;
|
||||||
|
case "TIME":
|
||||||
|
return CalcType.TIME;
|
||||||
|
case "DATETIME":
|
||||||
|
case "UPDATED_TIME":
|
||||||
|
return CalcType.DATETIME;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Operator {
|
||||||
|
SUM = "SUM",
|
||||||
|
AVG = "AVG",
|
||||||
|
MAX = "MAX",
|
||||||
|
MIN = "MIN",
|
||||||
|
COUNT = "COUNT",
|
||||||
|
FIRST = "FIRST"
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CalcType {
|
||||||
|
NUMBER = "number",
|
||||||
|
STRING = "string",
|
||||||
|
DATE = "date",
|
||||||
|
TIME = "time",
|
||||||
|
DATETIME = "datetime",
|
||||||
|
}
|
||||||
|
|
||||||
|
const calcFunc: Record<string, (value: string[]) => string | null> = {
|
||||||
|
[`${CalcType.NUMBER}_${Operator.COUNT}`]: (value: string[]) =>
|
||||||
|
value.length.toString(),
|
||||||
|
[`${CalcType.STRING}_${Operator.COUNT}`]: (value: string[]) =>
|
||||||
|
value.length.toString(),
|
||||||
|
[`${CalcType.DATE}_${Operator.COUNT}`]: (value: string[]) =>
|
||||||
|
value.length.toString(),
|
||||||
|
[`${CalcType.TIME}_${Operator.COUNT}`]: (value: string[]) =>
|
||||||
|
value.length.toString(),
|
||||||
|
[`${CalcType.DATETIME}_${Operator.COUNT}`]: (value: string[]) =>
|
||||||
|
value.length.toString(),
|
||||||
|
|
||||||
|
[`${CalcType.NUMBER}_${Operator.SUM}`]: (value: string[]) =>
|
||||||
|
value.reduce((acc, v) => acc + Number(v), 0).toString(),
|
||||||
|
[`${CalcType.NUMBER}_${Operator.AVG}`]: (value: string[]) =>
|
||||||
|
(value.reduce((acc, v) => acc + Number(v), 0) / value.length).toString(),
|
||||||
|
[`${CalcType.NUMBER}_${Operator.MAX}`]: (value: string[]) =>
|
||||||
|
Math.max(...value.map(Number)).toString(),
|
||||||
|
[`${CalcType.NUMBER}_${Operator.MIN}`]: (value: string[]) =>
|
||||||
|
Math.min(...value.map(Number)).toString(),
|
||||||
|
|
||||||
|
[`${CalcType.STRING}_${Operator.SUM}`]: (value: string[]) => value.join(" "),
|
||||||
|
|
||||||
|
[`${CalcType.DATE}_${Operator.MAX}`]: (value: string[]) =>
|
||||||
|
value.reduce((maxDate, currentDate) =>
|
||||||
|
maxDate > currentDate ? maxDate : currentDate
|
||||||
|
),
|
||||||
|
|
||||||
|
[`${CalcType.DATE}_${Operator.MIN}`]: (value: string[]) =>
|
||||||
|
value.reduce((minDate, currentDate) =>
|
||||||
|
minDate < currentDate ? minDate : currentDate
|
||||||
|
),
|
||||||
|
|
||||||
|
[`${CalcType.TIME}_${Operator.MAX}`]: (value: string[]) =>
|
||||||
|
value.reduce((maxTime, currentTime) =>
|
||||||
|
maxTime > currentTime ? maxTime : currentTime
|
||||||
|
),
|
||||||
|
[`${CalcType.TIME}_${Operator.MIN}`]: (value: string[]) =>
|
||||||
|
value.reduce((minTime, currentTime) =>
|
||||||
|
minTime < currentTime ? minTime : currentTime
|
||||||
|
),
|
||||||
|
|
||||||
|
[`${CalcType.DATETIME}_${Operator.MAX}`]: (value: string[]) =>
|
||||||
|
value.reduce((maxDateTime, currentDateTime) =>
|
||||||
|
new Date(maxDateTime) > new Date(currentDateTime)
|
||||||
|
? maxDateTime
|
||||||
|
: currentDateTime
|
||||||
|
),
|
||||||
|
|
||||||
|
[`${CalcType.DATETIME}_${Operator.MIN}`]: (value: string[]) =>
|
||||||
|
value.reduce((minDateTime, currentDateTime) =>
|
||||||
|
new Date(minDateTime) < new Date(currentDateTime)
|
||||||
|
? minDateTime
|
||||||
|
: currentDateTime
|
||||||
|
),
|
||||||
|
[`${CalcType.STRING}_${Operator.FIRST}`]:(value: string[])=>{
|
||||||
|
return value[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -6,6 +6,8 @@ import '../actions/field-shown';
|
|||||||
import '../actions/error-show';
|
import '../actions/error-show';
|
||||||
import '../actions/button-add';
|
import '../actions/button-add';
|
||||||
import '../actions/condition-action';
|
import '../actions/condition-action';
|
||||||
|
import '../actions/data-processing';
|
||||||
|
import '../actions/data-mapping';
|
||||||
import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes";
|
import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes";
|
||||||
|
|
||||||
export class ActionProcess{
|
export class ActionProcess{
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": false,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": false,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,16 +1,32 @@
|
|||||||
// vite.config.js
|
// vite.config.js
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig, loadEnv } from "vite";
|
||||||
const sourcemap = process.env.SOURCE_MAP==='true';
|
import checker from "vite-plugin-checker";
|
||||||
|
import { libInjectCss } from 'vite-plugin-lib-inject-css';
|
||||||
|
|
||||||
export default defineConfig({
|
export default ({ mode }) => {
|
||||||
build: {
|
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
|
||||||
rollupOptions: {
|
|
||||||
input: 'src/index.ts', // entry file
|
return defineConfig({
|
||||||
output:{
|
plugins: [
|
||||||
entryFileNames:'alc_runtime.js',
|
checker({
|
||||||
// assetFileNames:'alc_kintone_style.css'
|
typescript: true,
|
||||||
}
|
}),
|
||||||
|
libInjectCss(),
|
||||||
|
],
|
||||||
|
build: {
|
||||||
|
cssCodeSplit: false,
|
||||||
|
rollupOptions: {
|
||||||
|
input: "src/index.ts", // entry file
|
||||||
|
output: {
|
||||||
|
entryFileNames: "alc_runtime.js",
|
||||||
|
// assetFileNames:'alc_kintone_style.css'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sourcemap: process.env.VITE_SOURCE_MAP,
|
||||||
},
|
},
|
||||||
sourcemap:sourcemap
|
server: {
|
||||||
}
|
port: process.env.VITE_PORT,
|
||||||
})
|
// open: "/dist/alc_runtime.js",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user