@steedos-labs/plugin-workflow 3.0.78 → 3.0.80

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.
@@ -1,5 +1,5 @@
1
1
  waitForThing(window, 'antd').then(function(){
2
- var v = '3.0.78';
2
+ var v = '3.0.80';
3
3
  loadJs('/amis-renderer/amis-renderer.js?v=' + v);
4
4
  loadCss('/amis-renderer/amis-renderer.css?v=' + v)
5
5
  })
@@ -37,6 +37,7 @@ async function upgradeFlowByForm(flow, formVersionId, options) {
37
37
  'created': now,
38
38
  'created_by': currentUserId,
39
39
  'steps': flow.current.steps,
40
+ 'nextEvents': flow.current.nextEvents || {},
40
41
  '_rev': flow.current._rev + 1,
41
42
  'flow': flow._id,
42
43
  'form_version': formVersionId,
@@ -219,6 +220,7 @@ async function upgradeFlow(flowCome, userId, flowId) {
219
220
  'created': now,
220
221
  'created_by': userId,
221
222
  'steps': flowCome['current']['steps'],
223
+ 'nextEvents': flowCome['current']['nextEvents'] || {},
222
224
  'form_version': flow.current.form_version,
223
225
  '_rev': flow.current._rev,
224
226
  'flow': flowId
@@ -233,7 +235,8 @@ async function upgradeFlow(flowCome, userId, flowId) {
233
235
  updateObj.$set = {
234
236
  'current.modified': now,
235
237
  'current.modified_by': userId,
236
- 'current.steps': flowCome["current"]["steps"]
238
+ 'current.steps': flowCome["current"]["steps"],
239
+ 'current.nextEvents': flowCome["current"]["nextEvents"] || {}
237
240
  };
238
241
  }
239
242
 
@@ -571,7 +574,8 @@ async function workflow(uid, spaceId, form, enabled, company_id, options = {}) {
571
574
  created_by: uid,
572
575
  modified: new Date(),
573
576
  modified_by: uid,
574
- steps: flow.current?.steps || []
577
+ steps: flow.current?.steps || [],
578
+ nextEvents: flow.current?.nextEvents || {}
575
579
  };
576
580
 
577
581
  // Process steps
@@ -9,45 +9,125 @@ amis_schema: |-
9
9
  "id": "u:instance_delete",
10
10
  "onEvent": {
11
11
  "click": {
12
+ "weight": 0,
12
13
  "actions": [
13
14
  {
14
- "args": {
15
- "api": {
16
- "url": "/api/workflow/v2/remove",
17
- "method": "post",
18
- "requestAdaptor": "api.data = {\n instance: {\n _id: context.context._id\n }\n}\n\nreturn api;",
19
- "data": {
20
- "record_id": "$record_id"
15
+ "actionType": "dialog",
16
+ "dialog": {
17
+ "type": "dialog",
18
+ "title": "${'CustomLabels.alert_info' | t}",
19
+ "body": [
20
+ {
21
+ "type": "tpl",
22
+ "tpl": "${'CustomLabels.confirm_delete' | t}",
23
+ "wrapperComponent": "",
24
+ "inline": false,
25
+ "visibleOn": "${!deleting}",
26
+ "id": "u:0c42a6d112ab"
27
+ },
28
+ {
29
+ "type": "wrapper",
30
+ "className": "flex items-center gap-2 text-gray-600",
31
+ "visibleOn": "${deleting}",
32
+ "body": [
33
+ { "type": "spinner", "show": true, "size": "sm" },
34
+ { "type": "tpl", "tpl": "正在删除,请稍候..." }
35
+ ]
21
36
  }
22
- },
23
- "messages": {}
24
- },
25
- "actionType": "ajax"
26
- },
27
- {
28
- "ignoreError": false,
29
- "actionType": "custom",
30
- "script": "try { sessionStorage.removeItem('flowId'); sessionStorage.removeItem('categoryId'); } catch(e) {} SteedosWorkflow.Instance.changed=false; navigate('/app/approve_workflow/instances/view/none?side_object=instances&side_listview_id=draft&additionalFilters=&flowId=&categoryId=')"
31
- },
32
- {
33
- "actionType": "wait",
34
- "args": {
35
- "time": 500
36
- }
37
- },
38
- {
39
- "actionType": "custom",
40
- "script":"window.$('.list-view-btn-reload').click()"
41
- },
42
- {
43
- "actionType": "custom",
44
- "script":"window.postMessage({ type: 'approval-tree-menu:reload' }, '*')"
45
- }
46
- ],
47
- "weight": 0
37
+ ],
38
+ "showCloseButton": true,
39
+ "showErrorMsg": true,
40
+ "showLoading": true,
41
+ "closeOnEsc": false,
42
+ "className": "app-popover",
43
+ "id": "u:42923ccc1c7f",
44
+ "actions": [
45
+ {
46
+ "type": "button",
47
+ "label": "${'Cancel' | t}",
48
+ "onEvent": {
49
+ "click": {
50
+ "actions": [
51
+ {
52
+ "actionType": "closeDialog"
53
+ }
54
+ ]
55
+ }
56
+ },
57
+ "id": "u:452a4266d210"
58
+ },
59
+ {
60
+ "type": "button",
61
+ "label": "${'OK' | t}",
62
+ "level": "danger",
63
+ "id": "u:fa92a7ba67ee",
64
+ "loadingOn": "${deleting}",
65
+ "onEvent": {
66
+ "click": {
67
+ "actions": [
68
+ {
69
+ "actionType": "setValue",
70
+ "componentId": "u:42923ccc1c7f",
71
+ "args": { "value": { "deleting": true } }
72
+ },
73
+ {
74
+ "actionType": "ajax",
75
+ "outputVar": "deleteResult",
76
+ "args": {
77
+ "options": {},
78
+ "messages": {},
79
+ "api": {
80
+ "url": "/api/workflow/v2/remove",
81
+ "method": "post",
82
+ "requestAdaptor": "api.data = {\n instance: {\n _id: context.context._id\n }\n}\n\nreturn api;",
83
+ "data": {
84
+ "record_id": "$record_id"
85
+ }
86
+ }
87
+ }
88
+ },
89
+ {
90
+ "actionType": "setValue",
91
+ "componentId": "u:42923ccc1c7f",
92
+ "args": { "value": { "deleting": false } }
93
+ },
94
+ {
95
+ "actionType": "closeDialog",
96
+ "expression": "${event.data.deleteResult.responseStatus===0}"
97
+ },
98
+ {
99
+ "ignoreError": false,
100
+ "actionType": "custom",
101
+ "expression": "${event.data.deleteResult.responseStatus===0}",
102
+ "script": "try { sessionStorage.removeItem('flowId'); sessionStorage.removeItem('categoryId'); } catch(e) {}\ntry { if (window.SteedosWorkflow && window.SteedosWorkflow.Instance) { window.SteedosWorkflow.Instance.changed = false; } } catch(e) {}\nvar params = new URLSearchParams(window.location.search);\nvar sideListviewId = params.get('side_listview_id') || 'draft';\nvar appId = (event.data && event.data.appId) || 'approve_workflow';\nnavigate('/app/' + appId + '/instances/view/none?side_object=instances&side_listview_id=' + sideListviewId + '&additionalFilters=&flowId=&categoryId=');"
103
+ },
104
+ {
105
+ "actionType": "wait",
106
+ "expression": "${event.data.deleteResult.responseStatus===0}",
107
+ "args": {
108
+ "time": 500
109
+ }
110
+ },
111
+ {
112
+ "actionType": "custom",
113
+ "expression": "${event.data.deleteResult.responseStatus===0}",
114
+ "script": "try { window.$('.list-view-btn-reload').click(); } catch(e) {}"
115
+ },
116
+ {
117
+ "actionType": "custom",
118
+ "expression": "${event.data.deleteResult.responseStatus===0}",
119
+ "script": "try { window.postMessage({ type: 'approval-tree-menu:reload' }, '*'); } catch(e) {}"
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ }
125
+ ]
126
+ }
127
+ }
128
+ ]
48
129
  }
49
130
  },
50
- "confirmText": "${'CustomLabels.confirm_delete' | t}",
51
131
  "hiddenOn": "(window.Builder && window.Builder.settings && window.Builder.settings.STEEDOS_PUBLIC_WORKFLOW_READONLY === 'true') || !(record.box == 'draft' || (record.box == 'monitor' && context.user.is_space_admin) \n || (_.includes(record.flow.perms.users_can_admin, context.user.userId) \n || _.intersection(record.flow.perms.orgs_can_admin, context.user.organizations_parents) > 0)\n || (record.box == 'inbox' && record.state == 'draft' && record.forward_from_instance))"
52
132
  }
53
133
  ],
@@ -64,4 +144,4 @@ label: 删除
64
144
  'on': record_only
65
145
  type: amis_button
66
146
  visible: true
67
- sort: 2500
147
+ sort: 2500
@@ -27,7 +27,17 @@ amis_schema: |-
27
27
  "tpl": "${'CustomLabels.confirm_delete' | t}",
28
28
  "wrapperComponent": "",
29
29
  "inline": false,
30
+ "visibleOn": "${!deleting}",
30
31
  "id": "u:0c42a6d112aa"
32
+ },
33
+ {
34
+ "type": "wrapper",
35
+ "className": "flex items-center gap-2 text-gray-600",
36
+ "visibleOn": "${deleting}",
37
+ "body": [
38
+ { "type": "spinner", "show": true, "size": "sm" },
39
+ { "type": "tpl", "tpl": "正在删除,请稍候..." }
40
+ ]
31
41
  }
32
42
  ],
33
43
  "showCloseButton": true,
@@ -54,9 +64,15 @@ amis_schema: |-
54
64
  {
55
65
  "type": "button",
56
66
  "label": "${'OK' | t}",
67
+ "loadingOn": "${deleting}",
57
68
  "onEvent": {
58
69
  "click": {
59
70
  "actions": [
71
+ {
72
+ "actionType": "setValue",
73
+ "componentId": "u:42923ccc1c7e",
74
+ "args": { "value": { "deleting": true } }
75
+ },
60
76
  {
61
77
  "actionType": "ajax",
62
78
  "outputVar": "responseResult",
@@ -78,6 +94,11 @@ amis_schema: |-
78
94
  }
79
95
  }
80
96
  },
97
+ {
98
+ "actionType": "setValue",
99
+ "componentId": "u:42923ccc1c7e",
100
+ "args": { "value": { "deleting": false } }
101
+ },
81
102
  {
82
103
  "actionType": "closeDialog",
83
104
  "expression": "${event.data.responseResult.responseStatus===0}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.78",
3
+ "version": "3.0.80",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "files": [