@vef-framework-react/approval 2.12.0
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/LICENSE +201 -0
- package/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/api/admin-api.cjs +1 -0
- package/dist/cjs/api/category-api.cjs +1 -0
- package/dist/cjs/api/delegation-api.cjs +1 -0
- package/dist/cjs/api/flow-api.cjs +1 -0
- package/dist/cjs/api/index.cjs +1 -0
- package/dist/cjs/api/instance-api.cjs +1 -0
- package/dist/cjs/api/my-api.cjs +1 -0
- package/dist/cjs/api/query.cjs +1 -0
- package/dist/cjs/components/detail/action-modals.cjs +1 -0
- package/dist/cjs/components/detail/admin.cjs +1 -0
- package/dist/cjs/components/detail/drawer.cjs +1 -0
- package/dist/cjs/components/detail/index.cjs +1 -0
- package/dist/cjs/components/flow-graph/index.cjs +1 -0
- package/dist/cjs/components/form-panel/index.cjs +1 -0
- package/dist/cjs/components/format.cjs +1 -0
- package/dist/cjs/components/icon.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -0
- package/dist/cjs/components/principal/index.cjs +1 -0
- package/dist/cjs/components/status/colors.cjs +1 -0
- package/dist/cjs/components/status/index.cjs +1 -0
- package/dist/cjs/components/status/labels.cjs +1 -0
- package/dist/cjs/components/timeline/index.cjs +1 -0
- package/dist/cjs/components/user/index.cjs +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/pages/admin-page/index.cjs +1 -0
- package/dist/cjs/pages/admin-page/instances.cjs +1 -0
- package/dist/cjs/pages/admin-page/metrics.cjs +1 -0
- package/dist/cjs/pages/admin-page/projections.cjs +1 -0
- package/dist/cjs/pages/admin-page/tasks.cjs +1 -0
- package/dist/cjs/pages/category-page/columns.cjs +1 -0
- package/dist/cjs/pages/category-page/form.cjs +1 -0
- package/dist/cjs/pages/category-page/index.cjs +1 -0
- package/dist/cjs/pages/delegation-page/columns.cjs +1 -0
- package/dist/cjs/pages/delegation-page/form.cjs +1 -0
- package/dist/cjs/pages/delegation-page/index.cjs +1 -0
- package/dist/cjs/pages/flow-page/columns.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/basic-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/flow-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/form-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/index.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/review-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/types.cjs +1 -0
- package/dist/cjs/pages/flow-page/index.cjs +1 -0
- package/dist/cjs/pages/flow-page/search.cjs +1 -0
- package/dist/cjs/pages/flow-page/versions.cjs +1 -0
- package/dist/cjs/pages/index.cjs +1 -0
- package/dist/cjs/pages/initiate-page/index.cjs +1 -0
- package/dist/cjs/pages/initiate-page/start-drawer.cjs +1 -0
- package/dist/cjs/pages/my-instances-page/index.cjs +1 -0
- package/dist/cjs/pages/task-center-page/index.cjs +1 -0
- package/dist/cjs/permissions.cjs +1 -0
- package/dist/cjs/plugins/index.cjs +1 -0
- package/dist/cjs/types/enums.cjs +1 -0
- package/dist/cjs/types/index.cjs +1 -0
- package/dist/es/api/admin-api.js +33 -0
- package/dist/es/api/category-api.js +17 -0
- package/dist/es/api/delegation-api.js +21 -0
- package/dist/es/api/flow-api.js +22 -0
- package/dist/es/api/index.js +9 -0
- package/dist/es/api/instance-api.js +27 -0
- package/dist/es/api/my-api.js +29 -0
- package/dist/es/api/query.js +14 -0
- package/dist/es/components/detail/action-modals.js +280 -0
- package/dist/es/components/detail/admin.js +147 -0
- package/dist/es/components/detail/drawer.js +21 -0
- package/dist/es/components/detail/index.js +392 -0
- package/dist/es/components/flow-graph/index.js +218 -0
- package/dist/es/components/form-panel/index.js +23 -0
- package/dist/es/components/format.js +16 -0
- package/dist/es/components/icon.js +13 -0
- package/dist/es/components/index.js +14 -0
- package/dist/es/components/principal/index.js +31 -0
- package/dist/es/components/status/colors.js +39 -0
- package/dist/es/components/status/index.js +41 -0
- package/dist/es/components/status/labels.js +94 -0
- package/dist/es/components/timeline/index.js +173 -0
- package/dist/es/components/user/index.js +64 -0
- package/dist/es/index.js +34 -0
- package/dist/es/pages/admin-page/index.js +67 -0
- package/dist/es/pages/admin-page/instances.js +148 -0
- package/dist/es/pages/admin-page/metrics.js +153 -0
- package/dist/es/pages/admin-page/projections.js +122 -0
- package/dist/es/pages/admin-page/tasks.js +170 -0
- package/dist/es/pages/category-page/columns.js +56 -0
- package/dist/es/pages/category-page/form.js +106 -0
- package/dist/es/pages/category-page/index.js +136 -0
- package/dist/es/pages/delegation-page/columns.js +60 -0
- package/dist/es/pages/delegation-page/form.js +117 -0
- package/dist/es/pages/delegation-page/index.js +122 -0
- package/dist/es/pages/flow-page/columns.js +81 -0
- package/dist/es/pages/flow-page/designer/basic-step.js +396 -0
- package/dist/es/pages/flow-page/designer/flow-step.js +41 -0
- package/dist/es/pages/flow-page/designer/form-step.js +87 -0
- package/dist/es/pages/flow-page/designer/index.js +294 -0
- package/dist/es/pages/flow-page/designer/review-step.js +132 -0
- package/dist/es/pages/flow-page/designer/types.js +40 -0
- package/dist/es/pages/flow-page/index.js +99 -0
- package/dist/es/pages/flow-page/search.js +53 -0
- package/dist/es/pages/flow-page/versions.js +94 -0
- package/dist/es/pages/index.js +12 -0
- package/dist/es/pages/initiate-page/index.js +168 -0
- package/dist/es/pages/initiate-page/start-drawer.js +118 -0
- package/dist/es/pages/my-instances-page/index.js +223 -0
- package/dist/es/pages/task-center-page/index.js +182 -0
- package/dist/es/permissions.js +48 -0
- package/dist/es/plugins/index.js +34 -0
- package/dist/es/types/enums.js +12 -0
- package/dist/es/types/index.js +3 -0
- package/dist/types/api/admin-api.d.ts +30 -0
- package/dist/types/api/category-api.d.ts +17 -0
- package/dist/types/api/delegation-api.d.ts +18 -0
- package/dist/types/api/flow-api.d.ts +34 -0
- package/dist/types/api/index.d.ts +7 -0
- package/dist/types/api/instance-api.d.ts +22 -0
- package/dist/types/api/my-api.d.ts +29 -0
- package/dist/types/api/query.d.ts +15 -0
- package/dist/types/components/detail/action-modals.d.ts +82 -0
- package/dist/types/components/detail/admin.d.ts +11 -0
- package/dist/types/components/detail/drawer.d.ts +17 -0
- package/dist/types/components/detail/index.d.ts +36 -0
- package/dist/types/components/flow-graph/index.d.ts +17 -0
- package/dist/types/components/form-panel/index.d.ts +38 -0
- package/dist/types/components/format.d.ts +10 -0
- package/dist/types/components/icon.d.ts +15 -0
- package/dist/types/components/index.d.ts +12 -0
- package/dist/types/components/principal/index.d.ts +18 -0
- package/dist/types/components/status/colors.d.ts +13 -0
- package/dist/types/components/status/index.d.ts +37 -0
- package/dist/types/components/status/labels.d.ts +34 -0
- package/dist/types/components/timeline/index.d.ts +11 -0
- package/dist/types/components/user/index.d.ts +38 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/pages/admin-page/index.d.ts +31 -0
- package/dist/types/pages/admin-page/instances.d.ts +9 -0
- package/dist/types/pages/admin-page/metrics.d.ts +9 -0
- package/dist/types/pages/admin-page/projections.d.ts +8 -0
- package/dist/types/pages/admin-page/tasks.d.ts +7 -0
- package/dist/types/pages/category-page/columns.d.ts +3 -0
- package/dist/types/pages/category-page/form.d.ts +25 -0
- package/dist/types/pages/category-page/index.d.ts +8 -0
- package/dist/types/pages/category-page/props.d.ts +24 -0
- package/dist/types/pages/delegation-page/columns.d.ts +3 -0
- package/dist/types/pages/delegation-page/form.d.ts +6 -0
- package/dist/types/pages/delegation-page/index.d.ts +7 -0
- package/dist/types/pages/delegation-page/props.d.ts +17 -0
- package/dist/types/pages/flow-page/columns.d.ts +12 -0
- package/dist/types/pages/flow-page/designer/basic-step.d.ts +20 -0
- package/dist/types/pages/flow-page/designer/flow-step.d.ts +16 -0
- package/dist/types/pages/flow-page/designer/form-step.d.ts +31 -0
- package/dist/types/pages/flow-page/designer/index.d.ts +20 -0
- package/dist/types/pages/flow-page/designer/review-step.d.ts +18 -0
- package/dist/types/pages/flow-page/designer/types.d.ts +52 -0
- package/dist/types/pages/flow-page/index.d.ts +11 -0
- package/dist/types/pages/flow-page/props.d.ts +24 -0
- package/dist/types/pages/flow-page/search.d.ts +8 -0
- package/dist/types/pages/flow-page/versions.d.ts +16 -0
- package/dist/types/pages/index.d.ts +8 -0
- package/dist/types/pages/initiate-page/index.d.ts +28 -0
- package/dist/types/pages/initiate-page/start-drawer.d.ts +23 -0
- package/dist/types/pages/my-instances-page/index.d.ts +16 -0
- package/dist/types/pages/task-center-page/index.d.ts +17 -0
- package/dist/types/permissions.d.ts +68 -0
- package/dist/types/plugins/index.d.ts +61 -0
- package/dist/types/types/admin.d.ts +185 -0
- package/dist/types/types/base.d.ts +36 -0
- package/dist/types/types/category.d.ts +37 -0
- package/dist/types/types/delegation.d.ts +38 -0
- package/dist/types/types/detail.d.ts +129 -0
- package/dist/types/types/enums.d.ts +81 -0
- package/dist/types/types/flow.d.ts +192 -0
- package/dist/types/types/index.d.ts +9 -0
- package/dist/types/types/instance.d.ts +83 -0
- package/dist/types/types/my.d.ts +203 -0
- package/package.json +71 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CategoryTreeOption } from '../category-page/form';
|
|
2
|
+
/**
|
|
3
|
+
* The inline search fields for the flow list. Label filters are typed as
|
|
4
|
+
* `key=value` tags and AND-combined by the backend's equality filter.
|
|
5
|
+
*/
|
|
6
|
+
export declare function FlowSearchFields({ categoryOptions }: {
|
|
7
|
+
categoryOptions: CategoryTreeOption[];
|
|
8
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Flow } from '../../types';
|
|
2
|
+
export interface FlowVersionsDrawerProps {
|
|
3
|
+
flow: Flow | null;
|
|
4
|
+
open: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Permission code gating the publish action.
|
|
7
|
+
*/
|
|
8
|
+
publishPermission: string;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The version history of one flow: every deploy in descending order, with
|
|
13
|
+
* publish for drafts. Publishing archives the previously published version;
|
|
14
|
+
* running instances keep the version they started on.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FlowVersionsDrawer({ flow, open, publishPermission, onClose }: FlowVersionsDrawerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ApprovalAdminPage, type ApprovalAdminPageProps } from './admin-page';
|
|
2
|
+
export { ApprovalCategoryPage, type ApprovalCategoryPageProps } from './category-page';
|
|
3
|
+
export { ApprovalDelegationPage, type ApprovalDelegationPageProps } from './delegation-page';
|
|
4
|
+
export { ApprovalFlowPage, FlowDesignerDrawer, type ApprovalFlowPageProps, type FlowDesignerDrawerProps } from './flow-page';
|
|
5
|
+
export { FlowVersionsDrawer, type FlowVersionsDrawerProps } from './flow-page/versions';
|
|
6
|
+
export { ApprovalInitiatePage, StartInstanceDrawer, type ApprovalInitiatePageProps, type StartInstanceDrawerProps } from './initiate-page';
|
|
7
|
+
export { ApprovalMyInstancesPage, type ApprovalMyInstancesPageProps } from './my-instances-page';
|
|
8
|
+
export { ApprovalTaskCenterPage, type ApprovalTaskCenterPageProps } from './task-center-page';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export { StartInstanceDrawer, type StartInstanceDrawerProps } from './start-drawer';
|
|
2
|
+
export interface ApprovalInitiatePageProps {
|
|
3
|
+
/**
|
|
4
|
+
* The tenant whose flows are offered.
|
|
5
|
+
*
|
|
6
|
+
* @default "default"
|
|
7
|
+
*/
|
|
8
|
+
tenantId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* A fixed label pre-filter (e.g. `{ mobile: "" }` to offer only
|
|
11
|
+
* mobile-initiable flows). Combined with the user's own label filter.
|
|
12
|
+
*/
|
|
13
|
+
labels?: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Optional page title.
|
|
16
|
+
*/
|
|
17
|
+
title?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Fired after an instance is submitted.
|
|
20
|
+
*/
|
|
21
|
+
onStarted?: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The initiation portal: every flow the current user may start, grouped by
|
|
25
|
+
* category, searchable by keyword and label. Clicking a card opens the start
|
|
26
|
+
* drawer with the published form.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ApprovalInitiatePage({ tenantId, labels, title, onStarted }: ApprovalInitiatePageProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface StartInstanceDrawerProps {
|
|
2
|
+
/**
|
|
3
|
+
* The flow to start; `null` keeps the drawer closed.
|
|
4
|
+
*/
|
|
5
|
+
flowCode: string | null;
|
|
6
|
+
tenantId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Prefilled business reference for business-bound flows started from a
|
|
9
|
+
* host business page.
|
|
10
|
+
*/
|
|
11
|
+
businessRef?: string;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Fired with the submission acknowledged, after the drawer closes.
|
|
15
|
+
*/
|
|
16
|
+
onStarted?: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The initiation drawer: loads the published form document through the
|
|
20
|
+
* start-gate (`my.get_start_form`) and submits `instance.start` with the
|
|
21
|
+
* renderer-validated form data.
|
|
22
|
+
*/
|
|
23
|
+
export declare function StartInstanceDrawer({ flowCode, tenantId, businessRef, onClose, onStarted }: StartInstanceDrawerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ApprovalMyInstancesPageProps {
|
|
3
|
+
/**
|
|
4
|
+
* Scope the lists to one tenant; omit for the caller's full view.
|
|
5
|
+
*/
|
|
6
|
+
tenantId?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional page title rendered above each list.
|
|
9
|
+
*/
|
|
10
|
+
title?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* My submissions and my carbon copies. Returned submissions resubmit from
|
|
14
|
+
* the detail drawer; opening an unread CC marks it read.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ApprovalMyInstancesPage({ tenantId, title }: ApprovalMyInstancesPageProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ApprovalTaskCenterPageProps {
|
|
3
|
+
/**
|
|
4
|
+
* Scope the lists to one tenant; omit for the caller's full view.
|
|
5
|
+
*/
|
|
6
|
+
tenantId?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional page title rendered above each list.
|
|
9
|
+
*/
|
|
10
|
+
title?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The task center: what awaits me and what I have handled. Opening a row
|
|
14
|
+
* shows the full detail with the action bar; completing an action refreshes
|
|
15
|
+
* both the list and the pending badge.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ApprovalTaskCenterPage({ tenantId, title }: ApprovalTaskCenterPageProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permission codes for the approval engine management API, mirroring the
|
|
3
|
+
* backend `RequiredPermission` strings verbatim. These are the lockstep
|
|
4
|
+
* anchors between the Go resources and the React pages: every management page
|
|
5
|
+
* defaults its permission gates to the matching entry here, and a business
|
|
6
|
+
* system overrides them through the page's `permissions` prop.
|
|
7
|
+
*
|
|
8
|
+
* The self-service `approval/my` resource carries no permission codes — its
|
|
9
|
+
* operations are scoped to the current user server-side, so the user-facing
|
|
10
|
+
* pages render without permission gates.
|
|
11
|
+
*/
|
|
12
|
+
export declare const APPROVAL_PERMISSIONS: {
|
|
13
|
+
readonly category: {
|
|
14
|
+
readonly query: "approval.category.query";
|
|
15
|
+
readonly create: "approval.category.create";
|
|
16
|
+
readonly update: "approval.category.update";
|
|
17
|
+
readonly delete: "approval.category.delete";
|
|
18
|
+
};
|
|
19
|
+
readonly flow: {
|
|
20
|
+
readonly query: "approval.flow.query";
|
|
21
|
+
readonly create: "approval.flow.create";
|
|
22
|
+
readonly update: "approval.flow.update";
|
|
23
|
+
readonly deploy: "approval.flow.deploy";
|
|
24
|
+
readonly publish: "approval.flow.publish";
|
|
25
|
+
};
|
|
26
|
+
readonly instance: {
|
|
27
|
+
readonly query: "approval.instance.query";
|
|
28
|
+
readonly detail: "approval.instance.detail";
|
|
29
|
+
readonly start: "approval.instance.start";
|
|
30
|
+
readonly withdraw: "approval.instance.withdraw";
|
|
31
|
+
readonly resubmit: "approval.instance.resubmit";
|
|
32
|
+
readonly cc: "approval.instance.cc";
|
|
33
|
+
readonly terminate: "approval.instance.terminate";
|
|
34
|
+
};
|
|
35
|
+
readonly task: {
|
|
36
|
+
readonly query: "approval.task.query";
|
|
37
|
+
readonly process: "approval.task.process";
|
|
38
|
+
readonly addAssignee: "approval.task.add_assignee";
|
|
39
|
+
readonly removeAssignee: "approval.task.remove_assignee";
|
|
40
|
+
readonly urge: "approval.task.urge";
|
|
41
|
+
readonly reassign: "approval.task.reassign";
|
|
42
|
+
};
|
|
43
|
+
readonly actionLog: {
|
|
44
|
+
readonly query: "approval.action_log.query";
|
|
45
|
+
};
|
|
46
|
+
readonly metrics: {
|
|
47
|
+
readonly query: "approval.metrics.query";
|
|
48
|
+
};
|
|
49
|
+
readonly binding: {
|
|
50
|
+
readonly query: "approval.binding.query";
|
|
51
|
+
readonly retry: "approval.binding.retry";
|
|
52
|
+
};
|
|
53
|
+
readonly delegation: {
|
|
54
|
+
readonly query: "approval.delegation.query";
|
|
55
|
+
readonly create: "approval.delegation.create";
|
|
56
|
+
readonly update: "approval.delegation.update";
|
|
57
|
+
readonly delete: "approval.delegation.delete";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export type ApprovalPermissions = typeof APPROVAL_PERMISSIONS;
|
|
61
|
+
export type CategoryPermissionCodes = ApprovalPermissions["category"];
|
|
62
|
+
export type FlowPermissionCodes = ApprovalPermissions["flow"];
|
|
63
|
+
export type InstancePermissionCodes = ApprovalPermissions["instance"];
|
|
64
|
+
export type TaskPermissionCodes = ApprovalPermissions["task"];
|
|
65
|
+
export type ActionLogPermissionCodes = ApprovalPermissions["actionLog"];
|
|
66
|
+
export type MetricsPermissionCodes = ApprovalPermissions["metrics"];
|
|
67
|
+
export type BindingPermissionCodes = ApprovalPermissions["binding"];
|
|
68
|
+
export type DelegationPermissionCodes = ApprovalPermissions["delegation"];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EditorPlugins, FormFieldDefinition, PickerProps, PrincipalKind } from '@vef-framework-react/approval-flow-editor';
|
|
2
|
+
import { DeviceRegistries } from '@vef-framework-react/form-editor';
|
|
3
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Host-integration points shared by every approval page and component. Wrap
|
|
6
|
+
* the approval routes in one `ApprovalProvider` and every picker, registry,
|
|
7
|
+
* and renderer below is resolved from it — pages never take these as props.
|
|
8
|
+
*/
|
|
9
|
+
export interface ApprovalPlugins {
|
|
10
|
+
/**
|
|
11
|
+
* Pickers that resolve concrete ids for each principal kind (user / role /
|
|
12
|
+
* department). The flow designer and the runtime action dialogs (transfer,
|
|
13
|
+
* add assignee, CC) share them. A kind left unset degrades to a plain
|
|
14
|
+
* id-tags input, so the pages stay functional without host wiring.
|
|
15
|
+
*/
|
|
16
|
+
pickers?: Partial<Record<PrincipalKind, FC<PickerProps>>>;
|
|
17
|
+
/**
|
|
18
|
+
* Form field registries for rendering and designing approval forms.
|
|
19
|
+
* Defaults to the approval profile from `approval-form-bridge`
|
|
20
|
+
* (`createApprovalRegistries`), which excludes the field types the backend
|
|
21
|
+
* parser rejects.
|
|
22
|
+
*/
|
|
23
|
+
registries?: DeviceRegistries;
|
|
24
|
+
/**
|
|
25
|
+
* Host-defined global subjects the flow designer's condition editor offers
|
|
26
|
+
* alongside the built-in applicant attributes — resolved server-side from
|
|
27
|
+
* `Instance.Globals` at instance start.
|
|
28
|
+
*/
|
|
29
|
+
globalSubjects?: FormFieldDefinition[];
|
|
30
|
+
/**
|
|
31
|
+
* Renders an instance's opaque business reference as a host-navigable
|
|
32
|
+
* element (a link to the business record, a drawer trigger, …). Defaults to
|
|
33
|
+
* plain text.
|
|
34
|
+
*/
|
|
35
|
+
renderBusinessRef?: (businessRef: string) => ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The plugin set after defaulting: registries are always present.
|
|
39
|
+
*/
|
|
40
|
+
export interface ResolvedApprovalPlugins extends ApprovalPlugins {
|
|
41
|
+
registries: DeviceRegistries;
|
|
42
|
+
}
|
|
43
|
+
export interface ApprovalProviderProps extends PropsWithChildren {
|
|
44
|
+
plugins?: ApprovalPlugins;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Provides the approval plugin set to every page and component beneath it.
|
|
48
|
+
* The default form registries are created once per mount; pass `registries`
|
|
49
|
+
* to override them wholesale.
|
|
50
|
+
*/
|
|
51
|
+
export declare function ApprovalProvider({ plugins, children }: ApprovalProviderProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Resolves the approval plugin set. Usable without a provider — every
|
|
54
|
+
* integration point then falls back to its built-in default.
|
|
55
|
+
*/
|
|
56
|
+
export declare function useApprovalPlugins(): ResolvedApprovalPlugins;
|
|
57
|
+
/**
|
|
58
|
+
* Projects the approval plugin set into the flow designer's `EditorPlugins`
|
|
59
|
+
* shape, layering the deploy-derived form fields on top.
|
|
60
|
+
*/
|
|
61
|
+
export declare function toEditorPlugins(plugins: ResolvedApprovalPlugins, formFields: FormFieldDefinition[]): EditorPlugins;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { FormSchema } from '@vef-framework-react/form-editor';
|
|
2
|
+
import { FormData, UserInfo } from './base';
|
|
3
|
+
import { InstanceFlowGraph, TimelineEntry } from './detail';
|
|
4
|
+
import { ActionType, BindingProjectionStatus, InstanceStatus, TaskStatus } from './enums';
|
|
5
|
+
/**
|
|
6
|
+
* An approval instance in the admin view, mirroring `admin.Instance`.
|
|
7
|
+
*/
|
|
8
|
+
export interface AdminInstance {
|
|
9
|
+
instanceId: string;
|
|
10
|
+
instanceNo: string;
|
|
11
|
+
title: string;
|
|
12
|
+
tenantId: string;
|
|
13
|
+
flowId: string;
|
|
14
|
+
flowName: string;
|
|
15
|
+
applicant: UserInfo;
|
|
16
|
+
status: InstanceStatus;
|
|
17
|
+
currentNodeName?: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
finishedAt?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An approval task in the admin view, mirroring `admin.Task`.
|
|
23
|
+
*/
|
|
24
|
+
export interface AdminTask {
|
|
25
|
+
taskId: string;
|
|
26
|
+
instanceId: string;
|
|
27
|
+
instanceTitle: string;
|
|
28
|
+
flowName: string;
|
|
29
|
+
nodeName: string;
|
|
30
|
+
assignee: UserInfo;
|
|
31
|
+
status: TaskStatus;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
deadline?: string;
|
|
34
|
+
finishedAt?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The instance's runtime state within an admin detail view, mirroring
|
|
38
|
+
* `admin.InstanceDetailInfo`. `labels` are the flow's host-owned selection
|
|
39
|
+
* metadata, read from the mutable flow at query time.
|
|
40
|
+
*/
|
|
41
|
+
export interface AdminInstanceInfo {
|
|
42
|
+
instanceId: string;
|
|
43
|
+
instanceNo: string;
|
|
44
|
+
title: string;
|
|
45
|
+
tenantId: string;
|
|
46
|
+
flowId: string;
|
|
47
|
+
flowName: string;
|
|
48
|
+
flowVersionId: string;
|
|
49
|
+
labels?: Record<string, string>;
|
|
50
|
+
applicant: UserInfo;
|
|
51
|
+
status: InstanceStatus;
|
|
52
|
+
currentNodeId?: string;
|
|
53
|
+
currentNodeName?: string;
|
|
54
|
+
businessRef?: string;
|
|
55
|
+
formData?: FormData;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
finishedAt?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The full admin detail view of an approval instance, mirroring
|
|
61
|
+
* `admin.InstanceDetail`. The raw audit trail stays available through the
|
|
62
|
+
* paginated action-log query.
|
|
63
|
+
*/
|
|
64
|
+
export interface AdminInstanceDetail {
|
|
65
|
+
instance: AdminInstanceInfo;
|
|
66
|
+
formSchema?: FormSchema;
|
|
67
|
+
timeline: TimelineEntry[];
|
|
68
|
+
flowGraph: InstanceFlowGraph;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* An action log entry in the admin audit view, mirroring `admin.ActionLog`.
|
|
72
|
+
*/
|
|
73
|
+
export interface AdminActionLog {
|
|
74
|
+
logId: string;
|
|
75
|
+
action: ActionType;
|
|
76
|
+
nodeId?: string;
|
|
77
|
+
taskId?: string;
|
|
78
|
+
operator: UserInfo;
|
|
79
|
+
transferTo?: UserInfo;
|
|
80
|
+
rollbackToNodeId?: string;
|
|
81
|
+
addedAssignees?: UserInfo[];
|
|
82
|
+
removedAssignees?: UserInfo[];
|
|
83
|
+
ccUsers?: UserInfo[];
|
|
84
|
+
opinion?: string;
|
|
85
|
+
attachments?: string[];
|
|
86
|
+
createdAt: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Aggregated approval engine health and throughput indicators, mirroring
|
|
90
|
+
* `admin.Metrics`. Count maps are keyed by the respective status strings.
|
|
91
|
+
*/
|
|
92
|
+
export interface ApprovalMetrics {
|
|
93
|
+
tenantId: string;
|
|
94
|
+
capturedAt: string;
|
|
95
|
+
instanceCounts: Partial<Record<InstanceStatus, number>>;
|
|
96
|
+
taskCounts: Partial<Record<TaskStatus, number>>;
|
|
97
|
+
timeoutTaskCount: number;
|
|
98
|
+
/**
|
|
99
|
+
* Average end-to-end duration in seconds over completed instances;
|
|
100
|
+
* `-1` means no completed instances yet.
|
|
101
|
+
*/
|
|
102
|
+
avgCompletionSeconds: number;
|
|
103
|
+
pendingBindingFailures: number;
|
|
104
|
+
businessProjectionCounts: Partial<Record<BindingProjectionStatus, number>>;
|
|
105
|
+
pendingBusinessProjections: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The record key of a business projection: configured key columns mapped to
|
|
109
|
+
* the values resolved from the instance's business ref.
|
|
110
|
+
*/
|
|
111
|
+
export type BusinessRecordKey = Record<string, string | number | boolean | null>;
|
|
112
|
+
/**
|
|
113
|
+
* The operator-facing convergence state for one bound business record,
|
|
114
|
+
* mirroring `admin.BusinessProjection`.
|
|
115
|
+
*/
|
|
116
|
+
export interface AdminBusinessProjection {
|
|
117
|
+
projectionId: string;
|
|
118
|
+
tenantId: string;
|
|
119
|
+
flowId: string;
|
|
120
|
+
flowVersionId: string;
|
|
121
|
+
ownerInstanceId: string;
|
|
122
|
+
appliedOwnerInstanceId?: string;
|
|
123
|
+
businessTable: string;
|
|
124
|
+
recordKey: BusinessRecordKey;
|
|
125
|
+
consistency: "synchronous" | "eventual";
|
|
126
|
+
desiredStatus: InstanceStatus;
|
|
127
|
+
desiredStartedAt: string;
|
|
128
|
+
desiredFinishedAt?: string;
|
|
129
|
+
desiredRevision: number;
|
|
130
|
+
appliedRevision: number;
|
|
131
|
+
status: BindingProjectionStatus;
|
|
132
|
+
attemptCount: number;
|
|
133
|
+
nextAttemptAt?: string;
|
|
134
|
+
leaseUntil?: string;
|
|
135
|
+
lastError?: string;
|
|
136
|
+
appliedAt?: string;
|
|
137
|
+
updatedAt: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Search parameters for `approval/admin.find_instances`.
|
|
141
|
+
*/
|
|
142
|
+
export interface AdminInstanceSearch {
|
|
143
|
+
tenantId?: string;
|
|
144
|
+
applicantId?: string;
|
|
145
|
+
status?: InstanceStatus;
|
|
146
|
+
flowId?: string;
|
|
147
|
+
keyword?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Search parameters for `approval/admin.find_tasks`.
|
|
151
|
+
*/
|
|
152
|
+
export interface AdminTaskSearch {
|
|
153
|
+
tenantId?: string;
|
|
154
|
+
assigneeId?: string;
|
|
155
|
+
instanceId?: string;
|
|
156
|
+
status?: TaskStatus;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Search parameters for `approval/admin.find_business_projections`.
|
|
160
|
+
*/
|
|
161
|
+
export interface AdminBusinessProjectionSearch {
|
|
162
|
+
tenantId?: string;
|
|
163
|
+
status?: BindingProjectionStatus;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Parameters for `approval/admin.terminate_instance`.
|
|
167
|
+
*/
|
|
168
|
+
export interface TerminateInstanceParams {
|
|
169
|
+
instanceId: string;
|
|
170
|
+
reason?: string;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Parameters for `approval/admin.reassign_task`.
|
|
174
|
+
*/
|
|
175
|
+
export interface ReassignTaskParams {
|
|
176
|
+
taskId: string;
|
|
177
|
+
newAssigneeId: string;
|
|
178
|
+
reason?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Parameters for `approval/admin.retry_business_projection`.
|
|
182
|
+
*/
|
|
183
|
+
export interface RetryBusinessProjectionParams {
|
|
184
|
+
projectionId: string;
|
|
185
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit envelopes shared by the approval models. They mirror the Go
|
|
3
|
+
* `orm.FullAuditedModel` embed: a management list row carries the id and the
|
|
4
|
+
* audit fields the server projects.
|
|
5
|
+
*/
|
|
6
|
+
export interface FullAudited {
|
|
7
|
+
id: string;
|
|
8
|
+
createdAt?: string;
|
|
9
|
+
createdBy?: string;
|
|
10
|
+
updatedAt?: string;
|
|
11
|
+
updatedBy?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A person snapshot captured at action time, mirroring the Go
|
|
15
|
+
* `approval.UserInfo` — the single person shape every approval projection
|
|
16
|
+
* uses (task assignees, CC recipients, operators, applicants). Department
|
|
17
|
+
* fields are present only when the host's `UserInfoResolver` fills them.
|
|
18
|
+
*/
|
|
19
|
+
export interface UserInfo {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
departmentId?: string;
|
|
23
|
+
departmentName?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Form data as submitted / stored: a flat map keyed by field key. Values are
|
|
27
|
+
* whatever the host's form schema produces — scalars, arrays (upload / table
|
|
28
|
+
* rows), or nested row objects.
|
|
29
|
+
*/
|
|
30
|
+
export type FormDataValue = string | number | boolean | null | FormDataValue[] | {
|
|
31
|
+
[key: string]: FormDataValue;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The runtime form-data map of an instance.
|
|
35
|
+
*/
|
|
36
|
+
export type FormData = Record<string, FormDataValue>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FullAudited } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* A flow category node, mirroring the Go `approval.FlowCategory`. Categories
|
|
4
|
+
* form a tree via `parentId`; the find-tree query returns nested `children`.
|
|
5
|
+
*/
|
|
6
|
+
export interface FlowCategory extends FullAudited {
|
|
7
|
+
tenantId: string;
|
|
8
|
+
code: string;
|
|
9
|
+
name: string;
|
|
10
|
+
icon?: string | null;
|
|
11
|
+
parentId?: string | null;
|
|
12
|
+
sortOrder: number;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
remark?: string | null;
|
|
15
|
+
children?: FlowCategory[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create/update parameters for a flow category.
|
|
19
|
+
*/
|
|
20
|
+
export interface CategoryParams {
|
|
21
|
+
id?: string;
|
|
22
|
+
tenantId: string;
|
|
23
|
+
code: string;
|
|
24
|
+
name: string;
|
|
25
|
+
icon?: string | null;
|
|
26
|
+
parentId?: string | null;
|
|
27
|
+
sortOrder: number;
|
|
28
|
+
isActive: boolean;
|
|
29
|
+
remark?: string | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Search parameters for the category tree.
|
|
33
|
+
*/
|
|
34
|
+
export interface CategorySearch {
|
|
35
|
+
name?: string;
|
|
36
|
+
isActive?: boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FullAudited } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* An approval delegation, mirroring the Go `approval.Delegation`: during the
|
|
4
|
+
* active window, tasks assigned to the delegator are routed to the delegatee.
|
|
5
|
+
* Scope narrows via `flowCategoryId` / `flowId`; both empty means all flows.
|
|
6
|
+
*/
|
|
7
|
+
export interface Delegation extends FullAudited {
|
|
8
|
+
delegatorId: string;
|
|
9
|
+
delegateeId: string;
|
|
10
|
+
flowCategoryId?: string | null;
|
|
11
|
+
flowId?: string | null;
|
|
12
|
+
startTime: string;
|
|
13
|
+
endTime: string;
|
|
14
|
+
isActive: boolean;
|
|
15
|
+
reason?: string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create/update parameters for a delegation.
|
|
19
|
+
*/
|
|
20
|
+
export interface DelegationParams {
|
|
21
|
+
id?: string;
|
|
22
|
+
delegatorId: string;
|
|
23
|
+
delegateeId: string;
|
|
24
|
+
flowCategoryId?: string | null;
|
|
25
|
+
flowId?: string | null;
|
|
26
|
+
startTime: string;
|
|
27
|
+
endTime: string;
|
|
28
|
+
isActive: boolean;
|
|
29
|
+
reason?: string | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Search parameters for the delegation list.
|
|
33
|
+
*/
|
|
34
|
+
export interface DelegationSearch {
|
|
35
|
+
delegatorId?: string;
|
|
36
|
+
delegateeId?: string;
|
|
37
|
+
isActive?: boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { NodeKind } from '@vef-framework-react/approval-flow-editor';
|
|
2
|
+
import { UserInfo } from './base';
|
|
3
|
+
import { ActivityAction, NodeProgressStatus, NodeVisitStatus } from './enums';
|
|
4
|
+
/**
|
|
5
|
+
* One assignee's involvement at an approval/handle node during a single
|
|
6
|
+
* visit, mirroring the Go `approval.NodeParticipant`. `taskId` is what task
|
|
7
|
+
* operations are submitted against; outcome details are fused from the action
|
|
8
|
+
* log that finished the task.
|
|
9
|
+
*/
|
|
10
|
+
export interface NodeParticipant {
|
|
11
|
+
taskId: string;
|
|
12
|
+
user: UserInfo;
|
|
13
|
+
delegator?: UserInfo;
|
|
14
|
+
status: string;
|
|
15
|
+
deadline?: string;
|
|
16
|
+
isTimeout?: boolean;
|
|
17
|
+
opinion?: string;
|
|
18
|
+
attachments?: string[];
|
|
19
|
+
actionTime?: string;
|
|
20
|
+
transferTo?: UserInfo;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A side action recorded at a node, mirroring the Go `approval.Activity`.
|
|
24
|
+
* Decisions themselves (approve / handle / reject) are not repeated here —
|
|
25
|
+
* they live on the participant that made them.
|
|
26
|
+
*/
|
|
27
|
+
export interface Activity {
|
|
28
|
+
action: ActivityAction;
|
|
29
|
+
operator: UserInfo;
|
|
30
|
+
opinion?: string;
|
|
31
|
+
attachments?: string[];
|
|
32
|
+
transferTo?: UserInfo;
|
|
33
|
+
target?: UserInfo;
|
|
34
|
+
rollbackToNodeId?: string;
|
|
35
|
+
rollbackToNodeName?: string;
|
|
36
|
+
addedAssignees?: UserInfo[];
|
|
37
|
+
removedAssignees?: UserInfo[];
|
|
38
|
+
ccUsers?: UserInfo[];
|
|
39
|
+
createdAt: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* One carbon-copy recipient at a node, with the read receipt when confirmed.
|
|
43
|
+
*/
|
|
44
|
+
export interface CCRecipient {
|
|
45
|
+
user: UserInfo;
|
|
46
|
+
readAt?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Kind of an instance timeline entry: node entries plus the withdraw /
|
|
50
|
+
* terminate milestones.
|
|
51
|
+
*/
|
|
52
|
+
export type TimelineEntryKind = "start" | "approval" | "handle" | "cc" | "withdraw" | "terminate";
|
|
53
|
+
/**
|
|
54
|
+
* One step of the instance timeline — the chronological, node-by-node account
|
|
55
|
+
* of the path an instance actually took, mirroring `approval.TimelineEntry`.
|
|
56
|
+
* Entries end at the node currently in progress; unreached nodes are not
|
|
57
|
+
* predicted.
|
|
58
|
+
*/
|
|
59
|
+
export interface TimelineEntry {
|
|
60
|
+
kind: TimelineEntryKind;
|
|
61
|
+
nodeId?: string;
|
|
62
|
+
name?: string;
|
|
63
|
+
status?: NodeVisitStatus;
|
|
64
|
+
executionType?: string;
|
|
65
|
+
approvalMethod?: string;
|
|
66
|
+
passRule?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Percentage in `(0, 100]`, serialized as a decimal string.
|
|
69
|
+
*/
|
|
70
|
+
passRatio?: string;
|
|
71
|
+
participants?: NodeParticipant[];
|
|
72
|
+
ccRecipients?: CCRecipient[];
|
|
73
|
+
activities?: Activity[];
|
|
74
|
+
startedAt: string;
|
|
75
|
+
finishedAt?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A React Flow–ready node of the instance flow graph. `kind` selects the node
|
|
79
|
+
* renderer (React Flow's `type`); `data` carries the progress-annotated
|
|
80
|
+
* payload.
|
|
81
|
+
*/
|
|
82
|
+
export interface FlowGraphNode {
|
|
83
|
+
id: string;
|
|
84
|
+
nodeId: string;
|
|
85
|
+
kind: NodeKind;
|
|
86
|
+
position: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
};
|
|
90
|
+
data: FlowGraphNodeData;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The runtime payload of a flow-graph node: display config plus progress and
|
|
94
|
+
* the same participant / CC / activity shapes the timeline uses, aggregated
|
|
95
|
+
* across the node's visits in traversal order.
|
|
96
|
+
*/
|
|
97
|
+
export interface FlowGraphNodeData {
|
|
98
|
+
name: string;
|
|
99
|
+
status: NodeProgressStatus;
|
|
100
|
+
executionType?: string;
|
|
101
|
+
approvalMethod?: string;
|
|
102
|
+
passRule?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Percentage in `(0, 100]`, serialized as a decimal string.
|
|
105
|
+
*/
|
|
106
|
+
passRatio?: string;
|
|
107
|
+
participants?: NodeParticipant[];
|
|
108
|
+
ccRecipients?: CCRecipient[];
|
|
109
|
+
activities?: Activity[];
|
|
110
|
+
startedAt?: string;
|
|
111
|
+
finishedAt?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A React Flow–ready edge of the instance flow graph.
|
|
115
|
+
*/
|
|
116
|
+
export interface FlowGraphEdge {
|
|
117
|
+
id: string;
|
|
118
|
+
source: string;
|
|
119
|
+
target: string;
|
|
120
|
+
sourceHandle?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The read-only, progress-annotated projection of an instance's flow
|
|
124
|
+
* definition, mirroring `approval.InstanceFlowGraph`.
|
|
125
|
+
*/
|
|
126
|
+
export interface InstanceFlowGraph {
|
|
127
|
+
nodes: FlowGraphNode[];
|
|
128
|
+
edges: FlowGraphEdge[];
|
|
129
|
+
}
|