@opens/service-workflow-ui 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,7 @@ created by the editor.
10
10
  import { createPinia } from 'pinia';
11
11
  import ServiceWorkflowUi, {
12
12
  AppServiceWorkflowAddForm,
13
+ AppServiceWorkflowEditNodeForm,
13
14
  AppServiceWorkflowEditor,
14
15
  } from '@opens/service-workflow-ui';
15
16
  import '@opens/service-workflow-ui/dist/yunique_ui.css';
@@ -23,21 +24,26 @@ app.use(ServiceWorkflowUi);
23
24
  workflow-id="main-flow"
24
25
  v-model="flow"
25
26
  :allowed-node-types="['screen', 'identification', 'service']"
26
- @change="handleChange"
27
27
  @node="handleNode"
28
+ @change="handleChange"
28
29
  @invalid-change="handleInvalidChange"
29
- @invalid-model="handleInvalidModel"
30
30
  ></app-service-workflow-editor>
31
31
 
32
32
  <app-service-workflow-add-form workflow-id="main-flow"></app-service-workflow-add-form>
33
+ <app-service-workflow-edit-node-form
34
+ workflow-id="main-flow"
35
+ @close="handleEditClose"
36
+ ></app-service-workflow-edit-node-form>
33
37
  ```
34
38
 
35
- `workflow-id` connects one editor to one external add form through Pinia. The consumer owns the
36
- Pinia instance; the library never installs or replaces it. The add form can be positioned anywhere
37
- in the application and appears when the editor toolbar or a child placeholder requests creation.
39
+ `workflow-id` connects one editor to external add and edit forms through Pinia. The consumer owns
40
+ the Pinia instance; the library never installs or replaces it. Both forms can be positioned
41
+ anywhere in the application. Selecting an editable `screen`, `service`, or `identification` node
42
+ opens the matching form; saving emits the updated workflow through the editor's `v-model` and
43
+ `change` event. The edit form emits `close` whenever an active form closes.
38
44
 
39
- A non-empty flow must contain exactly one rule with `isRoot: true`. Disconnected rules, multiple
40
- parents, and cycles are supported. Invalid models remain visible in read-only mode.
45
+ The editor keeps externally supplied workflows editable, including partially configured rules and
46
+ connections. It does not validate the complete workflow or switch to a global read-only mode.
41
47
 
42
48
  Node-type descriptors may define a maximum number of outgoing children. Every rule with remaining
43
49
  capacity displays one rolling purple add placeholder, regardless of how many slots remain.
package/dist/main.d.ts CHANGED
@@ -2,8 +2,12 @@ import { App } from 'vue';
2
2
  import { ComponentOptionsMixin } from 'vue';
3
3
  import { ComponentProvideOptions } from 'vue';
4
4
  import { ComputedRef } from 'vue';
5
+ import { CreateIdentificationRuleDTO } from '@opens/gateways/chat-config';
6
+ import { CreateScreenRuleDTO } from '@opens/gateways/chat-config';
7
+ import { CreateServiceRuleDTO } from '@opens/gateways/chat-config';
5
8
  import { DefineComponent } from 'vue';
6
9
  import { PublicProps } from 'vue';
10
+ import { Rule } from '@opens/gateways/chat-config';
7
11
 
8
12
  declare type __VLS_Props = {
9
13
  workflowId: string;
@@ -11,19 +15,29 @@ declare type __VLS_Props = {
11
15
 
12
16
  declare type __VLS_Props_2 = {
13
17
  workflowId: string;
18
+ };
19
+
20
+ declare type __VLS_Props_3 = {
21
+ workflowId: string;
14
22
  modelValue: any;
15
23
  allowedNodeTypes?: any[];
16
24
  };
17
25
 
18
26
  export declare const AppServiceWorkflowAddForm: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
19
27
 
20
- export declare const AppServiceWorkflowEditor: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
28
+ export declare const AppServiceWorkflowEditNodeForm: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
29
+ close: () => any;
30
+ }, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
31
+ onClose?: (() => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
33
+
34
+ export declare const AppServiceWorkflowEditor: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
21
35
  "update:modelValue": (flow: any) => any;
22
36
  change: (flow: any, mutation: WorkflowMutation) => any;
23
37
  node: (rule: any) => any;
24
38
  "invalid-change": (invalid: InvalidChange) => any;
25
39
  "invalid-model": (invalid: InvalidModel) => any;
26
- }, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
40
+ }, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{
27
41
  "onUpdate:modelValue"?: ((flow: any) => any) | undefined;
28
42
  onChange?: ((flow: any, mutation: WorkflowMutation) => any) | undefined;
29
43
  onNode?: ((rule: any) => any) | undefined;
@@ -56,15 +70,24 @@ export declare interface NormalizedNodeType {
56
70
  maxChildren?: number;
57
71
  }
58
72
 
59
- export declare interface ServiceWorkflowEditorChannel {
73
+ export declare type ServiceWorkflowEditorChannel = ReturnType<typeof useServiceWorkflowEditorChannel>;
74
+
75
+ export declare const useServiceWorkflowEditorChannel: (workflowId: string) => {
60
76
  request: ComputedRef<WorkflowAddRequest | undefined>;
77
+ editRequest: ComputedRef< {
78
+ workflowId: string;
79
+ rule: Rule & {
80
+ action: (CreateScreenRuleDTO | CreateServiceRuleDTO | CreateIdentificationRuleDTO)["action"];
81
+ };
82
+ } | undefined>;
61
83
  nodeTypes: ComputedRef<NormalizedNodeType[]>;
62
84
  requestAdd: (parentRule?: any) => boolean;
85
+ requestEdit: (rule: Parameters<(id: string, rule: Rule) => boolean>[1]) => boolean;
63
86
  cancelAdd: () => void;
64
- confirmAdd: (nodeType: NormalizedNodeType) => boolean;
65
- }
66
-
67
- export declare const useServiceWorkflowEditorChannel: (workflowId: string) => ServiceWorkflowEditorChannel;
87
+ cancelEdit: () => void;
88
+ confirmAdd: (nodeType: Parameters<(id: string, nodeType: NormalizedNodeType) => boolean>[1]) => boolean;
89
+ confirmEdit: (payload: Parameters<(id: string, payload: CreateScreenRuleDTO | CreateServiceRuleDTO | CreateIdentificationRuleDTO) => boolean>[1]) => boolean;
90
+ };
68
91
 
69
92
  export declare interface WorkflowAddRequest {
70
93
  workflowId: string;
@@ -76,6 +99,9 @@ export declare type WorkflowMutation = {
76
99
  type: 'add-node';
77
100
  nodeId: string;
78
101
  parentId?: string;
102
+ } | {
103
+ type: 'edit-node';
104
+ nodeId: string;
79
105
  } | {
80
106
  type: 'delete-node';
81
107
  nodeId: string;