@rytass/bpm-core-react 0.16.2 → 0.17.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/CHANGELOG.md +61 -0
- package/README.md +54 -6
- package/dist/chunks/admin-pickers-BRHk3qKq.cjs +2 -0
- package/dist/chunks/admin-pickers-BRHk3qKq.cjs.map +1 -0
- package/dist/chunks/{admin-pickers-DxhzECkD.js → admin-pickers-Djq3h-UR.js} +41 -39
- package/dist/chunks/admin-pickers-Djq3h-UR.js.map +1 -0
- package/dist/chunks/{categories-DjENouRm.cjs → categories-AxxhqjLZ.cjs} +2 -2
- package/dist/chunks/{categories-DjENouRm.cjs.map → categories-AxxhqjLZ.cjs.map} +1 -1
- package/dist/chunks/{categories-1gKxeEqw.js → categories-riC33J_j.js} +2 -2
- package/dist/chunks/{categories-1gKxeEqw.js.map → categories-riC33J_j.js.map} +1 -1
- package/dist/chunks/{compose-DUH9cQ-L.cjs → compose-B7TtrpQJ.cjs} +2 -2
- package/dist/chunks/{compose-DUH9cQ-L.cjs.map → compose-B7TtrpQJ.cjs.map} +1 -1
- package/dist/chunks/{compose-DO6n0NJi.js → compose-_pREPtfN.js} +2 -2
- package/dist/chunks/{compose-DO6n0NJi.js.map → compose-_pREPtfN.js.map} +1 -1
- package/dist/chunks/{delegations-BLzYnOae.cjs → delegations-V9HIe3_P.cjs} +2 -2
- package/dist/chunks/delegations-V9HIe3_P.cjs.map +1 -0
- package/dist/chunks/{delegations-_b4_xBit.js → delegations-xUt1tj8d.js} +2 -1
- package/dist/chunks/{delegations-_b4_xBit.js.map → delegations-xUt1tj8d.js.map} +1 -1
- package/dist/chunks/{designer-B-cfiob9.js → designer-BiywgNXs.js} +1003 -949
- package/dist/chunks/designer-BiywgNXs.js.map +1 -0
- package/dist/chunks/designer-ttAqv859.cjs +65 -0
- package/dist/chunks/designer-ttAqv859.cjs.map +1 -0
- package/dist/chunks/detail-DRCTnuKm.cjs +2 -0
- package/dist/chunks/detail-DRCTnuKm.cjs.map +1 -0
- package/dist/chunks/{detail-C6NdVijG.js → detail-DScLf42P.js} +183 -156
- package/dist/chunks/detail-DScLf42P.js.map +1 -0
- package/dist/chunks/orgs-C8usknWb.cjs +2 -0
- package/dist/chunks/orgs-C8usknWb.cjs.map +1 -0
- package/dist/chunks/{orgs-Bpp1U60k.js → orgs-Lg7tXv2u.js} +584 -544
- package/dist/chunks/orgs-Lg7tXv2u.js.map +1 -0
- package/dist/chunks/users-DRbuDYF1.js +422 -0
- package/dist/chunks/users-DRbuDYF1.js.map +1 -0
- package/dist/chunks/users-DVQicZIo.cjs +2 -0
- package/dist/chunks/users-DVQicZIo.cjs.map +1 -0
- package/dist/components/admin-pickers.d.cts +65 -0
- package/dist/components/approval-instance-list-page.d.cts +17 -0
- package/dist/components/bpm-form-field.d.cts +10 -0
- package/dist/components/bpm-notification-bell-button.d.cts +22 -0
- package/dist/components/dashboard-page.d.cts +7 -0
- package/dist/components/notification-drawer.d.cts +11 -0
- package/dist/components/org-unit-tree-draft-editor.d.cts +24 -0
- package/dist/components/org-unit-tree-draft-editor.d.ts +1 -1
- package/dist/components/pdf-preview.d.cts +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -1
- package/dist/lib/auth-provider.d.cts +37 -0
- package/dist/lib/format-date-time.d.cts +5 -0
- package/dist/lib/format-member-label.d.cts +12 -0
- package/dist/lib/member-profile-resolution.d.cts +48 -0
- package/dist/lib/notification-drawer-provider.d.cts +27 -0
- package/dist/lib/notification-unread-provider.d.cts +25 -0
- package/dist/lib/org-tree-draft.d.cts +27 -0
- package/dist/lib/providers.d.cts +31 -0
- package/dist/lib/router-adapter.d.cts +47 -0
- package/dist/lib/routes-config.d.cts +117 -0
- package/dist/lib/task-node-label.d.cts +10 -0
- package/dist/lib/use-bpm-logout.d.cts +12 -0
- package/dist/lib/use-bpm-member.d.cts +17 -0
- package/dist/next/BPMNextProviders.d.cts +51 -0
- package/dist/next/index.d.cts +2 -0
- package/dist/next/index.d.ts +2 -2
- package/dist/next/workflow-chat-route.d.cts +17 -0
- package/dist/pages/admin/delegations/index.cjs +1 -1
- package/dist/pages/admin/delegations/index.d.cts +4 -0
- package/dist/pages/admin/delegations/index.js +1 -1
- package/dist/pages/admin/orgs/index.cjs +1 -1
- package/dist/pages/admin/orgs/index.d.cts +4 -0
- package/dist/pages/admin/orgs/index.js +1 -1
- package/dist/pages/admin/users/index.cjs +1 -1
- package/dist/pages/admin/users/index.d.cts +4 -0
- package/dist/pages/admin/users/index.js +1 -1
- package/dist/pages/admin/webhook-endpoints/index.d.cts +4 -0
- package/dist/pages/cc/index.d.cts +16 -0
- package/dist/pages/dashboard/index.d.cts +16 -0
- package/dist/pages/delegations/index.d.cts +4 -0
- package/dist/pages/inbox/index.d.cts +16 -0
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.d.cts +23 -0
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/instances/new/index.d.cts +20 -0
- package/dist/pages/login/index.d.cts +21 -0
- package/dist/pages/root/index.d.cts +18 -0
- package/dist/pages/search/index.d.cts +16 -0
- package/dist/pages/sent/index.d.cts +16 -0
- package/dist/pages/settings/notifications/index.d.cts +4 -0
- package/dist/pages/templates/categories/index.cjs +1 -1
- package/dist/pages/templates/categories/index.d.cts +4 -0
- package/dist/pages/templates/categories/index.js +1 -1
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.d.cts +25 -0
- package/dist/pages/templates/compose/index.js +1 -1
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.d.cts +8 -0
- package/dist/pages/templates/designer/index.js +1 -1
- package/dist/pages/templates/index.d.cts +4 -0
- package/dist/pages/templates/versions/index.d.cts +8 -0
- package/dist/views/admin/delegations/AdminDelegationsView.d.cts +2 -0
- package/dist/views/admin/delegations/index.cjs +1 -1
- package/dist/views/admin/delegations/index.d.cts +1 -0
- package/dist/views/admin/delegations/index.d.ts +1 -1
- package/dist/views/admin/delegations/index.js +1 -1
- package/dist/views/admin/index.cjs +1 -1
- package/dist/views/admin/index.d.cts +4 -0
- package/dist/views/admin/index.d.ts +4 -4
- package/dist/views/admin/index.js +3 -3
- package/dist/views/admin/orgs/AdminOrgsView.d.cts +2 -0
- package/dist/views/admin/orgs/index.cjs +1 -1
- package/dist/views/admin/orgs/index.d.cts +1 -0
- package/dist/views/admin/orgs/index.d.ts +1 -1
- package/dist/views/admin/orgs/index.js +1 -1
- package/dist/views/admin/users/AdminUsersView.d.cts +2 -0
- package/dist/views/admin/users/MemberTaskReassignModal.d.cts +13 -0
- package/dist/views/admin/users/MemberTaskReassignModal.d.ts +13 -0
- package/dist/views/admin/users/index.cjs +1 -1
- package/dist/views/admin/users/index.d.cts +1 -0
- package/dist/views/admin/users/index.d.ts +1 -1
- package/dist/views/admin/users/index.js +1 -1
- package/dist/views/admin/webhook-endpoints/AdminWebhookEndpointsView.d.cts +8 -0
- package/dist/views/admin/webhook-endpoints/index.d.cts +1 -0
- package/dist/views/admin/webhook-endpoints/index.d.ts +1 -1
- package/dist/views/cc/CcView.d.cts +7 -0
- package/dist/views/cc/index.d.cts +1 -0
- package/dist/views/cc/index.d.ts +1 -1
- package/dist/views/dashboard/DashboardView.d.cts +7 -0
- package/dist/views/dashboard/index.d.cts +1 -0
- package/dist/views/dashboard/index.d.ts +1 -1
- package/dist/views/delegations/DelegationsView.d.cts +2 -0
- package/dist/views/delegations/index.d.cts +1 -0
- package/dist/views/delegations/index.d.ts +1 -1
- package/dist/views/forms/builder/FormBuilderView.d.cts +18 -0
- package/dist/views/forms/builder/index.d.cts +1 -0
- package/dist/views/forms/builder/index.d.ts +1 -1
- package/dist/views/forms/builder/json-code-editor.d.cts +11 -0
- package/dist/views/forms/renderer/FormRendererView.d.cts +24 -0
- package/dist/views/forms/renderer/FormRendererView.d.ts +1 -1
- package/dist/views/forms/renderer/form-data-source-field.d.cts +65 -0
- package/dist/views/forms/renderer/form-field-link.d.cts +16 -0
- package/dist/views/forms/renderer/index.d.cts +2 -0
- package/dist/views/forms/renderer/index.d.ts +2 -2
- package/dist/views/forms/renderer/member-field-options.d.cts +39 -0
- package/dist/views/forms/renderer/member-field.d.cts +21 -0
- package/dist/views/inbox/InboxView.d.cts +7 -0
- package/dist/views/inbox/index.d.cts +1 -0
- package/dist/views/inbox/index.d.ts +1 -1
- package/dist/views/instances/detail/InstanceDetailView.d.cts +27 -0
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.d.cts +7 -0
- package/dist/views/instances/detail/index.d.ts +7 -7
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/sections/InstanceAttachmentsSection.d.cts +15 -0
- package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +36 -0
- package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +1 -1
- package/dist/views/instances/detail/sections/InstanceHistorySection.d.cts +29 -0
- package/dist/views/instances/detail/sections/InstanceSignaturesSection.d.cts +14 -0
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +55 -0
- package/dist/views/instances/detail/sections/InstanceWebhookDeliveriesSection.d.cts +20 -0
- package/dist/views/instances/detail/sections/container-helpers.d.cts +10 -0
- package/dist/views/instances/detail/sections/container-helpers.d.ts +1 -1
- package/dist/views/instances/detail/sections/shared.d.cts +141 -0
- package/dist/views/instances/detail/submitted-by.d.cts +23 -0
- package/dist/views/instances/index.d.cts +1 -0
- package/dist/views/instances/index.d.ts +1 -1
- package/dist/views/instances/new/InstanceNewView.d.cts +15 -0
- package/dist/views/instances/new/index.d.cts +1 -0
- package/dist/views/instances/new/index.d.ts +1 -1
- package/dist/views/login/LoginView.d.cts +47 -0
- package/dist/views/login/index.d.cts +1 -0
- package/dist/views/login/index.d.ts +1 -1
- package/dist/views/root/RootView.d.cts +10 -0
- package/dist/views/root/index.d.cts +1 -0
- package/dist/views/root/index.d.ts +1 -1
- package/dist/views/search/SearchView.d.cts +7 -0
- package/dist/views/search/index.d.cts +1 -0
- package/dist/views/search/index.d.ts +1 -1
- package/dist/views/sent/SentView.d.cts +7 -0
- package/dist/views/sent/index.d.cts +1 -0
- package/dist/views/sent/index.d.ts +1 -1
- package/dist/views/settings/index.d.cts +1 -0
- package/dist/views/settings/index.d.ts +1 -1
- package/dist/views/settings/notifications/SettingsNotificationsView.d.cts +2 -0
- package/dist/views/settings/notifications/index.d.cts +1 -0
- package/dist/views/settings/notifications/index.d.ts +1 -1
- package/dist/views/templates/TemplatesView.d.cts +7 -0
- package/dist/views/templates/categories/TemplateCategoriesView.d.cts +2 -0
- package/dist/views/templates/categories/index.cjs +1 -1
- package/dist/views/templates/categories/index.d.cts +1 -0
- package/dist/views/templates/categories/index.d.ts +1 -1
- package/dist/views/templates/categories/index.js +1 -1
- package/dist/views/templates/compose/TemplateComposeWizardView.d.cts +21 -0
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.d.cts +2 -0
- package/dist/views/templates/compose/index.d.ts +2 -2
- package/dist/views/templates/compose/index.js +1 -1
- package/dist/views/templates/compose/steps/ComposeFormStep.d.cts +15 -0
- package/dist/views/templates/compose/steps/ComposeReviewStep.d.cts +12 -0
- package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.cts +22 -0
- package/dist/views/templates/compose/use-template-compose-wizard.d.cts +46 -0
- package/dist/views/templates/designer/NotifyWebhookTargetsEditor.d.cts +20 -0
- package/dist/views/templates/designer/NotifyWebhookTargetsEditor.d.ts +1 -1
- package/dist/views/templates/designer/TemplateDesignerView.d.cts +65 -0
- package/dist/views/templates/designer/chrome-workflow-chat.d.cts +12 -0
- package/dist/views/templates/designer/chrome-workflow-chat.d.ts +1 -1
- package/dist/views/templates/designer/decision-policy-options.d.cts +8 -0
- package/dist/views/templates/designer/designer-version-labels.d.cts +12 -0
- package/dist/views/templates/designer/dry-run-assignee-label.d.cts +28 -0
- package/dist/views/templates/designer/dry-run-sample-data.d.cts +9 -0
- package/dist/views/templates/designer/dynamic-form-resolver-options.d.cts +35 -0
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.d.cts +1 -0
- package/dist/views/templates/designer/index.d.ts +1 -1
- package/dist/views/templates/designer/index.js +1 -1
- package/dist/views/templates/designer/notify-webhook-designer.d.cts +74 -0
- package/dist/views/templates/designer/position-level-options.d.cts +17 -0
- package/dist/views/templates/designer/use-workflow-chat.d.cts +21 -0
- package/dist/views/templates/designer/use-workflow-chat.d.ts +1 -1
- package/dist/views/templates/designer/use-workflow-designer-controller.d.cts +41 -0
- package/dist/views/templates/designer/workflow-chat-drawer.d.cts +16 -0
- package/dist/views/templates/designer/workflow-chat-drawer.d.ts +1 -1
- package/dist/views/templates/index.cjs +1 -1
- package/dist/views/templates/index.d.cts +3 -0
- package/dist/views/templates/index.d.ts +3 -3
- package/dist/views/templates/index.js +1 -1
- package/dist/views/templates/versions/TemplateVersionsView.d.cts +5 -0
- package/dist/views/templates/versions/index.d.cts +1 -0
- package/dist/views/templates/versions/index.d.ts +1 -1
- package/dist/views/workflow/index.d.cts +4 -0
- package/dist/views/workflow/index.d.ts +4 -4
- package/package.json +387 -147
- package/dist/chunks/admin-pickers-DxhzECkD.js.map +0 -1
- package/dist/chunks/admin-pickers-qe3j--gX.cjs +0 -2
- package/dist/chunks/admin-pickers-qe3j--gX.cjs.map +0 -1
- package/dist/chunks/delegations-BLzYnOae.cjs.map +0 -1
- package/dist/chunks/designer-2YvjP_GU.cjs +0 -65
- package/dist/chunks/designer-2YvjP_GU.cjs.map +0 -1
- package/dist/chunks/designer-B-cfiob9.js.map +0 -1
- package/dist/chunks/detail-C6NdVijG.js.map +0 -1
- package/dist/chunks/detail-DKobK4Cg.cjs +0 -2
- package/dist/chunks/detail-DKobK4Cg.cjs.map +0 -1
- package/dist/chunks/orgs-Bpp1U60k.js.map +0 -1
- package/dist/chunks/orgs-ywaE1_02.cjs +0 -2
- package/dist/chunks/orgs-ywaE1_02.cjs.map +0 -1
- package/dist/chunks/users-BSVo_eNe.js +0 -215
- package/dist/chunks/users-BSVo_eNe.js.map +0 -1
- package/dist/chunks/users-DFSBTDMy.cjs +0 -2
- package/dist/chunks/users-DFSBTDMy.cjs.map +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { OrgUnitRecord, PositionRecord } from '@rytass/bpm-core-client/organization';
|
|
3
|
+
export type MemberOption = Readonly<{
|
|
4
|
+
email: string;
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type OrgUnitOption = Readonly<{
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}>;
|
|
12
|
+
export type PositionOption = Readonly<{
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}>;
|
|
16
|
+
interface MemberPickerProps {
|
|
17
|
+
readonly disabled?: boolean;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly onChange: (option: MemberOption | null) => void;
|
|
20
|
+
readonly placeholder?: string;
|
|
21
|
+
readonly size?: 'main' | 'sub';
|
|
22
|
+
readonly value: MemberOption | null;
|
|
23
|
+
}
|
|
24
|
+
interface OrgUnitPickerProps {
|
|
25
|
+
readonly disabled?: boolean;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly onChange: (option: OrgUnitOption | null) => void;
|
|
28
|
+
readonly orgUnits: readonly OrgUnitRecord[];
|
|
29
|
+
readonly placeholder?: string;
|
|
30
|
+
readonly size?: 'main' | 'sub';
|
|
31
|
+
readonly value: OrgUnitOption | null;
|
|
32
|
+
}
|
|
33
|
+
interface PositionPickerProps {
|
|
34
|
+
readonly disabled?: boolean;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly onChange: (option: PositionOption | null) => void;
|
|
37
|
+
readonly placeholder?: string;
|
|
38
|
+
readonly positions: readonly PositionRecord[];
|
|
39
|
+
readonly size?: 'main' | 'sub';
|
|
40
|
+
readonly value: PositionOption | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* AutoComplete-backed picker that searches the BPM member directory via
|
|
44
|
+
* `searchMembers()`. Emits a {@link MemberOption} `{ id, name, email }`
|
|
45
|
+
* on selection (or `null` when cleared).
|
|
46
|
+
*/
|
|
47
|
+
export declare function MemberPicker({ disabled, name, onChange, placeholder, size, value, }: MemberPickerProps): ReactElement;
|
|
48
|
+
/**
|
|
49
|
+
* Static `<Select>` over a pre-fetched list of org units. Caller is
|
|
50
|
+
* responsible for fetching the org units (typically via
|
|
51
|
+
* `readOrganizationDashboard` from `@rytass/bpm-core-client/organization`).
|
|
52
|
+
*/
|
|
53
|
+
export declare function OrgUnitPicker({ disabled, onChange, orgUnits, placeholder, size, value, }: OrgUnitPickerProps): ReactElement;
|
|
54
|
+
/**
|
|
55
|
+
* Static `<Select>` over a pre-fetched list of positions.
|
|
56
|
+
*/
|
|
57
|
+
export declare function PositionPicker({ disabled, onChange, placeholder, positions, size, value, }: PositionPickerProps): ReactElement;
|
|
58
|
+
export declare function readMemberOption(member: {
|
|
59
|
+
readonly email: string;
|
|
60
|
+
readonly memberId: string;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
}): MemberOption;
|
|
63
|
+
export declare function readOrgUnitOption(orgUnit: OrgUnitRecord): OrgUnitOption;
|
|
64
|
+
export declare function readPositionOption(position: PositionRecord): PositionOption;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ApprovalInstanceState, ApprovalInstanceView } from '@rytass/bpm-core-client/workflow';
|
|
3
|
+
export interface ApprovalInstanceListPageProps {
|
|
4
|
+
readonly defaultState: ApprovalInstanceState | null;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly emptyMessage: string;
|
|
7
|
+
readonly searchPlaceholder: string;
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly view: ApprovalInstanceView;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shared list page for any approval-instance "view" (inbox / sent / cc /
|
|
13
|
+
* delegated). Caller picks the view + default state filter; the page renders
|
|
14
|
+
* the standard BPM filter bar + paginated table and navigates to
|
|
15
|
+
* `/instances/:id` on row action.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ApprovalInstanceListPage({ defaultState, description, emptyMessage, searchPlaceholder, title, view, }: ApprovalInstanceListPageProps): ReactElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { FormFieldProps } from '@mezzanine-ui/react';
|
|
3
|
+
type BPMFormFieldProps = Omit<FormFieldProps, 'density' | 'fullWidth' | 'layout'> & Partial<Pick<FormFieldProps, 'density' | 'fullWidth' | 'layout'>>;
|
|
4
|
+
/**
|
|
5
|
+
* Mezzanine `<FormField>` pre-configured with the BPM admin defaults
|
|
6
|
+
* (`TIGHT` density, `HORIZONTAL` layout, full width). Use everywhere a
|
|
7
|
+
* label-aligned field is needed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function BPMFormField({ density, fullWidth, layout, ...props }: BPMFormFieldProps): ReactElement;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export interface BPMNotificationBellButtonProps {
|
|
3
|
+
/** Override the aria-label / tooltip. Defaults to `通知中心`. */
|
|
4
|
+
readonly label?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Drop-in notification bell. Reads the unread count from
|
|
8
|
+
* `<NotificationUnreadProvider>`, opens the BPM `<NotificationDrawer />`
|
|
9
|
+
* mounted by `<Providers>` (or `<BPMNextProviders>`) on click, and
|
|
10
|
+
* renders a small red badge with the unread count.
|
|
11
|
+
*
|
|
12
|
+
* Use this when the host navigation wants the BPM notification UX with
|
|
13
|
+
* minimum wiring. Hosts that need a fully custom button can skip this
|
|
14
|
+
* widget and consume `useNotificationDrawer()` + `useNotificationUnread()`
|
|
15
|
+
* directly to wire their own trigger.
|
|
16
|
+
*
|
|
17
|
+
* Visual: uses Mezzanine `NavigationIconButton` so the bell aligns with
|
|
18
|
+
* surrounding Mezzanine navigation chrome. The button is decoupled from
|
|
19
|
+
* the `<Navigation>` container — it does not require a Mezzanine
|
|
20
|
+
* navigation tree to render.
|
|
21
|
+
*/
|
|
22
|
+
export declare function BPMNotificationBellButton({ label, }?: BPMNotificationBellButtonProps): ReactElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Operator dashboard — shows pending/unread/active counts for the
|
|
4
|
+
* currently-authenticated member. Reads {@link readWorkflowDashboardSummary}
|
|
5
|
+
* and renders five metric tiles that navigate via {@link useRouterAdapter}.
|
|
6
|
+
*/
|
|
7
|
+
export declare function DashboardPage(): ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Right-side notification drawer mounted at the root by `<Providers>`.
|
|
4
|
+
* Opens / closes via `useNotificationDrawer()`, polls
|
|
5
|
+
* `listNotifications()` for the current member, supports filter
|
|
6
|
+
* (`all` / `read` / `unread`), per-row mark-read, per-row archive / unarchive,
|
|
7
|
+
* bulk mark-all-read, and load-more pagination. Archived notifications are
|
|
8
|
+
* hidden until the filter-bar menu turns "顯示已封存" on. Clicking a row with an
|
|
9
|
+
* `instanceId` navigates to `/instances/<id>` via the host's router adapter.
|
|
10
|
+
*/
|
|
11
|
+
export declare function NotificationDrawer(): ReactElement | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OrgUnitRecord } from '@rytass/bpm-core-client/organization';
|
|
2
|
+
import { OrgUnitHierarchyDraftChange } from '../lib/org-tree-draft.cjs';
|
|
3
|
+
export type OrgUnitTreeDraftEditorHandle = Readonly<{
|
|
4
|
+
cancelEditing: () => void;
|
|
5
|
+
saveDraft: () => Promise<void>;
|
|
6
|
+
startEditing: () => void;
|
|
7
|
+
}>;
|
|
8
|
+
export type OrgUnitTreeDraftEditorState = Readonly<{
|
|
9
|
+
hasDraftChanges: boolean;
|
|
10
|
+
isEditing: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const OrgUnitTreeDraftEditor: import('react').ForwardRefExoticComponent<Readonly<{
|
|
13
|
+
onCreateChild: (parentId: string) => void;
|
|
14
|
+
onCreateRoot: () => void;
|
|
15
|
+
onEditOrgUnit: (orgUnit: OrgUnitRecord) => void;
|
|
16
|
+
onSaveDraft?: (changes: readonly OrgUnitHierarchyDraftChange[]) => Promise<void>;
|
|
17
|
+
onStateChange: (state: OrgUnitTreeDraftEditorState) => void;
|
|
18
|
+
orgUnits: readonly OrgUnitRecord[];
|
|
19
|
+
saving: boolean;
|
|
20
|
+
}> & import('react').RefAttributes<Readonly<{
|
|
21
|
+
cancelEditing: () => void;
|
|
22
|
+
saveDraft: () => Promise<void>;
|
|
23
|
+
startEditing: () => void;
|
|
24
|
+
}>>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrgUnitRecord } from '@rytass/bpm-core-client/organization';
|
|
2
|
-
import { OrgUnitHierarchyDraftChange } from '../lib/org-tree-draft';
|
|
2
|
+
import { OrgUnitHierarchyDraftChange } from '../lib/org-tree-draft.js';
|
|
3
3
|
export type OrgUnitTreeDraftEditorHandle = Readonly<{
|
|
4
4
|
cancelEditing: () => void;
|
|
5
5
|
saveDraft: () => Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export declare function configurePdfWorker(workerSrc: string): void;
|
|
3
|
+
export interface PDFPreviewProps {
|
|
4
|
+
readonly filename: string;
|
|
5
|
+
readonly fileUrl: string;
|
|
6
|
+
readonly onDownload?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Mezzanine-styled PDF preview powered by `react-pdf`. Used by the instance
|
|
10
|
+
* detail view to preview PDF attachments inline.
|
|
11
|
+
*/
|
|
12
|
+
export declare function PDFPreview({ filename, fileUrl, onDownload, }: PDFPreviewProps): ReactElement;
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');const e=require("./chunks/router-adapter--gYs13E8.cjs"),t=require("./chunks/auth-provider-4BeCw7cI.cjs"),n=require("./chunks/format-date-time-D-cx5M8z.cjs"),r=require("./chunks/providers-DHtDZFNA.cjs"),i=require("./chunks/routes-config-C1j_vFKo.cjs"),a=require("./chunks/bpm-form-field-Bc6k4ZEO.cjs"),o=require("./chunks/use-bpm-member-DpNAQtNC.cjs"),s=require("./chunks/admin-pickers-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');const e=require("./chunks/router-adapter--gYs13E8.cjs"),t=require("./chunks/auth-provider-4BeCw7cI.cjs"),n=require("./chunks/format-date-time-D-cx5M8z.cjs"),r=require("./chunks/providers-DHtDZFNA.cjs"),i=require("./chunks/routes-config-C1j_vFKo.cjs"),a=require("./chunks/bpm-form-field-Bc6k4ZEO.cjs"),o=require("./chunks/use-bpm-member-DpNAQtNC.cjs"),s=require("./chunks/admin-pickers-BRHk3qKq.cjs"),c=require("./chunks/approval-instance-list-page-ax0pm8bt.cjs"),l=require("./chunks/dashboard-page-BWQBSGDq.cjs");let u=require("@mezzanine-ui/react"),d=require("react/jsx-runtime"),f=require("@mezzanine-ui/icons");function p(){let{logout:e}=t.n();return e}var m={root:`bpm_root_jl5S-`,badge:`bpm_badge_SIKJk`};function h({label:e=`通知中心`}={}){let{open:t}=r.o(),{unreadCount:n}=r.i(),i=n>0?`${e},${n} 則未讀`:e;return(0,d.jsxs)(`span`,{className:m.root,children:[(0,d.jsx)(u.NavigationIconButton,{"aria-label":i,icon:f.NotificationUnreadIcon,onClick:()=>{t()},title:e,type:`button`}),n>0?(0,d.jsx)(`span`,{className:m.badge,children:n>99?`99+`:n}):null]})}exports.ApprovalInstanceListPage=c.t,exports.AuthProvider=t.t,exports.BPMFormField=a.t,exports.BPMNotificationBellButton=h,exports.BPMRoutesProvider=i.t,exports.DashboardPage=l.t,exports.MemberPicker=s.t,exports.NotificationDrawer=r.n,exports.NotificationDrawerProvider=r.a,exports.NotificationUnreadProvider=r.r,exports.OrgUnitPicker=s.n,exports.PositionPicker=s.r,exports.Providers=r.t,exports.RouterAdapterProvider=e.t,exports.createDefaultBPMRoutes=i.n,exports.defaultBrowserSearchParams=e.n,exports.formatDateTime=n.t,exports.isBPMAdminMember=o.t,exports.readMemberOption=s.i,exports.readOrgUnitOption=s.a,exports.readPositionOption=s.o,exports.useAuth=t.n,exports.useBPMLogout=p,exports.useBPMMember=o.n,exports.useBPMRoutes=i.r,exports.useNotificationDrawer=r.o,exports.useNotificationUnread=r.i,exports.useRouterAdapter=e.r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './lib/auth-provider.cjs';
|
|
2
|
+
export * from './lib/format-date-time.cjs';
|
|
3
|
+
export * from './lib/notification-drawer-provider.cjs';
|
|
4
|
+
export * from './lib/notification-unread-provider.cjs';
|
|
5
|
+
export * from './lib/providers.cjs';
|
|
6
|
+
export * from './lib/router-adapter.cjs';
|
|
7
|
+
export * from './lib/routes-config.cjs';
|
|
8
|
+
export * from './lib/use-bpm-logout.cjs';
|
|
9
|
+
export * from './lib/use-bpm-member.cjs';
|
|
10
|
+
export * from './components/admin-pickers.cjs';
|
|
11
|
+
export * from './components/approval-instance-list-page.cjs';
|
|
12
|
+
export * from './components/bpm-form-field.cjs';
|
|
13
|
+
export * from './components/bpm-notification-bell-button.cjs';
|
|
14
|
+
export * from './components/dashboard-page.cjs';
|
|
15
|
+
export * from './components/notification-drawer.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export * from './lib/auth-provider';
|
|
2
|
-
export * from './lib/format-date-time';
|
|
3
|
-
export * from './lib/notification-drawer-provider';
|
|
4
|
-
export * from './lib/notification-unread-provider';
|
|
5
|
-
export * from './lib/providers';
|
|
6
|
-
export * from './lib/router-adapter';
|
|
7
|
-
export * from './lib/routes-config';
|
|
8
|
-
export * from './lib/use-bpm-logout';
|
|
9
|
-
export * from './lib/use-bpm-member';
|
|
10
|
-
export * from './components/admin-pickers';
|
|
11
|
-
export * from './components/approval-instance-list-page';
|
|
12
|
-
export * from './components/bpm-form-field';
|
|
13
|
-
export * from './components/bpm-notification-bell-button';
|
|
14
|
-
export * from './components/dashboard-page';
|
|
15
|
-
export * from './components/notification-drawer';
|
|
1
|
+
export * from './lib/auth-provider.js';
|
|
2
|
+
export * from './lib/format-date-time.js';
|
|
3
|
+
export * from './lib/notification-drawer-provider.js';
|
|
4
|
+
export * from './lib/notification-unread-provider.js';
|
|
5
|
+
export * from './lib/providers.js';
|
|
6
|
+
export * from './lib/router-adapter.js';
|
|
7
|
+
export * from './lib/routes-config.js';
|
|
8
|
+
export * from './lib/use-bpm-logout.js';
|
|
9
|
+
export * from './lib/use-bpm-member.js';
|
|
10
|
+
export * from './components/admin-pickers.js';
|
|
11
|
+
export * from './components/approval-instance-list-page.js';
|
|
12
|
+
export * from './components/bpm-form-field.js';
|
|
13
|
+
export * from './components/bpm-notification-bell-button.js';
|
|
14
|
+
export * from './components/dashboard-page.js';
|
|
15
|
+
export * from './components/notification-drawer.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { a as o, i as s, n as c, o as l, r as u, t as d } from "./chunks/provide
|
|
|
6
6
|
import { n as f, r as p, t as m } from "./chunks/routes-config-yZbESPlw.js";
|
|
7
7
|
import { t as h } from "./chunks/bpm-form-field-Cao0rMol.js";
|
|
8
8
|
import { n as g, t as _ } from "./chunks/use-bpm-member-D57LKe_u.js";
|
|
9
|
-
import { a as v, i as y, n as b, o as x, r as S, t as C } from "./chunks/admin-pickers-
|
|
9
|
+
import { a as v, i as y, n as b, o as x, r as S, t as C } from "./chunks/admin-pickers-Djq3h-UR.js";
|
|
10
10
|
import { t as w } from "./chunks/approval-instance-list-page-CPXMP3PL.js";
|
|
11
11
|
import { t as T } from "./chunks/dashboard-page-DdBvV6YI.js";
|
|
12
12
|
import { NavigationIconButton as E } from "@mezzanine-ui/react";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ApiMember } from '@rytass/bpm-core-client';
|
|
3
|
+
interface AuthContextValue {
|
|
4
|
+
readonly loading: boolean;
|
|
5
|
+
readonly member: ApiMember | null;
|
|
6
|
+
readonly login: (input: {
|
|
7
|
+
readonly identifier: string;
|
|
8
|
+
readonly password: string;
|
|
9
|
+
}) => Promise<ApiMember>;
|
|
10
|
+
readonly logout: () => Promise<void>;
|
|
11
|
+
readonly refresh: () => Promise<ApiMember | null>;
|
|
12
|
+
}
|
|
13
|
+
export interface AuthProviderProps {
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Paths that should not redirect to `/login` when there is no session.
|
|
17
|
+
* Defaults to `['/login']`. Override when your host runs the login UI
|
|
18
|
+
* under a different path.
|
|
19
|
+
*/
|
|
20
|
+
readonly publicPaths?: readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* Where to send unauthenticated users. Defaults to `'/login'`.
|
|
23
|
+
*/
|
|
24
|
+
readonly loginPath?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* BPM auth context provider. Reads / writes the host BPM API session via
|
|
28
|
+
* `@rytass/bpm-core-client` (`loginApi` / `logoutApi` / `readApiCurrentMember`)
|
|
29
|
+
* and uses the host-supplied {@link useRouterAdapter} to redirect
|
|
30
|
+
* unauthenticated users.
|
|
31
|
+
*/
|
|
32
|
+
export declare function AuthProvider({ children, publicPaths, loginPath, }: AuthProviderProps): ReactElement;
|
|
33
|
+
/**
|
|
34
|
+
* Access the BPM auth context. Throws when used outside `<AuthProvider>`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useAuth(): AuthContextValue;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the e-mail is attached to the name: `ascii` is `name (email)`,
|
|
3
|
+
* `fullwidth` is `name(email)` and `dot` is `name · email`. Each call site
|
|
4
|
+
* keeps the separator it always had.
|
|
5
|
+
*/
|
|
6
|
+
export type MemberLabelStyle = 'ascii' | 'dot' | 'fullwidth';
|
|
7
|
+
/**
|
|
8
|
+
* `name` followed by the e-mail in the given style. A host may resolve a member
|
|
9
|
+
* with `email: ''` (or a blank string), and then the label is just the name —
|
|
10
|
+
* never `name ()` or `name · `.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatMemberLabel(name: string, email: string | null | undefined, style?: MemberLabelStyle): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MemberProfileRecord } from '@rytass/bpm-core-client/template';
|
|
2
|
+
/** Most ids asked for on their own after a failed batch, per round. */
|
|
3
|
+
export declare const MAX_PER_ID_REQUESTS = 20;
|
|
4
|
+
/** Most per-id requests in flight at once. */
|
|
5
|
+
export declare const PER_ID_CONCURRENCY = 4;
|
|
6
|
+
export type MemberProfileResolution = Readonly<{
|
|
7
|
+
/** Ids whose lookup failed even when asked for on their own. */
|
|
8
|
+
failedIds: readonly string[];
|
|
9
|
+
profiles: readonly MemberProfileRecord[];
|
|
10
|
+
/**
|
|
11
|
+
* Ids left unasked because a failed batch held more than the per-id budget.
|
|
12
|
+
* They were not tried, so a later round may ask for them again.
|
|
13
|
+
*/
|
|
14
|
+
skippedIds: readonly string[];
|
|
15
|
+
}>;
|
|
16
|
+
export type MemberProfileResolutionLimits = Readonly<{
|
|
17
|
+
concurrency?: number;
|
|
18
|
+
maxPerIdRequests?: number;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Looks up member profiles in one batch, and degrades per id when the batch
|
|
22
|
+
* request fails.
|
|
23
|
+
*
|
|
24
|
+
* The host fails a whole lookup when it contains an id it cannot handle (a
|
|
25
|
+
* foreign id stored in a template, say). Treating that as "nobody resolved"
|
|
26
|
+
* labels every approver of the template 「未知會員」 for the sake of one bad
|
|
27
|
+
* id, so a failed batch is retried one id at a time and only the ids that fail
|
|
28
|
+
* on their own are reported back in `failedIds`.
|
|
29
|
+
*
|
|
30
|
+
* The retry is bounded: at most `maxPerIdRequests` ids are asked for on their
|
|
31
|
+
* own (the rest come back in `skippedIds` without a request), and at most
|
|
32
|
+
* `concurrency` of those requests run at once, so one bad id in a large
|
|
33
|
+
* template cannot turn into a burst of requests.
|
|
34
|
+
*
|
|
35
|
+
* A single-id batch is not retried: it already is the per-id request.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveMemberProfilesPerIdOnFailure(memberIds: readonly string[], resolveMembers: (memberIds: readonly string[]) => Promise<readonly MemberProfileRecord[]>, limits?: MemberProfileResolutionLimits): Promise<MemberProfileResolution>;
|
|
38
|
+
/**
|
|
39
|
+
* The ids still worth asking the directory for: those that already failed on
|
|
40
|
+
* their own in this session are left out, so they stay 「未知會員」 instead of
|
|
41
|
+
* being re-requested every time the option list changes.
|
|
42
|
+
*
|
|
43
|
+
* A failed id stays 「未知會員」 for the rest of the session, even when the
|
|
44
|
+
* failure was transient (a network blip, say), unless a later member search
|
|
45
|
+
* returns it and replaces the placeholder. Ids skipped over the per-id cap
|
|
46
|
+
* were never asked and must not be added to `failedMemberIds`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function excludeFailedMemberIds(memberIds: readonly string[], failedMemberIds: ReadonlySet<string>): readonly string[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
interface NotificationDrawerContextValue {
|
|
3
|
+
readonly close: () => void;
|
|
4
|
+
readonly isOpen: boolean;
|
|
5
|
+
readonly open: () => void;
|
|
6
|
+
readonly toggle: () => void;
|
|
7
|
+
}
|
|
8
|
+
interface NotificationDrawerProviderProps {
|
|
9
|
+
readonly children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Controls the open/closed state of the BPM notification drawer. Wraps
|
|
13
|
+
* children with a context that `<NotificationDrawer />` reads to mount /
|
|
14
|
+
* hide itself, and that the host navigation reads (via
|
|
15
|
+
* `<BPMNotificationBellButton />` or `useNotificationDrawer().open`) to
|
|
16
|
+
* open the drawer when the bell icon is clicked.
|
|
17
|
+
*
|
|
18
|
+
* When used outside this provider, the returned hook is a safe no-op so
|
|
19
|
+
* components don't crash in test or storybook environments.
|
|
20
|
+
*/
|
|
21
|
+
export declare function NotificationDrawerProvider({ children, }: NotificationDrawerProviderProps): ReactElement;
|
|
22
|
+
/**
|
|
23
|
+
* Read the BPM notification drawer's open state and control helpers.
|
|
24
|
+
* Returns a no-op stub when used outside `<NotificationDrawerProvider>`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useNotificationDrawer(): NotificationDrawerContextValue;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
interface NotificationUnreadContextValue {
|
|
3
|
+
readonly refreshUnreadCount: () => Promise<number>;
|
|
4
|
+
readonly unreadCount: number;
|
|
5
|
+
}
|
|
6
|
+
interface NotificationUnreadProviderProps {
|
|
7
|
+
readonly children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Polls BPM for the current member's unread notification count via
|
|
11
|
+
* `readUnreadNotificationCount` and exposes it through context for the
|
|
12
|
+
* host navigation (`<BPMNotificationBellButton />` badge or any custom
|
|
13
|
+
* trigger using `useNotificationUnread().unreadCount`) and the BPM
|
|
14
|
+
* `<NotificationDrawer />` (header count). Refresh is triggered on
|
|
15
|
+
* mount and whenever the auth member id changes; consumers can call
|
|
16
|
+
* `refreshUnreadCount()` after acknowledging a notification.
|
|
17
|
+
*/
|
|
18
|
+
export declare function NotificationUnreadProvider({ children, }: NotificationUnreadProviderProps): ReactElement;
|
|
19
|
+
/**
|
|
20
|
+
* Read the current unread-notification count and a manual refresh helper.
|
|
21
|
+
* Returns a zero/no-op stub when used outside
|
|
22
|
+
* `<NotificationUnreadProvider>`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useNotificationUnread(): NotificationUnreadContextValue;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OrgUnitRecord } from '@rytass/bpm-core-client/organization';
|
|
2
|
+
export type OrgUnitParentDraftMap = ReadonlyMap<string, string | null>;
|
|
3
|
+
export type OrgUnitHierarchyDraftChange = Readonly<{
|
|
4
|
+
orgUnitId: string;
|
|
5
|
+
parentId: string | null;
|
|
6
|
+
previousParentId: string | null;
|
|
7
|
+
}>;
|
|
8
|
+
export type OrgUnitParentAssignmentResult = Readonly<{
|
|
9
|
+
message: string;
|
|
10
|
+
parentDraft: OrgUnitParentDraftMap;
|
|
11
|
+
status: 'INVALID' | 'UNCHANGED' | 'UPDATED';
|
|
12
|
+
}>;
|
|
13
|
+
export declare function createOrgUnitParentDraftMap(orgUnits: readonly OrgUnitRecord[]): OrgUnitParentDraftMap;
|
|
14
|
+
export declare function assignOrgUnitDraftParent({ orgUnitId, parentDraft, parentId, }: {
|
|
15
|
+
readonly orgUnitId: string;
|
|
16
|
+
readonly parentDraft: OrgUnitParentDraftMap;
|
|
17
|
+
readonly parentId: string | null;
|
|
18
|
+
}): OrgUnitParentAssignmentResult;
|
|
19
|
+
export declare function readOrgUnitHierarchyDraftChanges({ orgUnits, parentDraft, }: {
|
|
20
|
+
readonly orgUnits: readonly OrgUnitRecord[];
|
|
21
|
+
readonly parentDraft: OrgUnitParentDraftMap;
|
|
22
|
+
}): readonly OrgUnitHierarchyDraftChange[];
|
|
23
|
+
export declare function readOrgUnitParentValidationMessage({ orgUnitId, parentDraft, parentId, }: {
|
|
24
|
+
readonly orgUnitId: string;
|
|
25
|
+
readonly parentDraft: OrgUnitParentDraftMap;
|
|
26
|
+
readonly parentId: string | null;
|
|
27
|
+
}): string | null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { CalendarLocale } from '@mezzanine-ui/react/moment';
|
|
3
|
+
interface ProvidersProps {
|
|
4
|
+
readonly children: ReactNode;
|
|
5
|
+
/** Override Mezzanine calendar locale. Defaults to `CalendarLocale.ZH_TW`. */
|
|
6
|
+
readonly locale?: CalendarLocale;
|
|
7
|
+
/**
|
|
8
|
+
* Public paths that should not trigger redirect to `/login` when there
|
|
9
|
+
* is no session. Forwarded to `<AuthProvider>`. Defaults to `['/login']`.
|
|
10
|
+
*/
|
|
11
|
+
readonly publicPaths?: readonly string[];
|
|
12
|
+
/** Where to send unauthenticated users. Defaults to `'/login'`. */
|
|
13
|
+
readonly loginPath?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* One-stop BPM admin provider stack. Wires:
|
|
17
|
+
*
|
|
18
|
+
* - Mezzanine UI calendar locale (moment-based, `ZH_TW` by default)
|
|
19
|
+
* - `<AuthProvider>` (BPM session via REST `/auth/*`)
|
|
20
|
+
* - `<NotificationUnreadProvider>` (polls unread count)
|
|
21
|
+
* - `<NotificationDrawerProvider>` (controls drawer open/close state)
|
|
22
|
+
* - `<NotificationDrawer />` mounted at the root so the host navigation
|
|
23
|
+
* bell (`<BPMNotificationBellButton />` or any custom trigger calling
|
|
24
|
+
* `useNotificationDrawer().open`) can open it.
|
|
25
|
+
*
|
|
26
|
+
* Consumer hosts wrap this **inside** a `<RouterAdapterProvider>` (provided
|
|
27
|
+
* by the `pages/*` subpath shims when consuming via Next.js, or wired by
|
|
28
|
+
* hand for other frameworks).
|
|
29
|
+
*/
|
|
30
|
+
export declare function Providers({ children, locale, publicPaths, loginPath, }: ProvidersProps): ReactElement;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic router contract every BPM view consumes.
|
|
4
|
+
*
|
|
5
|
+
* Next.js App Router consumers wire it from `useRouter()` / `usePathname()`,
|
|
6
|
+
* but the contract is intentionally generic so SPA / Remix / Tanstack Router
|
|
7
|
+
* hosts can plug in the same `<RouterAdapterProvider>` with their own
|
|
8
|
+
* navigation primitives.
|
|
9
|
+
*/
|
|
10
|
+
export interface RouterAdapter {
|
|
11
|
+
/** Current pathname (e.g. "/inbox"). `null` during SSR before hydration. */
|
|
12
|
+
readonly pathname: string | null;
|
|
13
|
+
/** Navigate to `href` (push onto history). */
|
|
14
|
+
push(href: string): void;
|
|
15
|
+
/** Navigate to `href` and replace the current history entry. */
|
|
16
|
+
replace(href: string): void;
|
|
17
|
+
/** Optional: go back. Falls back to `history.back()` when omitted. */
|
|
18
|
+
back?(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Optional search params accessor. Returned `URLSearchParams` should be
|
|
21
|
+
* read-only — mutating it does not navigate. Default implementation reads
|
|
22
|
+
* `window.location.search` on the client.
|
|
23
|
+
*/
|
|
24
|
+
searchParams?(): URLSearchParams;
|
|
25
|
+
}
|
|
26
|
+
export interface RouterAdapterProviderProps {
|
|
27
|
+
readonly value: RouterAdapter;
|
|
28
|
+
readonly children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Wraps the BPM React tree so `useRouterAdapter()` resolves to the host's
|
|
32
|
+
* navigation primitives. Consumers typically put this once at the very root
|
|
33
|
+
* of their layout (or inside a `'use client'` shim that reads
|
|
34
|
+
* `useRouter()` + `usePathname()` from `next/navigation`).
|
|
35
|
+
*/
|
|
36
|
+
export declare function RouterAdapterProvider({ value, children, }: RouterAdapterProviderProps): ReactElement;
|
|
37
|
+
/**
|
|
38
|
+
* Reads the host-provided {@link RouterAdapter}. Throws when used outside a
|
|
39
|
+
* `<RouterAdapterProvider>` to surface wiring mistakes early.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useRouterAdapter(): RouterAdapter;
|
|
42
|
+
/**
|
|
43
|
+
* Pure default search-params reader for the browser. Server-side returns an
|
|
44
|
+
* empty `URLSearchParams`. Used internally when a {@link RouterAdapter}
|
|
45
|
+
* does not override `searchParams()`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function defaultBrowserSearchParams(): URLSearchParams;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic path mapping every BPM view uses for internal
|
|
4
|
+
* cross-navigation. When a host embeds BPM under a non-root prefix
|
|
5
|
+
* (e.g. `/workspace/bpm/*`) it provides its own implementation through
|
|
6
|
+
* `<BPMRoutesProvider value={...}>`; otherwise the default factory
|
|
7
|
+
* preserves the historical `/instances/:id`, `/templates`, etc. paths.
|
|
8
|
+
*
|
|
9
|
+
* Function-shape (instead of string templates) means:
|
|
10
|
+
* - Optional and multi-param routes can branch on argument presence
|
|
11
|
+
* (`caseNew(templateId?)`).
|
|
12
|
+
* - Query-string composition stays inside the host's resolver, not the
|
|
13
|
+
* view.
|
|
14
|
+
* - TypeScript flags missing arguments at compile time.
|
|
15
|
+
*
|
|
16
|
+
* Mirror sibling: {@link RouterAdapter} owns *navigation primitives*
|
|
17
|
+
* (`push`, `replace`, `pathname`); `BPMRoutes` owns *path strings*. The
|
|
18
|
+
* two compose: views call `router.push(routes.caseDetail(id))`.
|
|
19
|
+
*/
|
|
20
|
+
export interface BPMRoutes {
|
|
21
|
+
/** Workflow dashboard landing. Used by sidebar + dashboard tiles. */
|
|
22
|
+
dashboard(): string;
|
|
23
|
+
/** Inbox (待簽) — pending tasks assigned to the current member. */
|
|
24
|
+
inbox(): string;
|
|
25
|
+
/** Sent (我發起的) — instances the current member initiated or submitted on someone's behalf. */
|
|
26
|
+
sent(): string;
|
|
27
|
+
/** CC (抄送給我) — instances the current member is copied on. */
|
|
28
|
+
cc(): string;
|
|
29
|
+
/** Cross-view search. */
|
|
30
|
+
search(): string;
|
|
31
|
+
/** Personal delegation rules. */
|
|
32
|
+
delegations(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Reserved for hosts that want a dedicated `/notifications` page —
|
|
35
|
+
* BPM's built-in views do **not** navigate here by default (the
|
|
36
|
+
* notification drawer mounted by `<BPMNextProviders>` is the primary
|
|
37
|
+
* unread-notification UX). The `createDefaultBPMRoutes()` factory
|
|
38
|
+
* returns `'/notifications'` so consumers can mount their own page
|
|
39
|
+
* at that path if desired; no BPM-shipped `pages/notifications`
|
|
40
|
+
* shim exists.
|
|
41
|
+
*/
|
|
42
|
+
notifications(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Detail page for one approval instance.
|
|
45
|
+
*
|
|
46
|
+
* @example default → `/instances/abc123`
|
|
47
|
+
*/
|
|
48
|
+
caseDetail(instanceId: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Launch a new approval instance. When `templateId` is passed, the
|
|
51
|
+
* launch form is pre-populated for that template — by default this is
|
|
52
|
+
* appended as a `?templateId=` query string so the path itself stays
|
|
53
|
+
* stable for routing.
|
|
54
|
+
*
|
|
55
|
+
* @example default `caseNew()` → `/instances/new`
|
|
56
|
+
* @example default `caseNew('tpl-1')` → `/instances/new?templateId=tpl-1`
|
|
57
|
+
*/
|
|
58
|
+
caseNew(templateId?: string): string;
|
|
59
|
+
/** Template index. */
|
|
60
|
+
templates(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Unified "form + flow" creation wizard. Designs a form and an approval
|
|
63
|
+
* flow together, then publishes both atomically. This is the only place
|
|
64
|
+
* forms are designed — there is no separate standalone form builder page.
|
|
65
|
+
*/
|
|
66
|
+
templateCompose(): string;
|
|
67
|
+
/** Template designer (xyflow canvas). */
|
|
68
|
+
templateDesigner(templateId: string): string;
|
|
69
|
+
/** Template version history. */
|
|
70
|
+
templateVersions(templateId: string): string;
|
|
71
|
+
/** Template categories admin. */
|
|
72
|
+
templateCategories(): string;
|
|
73
|
+
/** Per-member notification preferences. */
|
|
74
|
+
notificationSettings(): string;
|
|
75
|
+
/** Admin: organization tree management. */
|
|
76
|
+
adminOrgs(): string;
|
|
77
|
+
/** Admin: member directory mapping. */
|
|
78
|
+
adminUsers(): string;
|
|
79
|
+
/** Admin: delegation rule management. */
|
|
80
|
+
adminDelegations(): string;
|
|
81
|
+
/** Admin: database-managed notify webhook endpoints (ADR 18). */
|
|
82
|
+
adminWebhookEndpoints(): string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Factory for the default `BPMRoutes` value. Reproduces the exact path
|
|
86
|
+
* literals BPM views used before `BPMRoutesContext` existed, so existing
|
|
87
|
+
* hosts (no provider mounted) keep working unchanged.
|
|
88
|
+
*/
|
|
89
|
+
export declare function createDefaultBPMRoutes(): BPMRoutes;
|
|
90
|
+
export interface BPMRoutesProviderProps {
|
|
91
|
+
/**
|
|
92
|
+
* Override the path mapping. Provide a full implementation, or spread
|
|
93
|
+
* the default and override individual entries:
|
|
94
|
+
*
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <BPMRoutesProvider value={{
|
|
97
|
+
* ...createDefaultBPMRoutes(),
|
|
98
|
+
* caseDetail: (id) => `/workspace/cases/${id}`,
|
|
99
|
+
* }}>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
readonly value?: BPMRoutes;
|
|
103
|
+
readonly children: ReactNode;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Wraps the BPM React tree with a {@link BPMRoutes} value. Mounting the
|
|
107
|
+
* provider is **optional** — `useBPMRoutes()` falls back to
|
|
108
|
+
* {@link createDefaultBPMRoutes} when no provider is present. Use it
|
|
109
|
+
* only when the host needs to remap BPM's internal paths.
|
|
110
|
+
*/
|
|
111
|
+
export declare function BPMRoutesProvider({ value, children, }: BPMRoutesProviderProps): ReactElement;
|
|
112
|
+
/**
|
|
113
|
+
* Reads the host-configured {@link BPMRoutes}. Falls back to
|
|
114
|
+
* {@link createDefaultBPMRoutes} when no `<BPMRoutesProvider>` ancestor
|
|
115
|
+
* is mounted, so views remain self-contained.
|
|
116
|
+
*/
|
|
117
|
+
export declare function useBPMRoutes(): BPMRoutes;
|