@nocobase/plugin-workflow-cc 2.0.0-beta.9 → 2.0.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.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ import { SingleRecordResource } from '@nocobase/flow-engine';
11
+ import { DetailsBlockModel } from '@nocobase/client';
12
+ /**
13
+ * 抄送任务卡片详情:隐藏顶部按钮,保留详情卡片的字段/标题配置,不支持卡片级操作按钮。
14
+ */
15
+ export declare class CCTaskCardDetailsModel extends DetailsBlockModel {
16
+ get hidden(): boolean;
17
+ set hidden(value: boolean);
18
+ onInit(options: any): void;
19
+ createResource(ctx: any, params: any): SingleRecordResource<unknown>;
20
+ refresh(): Promise<void>;
21
+ renderComponent(): React.JSX.Element;
22
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { DetailsGridModel } from '@nocobase/client';
10
+ import React from 'react';
11
+ /**
12
+ * 抄送任务卡片详情的字段网格
13
+ */
14
+ export declare class CCTaskCardGridModel extends DetailsGridModel {
15
+ private lastTempAssociationSnapshot?;
16
+ private readonly tempAssociationSyncHandler;
17
+ onMount(): void;
18
+ onUnmount(): void;
19
+ private getTempAssociationFieldNames;
20
+ private syncTempAssociationFields;
21
+ renderAddSubModelButton(): React.JSX.Element;
22
+ render(): React.JSX.Element;
23
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { BlockGridModel } from '@nocobase/client';
10
+ import React from 'react';
11
+ export declare class CCTriggerBlockGridModel extends BlockGridModel {
12
+ renderAddSubModelButton(): React.JSX.Element;
13
+ }
@@ -24,5 +24,8 @@ export declare const ccTodo: {
24
24
  Actions: typeof TodoExtraActions;
25
25
  Item: typeof TaskItem;
26
26
  Detail: typeof Drawer;
27
+ getPopupRecord: (apiClient: any, { params }: {
28
+ params: any;
29
+ }) => any;
27
30
  };
28
31
  export {};
@@ -8,6 +8,7 @@
8
8
  */
9
9
  declare const _default: {
10
10
  name: string;
11
+ filterTargetKey: string;
11
12
  dumpRules: {
12
13
  group: string;
13
14
  };
@@ -69,11 +70,17 @@ declare const _default: {
69
70
  type: string;
70
71
  name: string;
71
72
  target: string;
73
+ uiSchema: {
74
+ type: string;
75
+ title: string;
76
+ 'x-component'?: undefined;
77
+ 'x-component-props'?: undefined;
78
+ enum?: undefined;
79
+ };
72
80
  primaryKey?: undefined;
73
81
  allowNull?: undefined;
74
82
  foreignKey?: undefined;
75
83
  interface?: undefined;
76
- uiSchema?: undefined;
77
84
  onDelete?: undefined;
78
85
  defaultValue?: undefined;
79
86
  } | {
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(workflowCcTasks_exports);
32
32
  var import_constants = require("../constants");
33
33
  var workflowCcTasks_default = {
34
34
  name: "workflowCcTasks",
35
+ filterTargetKey: "id",
35
36
  dumpRules: {
36
37
  group: "log"
37
38
  },
@@ -78,7 +79,11 @@ var workflowCcTasks_default = {
78
79
  {
79
80
  type: "belongsTo",
80
81
  name: "node",
81
- target: "flow_nodes"
82
+ target: "flow_nodes",
83
+ uiSchema: {
84
+ type: "object",
85
+ title: `{{t("CC node", { ns: "${import_constants.NAMESPACE}" })}}`
86
+ }
82
87
  },
83
88
  {
84
89
  type: "belongsTo",
@@ -141,7 +146,7 @@ var workflowCcTasks_default = {
141
146
  interface: "createdAt",
142
147
  uiSchema: {
143
148
  type: "datetime",
144
- title: '{{t("Created at")}}',
149
+ title: `{{t("Created at", { ns: "${import_constants.NAMESPACE}" })}}`,
145
150
  "x-component": "DatePicker",
146
151
  "x-component-props": {
147
152
  showTime: true
@@ -154,7 +159,7 @@ var workflowCcTasks_default = {
154
159
  interface: "updatedAt",
155
160
  uiSchema: {
156
161
  type: "datetime",
157
- title: '{{t("Updated at")}}',
162
+ title: `{{t("Updated at", { ns: "${import_constants.NAMESPACE}" })}}`,
158
163
  "x-component": "DatePicker",
159
164
  "x-component-props": {
160
165
  showTime: true
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const TEMP_ASSOCIATION_PREFIX = "ccTempAssoc_";
10
+ export declare const buildTempAssociationFieldName: (nodeType: string, nodeKey: string | number) => string;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var tempAssociation_exports = {};
28
+ __export(tempAssociation_exports, {
29
+ TEMP_ASSOCIATION_PREFIX: () => TEMP_ASSOCIATION_PREFIX,
30
+ buildTempAssociationFieldName: () => buildTempAssociationFieldName
31
+ });
32
+ module.exports = __toCommonJS(tempAssociation_exports);
33
+ const TEMP_ASSOCIATION_PREFIX = "ccTempAssoc_";
34
+ const sanitizeFieldKey = (value) => String(value ?? "").replace(/[^a-zA-Z0-9_]/g, "_");
35
+ const buildTempAssociationFieldName = (nodeType, nodeKey) => `${TEMP_ASSOCIATION_PREFIX}${nodeType}_${sanitizeFieldKey(nodeKey)}`;
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ TEMP_ASSOCIATION_PREFIX,
39
+ buildTempAssociationFieldName
40
+ });
@@ -9,20 +9,22 @@
9
9
 
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
- "@nocobase/client": "2.0.0-beta.9",
13
- "@nocobase/plugin-workflow": "2.0.0-beta.9",
12
+ "@nocobase/client": "2.0.1",
13
+ "@nocobase/plugin-workflow": "2.0.1",
14
14
  "react-i18next": "11.18.6",
15
15
  "antd-style": "3.7.1",
16
16
  "antd": "5.24.2",
17
17
  "react-router-dom": "6.30.1",
18
18
  "lodash": "4.17.21",
19
- "@nocobase/utils": "2.0.0-beta.9",
20
- "@nocobase/plugin-ui-schema-storage": "2.0.0-beta.9",
21
- "@nocobase/actions": "2.0.0-beta.9",
22
- "@nocobase/server": "2.0.0-beta.9",
23
- "@nocobase/database": "2.0.0-beta.9",
19
+ "@nocobase/utils": "2.0.1",
20
+ "@nocobase/plugin-ui-schema-storage": "2.0.1",
21
+ "@nocobase/actions": "2.0.1",
22
+ "@nocobase/server": "2.0.1",
23
+ "@nocobase/database": "2.0.1",
24
+ "@nocobase/data-source-manager": "2.0.1",
25
+ "@nocobase/flow-engine": "2.0.1",
24
26
  "@formily/shared": "2.3.7",
25
27
  "@formily/react": "2.3.7",
26
- "@formily/antd-v5": "1.2.3",
27
- "@ant-design/icons": "5.6.1"
28
+ "@ant-design/icons": "5.6.1",
29
+ "@formily/antd-v5": "1.2.3"
28
30
  };
@@ -1,15 +1,30 @@
1
1
  {
2
2
  "CC": "CC",
3
3
  "CC to me": "CC to me",
4
+ "CC information": "CC information",
4
5
  "Configure user interface": "Configure user interface",
6
+ "Configure v2 UI": "Configure v2 UI",
7
+ "Before using the v2 UI, you must delete the existing v1 UI. Are you sure you want to delete the v1 UI?": "Before using the v2 UI, you must delete the existing v1 UI. Are you sure you want to delete the v1 UI?",
8
+ "Delete v1 configuration": "Delete v1 configuration",
9
+ "Deleted successfully": "Deleted successfully",
10
+ "Go to configure": "Go to configure",
5
11
  "Mark all as read": "Mark all as read",
6
12
  "Mark as read": "Mark as read",
7
13
  "Mark as unread": "Mark as unread",
14
+ "Refresh": "Refresh",
15
+ "Filter": "Filter",
8
16
  "Provide a CC (carbon copy) feature in workflows to send approvals, or any other type of information to specified users.": "Provide a CC (carbon copy) feature in workflows to send approvals, or any other type of information to specified users.",
9
17
  "Read": "Read",
10
18
  "Recipients": "Recipients",
19
+ "Task card": "Task card",
20
+ "Task title": "Task title",
11
21
  "Title of each CC item in tasks center. Could use variables in string template. Default to node title.": "Title of each CC item in tasks center. Could use variables in string template. Default to node title.",
22
+ "Read at": "Read at",
23
+ "Created at": "Created at",
24
+ "Updated at": "Updated at",
12
25
  "Unread": "Unread",
13
26
  "User interface": "User interface",
14
- "View user interface": "View user interface"
15
- }
27
+ "View user interface": "View user interface",
28
+ "v1 (Legacy)": "v1 (Legacy)",
29
+ "v2": "v2"
30
+ }
@@ -1,15 +1,33 @@
1
1
  {
2
2
  "CC": "抄送",
3
3
  "CC to me": "抄送我的",
4
+ "CC information": "抄送信息",
5
+ "CC node": "抄送节点",
6
+ "Other information": "其他信息",
4
7
  "Configure user interface": "配置用户界面",
8
+ "Configure v2 UI": "配置 v2 界面",
9
+ "Before using the v2 UI, you must delete the existing v1 UI. Are you sure you want to delete the v1 UI?": "使用 v2 界面前,必须删除现有的 v1 界面。确定要删除 v1 界面吗?",
10
+ "Delete v1 configuration": "删除 v1 配置",
11
+ "Deleted successfully": "删除成功",
12
+ "Go to configure": "前往配置",
5
13
  "Mark all as read": "全部标为已读",
6
14
  "Mark as read": "标为已读",
7
15
  "Mark as unread": "标为未读",
16
+ "Refresh": "刷新",
17
+ "Filter": "筛选",
8
18
  "Provide a CC (carbon copy) feature in workflows to send approvals, or any other type of information to specified users.": "在工作流中提供抄送功能,将审批或其他任意信息抄送给特定的用户。",
9
19
  "Read": "已读",
10
20
  "Recipients": "接收人",
21
+ "Task card": "任务卡片",
22
+ "Task title": "任务标题",
23
+ "Status": "状态",
24
+ "Read at": "阅读时间",
25
+ "Created at": "创建时间",
26
+ "Updated at": "更新时间",
11
27
  "Title of each CC item in tasks center. Could use variables in string template. Default to node title.": "待办中心每个抄送项的标题。可以在字符串模板中使用变量。默认为节点标题。",
12
28
  "Unread": "未读",
13
29
  "User interface": "用户界面",
14
- "View user interface": "查看用户界面"
15
- }
30
+ "View user interface": "查看用户界面",
31
+ "v1 (Legacy)": "v1(旧版)",
32
+ "v2": "v2"
33
+ }
@@ -82,15 +82,30 @@ class CCInstruction extends import_plugin_workflow.Instruction {
82
82
  }
83
83
  async duplicateConfig(node, { transaction }) {
84
84
  const uiSchemaRepo = this.workflow.app.db.getRepository("uiSchemas");
85
- if (!node.config.ccDetail) {
86
- return node.config;
85
+ const flowModelRepo = this.workflow.app.db.getRepository("flowModels");
86
+ const nextConfig = { ...node.config };
87
+ if (node.config.ccDetail) {
88
+ const result = await uiSchemaRepo.duplicate(node.config.ccDetail, {
89
+ transaction
90
+ });
91
+ nextConfig.ccDetail = (result == null ? void 0 : result["x-uid"]) ?? (0, import_utils.uid)();
87
92
  }
88
- const result = await uiSchemaRepo.duplicate(node.config.ccDetail, {
89
- transaction
90
- });
91
- return {
92
- ...node.config,
93
- ccDetail: (result == null ? void 0 : result["x-uid"]) ?? (0, import_utils.uid)()
93
+ const duplicateFlowModelUid = async (modelUid) => {
94
+ var _a, _b, _c, _d;
95
+ if (!modelUid) return void 0;
96
+ try {
97
+ const duplicated = await ((_a = flowModelRepo == null ? void 0 : flowModelRepo.duplicate) == null ? void 0 : _a.call(flowModelRepo, modelUid, { transaction }));
98
+ return (duplicated == null ? void 0 : duplicated.uid) || ((_b = duplicated == null ? void 0 : duplicated.data) == null ? void 0 : _b.uid) || ((_d = (_c = duplicated == null ? void 0 : duplicated.data) == null ? void 0 : _c.data) == null ? void 0 : _d.uid) || (0, import_utils.uid)();
99
+ } catch (error) {
100
+ return modelUid;
101
+ }
94
102
  };
103
+ if (node.config.ccUid) {
104
+ nextConfig.ccUid = await duplicateFlowModelUid(node.config.ccUid);
105
+ }
106
+ if (node.config.taskCardUid) {
107
+ nextConfig.taskCardUid = await duplicateFlowModelUid(node.config.taskCardUid);
108
+ }
109
+ return nextConfig;
95
110
  }
96
111
  }
@@ -40,6 +40,12 @@ __export(actions_exports, {
40
40
  });
41
41
  module.exports = __toCommonJS(actions_exports);
42
42
  var import_actions = __toESM(require("@nocobase/actions"));
43
+ var import_tempAssociationFields = require("./tempAssociationFields");
44
+ const mergeAppends = (appends, required) => {
45
+ const result = /* @__PURE__ */ new Set([...appends || []]);
46
+ required.forEach((item) => result.add(item));
47
+ return Array.from(result);
48
+ };
43
49
  const workflowCcTasks = {
44
50
  async get(context, next) {
45
51
  context.action.mergeParams({
@@ -50,12 +56,15 @@ const workflowCcTasks = {
50
56
  return import_actions.default.get(context, next);
51
57
  },
52
58
  async listMine(context, next) {
59
+ var _a;
53
60
  context.action.mergeParams({
54
61
  filter: {
55
62
  userId: context.state.currentUser.id
56
- }
63
+ },
64
+ appends: mergeAppends((_a = context.action.params) == null ? void 0 : _a.appends, ["node", "workflow", "workflow.nodes"])
57
65
  });
58
- return import_actions.default.list(context, next);
66
+ await import_actions.default.list(context, next);
67
+ await (0, import_tempAssociationFields.appendTempAssociationFields)(context);
59
68
  },
60
69
  async read(context, next) {
61
70
  const { filterByTk } = context.action.params;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Context } from '@nocobase/actions';
10
+ export declare function appendTempAssociationFields(context: Context): Promise<void>;