gbflowengine 0.1.0 → 0.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 +271 -271
- package/dist/gbflowengine.css +1 -1
- package/dist/gbflowengine.js +8232 -6913
- package/dist/gbflowengine.js.map +1 -1
- package/dist/gbflowengine.umd.cjs +2 -2
- package/dist/gbflowengine.umd.cjs.map +1 -1
- package/package.json +85 -84
- package/src/center/DefinitionInspect.vue +291 -291
- package/src/center/FlowCenter.vue +33 -33
- package/src/center/index.js +29 -29
- package/src/center/storage.js +748 -748
- package/src/core/flow/condition.js +160 -160
- package/src/core/flow/customNode.js +385 -385
- package/src/core/flow/defaults.js +124 -124
- package/src/core/flow/flowConstant.js +265 -265
- package/src/core/flow/flowNodeUtils.js +29 -29
- package/src/core/flow/index.js +47 -47
- package/src/core/flow/node.js +44 -44
- package/src/core/flow/nodeFactory.js +58 -58
- package/src/core/flow/prediction.js +325 -325
- package/src/core/flow/schema.js +864 -864
- package/src/definition/FlowDefinitionDesigner.vue +338 -338
- package/src/definition/index.js +9 -9
- package/src/index.js +39 -39
- package/src/storage.js +200 -200
- package/src/testing/FlowTestPanel.vue +2502 -2502
- package/src/testing/UserConfigDrawer.vue +376 -376
- package/src/testing/diagram/FlowProgressDiagram.vue +318 -318
- package/src/testing/diagramModel.js +517 -517
- package/src/testing/index.js +23 -23
- package/src/testing/mock.js +246 -246
- package/src/testing/oaExecutors.js +51 -51
- package/src/testing/oaSeed.js +467 -467
- package/src/testing/sample.js +412 -412
- package/src/testing/seed.js +122 -122
- package/src/utils/format.js +27 -27
- package/src/visual/FlowCanvas.vue +440 -440
- package/src/visual/NodeProgressDetail.vue +43 -43
- package/src/visual/NodeStatusBadge.vue +17 -17
- package/src/visual/NodeWrap.vue +46 -46
- package/src/visual/ScWorkflow.vue +49 -49
- package/src/visual/SelectDialog.vue +459 -459
- package/src/visual/conditionHelpers.js +116 -116
- package/src/visual/index.js +6 -6
- package/src/visual/nodes/AddNode.vue +222 -222
- package/src/visual/nodes/ApproverNode.vue +347 -347
- package/src/visual/nodes/BranchNode.vue +441 -441
- package/src/visual/nodes/CustomNode.vue +339 -339
- package/src/visual/nodes/EndNode.vue +21 -21
- package/src/visual/nodes/PassNode.vue +100 -100
- package/src/visual/nodes/PromoterNode.vue +134 -134
- package/src/visual/nodes/RejectNode.vue +100 -100
- package/src/visual/nodes/SendNode.vue +151 -151
- package/src/visual/styles.scss +879 -879
- package/src/visual/useScNodeStatus.js +18 -18
- package/src/workbench/OaWorkbench.vue +1341 -1341
- package/src/workbench/components/ApprovalWorkspace.vue +2090 -2090
- package/src/workbench/components/CategoryIcon.vue +74 -74
- package/src/workbench/components/NotificationIcon.vue +73 -73
- package/src/workbench/components/ProcessSteps.vue +557 -557
- package/src/workbench/components/ResubmitDialog.vue +227 -227
- package/src/workbench/components/SidebarNav.vue +138 -138
- package/src/workbench/components/StartFlowDialog.vue +1058 -1058
- package/src/workbench/components/UserAvatar.vue +68 -68
- package/src/workbench/model.js +1080 -1080
- package/src/workbench/pages/DesignPage.vue +798 -798
- package/src/workbench/pages/HomePage.vue +1050 -1050
- package/src/workbench/pages/MonitorPage.vue +1029 -1029
- package/src/workbench/pages/NotificationsPage.vue +554 -554
- package/src/workbench/pages/RequestsPage.vue +644 -644
- package/src/workbench/pages/TaskCenterPage.vue +1155 -1155
- package/src/workbench/pages/TemplatesPage.vue +680 -680
- package/src/workbench/styles.scss +555 -555
- package/types/center.d.ts +5 -5
- package/types/core.d.ts +479 -479
- package/types/definition.d.ts +4 -4
- package/types/index.d.ts +34 -34
- package/types/testing.d.ts +20 -20
- package/types/visual.d.ts +20 -20
package/src/core/flow/index.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
export * from './flowConstant.js'
|
|
2
|
-
export { findNodeById, hasEndNode, ensureEndNode } from './node.js'
|
|
3
|
-
export * from './nodeFactory.js'
|
|
4
|
-
export {
|
|
5
|
-
traverseNodes,
|
|
6
|
-
getAllNodes,
|
|
7
|
-
getNodeStatistics,
|
|
8
|
-
countNodes
|
|
9
|
-
} from './flowNodeUtils.js'
|
|
10
|
-
export * from './schema.js'
|
|
11
|
-
export * from './condition.js'
|
|
12
|
-
export * from './runtime.js'
|
|
13
|
-
export * from './prediction.js'
|
|
14
|
-
export * from './defaults.js'
|
|
15
|
-
export * from './customNode.js'
|
|
16
|
-
export {
|
|
17
|
-
FormVariable,
|
|
18
|
-
computeDataType,
|
|
19
|
-
BaseDataType,
|
|
20
|
-
ComponentType,
|
|
21
|
-
ConditionOperator,
|
|
22
|
-
OPERATOR_LABEL_MAP,
|
|
23
|
-
getOperatorsForDataType,
|
|
24
|
-
operatorNeedsValue,
|
|
25
|
-
enrichFormVariables,
|
|
26
|
-
findFormVariable,
|
|
27
|
-
getAllFormComponents,
|
|
28
|
-
countFormComponents,
|
|
29
|
-
filterValidComponents,
|
|
30
|
-
validateComponentConfig,
|
|
31
|
-
normalizeForm,
|
|
32
|
-
validateForm,
|
|
33
|
-
importForm,
|
|
34
|
-
exportForm,
|
|
35
|
-
FORM_KIND,
|
|
36
|
-
downloadJSON,
|
|
37
|
-
downloadText,
|
|
38
|
-
readTextFile,
|
|
39
|
-
pickJSONFile,
|
|
40
|
-
sanitizeFileName,
|
|
41
|
-
COMPONENT_TYPES,
|
|
42
|
-
COMPONENT_TYPE_LABELS,
|
|
43
|
-
OPTION_COMPONENT_TYPES,
|
|
44
|
-
generateComponentId,
|
|
45
|
-
ensureComponentId,
|
|
46
|
-
getFieldName
|
|
47
|
-
} from 'gbformdesign/core'
|
|
1
|
+
export * from './flowConstant.js'
|
|
2
|
+
export { findNodeById, hasEndNode, ensureEndNode } from './node.js'
|
|
3
|
+
export * from './nodeFactory.js'
|
|
4
|
+
export {
|
|
5
|
+
traverseNodes,
|
|
6
|
+
getAllNodes,
|
|
7
|
+
getNodeStatistics,
|
|
8
|
+
countNodes
|
|
9
|
+
} from './flowNodeUtils.js'
|
|
10
|
+
export * from './schema.js'
|
|
11
|
+
export * from './condition.js'
|
|
12
|
+
export * from './runtime.js'
|
|
13
|
+
export * from './prediction.js'
|
|
14
|
+
export * from './defaults.js'
|
|
15
|
+
export * from './customNode.js'
|
|
16
|
+
export {
|
|
17
|
+
FormVariable,
|
|
18
|
+
computeDataType,
|
|
19
|
+
BaseDataType,
|
|
20
|
+
ComponentType,
|
|
21
|
+
ConditionOperator,
|
|
22
|
+
OPERATOR_LABEL_MAP,
|
|
23
|
+
getOperatorsForDataType,
|
|
24
|
+
operatorNeedsValue,
|
|
25
|
+
enrichFormVariables,
|
|
26
|
+
findFormVariable,
|
|
27
|
+
getAllFormComponents,
|
|
28
|
+
countFormComponents,
|
|
29
|
+
filterValidComponents,
|
|
30
|
+
validateComponentConfig,
|
|
31
|
+
normalizeForm,
|
|
32
|
+
validateForm,
|
|
33
|
+
importForm,
|
|
34
|
+
exportForm,
|
|
35
|
+
FORM_KIND,
|
|
36
|
+
downloadJSON,
|
|
37
|
+
downloadText,
|
|
38
|
+
readTextFile,
|
|
39
|
+
pickJSONFile,
|
|
40
|
+
sanitizeFileName,
|
|
41
|
+
COMPONENT_TYPES,
|
|
42
|
+
COMPONENT_TYPE_LABELS,
|
|
43
|
+
OPTION_COMPONENT_TYPES,
|
|
44
|
+
generateComponentId,
|
|
45
|
+
ensureComponentId,
|
|
46
|
+
getFieldName
|
|
47
|
+
} from 'gbformdesign/core'
|
package/src/core/flow/node.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { FlowNodeType } from './flowConstant.js'
|
|
2
|
-
import { createEndNode } from './nodeFactory.js'
|
|
3
|
-
|
|
4
|
-
export function findNodeById(node, targetId) {
|
|
5
|
-
if (!node) return null
|
|
6
|
-
if (node.nodeId === targetId) return node
|
|
7
|
-
if (node.childNode) {
|
|
8
|
-
const found = findNodeById(node.childNode, targetId)
|
|
9
|
-
if (found) return found
|
|
10
|
-
}
|
|
11
|
-
for (const branch of node.branchList || []) {
|
|
12
|
-
const found = findNodeById(branch, targetId)
|
|
13
|
-
if (found) return found
|
|
14
|
-
}
|
|
15
|
-
return null
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function findLastNonEndNode(node) {
|
|
19
|
-
if (!node || node.type === FlowNodeType.END) return null
|
|
20
|
-
if (node.childNode) {
|
|
21
|
-
return node.childNode.type === FlowNodeType.END ? node : findLastNonEndNode(node.childNode)
|
|
22
|
-
}
|
|
23
|
-
let last = node
|
|
24
|
-
for (const branch of node.branchList || []) {
|
|
25
|
-
const branchEnd = findLastNonEndNode(branch)
|
|
26
|
-
if (branchEnd) last = branchEnd
|
|
27
|
-
}
|
|
28
|
-
return last
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function hasEndNode(node) {
|
|
32
|
-
if (!node) return false
|
|
33
|
-
if (node.type === FlowNodeType.END) return true
|
|
34
|
-
if (node.childNode && hasEndNode(node.childNode)) return true
|
|
35
|
-
return (node.branchList || []).some(hasEndNode)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function ensureEndNode(rootNode) {
|
|
39
|
-
if (!rootNode || hasEndNode(rootNode)) return rootNode
|
|
40
|
-
const lastNode = findLastNonEndNode(rootNode)
|
|
41
|
-
if (!lastNode || lastNode.type === FlowNodeType.END) return rootNode
|
|
42
|
-
lastNode.childNode = createEndNode()
|
|
43
|
-
return rootNode
|
|
44
|
-
}
|
|
1
|
+
import { FlowNodeType } from './flowConstant.js'
|
|
2
|
+
import { createEndNode } from './nodeFactory.js'
|
|
3
|
+
|
|
4
|
+
export function findNodeById(node, targetId) {
|
|
5
|
+
if (!node) return null
|
|
6
|
+
if (node.nodeId === targetId) return node
|
|
7
|
+
if (node.childNode) {
|
|
8
|
+
const found = findNodeById(node.childNode, targetId)
|
|
9
|
+
if (found) return found
|
|
10
|
+
}
|
|
11
|
+
for (const branch of node.branchList || []) {
|
|
12
|
+
const found = findNodeById(branch, targetId)
|
|
13
|
+
if (found) return found
|
|
14
|
+
}
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function findLastNonEndNode(node) {
|
|
19
|
+
if (!node || node.type === FlowNodeType.END) return null
|
|
20
|
+
if (node.childNode) {
|
|
21
|
+
return node.childNode.type === FlowNodeType.END ? node : findLastNonEndNode(node.childNode)
|
|
22
|
+
}
|
|
23
|
+
let last = node
|
|
24
|
+
for (const branch of node.branchList || []) {
|
|
25
|
+
const branchEnd = findLastNonEndNode(branch)
|
|
26
|
+
if (branchEnd) last = branchEnd
|
|
27
|
+
}
|
|
28
|
+
return last
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function hasEndNode(node) {
|
|
32
|
+
if (!node) return false
|
|
33
|
+
if (node.type === FlowNodeType.END) return true
|
|
34
|
+
if (node.childNode && hasEndNode(node.childNode)) return true
|
|
35
|
+
return (node.branchList || []).some(hasEndNode)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function ensureEndNode(rootNode) {
|
|
39
|
+
if (!rootNode || hasEndNode(rootNode)) return rootNode
|
|
40
|
+
const lastNode = findLastNonEndNode(rootNode)
|
|
41
|
+
if (!lastNode || lastNode.type === FlowNodeType.END) return rootNode
|
|
42
|
+
lastNode.childNode = createEndNode()
|
|
43
|
+
return rootNode
|
|
44
|
+
}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 流程节点工厂
|
|
3
|
-
* 负责创建和生成节点
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { FlowNodeType } from './flowConstant.js'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 生成唯一的数字ID
|
|
10
|
-
* @returns {number} 唯一的数字ID
|
|
11
|
-
*/
|
|
12
|
-
function generateNumericId() {
|
|
13
|
-
return Date.now() + Math.floor(Math.random() * 1000)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 生成唯一的节点ID
|
|
18
|
-
* @returns {number} 唯一的节点ID
|
|
19
|
-
*/
|
|
20
|
-
export function generateNodeId() {
|
|
21
|
-
return generateNumericId()
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 创建新的节点对象
|
|
26
|
-
* @param {string} type - 节点类型
|
|
27
|
-
* @param {string} name - 节点名称
|
|
28
|
-
* @returns {Object} 新的节点对象
|
|
29
|
-
*/
|
|
30
|
-
export function createNewNode(type, name) {
|
|
31
|
-
const baseNode = {
|
|
32
|
-
nodeId: generateNodeId(),
|
|
33
|
-
nodeName: name,
|
|
34
|
-
type: type,
|
|
35
|
-
childNode: null
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 为审批节点添加userList属性
|
|
39
|
-
if (type === FlowNodeType.APPROVE) {
|
|
40
|
-
baseNode.userList = []
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return baseNode
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 创建结束节点
|
|
48
|
-
* @returns {Object} 结束节点对象
|
|
49
|
-
*/
|
|
50
|
-
export function createEndNode() {
|
|
51
|
-
return {
|
|
52
|
-
nodeId: generateNodeId(),
|
|
53
|
-
nodeName: '流程结束',
|
|
54
|
-
type: FlowNodeType.END,
|
|
55
|
-
childNode: null
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 流程节点工厂
|
|
3
|
+
* 负责创建和生成节点
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { FlowNodeType } from './flowConstant.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 生成唯一的数字ID
|
|
10
|
+
* @returns {number} 唯一的数字ID
|
|
11
|
+
*/
|
|
12
|
+
function generateNumericId() {
|
|
13
|
+
return Date.now() + Math.floor(Math.random() * 1000)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 生成唯一的节点ID
|
|
18
|
+
* @returns {number} 唯一的节点ID
|
|
19
|
+
*/
|
|
20
|
+
export function generateNodeId() {
|
|
21
|
+
return generateNumericId()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 创建新的节点对象
|
|
26
|
+
* @param {string} type - 节点类型
|
|
27
|
+
* @param {string} name - 节点名称
|
|
28
|
+
* @returns {Object} 新的节点对象
|
|
29
|
+
*/
|
|
30
|
+
export function createNewNode(type, name) {
|
|
31
|
+
const baseNode = {
|
|
32
|
+
nodeId: generateNodeId(),
|
|
33
|
+
nodeName: name,
|
|
34
|
+
type: type,
|
|
35
|
+
childNode: null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 为审批节点添加userList属性
|
|
39
|
+
if (type === FlowNodeType.APPROVE) {
|
|
40
|
+
baseNode.userList = []
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return baseNode
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 创建结束节点
|
|
48
|
+
* @returns {Object} 结束节点对象
|
|
49
|
+
*/
|
|
50
|
+
export function createEndNode() {
|
|
51
|
+
return {
|
|
52
|
+
nodeId: generateNodeId(),
|
|
53
|
+
nodeName: '流程结束',
|
|
54
|
+
type: FlowNodeType.END,
|
|
55
|
+
childNode: null
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|