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.
Files changed (79) hide show
  1. package/README.md +271 -271
  2. package/dist/gbflowengine.css +1 -1
  3. package/dist/gbflowengine.js +8232 -6913
  4. package/dist/gbflowengine.js.map +1 -1
  5. package/dist/gbflowengine.umd.cjs +2 -2
  6. package/dist/gbflowengine.umd.cjs.map +1 -1
  7. package/package.json +85 -84
  8. package/src/center/DefinitionInspect.vue +291 -291
  9. package/src/center/FlowCenter.vue +33 -33
  10. package/src/center/index.js +29 -29
  11. package/src/center/storage.js +748 -748
  12. package/src/core/flow/condition.js +160 -160
  13. package/src/core/flow/customNode.js +385 -385
  14. package/src/core/flow/defaults.js +124 -124
  15. package/src/core/flow/flowConstant.js +265 -265
  16. package/src/core/flow/flowNodeUtils.js +29 -29
  17. package/src/core/flow/index.js +47 -47
  18. package/src/core/flow/node.js +44 -44
  19. package/src/core/flow/nodeFactory.js +58 -58
  20. package/src/core/flow/prediction.js +325 -325
  21. package/src/core/flow/schema.js +864 -864
  22. package/src/definition/FlowDefinitionDesigner.vue +338 -338
  23. package/src/definition/index.js +9 -9
  24. package/src/index.js +39 -39
  25. package/src/storage.js +200 -200
  26. package/src/testing/FlowTestPanel.vue +2502 -2502
  27. package/src/testing/UserConfigDrawer.vue +376 -376
  28. package/src/testing/diagram/FlowProgressDiagram.vue +318 -318
  29. package/src/testing/diagramModel.js +517 -517
  30. package/src/testing/index.js +23 -23
  31. package/src/testing/mock.js +246 -246
  32. package/src/testing/oaExecutors.js +51 -51
  33. package/src/testing/oaSeed.js +467 -467
  34. package/src/testing/sample.js +412 -412
  35. package/src/testing/seed.js +122 -122
  36. package/src/utils/format.js +27 -27
  37. package/src/visual/FlowCanvas.vue +440 -440
  38. package/src/visual/NodeProgressDetail.vue +43 -43
  39. package/src/visual/NodeStatusBadge.vue +17 -17
  40. package/src/visual/NodeWrap.vue +46 -46
  41. package/src/visual/ScWorkflow.vue +49 -49
  42. package/src/visual/SelectDialog.vue +459 -459
  43. package/src/visual/conditionHelpers.js +116 -116
  44. package/src/visual/index.js +6 -6
  45. package/src/visual/nodes/AddNode.vue +222 -222
  46. package/src/visual/nodes/ApproverNode.vue +347 -347
  47. package/src/visual/nodes/BranchNode.vue +441 -441
  48. package/src/visual/nodes/CustomNode.vue +339 -339
  49. package/src/visual/nodes/EndNode.vue +21 -21
  50. package/src/visual/nodes/PassNode.vue +100 -100
  51. package/src/visual/nodes/PromoterNode.vue +134 -134
  52. package/src/visual/nodes/RejectNode.vue +100 -100
  53. package/src/visual/nodes/SendNode.vue +151 -151
  54. package/src/visual/styles.scss +879 -879
  55. package/src/visual/useScNodeStatus.js +18 -18
  56. package/src/workbench/OaWorkbench.vue +1341 -1341
  57. package/src/workbench/components/ApprovalWorkspace.vue +2090 -2090
  58. package/src/workbench/components/CategoryIcon.vue +74 -74
  59. package/src/workbench/components/NotificationIcon.vue +73 -73
  60. package/src/workbench/components/ProcessSteps.vue +557 -557
  61. package/src/workbench/components/ResubmitDialog.vue +227 -227
  62. package/src/workbench/components/SidebarNav.vue +138 -138
  63. package/src/workbench/components/StartFlowDialog.vue +1058 -1058
  64. package/src/workbench/components/UserAvatar.vue +68 -68
  65. package/src/workbench/model.js +1080 -1080
  66. package/src/workbench/pages/DesignPage.vue +798 -798
  67. package/src/workbench/pages/HomePage.vue +1050 -1050
  68. package/src/workbench/pages/MonitorPage.vue +1029 -1029
  69. package/src/workbench/pages/NotificationsPage.vue +554 -554
  70. package/src/workbench/pages/RequestsPage.vue +644 -644
  71. package/src/workbench/pages/TaskCenterPage.vue +1155 -1155
  72. package/src/workbench/pages/TemplatesPage.vue +680 -680
  73. package/src/workbench/styles.scss +555 -555
  74. package/types/center.d.ts +5 -5
  75. package/types/core.d.ts +479 -479
  76. package/types/definition.d.ts +4 -4
  77. package/types/index.d.ts +34 -34
  78. package/types/testing.d.ts +20 -20
  79. package/types/visual.d.ts +20 -20
@@ -1,117 +1,117 @@
1
- import { findFormVariable, OPERATOR_LABEL_MAP } from 'gbformdesign'
2
-
3
- export function getVariable(formVariables, variableName) {
4
- return findFormVariable(formVariables, variableName)
5
- }
6
-
7
- /**
8
- * Maps a form variable to the editor control used for its comparison value.
9
- */
10
- export function getValueControl(formVariables, variableName) {
11
- const variable = getVariable(formVariables, variableName)
12
- if (!variable) return 'text'
13
- const dataType = variable.dataType
14
- if (dataType === 'integer' || dataType === 'decimal') return 'number'
15
- if (dataType === 'date') return 'date'
16
- if (dataType === 'datetime') return 'datetime'
17
- if (dataType === 'array') return 'array'
18
- if (dataType === 'boolean') return 'boolean'
19
- if (['radio-group', 'select'].includes(variable.componentType)) return 'options'
20
- return 'text'
21
- }
22
-
23
- export function getVariableOptions(formVariables, variableName) {
24
- const variable = getVariable(formVariables, variableName)
25
- return variable?.getOptions?.() || variable?.metadata?.options || []
26
- }
27
-
28
- export function getVariableDateFormat(formVariables, variableName) {
29
- const variable = getVariable(formVariables, variableName)
30
- return variable?.getDateFormat?.() || variable?.metadata?.dateFormat || 'date'
31
- }
32
-
33
- export function isIntegerVariable(formVariables, variableName) {
34
- const variable = getVariable(formVariables, variableName)
35
- return variable?.dataType === 'integer'
36
- }
37
-
38
- export function operatorLabel(operator) {
39
- return OPERATOR_LABEL_MAP[operator] || operator || ''
40
- }
41
-
42
- export function operatorsForVariable(formVariables, variableName) {
43
- const variable = getVariable(formVariables, variableName)
44
- const dataType = variable?.dataType || 'string'
45
- return Object.entries(OPERATOR_LABEL_MAP)
46
- .filter(([value]) => {
47
- if (value === 'is_empty' || value === 'is_not_empty') return true
48
- if (dataType === 'array') return ['contains', 'not_contains'].includes(value)
49
- if (dataType === 'boolean') return ['==', '!='].includes(value)
50
- if (['integer', 'decimal', 'date', 'datetime'].includes(dataType)) {
51
- return ['==', '!=', '>', '<', '>=', '<='].includes(value)
52
- }
53
- return ['==', '!=', 'contains', 'not_contains'].includes(value)
54
- })
55
- .map(([value, label]) => ({ value, label }))
56
- }
57
-
58
- export function needsValue(operator) {
59
- return !['is_empty', 'is_not_empty'].includes(operator)
60
- }
61
-
62
- /**
63
- * Condition summary in the reference project's style:
64
- * `field operator value` joined by 和 / 或者.
65
- */
66
- export function summarizeConditions(formVariables, conditions) {
67
- if (!Array.isArray(conditions) || conditions.length === 0) return ''
68
- return conditions
69
- .map((condition, index) => {
70
- const label = condition.variableName || condition.variable || '未设置'
71
- const op = operatorLabel(condition.operator)
72
- let text
73
- if (!needsValue(condition.operator)) {
74
- text = `${label}${op}`
75
- } else {
76
- const value = Array.isArray(condition.value) ? condition.value.join(',') : condition.value
77
- text = `${label}${op}${value === undefined || value === null ? '' : value}`
78
- }
79
- if (index < conditions.length - 1) {
80
- text += condition.logic === 'OR' ? ' 或者 ' : ' 和 '
81
- }
82
- return text
83
- })
84
- .join('')
85
- }
86
-
87
- /**
88
- * The designer edits conditions as OR-separated groups (flowlong style),
89
- * while the schema stores a flat list linked by the preceding `logic` flag.
90
- */
91
- export function groupsFromConditions(conditions) {
92
- const list = Array.isArray(conditions) ? conditions : []
93
- const groups = [[]]
94
- list.forEach((condition) => {
95
- groups[groups.length - 1].push({ ...condition })
96
- if (condition.logic === 'OR') groups.push([])
97
- })
98
- const last = groups[groups.length - 1]
99
- if (last.length === 0) groups.pop()
100
- if (groups.length === 0) groups.push([])
101
- return groups
102
- }
103
-
104
- export function conditionsFromGroups(groups) {
105
- const result = []
106
- groups.forEach((group, groupIndex) => {
107
- group.forEach((condition, index) => {
108
- const isLastOfGroup = index === group.length - 1
109
- const isLastGroup = groupIndex === groups.length - 1
110
- result.push({
111
- ...condition,
112
- logic: isLastOfGroup && !isLastGroup ? 'OR' : 'AND'
113
- })
114
- })
115
- })
116
- return result
1
+ import { findFormVariable, OPERATOR_LABEL_MAP } from 'gbformdesign'
2
+
3
+ export function getVariable(formVariables, variableName) {
4
+ return findFormVariable(formVariables, variableName)
5
+ }
6
+
7
+ /**
8
+ * Maps a form variable to the editor control used for its comparison value.
9
+ */
10
+ export function getValueControl(formVariables, variableName) {
11
+ const variable = getVariable(formVariables, variableName)
12
+ if (!variable) return 'text'
13
+ const dataType = variable.dataType
14
+ if (dataType === 'integer' || dataType === 'decimal') return 'number'
15
+ if (dataType === 'date') return 'date'
16
+ if (dataType === 'datetime') return 'datetime'
17
+ if (dataType === 'array') return 'array'
18
+ if (dataType === 'boolean') return 'boolean'
19
+ if (['radio-group', 'select'].includes(variable.componentType)) return 'options'
20
+ return 'text'
21
+ }
22
+
23
+ export function getVariableOptions(formVariables, variableName) {
24
+ const variable = getVariable(formVariables, variableName)
25
+ return variable?.getOptions?.() || variable?.metadata?.options || []
26
+ }
27
+
28
+ export function getVariableDateFormat(formVariables, variableName) {
29
+ const variable = getVariable(formVariables, variableName)
30
+ return variable?.getDateFormat?.() || variable?.metadata?.dateFormat || 'date'
31
+ }
32
+
33
+ export function isIntegerVariable(formVariables, variableName) {
34
+ const variable = getVariable(formVariables, variableName)
35
+ return variable?.dataType === 'integer'
36
+ }
37
+
38
+ export function operatorLabel(operator) {
39
+ return OPERATOR_LABEL_MAP[operator] || operator || ''
40
+ }
41
+
42
+ export function operatorsForVariable(formVariables, variableName) {
43
+ const variable = getVariable(formVariables, variableName)
44
+ const dataType = variable?.dataType || 'string'
45
+ return Object.entries(OPERATOR_LABEL_MAP)
46
+ .filter(([value]) => {
47
+ if (value === 'is_empty' || value === 'is_not_empty') return true
48
+ if (dataType === 'array') return ['contains', 'not_contains'].includes(value)
49
+ if (dataType === 'boolean') return ['==', '!='].includes(value)
50
+ if (['integer', 'decimal', 'date', 'datetime'].includes(dataType)) {
51
+ return ['==', '!=', '>', '<', '>=', '<='].includes(value)
52
+ }
53
+ return ['==', '!=', 'contains', 'not_contains'].includes(value)
54
+ })
55
+ .map(([value, label]) => ({ value, label }))
56
+ }
57
+
58
+ export function needsValue(operator) {
59
+ return !['is_empty', 'is_not_empty'].includes(operator)
60
+ }
61
+
62
+ /**
63
+ * Condition summary in the reference project's style:
64
+ * `field operator value` joined by 和 / 或者.
65
+ */
66
+ export function summarizeConditions(formVariables, conditions) {
67
+ if (!Array.isArray(conditions) || conditions.length === 0) return ''
68
+ return conditions
69
+ .map((condition, index) => {
70
+ const label = condition.variableName || condition.variable || '未设置'
71
+ const op = operatorLabel(condition.operator)
72
+ let text
73
+ if (!needsValue(condition.operator)) {
74
+ text = `${label}${op}`
75
+ } else {
76
+ const value = Array.isArray(condition.value) ? condition.value.join(',') : condition.value
77
+ text = `${label}${op}${value === undefined || value === null ? '' : value}`
78
+ }
79
+ if (index < conditions.length - 1) {
80
+ text += condition.logic === 'OR' ? ' 或者 ' : ' 和 '
81
+ }
82
+ return text
83
+ })
84
+ .join('')
85
+ }
86
+
87
+ /**
88
+ * The designer edits conditions as OR-separated groups (flowlong style),
89
+ * while the schema stores a flat list linked by the preceding `logic` flag.
90
+ */
91
+ export function groupsFromConditions(conditions) {
92
+ const list = Array.isArray(conditions) ? conditions : []
93
+ const groups = [[]]
94
+ list.forEach((condition) => {
95
+ groups[groups.length - 1].push({ ...condition })
96
+ if (condition.logic === 'OR') groups.push([])
97
+ })
98
+ const last = groups[groups.length - 1]
99
+ if (last.length === 0) groups.pop()
100
+ if (groups.length === 0) groups.push([])
101
+ return groups
102
+ }
103
+
104
+ export function conditionsFromGroups(groups) {
105
+ const result = []
106
+ groups.forEach((group, groupIndex) => {
107
+ group.forEach((condition, index) => {
108
+ const isLastOfGroup = index === group.length - 1
109
+ const isLastGroup = groupIndex === groups.length - 1
110
+ result.push({
111
+ ...condition,
112
+ logic: isLastOfGroup && !isLastGroup ? 'OR' : 'AND'
113
+ })
114
+ })
115
+ })
116
+ return result
117
117
  }
@@ -1,6 +1,6 @@
1
- export { default as FlowCanvas } from './FlowCanvas.vue'
2
- export { default as ScWorkflow } from './ScWorkflow.vue'
3
- export { default as NodeStatusBadge } from './NodeStatusBadge.vue'
4
- export { default as NodeProgressDetail } from './NodeProgressDetail.vue'
5
- export * from './conditionHelpers.js'
6
- export { useScNodeStatus } from './useScNodeStatus.js'
1
+ export { default as FlowCanvas } from './FlowCanvas.vue'
2
+ export { default as ScWorkflow } from './ScWorkflow.vue'
3
+ export { default as NodeStatusBadge } from './NodeStatusBadge.vue'
4
+ export { default as NodeProgressDetail } from './NodeProgressDetail.vue'
5
+ export * from './conditionHelpers.js'
6
+ export { useScNodeStatus } from './useScNodeStatus.js'