@gct-paas/render 0.1.4-dev.8 → 0.1.4-dev.9

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 (51) hide show
  1. package/dist/index.esm.min.mjs +7684 -15
  2. package/dist/index.min.cjs +9 -1
  3. package/dist/index.system.min.js +9 -1
  4. package/es/Event/Dependency/controller.d.ts +13 -0
  5. package/es/Event/Dependency/controller.mjs +97 -0
  6. package/es/Event/Dependency/displayRule.d.ts +19 -0
  7. package/es/Event/Dependency/displayRule.mjs +76 -0
  8. package/es/Event/Dependency/useDependency.d.ts +7 -0
  9. package/es/Event/Dependency/useDependencyToShow.d.ts +10 -0
  10. package/es/Event/Dependency/useDependencyToShow.mjs +109 -0
  11. package/es/Event/baseEvent.d.ts +160 -0
  12. package/es/Event/baseEvent.mjs +445 -0
  13. package/es/Event/bizServiceRequest.d.ts +26 -0
  14. package/es/Event/bizServiceRequest.mjs +47 -0
  15. package/es/Event/eventType.d.ts +20 -0
  16. package/es/Event/index.d.ts +4 -0
  17. package/es/Event/utils/appRedis.d.ts +29 -0
  18. package/es/Event/utils/appRedis.mjs +50 -0
  19. package/es/Event/utils/processRovedInfo.d.ts +100 -0
  20. package/es/Event/utils/processRovedInfo.mjs +297 -0
  21. package/es/Event/utils/runGlobalByPage.d.ts +332 -0
  22. package/es/Event/utils/runGlobalByPage.mjs +306 -0
  23. package/es/Event/utils/verificationVar.d.ts +2 -0
  24. package/es/Event/utils/verificationVar.mjs +42 -0
  25. package/es/enums/index.d.ts +14 -0
  26. package/es/enums/index.mjs +6 -0
  27. package/es/hooks/useStorageRef.d.ts +9 -0
  28. package/es/hooks/useStorageRef.mjs +33 -0
  29. package/es/index.d.ts +2 -0
  30. package/es/index.mjs +22 -0
  31. package/es/register/index.d.ts +1 -0
  32. package/es/register/render-register/render-register.d.ts +54 -0
  33. package/es/register/render-register/render-register.mjs +59 -0
  34. package/es/types/index.d.ts +6 -0
  35. package/es/utils/cacheAdapter.d.ts +7 -0
  36. package/es/utils/cacheAdapter.mjs +57 -0
  37. package/es/utils/expression/index.d.ts +6 -0
  38. package/es/utils/expression/index.mjs +133 -0
  39. package/es/utils/expression/regularExpression/methods.d.ts +77 -0
  40. package/es/utils/expression/regularExpression/methods.mjs +729 -0
  41. package/es/utils/field-attrs/index.d.ts +1 -1
  42. package/es/utils/get-ref-data.d.ts +1 -0
  43. package/es/utils/get-ref-data.mjs +62 -0
  44. package/es/utils/getFieldSchema.d.ts +1 -3
  45. package/es/utils/getFieldSchema.mjs +83 -0
  46. package/es/utils/index.d.ts +5 -0
  47. package/es/utils/model-transformer.d.ts +46 -0
  48. package/es/utils/model-transformer.mjs +77 -0
  49. package/es/utils/useStyle.d.ts +21 -0
  50. package/es/utils/useStyle.mjs +17 -0
  51. package/package.json +25 -6
@@ -0,0 +1,100 @@
1
+ import { LowCodeWidget, approveButton } from '@gct-paas/schema';
2
+ import { ExamineAndApproveStateEnum, ButtonTypeEnum } from '@gct-paas/core';
3
+ export { ExamineAndApproveStateEnum };
4
+ /**流程审批信息 */
5
+ export declare class ProcessAppRovedData {
6
+ /**是否当前处理人 */
7
+ isHandle: boolean;
8
+ /**需要显示的审批按钮 */
9
+ buttonConfig: ButtonConfig;
10
+ /**字段信息 */
11
+ fieldConfig: FieldConfig;
12
+ /**流程id */
13
+ processId: string;
14
+ /**数据id */
15
+ dataId: string;
16
+ /**taskId */
17
+ taskId: string;
18
+ /**流程实例id */
19
+ processInstanceId: string;
20
+ /**模态框模式下绑定的流程表单id */
21
+ refFormId?: string;
22
+ /**审批状态 我发起的,我的代办,我的已办*/
23
+ examineAndApproveState: ExamineAndApproveStateEnum;
24
+ fieldStatus: string;
25
+ /**查看页面 */
26
+ viewPageKey?: string;
27
+ /**当前是否是查看页面 */
28
+ isviewPage?: boolean;
29
+ /**当前是否是APP查看页面 */
30
+ isAPPviewPage?: boolean;
31
+ /**非流程相关人 */
32
+ nonRelatedPerson?: boolean;
33
+ constructor({ taskId, processInstanceId, examineAndApproveState, refFormId, }: ProcessAppRovedDataOptions);
34
+ /**初始化流程信息 */
35
+ readyProcess(): Promise<void>;
36
+ /**审批人,发起人 时候撤回按钮特殊逻辑 */
37
+ withdrawByNode(node?: {
38
+ buttonConfig?: string;
39
+ }): void;
40
+ /**节点按钮状态数据转化 */
41
+ transformByNode(node?: {
42
+ opinionConfig?: string;
43
+ buttonConfig?: string;
44
+ fieldConfig?: string;
45
+ }): void;
46
+ /**获取流程数据信息 */
47
+ getDataInfo(): Promise<void>;
48
+ /**过滤按钮 */
49
+ filterButton(list: approveButton[]): approveButton[];
50
+ /**修改字段状态 */
51
+ useFieldWidget(widget: LowCodeWidget.BasicSchema): void;
52
+ /**修改字段显示隐藏状态 */
53
+ useFieldToShow(widget: LowCodeWidget.BasicSchema): void;
54
+ }
55
+ type ButtonConfig = Partial<Record<ButtonTypeEnum, {
56
+ /**成功的消息 */
57
+ success: string;
58
+ /**是否需要弹框 */
59
+ showModel: boolean;
60
+ /**模态框标题 */
61
+ title: string;
62
+ /**是否显示按钮 */
63
+ show: boolean;
64
+ /** 别名 */
65
+ alias: string;
66
+ /**需要签名 */
67
+ signature: boolean;
68
+ /**审批意见 */
69
+ opinion: {
70
+ /**是否需要 */
71
+ show?: boolean;
72
+ /**是否必填 */
73
+ required?: boolean;
74
+ };
75
+ /**人员选择 */
76
+ user: {
77
+ /**是否显示 */
78
+ show?: boolean;
79
+ /**是否多选 */
80
+ multiple?: boolean;
81
+ label?: string;
82
+ };
83
+ }>>;
84
+ type FieldConfig = Record<string, {
85
+ permission: string;
86
+ children?: FieldConfig[];
87
+ }>;
88
+ /** */
89
+ export declare enum FieldsPermissionEnum {
90
+ hidden = "hidden",
91
+ readonly = "readonly",
92
+ disabled = "disabled",
93
+ editable = "editable"
94
+ }
95
+ interface ProcessAppRovedDataOptions {
96
+ taskId: string;
97
+ processInstanceId: string;
98
+ examineAndApproveState?: ExamineAndApproveStateEnum;
99
+ refFormId?: string;
100
+ }
@@ -0,0 +1,297 @@
1
+ import { ExamineAndApproveStateEnum, ButtonTypeEnum, t, FormComponents, OpinionTypeEnum } from '@gct-paas/core';
2
+ export { ExamineAndApproveStateEnum } from '@gct-paas/core';
3
+
4
+ class ProcessAppRovedData {
5
+ /**是否当前处理人 */
6
+ isHandle = false;
7
+ /**需要显示的审批按钮 */
8
+ buttonConfig = {};
9
+ /**字段信息 */
10
+ fieldConfig = {};
11
+ /**流程id */
12
+ processId = "";
13
+ /**数据id */
14
+ dataId = "";
15
+ /**taskId */
16
+ taskId;
17
+ /**流程实例id */
18
+ processInstanceId;
19
+ /**模态框模式下绑定的流程表单id */
20
+ refFormId;
21
+ /**审批状态 我发起的,我的代办,我的已办*/
22
+ examineAndApproveState = ExamineAndApproveStateEnum.MY_CUSTOM;
23
+ fieldStatus = "";
24
+ /**查看页面 */
25
+ viewPageKey;
26
+ /**当前是否是查看页面 */
27
+ isviewPage;
28
+ /**当前是否是APP查看页面 */
29
+ isAPPviewPage;
30
+ /**非流程相关人 */
31
+ nonRelatedPerson = false;
32
+ constructor({
33
+ taskId,
34
+ processInstanceId,
35
+ examineAndApproveState = ExamineAndApproveStateEnum.MY_CUSTOM,
36
+ refFormId
37
+ }) {
38
+ this.taskId = taskId;
39
+ this.processInstanceId = processInstanceId;
40
+ this.examineAndApproveState = examineAndApproveState;
41
+ this.refFormId = refFormId;
42
+ }
43
+ /**初始化流程信息 */
44
+ async readyProcess() {
45
+ const { taskId, processInstanceId } = this;
46
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_AGENT) {
47
+ await this.getDataInfo();
48
+ const { node, processDefId, webViewPageKey, mobileViewPageKey } = await _gct.api.apaas.pmProcessEngine.getTaskExtension({
49
+ taskId
50
+ });
51
+ this.transformByNode(node);
52
+ this.processId = processDefId;
53
+ for (const k in this.buttonConfig) {
54
+ if (k === ButtonTypeEnum.Withdraw) {
55
+ this.buttonConfig[k].show = false;
56
+ }
57
+ }
58
+ this.viewPageKey = node?.webViewPageKey || webViewPageKey;
59
+ this.isAPPviewPage = !!node?.mobileViewPageKey || !!mobileViewPageKey;
60
+ }
61
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_APPLICATION) {
62
+ await this.getDataInfo();
63
+ const { node, processDefId, withdrawOp } = await _gct.api.apaas.pmProcessEngine.getInitialTaskExtension({
64
+ processInstanceId
65
+ }) || {};
66
+ this.transformByNode(node);
67
+ this.processId = processDefId;
68
+ for (const k in this.buttonConfig) {
69
+ if (k === ButtonTypeEnum.End) {
70
+ this.buttonConfig[k].show = false;
71
+ }
72
+ if (k === ButtonTypeEnum.Withdraw) {
73
+ this.buttonConfig[k].show = !!withdrawOp;
74
+ }
75
+ if (k === ButtonTypeEnum.Resubmit) {
76
+ this.buttonConfig[k].show = false;
77
+ }
78
+ }
79
+ }
80
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_DONE) {
81
+ await this.getDataInfo();
82
+ const { node, processDefId } = await _gct.api.apaas.pmProcessEngine.getHiTaskExtension({
83
+ taskId
84
+ });
85
+ this.transformByNode(node);
86
+ this.processId = processDefId;
87
+ }
88
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_CUSTOM) {
89
+ await this.getDataInfo();
90
+ const {
91
+ node,
92
+ processDefId,
93
+ btnList,
94
+ webViewPageKey,
95
+ taskId: taskId2,
96
+ initiatorNode
97
+ } = await _gct.api.apaas.pmProcessEngine.getProcInstExtension({
98
+ procInstId: processInstanceId
99
+ });
100
+ const btnkeys = btnList || [];
101
+ this.withdrawByNode(initiatorNode);
102
+ this.transformByNode(node);
103
+ this.processId = processDefId;
104
+ for (const k in this.buttonConfig) {
105
+ const key = k;
106
+ if (this.buttonConfig[key].show) {
107
+ this.buttonConfig[key].show = btnkeys.includes(k);
108
+ }
109
+ }
110
+ if (!node) {
111
+ this.nonRelatedPerson = true;
112
+ return;
113
+ }
114
+ if (!btnkeys.length || node?.key === "__initiator__" && !taskId2) {
115
+ this.isviewPage = true;
116
+ } else {
117
+ this.viewPageKey = node?.webViewPageKey || webViewPageKey;
118
+ }
119
+ }
120
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_CUSTOM_Modal) {
121
+ await this.getDataInfo();
122
+ const { node, btnList, taskId: taskId2, processDefId, initiatorNode } = await _gct.api.apaas.pmProcessEngine.getProcInstExtension({
123
+ procInstId: processInstanceId
124
+ });
125
+ const btnkeys = btnList || [];
126
+ this.withdrawByNode(initiatorNode);
127
+ this.transformByNode(node);
128
+ this.processId = processDefId;
129
+ for (const k in this.buttonConfig) {
130
+ const key = k;
131
+ if (this.buttonConfig[key].show) {
132
+ this.buttonConfig[key].show = btnkeys.includes(k);
133
+ }
134
+ }
135
+ if (!node) {
136
+ this.nonRelatedPerson = true;
137
+ return;
138
+ }
139
+ if (!btnkeys.length || node?.key === "__initiator__" && !taskId2) {
140
+ this.isviewPage = true;
141
+ }
142
+ }
143
+ }
144
+ /**审批人,发起人 时候撤回按钮特殊逻辑 */
145
+ withdrawByNode(node) {
146
+ if (!node) return;
147
+ const { buttonConfig } = node;
148
+ const button = JSON.parse(buttonConfig + "");
149
+ button.forEach((i) => {
150
+ const actionTitle = t(`sys.process.paasBpmnButtonEvent.${i.type}`);
151
+ this.buttonConfig[i.type] = {
152
+ showModel: false,
153
+ title: t("sys.process.element.approval") + actionTitle,
154
+ success: actionTitle + t("sys.success") + "!",
155
+ show: i.enable,
156
+ alias: i.alias,
157
+ signature: !!i.signature,
158
+ opinion: {},
159
+ user: {}
160
+ };
161
+ });
162
+ }
163
+ /**节点按钮状态数据转化 */
164
+ transformByNode(node) {
165
+ if (!node) return;
166
+ try {
167
+ const { opinionConfig, buttonConfig, fieldConfig } = node;
168
+ const button = JSON.parse(buttonConfig || "[]");
169
+ const options = JSON.parse(
170
+ opinionConfig || '{"enabled":false,"opinionType":[]}'
171
+ );
172
+ button.forEach((i) => {
173
+ const actionTitle = t(`sys.process.paasBpmnButtonEvent.${i.type}`);
174
+ this.buttonConfig[i.type] = {
175
+ showModel: ![
176
+ ButtonTypeEnum.Resubmit,
177
+ ButtonTypeEnum.Withdraw,
178
+ ButtonTypeEnum.End
179
+ ].includes(i.type),
180
+ title: t("sys.process.element.approval") + actionTitle,
181
+ success: actionTitle + t("sys.success") + "!",
182
+ show: i.enable,
183
+ alias: i.alias,
184
+ signature: !!i.signature,
185
+ opinion: {
186
+ show: options.enabled,
187
+ required: transformOption(options.opinionType, i.type)
188
+ },
189
+ user: {
190
+ show: [
191
+ ButtonTypeEnum.Reassign,
192
+ ButtonTypeEnum.Countersign
193
+ ].includes(i.type),
194
+ multiple: ButtonTypeEnum.Countersign === i.type,
195
+ label: t(`sys.process.user.${i.type}`)
196
+ }
197
+ };
198
+ });
199
+ this.fieldConfig = JSON.parse(fieldConfig + "");
200
+ } catch (error) {
201
+ console.log("流程信息解析失败", error);
202
+ }
203
+ }
204
+ /**获取流程数据信息 */
205
+ async getDataInfo() {
206
+ const { dataId } = await _gct.api.apaas.pmProcessEngine.getModel({
207
+ processInstanceId: this.processInstanceId
208
+ });
209
+ this.dataId = dataId;
210
+ }
211
+ /**过滤按钮 */
212
+ filterButton(list) {
213
+ if (this.nonRelatedPerson) return [];
214
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_DONE)
215
+ return [];
216
+ return list.filter((i) => {
217
+ if (i.type === FormComponents.ProcessApproveButton) {
218
+ const status = this.buttonConfig[i.props.action];
219
+ const show = !!status?.show;
220
+ if (show) {
221
+ i.props.title = status.alias;
222
+ }
223
+ return show;
224
+ }
225
+ return true;
226
+ });
227
+ }
228
+ /**修改字段状态 */
229
+ useFieldWidget(widget) {
230
+ if (this.nonRelatedPerson) return;
231
+ const field = widget.props.field;
232
+ const { fieldConfig, examineAndApproveState } = this;
233
+ if (fieldConfig && fieldConfig[field]) {
234
+ const { permission } = fieldConfig[field];
235
+ switch (permission) {
236
+ case "disabled" /* disabled */:
237
+ widget.props.disabled = true;
238
+ widget.props.readonly = false;
239
+ break;
240
+ case "editable" /* editable */:
241
+ widget.props.disabled = false;
242
+ widget.props.readonly = false;
243
+ break;
244
+ case "readonly" /* readonly */:
245
+ widget.props.readonly = true;
246
+ break;
247
+ }
248
+ } else {
249
+ widget.props.readonly = true;
250
+ }
251
+ if (!widget.props.disabled && ([
252
+ ExamineAndApproveStateEnum.MY_APPLICATION,
253
+ ExamineAndApproveStateEnum.MY_DONE
254
+ ].includes(examineAndApproveState) || this.isviewPage)) {
255
+ widget.props.readonly = true;
256
+ }
257
+ }
258
+ /**修改字段显示隐藏状态 */
259
+ useFieldToShow(widget) {
260
+ const field = widget.props.field;
261
+ const { fieldConfig } = this;
262
+ if (fieldConfig && fieldConfig[field]) {
263
+ const { permission } = fieldConfig[field];
264
+ if (permission === "hidden" /* hidden */) {
265
+ widget.props.hidden = true;
266
+ }
267
+ }
268
+ }
269
+ }
270
+ function transformOption(opinionType, action) {
271
+ if (opinionType.includes(OpinionTypeEnum.Required)) {
272
+ return true;
273
+ }
274
+ if (opinionType.includes(OpinionTypeEnum.Optional)) {
275
+ return false;
276
+ }
277
+ if (opinionType.includes(OpinionTypeEnum.ApproveRequired)) {
278
+ return action === ButtonTypeEnum.Approve;
279
+ }
280
+ if (opinionType.includes(OpinionTypeEnum.ApproveRequired)) {
281
+ return action === ButtonTypeEnum.Approve;
282
+ }
283
+ if (opinionType.includes(OpinionTypeEnum.CountersignRequired)) {
284
+ return action === ButtonTypeEnum.Countersign;
285
+ }
286
+ if (opinionType.includes(OpinionTypeEnum.ReassignRequired)) {
287
+ return action === ButtonTypeEnum.Reassign;
288
+ }
289
+ if (opinionType.includes(OpinionTypeEnum.RejectRequired)) {
290
+ return action === ButtonTypeEnum.Reject;
291
+ }
292
+ if (opinionType.includes(OpinionTypeEnum.RefuseRequired)) {
293
+ return action === ButtonTypeEnum.Refuse;
294
+ }
295
+ }
296
+
297
+ export { ProcessAppRovedData };