Compare commits
1 Commits
feature/em
...
feature-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7078b54c5 |
@@ -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"
|
|
||||||
children-key="events"
|
|
||||||
no-connectors
|
|
||||||
v-model:expanded="store.expandedScreen"
|
|
||||||
:dense="true"
|
|
||||||
:ref="tree"
|
|
||||||
>
|
|
||||||
<template v-slot:header-EVENT="prop">
|
<template v-slot:header-EVENT="prop">
|
||||||
<div class="row col items-start no-wrap event-node" @click="onSelected(prop.node)">
|
<div :ref="prop.node.eventId" class="row col items-center no-wrap event-node">
|
||||||
<q-icon v-if="prop.node.eventId"
|
<q-icon v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px"
|
||||||
name="play_circle"
|
class="q-mr-sm">
|
||||||
:color="prop.node.hasFlow?'green':'grey'"
|
|
||||||
size="16px" class="q-mr-sm">
|
|
||||||
</q-icon>
|
</q-icon>
|
||||||
<div class="no-wrap" :class="selectedEvent && prop.node.eventId===selectedEvent.eventId?'selected-node':''">{{ prop.node.label }}</div>
|
<div class="no-wrap" @click="onSelected(prop.node)"
|
||||||
|
:class="selectedEvent && prop.node.eventId === selectedEvent.eventId ? 'selected-node' : ''">{{
|
||||||
|
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 v-if="prop.node.hasFlow" name="delete" color="negative" size="16px" class="q-mr-sm"></q-icon> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:header-CHANGE="prop">
|
<template v-slot:header-CHANGE="prop">
|
||||||
<div class="row col items-start no-wrap event-node" >
|
<div class="row col items-center no-wrap event-node">
|
||||||
<div class="no-wrap">{{ prop.node.label }}</div>
|
<div class="no-wrap">{{ prop.node.label }}</div>
|
||||||
<q-space></q-space>
|
<q-space></q-space>
|
||||||
<q-icon name="add_circle" color="primary" size="16px" class="q-mr-sm" @click="addChangeEvent(prop.node)"></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>
|
||||||
|
<q-btn class="q-mr-sm delete-btn" flat fab-mini icon="delete_forever" padding="none" color="negative"
|
||||||
|
@click="deleteEvent(prop.node)"></q-btn>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-tree>
|
</q-tree>
|
||||||
<show-dialog v-model:visible="showDialog" name="フィールド選択" @close="closeDg" widht="400px">
|
<show-dialog v-model:visible="showDialog" name="フィールド選択" @close="closeDg">
|
||||||
<field-select ref="appDg" name="フィールド" type="single" :appId="store.appInfo?.appId"></field-select>
|
<field-select ref="appDg" name="フィールド" type="single" :appId="store.appInfo?.appId"></field-select>
|
||||||
</show-dialog>
|
</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);
|
||||||
@@ -72,12 +80,12 @@ export default defineComponent({
|
|||||||
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();
|
||||||
}
|
}
|
||||||
@@ -89,6 +97,21 @@ export default defineComponent({
|
|||||||
selectedChangeEvent.value = node;
|
selectedChangeEvent.value = node;
|
||||||
showDialog.value = true;
|
showDialog.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deleteEvent = (node: IKintoneEvent) => {
|
||||||
|
if (!node.eventId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store.deleteEvent(node);
|
||||||
|
store.selectFlow(undefined)
|
||||||
|
|
||||||
|
$q.notify({
|
||||||
|
type: 'positive',
|
||||||
|
caption: "通知",
|
||||||
|
message: `イベント ${node.label} 削除`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const onSelected = (node: IKintoneEvent) => {
|
const onSelected = (node: IKintoneEvent) => {
|
||||||
if (!node.eventId) {
|
if (!node.eventId) {
|
||||||
return;
|
return;
|
||||||
@@ -98,6 +121,7 @@ export default defineComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const screen = store.eventTree.findEventById(node.parentId);
|
const screen = store.eventTree.findEventById(node.parentId);
|
||||||
|
|
||||||
let flow = store.findFlowByEventId(node.eventId);
|
let flow = store.findFlowByEventId(node.eventId);
|
||||||
let screenName = screen !== null ? screen.label : "";
|
let screenName = screen !== null ? screen.label : "";
|
||||||
let nodeLabel = node.label;
|
let nodeLabel = node.label;
|
||||||
@@ -105,6 +129,7 @@ export default defineComponent({
|
|||||||
// screenName=nodeLabel;
|
// screenName=nodeLabel;
|
||||||
// nodeLabel=`${node.label}の値を変更したとき`;
|
// nodeLabel=`${node.label}の値を変更したとき`;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (flow !== undefined && flow !== null) {
|
if (flow !== undefined && flow !== null) {
|
||||||
store.selectFlow(flow);
|
store.selectFlow(flow);
|
||||||
} else {
|
} else {
|
||||||
@@ -125,6 +150,7 @@ export default defineComponent({
|
|||||||
onSelected,
|
onSelected,
|
||||||
selectedEvent,
|
selectedEvent,
|
||||||
addChangeEvent,
|
addChangeEvent,
|
||||||
|
deleteEvent,
|
||||||
closeDg,
|
closeDg,
|
||||||
store
|
store
|
||||||
}
|
}
|
||||||
@@ -136,16 +162,21 @@ export default defineComponent({
|
|||||||
flex-wrap: nowarp;
|
flex-wrap: nowarp;
|
||||||
text-wrap: nowarp;
|
text-wrap: nowarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-node {
|
.event-node {
|
||||||
cursor: pointer;
|
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>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
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[]> {
|
||||||
|
|
||||||
async getFlows(appId:string):Promise<ActionFlow[]>
|
|
||||||
{
|
|
||||||
const flows: ActionFlow[] = [];
|
const flows: ActionFlow[] = [];
|
||||||
try {
|
try {
|
||||||
const result = await api.get(`api/flows/${appId}`);
|
const result = await api.get(`api/flows/${appId}`);
|
||||||
@@ -24,10 +21,9 @@ export class FlowCtrl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -35,10 +31,19 @@ export class FlowCtrl
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export interface FlowEditorState{
|
|||||||
}
|
}
|
||||||
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,
|
||||||
@@ -24,7 +24,7 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
activeNode: undefined,
|
activeNode: undefined,
|
||||||
eventTree: eventTree,
|
eventTree: eventTree,
|
||||||
selectedEvent: undefined,
|
selectedEvent: undefined,
|
||||||
expandedScreen:[]
|
expandedScreen: [],
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
/**
|
/**
|
||||||
@@ -43,17 +43,24 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
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) {
|
||||||
@@ -80,7 +87,7 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
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;
|
||||||
},
|
},
|
||||||
@@ -95,8 +102,8 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
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);
|
||||||
@@ -104,6 +111,24 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
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);
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* デプロイする
|
* デプロイする
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +137,6 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return await flowCtrl.depoly(this.appInfo?.appId);
|
return await flowCtrl.depoly(this.appInfo?.appId);
|
||||||
}
|
},
|
||||||
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useFlowEditorStore } from 'src/stores/flowEditor';
|
||||||
import { IActionFlow } from './ActionTypes';
|
import { IActionFlow } from './ActionTypes';
|
||||||
export interface IKintoneEventNode {
|
export interface IKintoneEventNode {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -15,18 +16,15 @@ 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) {
|
constructor(label: string, eventId: string, parentId: string) {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
@@ -40,9 +38,14 @@ export class kintoneEventGroup implements IKintoneEventGroup{
|
|||||||
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(
|
||||||
|
eventId: string,
|
||||||
|
label: string,
|
||||||
|
events: IKintoneEventNode[],
|
||||||
|
parentId: string
|
||||||
|
) {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
@@ -50,16 +53,20 @@ export class kintoneEventGroup implements IKintoneEventGroup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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(
|
||||||
|
eventId: string,
|
||||||
|
label: string,
|
||||||
|
events: IKintoneEventNode[],
|
||||||
|
parentId: string
|
||||||
|
) {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
@@ -67,8 +74,6 @@ export class kintoneEventForChange implements IKintoneEventGroup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class KintoneEventManager {
|
export class KintoneEventManager {
|
||||||
public screens: IKintoneEventGroup[];
|
public screens: IKintoneEventGroup[];
|
||||||
|
|
||||||
@@ -82,22 +87,29 @@ export class KintoneEventManager {
|
|||||||
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 (
|
||||||
|
eventNode &&
|
||||||
|
(eventNode.header === 'EVENTGROUP' || eventNode.header === 'CHANGE')
|
||||||
|
) {
|
||||||
const groupEvent = eventNode as kintoneEventGroup;
|
const groupEvent = eventNode as kintoneEventGroup;
|
||||||
const newEvent =new kintoneEvent(
|
|
||||||
flow.getRoot()?.subTitle || "",
|
const newEvent = {
|
||||||
eventId,
|
label: flow.getRoot()?.subTitle || '',
|
||||||
groupEvent.parentId
|
eventId: eventId,
|
||||||
);
|
parentId: groupId,
|
||||||
newEvent.flowData=flow;
|
header: 'DELETABLE',
|
||||||
|
hasFlow: true,
|
||||||
|
flowData: flow,
|
||||||
|
};
|
||||||
|
|
||||||
groupEvent.events.push(newEvent);
|
groupEvent.events.push(newEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,17 +119,19 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -128,39 +142,169 @@ export class KintoneEventManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 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[] {
|
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'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user