@rytass/bpm-core-react 0.17.9 → 0.18.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 +8 -0
- package/dist/chunks/FormBuilderView-CHaAQL5v.cjs +3 -0
- package/dist/chunks/FormBuilderView-CHaAQL5v.cjs.map +1 -0
- package/dist/chunks/{FormBuilderView-ClLnQ1e_.js → FormBuilderView-vQfVc08Z.js} +493 -437
- package/dist/chunks/FormBuilderView-vQfVc08Z.js.map +1 -0
- package/dist/chunks/{FormRendererView-BsTwZkqU.js → FormRendererView-CTLlG13b.js} +300 -189
- package/dist/chunks/FormRendererView-CTLlG13b.js.map +1 -0
- package/dist/chunks/FormRendererView-ChmM_4Yc.cjs +4 -0
- package/dist/chunks/FormRendererView-ChmM_4Yc.cjs.map +1 -0
- package/dist/chunks/admin-pickers-BjbkBpSJ.cjs +2 -0
- package/dist/chunks/admin-pickers-BjbkBpSJ.cjs.map +1 -0
- package/dist/chunks/{admin-pickers-Djq3h-UR.js → admin-pickers-DfGxsjpp.js} +42 -42
- package/dist/chunks/admin-pickers-DfGxsjpp.js.map +1 -0
- package/dist/chunks/{approval-instance-list-page-CPXMP3PL.js → approval-instance-list-page-BnI4t5mD.js} +7 -8
- package/dist/chunks/{approval-instance-list-page-CPXMP3PL.js.map → approval-instance-list-page-BnI4t5mD.js.map} +1 -1
- package/dist/chunks/{approval-instance-list-page-ax0pm8bt.cjs → approval-instance-list-page-fqvmkBlg.cjs} +2 -2
- package/dist/chunks/{approval-instance-list-page-ax0pm8bt.cjs.map → approval-instance-list-page-fqvmkBlg.cjs.map} +1 -1
- package/dist/chunks/approver-filled-form-B4zPg9kz.cjs +2 -0
- package/dist/chunks/approver-filled-form-B4zPg9kz.cjs.map +1 -0
- package/dist/chunks/approver-filled-form-Bgazhbvd.js +112 -0
- package/dist/chunks/approver-filled-form-Bgazhbvd.js.map +1 -0
- package/dist/chunks/auth-provider-4BeCw7cI.cjs.map +1 -1
- package/dist/chunks/{auth-provider-B5oPmvk2.js → auth-provider-C2b-5mGt.js} +2 -3
- package/dist/chunks/{auth-provider-B5oPmvk2.js.map → auth-provider-C2b-5mGt.js.map} +1 -1
- package/dist/chunks/{bpm-form-field-Cao0rMol.js → bpm-form-field-9B-Det0u.js} +2 -3
- package/dist/chunks/{bpm-form-field-Cao0rMol.js.map → bpm-form-field-9B-Det0u.js.map} +1 -1
- package/dist/chunks/bpm-form-field-Bc6k4ZEO.cjs.map +1 -1
- package/dist/chunks/{categories-riC33J_j.js → categories-BAdxjNSA.js} +14 -15
- package/dist/chunks/{categories-riC33J_j.js.map → categories-BAdxjNSA.js.map} +1 -1
- package/dist/chunks/{categories-AxxhqjLZ.cjs → categories-DQUtVEiV.cjs} +2 -2
- package/dist/chunks/{categories-AxxhqjLZ.cjs.map → categories-DQUtVEiV.cjs.map} +1 -1
- package/dist/chunks/{compose-jnvnnVfN.js → compose-D9ipJpF_.js} +131 -148
- package/dist/chunks/compose-D9ipJpF_.js.map +1 -0
- package/dist/chunks/compose-DtfX8DQ9.cjs +2 -0
- package/dist/chunks/compose-DtfX8DQ9.cjs.map +1 -0
- package/dist/chunks/{dashboard-page-DdBvV6YI.js → dashboard-page-BoqNhjT_.js} +5 -6
- package/dist/chunks/{dashboard-page-DdBvV6YI.js.map → dashboard-page-BoqNhjT_.js.map} +1 -1
- package/dist/chunks/{dashboard-page-BWQBSGDq.cjs → dashboard-page-D7YJ3udk.cjs} +2 -2
- package/dist/chunks/{dashboard-page-BWQBSGDq.cjs.map → dashboard-page-D7YJ3udk.cjs.map} +1 -1
- package/dist/chunks/{delegations-MxF3uJGW.js → delegations-BfhCDz5e.js} +15 -16
- package/dist/chunks/{delegations-MxF3uJGW.js.map → delegations-BfhCDz5e.js.map} +1 -1
- package/dist/chunks/{delegations-Ckf03icM.cjs → delegations-BmFGcuhA.cjs} +2 -2
- package/dist/chunks/{delegations-Ckf03icM.cjs.map → delegations-BmFGcuhA.cjs.map} +1 -1
- package/dist/chunks/{delegations-V9HIe3_P.cjs → delegations-CcS0SHbf.cjs} +2 -2
- package/dist/chunks/{delegations-V9HIe3_P.cjs.map → delegations-CcS0SHbf.cjs.map} +1 -1
- package/dist/chunks/{delegations-xUt1tj8d.js → delegations-DBh5TT6G.js} +16 -17
- package/dist/chunks/{delegations-xUt1tj8d.js.map → delegations-DBh5TT6G.js.map} +1 -1
- package/dist/chunks/designer-Df79YzUn.cjs +65 -0
- package/dist/chunks/designer-Df79YzUn.cjs.map +1 -0
- package/dist/chunks/{designer-B8Gvew_k.js → designer-ubnZbP-A.js} +1779 -1360
- package/dist/chunks/designer-ubnZbP-A.js.map +1 -0
- package/dist/chunks/detail-BBC9kqXd.cjs +5 -0
- package/dist/chunks/detail-BBC9kqXd.cjs.map +1 -0
- package/dist/chunks/detail-C6XKZjlF.js +2665 -0
- package/dist/chunks/detail-C6XKZjlF.js.map +1 -0
- package/dist/chunks/{format-date-time-CB-LxzqT.js → format-date-time-B0LdmWg4.js} +2 -3
- package/dist/chunks/{format-date-time-CB-LxzqT.js.map → format-date-time-B0LdmWg4.js.map} +1 -1
- package/dist/chunks/format-date-time-D-cx5M8z.cjs.map +1 -1
- package/dist/chunks/{format-member-label-DudVI55w.js → format-member-label-C73FuP-d.js} +2 -3
- package/dist/chunks/{format-member-label-DudVI55w.js.map → format-member-label-C73FuP-d.js.map} +1 -1
- package/dist/chunks/format-member-label-t7ANTF62.cjs.map +1 -1
- package/dist/chunks/language-provider-Bdnx3Gxl.cjs.map +1 -1
- package/dist/chunks/{language-provider-B3cEbLe4.js → language-provider-phkWOapf.js} +2 -3
- package/dist/chunks/{language-provider-B3cEbLe4.js.map → language-provider-phkWOapf.js.map} +1 -1
- package/dist/chunks/{login-C6qlTC6F.js → login-D6cc3bo7.js} +4 -5
- package/dist/chunks/{login-C6qlTC6F.js.map → login-D6cc3bo7.js.map} +1 -1
- package/dist/chunks/{login-AtVxZBsC.cjs → login-uvVcltrS.cjs} +2 -2
- package/dist/chunks/{login-AtVxZBsC.cjs.map → login-uvVcltrS.cjs.map} +1 -1
- package/dist/chunks/notifications-Bc4mgSds.cjs.map +1 -1
- package/dist/chunks/{notifications-DJ5wzCye.js → notifications-Cvme5Qbl.js} +2 -3
- package/dist/chunks/{notifications-DJ5wzCye.js.map → notifications-Cvme5Qbl.js.map} +1 -1
- package/dist/chunks/orgs-B_2J2tLX.cjs +2 -0
- package/dist/chunks/{orgs-BeeDDWL1.cjs.map → orgs-B_2J2tLX.cjs.map} +1 -1
- package/dist/chunks/{orgs-8hje_l2n.js → orgs-DqxMds26.js} +48 -49
- package/dist/chunks/{orgs-8hje_l2n.js.map → orgs-DqxMds26.js.map} +1 -1
- package/dist/chunks/{providers-B_d5tbCL.js → providers-BbCs23sk.js} +21 -25
- package/dist/chunks/{providers-B_d5tbCL.js.map → providers-BbCs23sk.js.map} +1 -1
- package/dist/chunks/{providers-chuJvMgv.cjs → providers-D_KAgOOu.cjs} +2 -2
- package/dist/chunks/{providers-chuJvMgv.cjs.map → providers-D_KAgOOu.cjs.map} +1 -1
- package/dist/chunks/router-adapter--gYs13E8.cjs.map +1 -1
- package/dist/chunks/{router-adapter-DftlFTOd.js → router-adapter-CkxCyzf5.js} +2 -3
- package/dist/chunks/{router-adapter-DftlFTOd.js.map → router-adapter-CkxCyzf5.js.map} +1 -1
- package/dist/chunks/{routes-config-yZbESPlw.js → routes-config-BcNaWJWJ.js} +2 -3
- package/dist/chunks/{routes-config-yZbESPlw.js.map → routes-config-BcNaWJWJ.js.map} +1 -1
- package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -1
- package/dist/chunks/task-decision-3d17ZvZE.js +29 -0
- package/dist/chunks/task-decision-3d17ZvZE.js.map +1 -0
- package/dist/chunks/task-decision-CqZ4WQOC.cjs +2 -0
- package/dist/chunks/task-decision-CqZ4WQOC.cjs.map +1 -0
- package/dist/chunks/{use-bpm-member-D57LKe_u.js → use-bpm-member-BPzcNU1g.js} +3 -4
- package/dist/chunks/{use-bpm-member-D57LKe_u.js.map → use-bpm-member-BPzcNU1g.js.map} +1 -1
- package/dist/chunks/use-bpm-member-DpNAQtNC.cjs.map +1 -1
- package/dist/chunks/{users-Pl6hY5Y5.js → users-BBtiZ9QQ.js} +22 -25
- package/dist/chunks/{users-Pl6hY5Y5.js.map → users-BBtiZ9QQ.js.map} +1 -1
- package/dist/chunks/{users-O2L_M3BK.cjs → users-EqSzDhuj.cjs} +2 -2
- package/dist/chunks/{users-O2L_M3BK.cjs.map → users-EqSzDhuj.cjs.map} +1 -1
- package/dist/components/admin-picker-options.d.cts +11 -0
- package/dist/components/admin-picker-options.d.ts +11 -0
- package/dist/components/admin-pickers.d.cts +2 -11
- package/dist/components/admin-pickers.d.ts +2 -11
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -19
- package/dist/index.js.map +1 -1
- package/dist/lib/task-decision.d.cts +16 -0
- package/dist/lib/task-decision.d.ts +16 -0
- package/dist/lib/use-org-unit-names.d.cts +10 -0
- package/dist/lib/use-org-unit-names.d.ts +10 -0
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +7 -8
- package/dist/next/index.js.map +1 -1
- package/dist/next/workflow-chat-route.cjs +19 -1
- package/dist/next/workflow-chat-route.cjs.map +1 -1
- package/dist/next/workflow-chat-route.js +2 -3
- package/dist/next/workflow-chat-route.js.map +1 -1
- package/dist/pages/admin/delegations/index.cjs +1 -1
- package/dist/pages/admin/delegations/index.cjs.map +1 -1
- package/dist/pages/admin/delegations/index.js +2 -3
- package/dist/pages/admin/orgs/index.cjs +1 -1
- package/dist/pages/admin/orgs/index.cjs.map +1 -1
- package/dist/pages/admin/orgs/index.js +2 -3
- package/dist/pages/admin/users/index.cjs +1 -1
- package/dist/pages/admin/users/index.cjs.map +1 -1
- package/dist/pages/admin/users/index.js +2 -3
- package/dist/pages/admin/webhook-endpoints/index.cjs.map +1 -1
- package/dist/pages/admin/webhook-endpoints/index.js +1 -2
- package/dist/pages/cc/index.cjs.map +1 -1
- package/dist/pages/cc/index.js +1 -2
- package/dist/pages/dashboard/index.cjs.map +1 -1
- package/dist/pages/dashboard/index.js +1 -2
- package/dist/pages/delegations/index.cjs +1 -1
- package/dist/pages/delegations/index.cjs.map +1 -1
- package/dist/pages/delegations/index.js +2 -3
- package/dist/pages/inbox/index.cjs.map +1 -1
- package/dist/pages/inbox/index.js +1 -2
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.cjs.map +1 -1
- package/dist/pages/instances/detail/index.js +2 -3
- package/dist/pages/instances/new/index.cjs.map +1 -1
- package/dist/pages/instances/new/index.js +1 -2
- package/dist/pages/login/index.cjs +1 -1
- package/dist/pages/login/index.cjs.map +1 -1
- package/dist/pages/login/index.js +2 -3
- package/dist/pages/root/index.cjs.map +1 -1
- package/dist/pages/root/index.js +1 -2
- package/dist/pages/search/index.cjs.map +1 -1
- package/dist/pages/search/index.js +1 -2
- package/dist/pages/sent/index.cjs.map +1 -1
- package/dist/pages/sent/index.js +1 -2
- package/dist/pages/settings/notifications/index.cjs.map +1 -1
- package/dist/pages/settings/notifications/index.js +2 -3
- package/dist/pages/templates/categories/index.cjs +1 -1
- package/dist/pages/templates/categories/index.cjs.map +1 -1
- package/dist/pages/templates/categories/index.js +2 -3
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.cjs.map +1 -1
- package/dist/pages/templates/compose/index.js +2 -3
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.cjs.map +1 -1
- package/dist/pages/templates/designer/index.js +2 -3
- package/dist/pages/templates/index.cjs.map +1 -1
- package/dist/pages/templates/index.js +1 -2
- package/dist/pages/templates/versions/index.cjs.map +1 -1
- package/dist/pages/templates/versions/index.js +1 -2
- package/dist/views/admin/delegations/index.cjs +1 -1
- package/dist/views/admin/delegations/index.js +1 -1
- package/dist/views/admin/index.cjs +1 -1
- package/dist/views/admin/index.js +3 -3
- package/dist/views/admin/orgs/index.cjs +1 -1
- package/dist/views/admin/orgs/index.js +1 -1
- package/dist/views/admin/users/index.cjs +1 -1
- package/dist/views/admin/users/index.js +1 -1
- package/dist/views/admin/webhook-endpoints/index.cjs +1 -1
- package/dist/views/admin/webhook-endpoints/index.cjs.map +1 -1
- package/dist/views/admin/webhook-endpoints/index.js +52 -53
- package/dist/views/admin/webhook-endpoints/index.js.map +1 -1
- package/dist/views/cc/index.cjs +1 -1
- package/dist/views/cc/index.cjs.map +1 -1
- package/dist/views/cc/index.js +2 -3
- package/dist/views/dashboard/index.cjs +1 -1
- package/dist/views/dashboard/index.cjs.map +1 -1
- package/dist/views/dashboard/index.js +2 -3
- package/dist/views/delegations/index.cjs +1 -1
- package/dist/views/delegations/index.js +1 -1
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -1
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.js +1 -1
- package/dist/views/forms/renderer/org-unit-field-options.d.cts +44 -0
- package/dist/views/forms/renderer/org-unit-field-options.d.ts +44 -0
- package/dist/views/forms/renderer/org-unit-field.d.cts +23 -0
- package/dist/views/forms/renderer/org-unit-field.d.ts +23 -0
- package/dist/views/inbox/index.cjs +1 -1
- package/dist/views/inbox/index.cjs.map +1 -1
- package/dist/views/inbox/index.js +133 -137
- package/dist/views/inbox/index.js.map +1 -1
- package/dist/views/instances/approver-filled-form.d.cts +9 -2
- package/dist/views/instances/approver-filled-form.d.ts +9 -2
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/sections/InstanceHistorySection.d.cts +8 -1
- package/dist/views/instances/detail/sections/InstanceHistorySection.d.ts +8 -1
- package/dist/views/instances/detail/sections/container-helpers.d.cts +0 -1
- package/dist/views/instances/detail/sections/container-helpers.d.ts +0 -1
- package/dist/views/instances/detail/sections/shared.d.cts +2 -2
- package/dist/views/instances/detail/sections/shared.d.ts +2 -2
- package/dist/views/instances/new/index.cjs +1 -1
- package/dist/views/instances/new/index.cjs.map +1 -1
- package/dist/views/instances/new/index.js +24 -21
- package/dist/views/instances/new/index.js.map +1 -1
- package/dist/views/login/index.cjs +1 -1
- package/dist/views/login/index.js +1 -1
- package/dist/views/search/index.cjs +1 -1
- package/dist/views/search/index.cjs.map +1 -1
- package/dist/views/search/index.js +2 -3
- package/dist/views/sent/index.cjs +1 -1
- package/dist/views/sent/index.cjs.map +1 -1
- package/dist/views/sent/index.js +2 -3
- package/dist/views/settings/index.js +1 -1
- package/dist/views/settings/notifications/index.js +1 -1
- package/dist/views/templates/categories/index.cjs +1 -1
- package/dist/views/templates/categories/index.js +1 -1
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.js +1 -1
- package/dist/views/templates/designer/approver-resolver-model.d.cts +211 -0
- package/dist/views/templates/designer/approver-resolver-model.d.ts +211 -0
- package/dist/views/templates/designer/dry-run-assignee-label.d.cts +2 -0
- package/dist/views/templates/designer/dry-run-assignee-label.d.ts +2 -0
- package/dist/views/templates/designer/dry-run-sample-data.d.cts +6 -0
- package/dist/views/templates/designer/dry-run-sample-data.d.ts +6 -0
- package/dist/views/templates/designer/dynamic-form-resolver-options.d.cts +25 -0
- package/dist/views/templates/designer/dynamic-form-resolver-options.d.ts +25 -0
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.js +1 -1
- package/dist/views/templates/designer/node-actor-resolver-options.d.cts +38 -0
- package/dist/views/templates/designer/node-actor-resolver-options.d.ts +38 -0
- package/dist/views/templates/index.cjs +1 -1
- package/dist/views/templates/index.cjs.map +1 -1
- package/dist/views/templates/index.js +50 -51
- package/dist/views/templates/index.js.map +1 -1
- package/dist/views/templates/versions/index.cjs +1 -1
- package/dist/views/templates/versions/index.cjs.map +1 -1
- package/dist/views/templates/versions/index.js +7 -8
- package/dist/views/templates/versions/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunks/FormBuilderView-CUOyS07f.cjs +0 -3
- package/dist/chunks/FormBuilderView-CUOyS07f.cjs.map +0 -1
- package/dist/chunks/FormBuilderView-ClLnQ1e_.js.map +0 -1
- package/dist/chunks/FormRendererView-BsTwZkqU.js.map +0 -1
- package/dist/chunks/FormRendererView-GpsE03np.cjs +0 -4
- package/dist/chunks/FormRendererView-GpsE03np.cjs.map +0 -1
- package/dist/chunks/admin-pickers-BRHk3qKq.cjs +0 -2
- package/dist/chunks/admin-pickers-BRHk3qKq.cjs.map +0 -1
- package/dist/chunks/admin-pickers-Djq3h-UR.js.map +0 -1
- package/dist/chunks/approver-filled-form-D1DmqDVP.cjs +0 -2
- package/dist/chunks/approver-filled-form-D1DmqDVP.cjs.map +0 -1
- package/dist/chunks/approver-filled-form-DuQGPtNB.js +0 -95
- package/dist/chunks/approver-filled-form-DuQGPtNB.js.map +0 -1
- package/dist/chunks/compose-Cock_B2Q.cjs +0 -2
- package/dist/chunks/compose-Cock_B2Q.cjs.map +0 -1
- package/dist/chunks/compose-jnvnnVfN.js.map +0 -1
- package/dist/chunks/designer-B8Gvew_k.js.map +0 -1
- package/dist/chunks/designer-CAEFV1ve.cjs +0 -65
- package/dist/chunks/designer-CAEFV1ve.cjs.map +0 -1
- package/dist/chunks/detail-CExpbazF.js +0 -2629
- package/dist/chunks/detail-CExpbazF.js.map +0 -1
- package/dist/chunks/detail-DIY-L4i-.cjs +0 -2
- package/dist/chunks/detail-DIY-L4i-.cjs.map +0 -1
- package/dist/chunks/orgs-BeeDDWL1.cjs +0 -2
- package/dist/chunks/task-node-label-BF6UllxP.cjs +0 -2
- package/dist/chunks/task-node-label-BF6UllxP.cjs.map +0 -1
- package/dist/chunks/task-node-label-CWZgOBj0.js +0 -9
- package/dist/chunks/task-node-label-CWZgOBj0.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Fragment","useRouterAdapter","useAuth","formatDateTime","readApplicantFormSchema","readApplicantSubmission","FormRenderer","Fragment$1","ContentHeader","FORM_SECTION_STYLE","InstanceNewView","Suspense","NewApprovalInstanceLoading","NewApprovalInstanceContent","props","templateIdProp","router","routes","useBPMRoutes","currentMemberId","member","templateId","context","setContext","useState","formValues","setFormValues","templates","setTemplates","error","setError","formErrors","setFormErrors","loading","setLoading","submitting","setSubmitting","dataSourceStates","setDataSourceStates","applicantSchema","useMemo","handleDataSourceStateChange","useCallback","currentState","currentStates","fieldKey","state","refreshContext","refreshTemplates","rows","template","columns","tableActions","record","listLaunchableTemplates","requestError","readErrorMessage","readLaunchContext","nextTemplateId","handleSubmit","dataSourceBlockMessage","readFormDataSourceSubmissionBlockMessage","submittedValues","buildFormRendererValues","validation","validateFormRendererValues","focusFormRendererField","instanceId","submitApprovalInstance","readFormDataCaseTitle","handleUploadAttachment","uploadAttachment","field","PageHeader","Button","CheckedIcon","SectionGroup","Section","Typography","values","Table","readFormDataSourceErrorMessage"],"sources":["../../../../src/views/instances/new/InstanceNewView.tsx"],"sourcesContent":["'use client';\n\nimport {\n CSSProperties,\n ReactElement,\n Suspense,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n Button,\n PageHeader,\n Section,\n SectionGroup,\n Table,\n Typography,\n} from '@mezzanine-ui/react';\nimport ContentHeader from '@mezzanine-ui/react/ContentHeader';\nimport { CheckedIcon } from '@mezzanine-ui/icons';\nimport type { TableActions, TableColumn } from '@mezzanine-ui/core/table';\nimport { FormFieldDefinition } from '@rytass/bpm-core-shared/form';\nimport {\n buildFormRendererValues,\n focusFormRendererField,\n FormRendererValues,\n readFormDataSourceErrorMessage,\n validateFormRendererValues,\n} from '@rytass/bpm-core-client/form';\nimport {\n LaunchContext,\n LaunchableTemplateRecord,\n listLaunchableTemplates,\n readFormDataCaseTitle,\n readLaunchContext,\n submitApprovalInstance,\n uploadAttachment,\n} from '@rytass/bpm-core-client/workflow';\nimport {\n readApplicantFormSchema,\n readApplicantSubmission,\n} from '../approver-filled-form';\nimport { formatDateTime } from '../../../lib/format-date-time';\nimport { useAuth } from '../../../lib/auth-provider';\nimport { useRouterAdapter } from '../../../lib/router-adapter';\nimport { useBPMRoutes } from '../../../lib/routes-config';\nimport { FormRenderer } from '../../forms/renderer/FormRendererView';\nimport {\n readFormDataSourceSubmissionBlockMessage,\n type FormDataSourceFieldState,\n} from '../../forms/renderer/form-data-source-field';\n\nconst FORM_SECTION_STYLE: CSSProperties = {\n display: 'grid',\n gap: 16,\n};\n\ntype LaunchableTemplateRow = Readonly<\n Record<string, unknown> &\n LaunchableTemplateRecord & {\n key: string;\n versionLabel: string;\n }\n>;\n\nexport interface InstanceNewViewProps {\n /**\n * Optional template id pre-selected by the host. The Server Component\n * page should read `?templateId=` from its `searchParams` and pass the\n * value through this prop.\n */\n readonly templateId?: string | null;\n}\n\n/**\n * Framework-agnostic view for the BPM \"發起簽核\" launch page. Mechanical port\n * of `apps/client/src/app/instances/new/page.tsx` — picks a launchable\n * template and submits the launch form.\n */\nexport function InstanceNewView(\n props: InstanceNewViewProps = {},\n): ReactElement {\n return (\n <Suspense fallback={<NewApprovalInstanceLoading />}>\n <NewApprovalInstanceContent templateId={props.templateId ?? undefined} />\n </Suspense>\n );\n}\n\nfunction NewApprovalInstanceContent({\n templateId: templateIdProp,\n}: {\n readonly templateId?: string;\n}): ReactElement {\n const router = useRouterAdapter();\n const routes = useBPMRoutes();\n const { member } = useAuth();\n const currentMemberId = member?.memberId ?? null;\n const templateId = templateIdProp ?? null;\n const [context, setContext] = useState<LaunchContext | null>(null);\n const [formValues, setFormValues] = useState<FormRendererValues>({});\n const [templates, setTemplates] = useState<\n readonly LaunchableTemplateRecord[]\n >([]);\n const [error, setError] = useState<string | null>(null);\n const [formErrors, setFormErrors] = useState<\n Readonly<Record<string, string>>\n >({});\n const [loading, setLoading] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n const [dataSourceStates, setDataSourceStates] = useState<\n Readonly<\n Record<string, Pick<FormDataSourceFieldState, 'hasValue' | 'status'>>\n >\n >({});\n\n // The form the applicant sees: approver-filled fields are not theirs to fill\n // (the server drops them), so they are left out of everything below.\n const applicantSchema = useMemo(\n () =>\n context\n ? readApplicantFormSchema(\n context.formVersion.schema,\n context.templateVersion.workflowDefinition,\n )\n : null,\n [context],\n );\n\n const handleDataSourceStateChange = useCallback(\n (\n fieldKey: string,\n state: Pick<\n FormDataSourceFieldState,\n 'hasValue' | 'invalidValues' | 'status'\n >,\n ): void => {\n setDataSourceStates((currentStates) => {\n const currentState = currentStates[fieldKey];\n\n if (\n currentState?.hasValue === state.hasValue &&\n currentState.status === state.status\n ) {\n return currentStates;\n }\n\n return {\n ...currentStates,\n [fieldKey]: {\n hasValue: state.hasValue,\n status: state.status,\n },\n };\n });\n },\n [],\n );\n\n useEffect((): void => {\n if (!templateId) {\n void refreshTemplates();\n\n return;\n }\n\n void refreshContext(templateId);\n }, [templateId]);\n\n const rows = useMemo(\n (): LaunchableTemplateRow[] =>\n templates.map((template) => ({\n ...template,\n key: template.id,\n updatedAt: formatDateTime(template.updatedAt),\n versionLabel: `v${template.version}`,\n })),\n [templates],\n );\n const columns = useMemo(\n (): TableColumn<LaunchableTemplateRow>[] => [\n { dataIndex: 'name', key: 'name', title: '模板名稱', width: 240 },\n {\n dataIndex: 'versionLabel',\n key: 'versionLabel',\n title: '發布版本',\n width: 120,\n },\n {\n dataIndex: 'updatedAt',\n key: 'updatedAt',\n title: '更新時間',\n width: 220,\n },\n ],\n [],\n );\n const tableActions = useMemo(\n (): TableActions<LaunchableTemplateRow> => ({\n render: (\n record,\n ): ReturnType<TableActions<LaunchableTemplateRow>['render']> => [\n {\n name: '發起',\n onClick: (): void =>\n router.push(routes.caseNew(record.id)),\n variant: 'base-primary',\n },\n ],\n variant: 'base-secondary',\n width: 88,\n }),\n [router],\n );\n\n async function refreshTemplates(): Promise<void> {\n setLoading(true);\n setError(null);\n setContext(null);\n setDataSourceStates({});\n\n try {\n setTemplates(await listLaunchableTemplates());\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n } finally {\n setLoading(false);\n }\n }\n\n async function refreshContext(nextTemplateId: string): Promise<void> {\n setLoading(true);\n setError(null);\n setTemplates([]);\n setDataSourceStates({});\n\n try {\n setContext(await readLaunchContext(nextTemplateId));\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n } finally {\n setLoading(false);\n }\n }\n\n async function handleSubmit(): Promise<void> {\n if (!context || !applicantSchema || !currentMemberId) {\n return;\n }\n\n setSubmitting(true);\n setError(null);\n setFormErrors({});\n\n const dataSourceBlockMessage = readFormDataSourceSubmissionBlockMessage(\n Object.values(dataSourceStates),\n );\n\n if (dataSourceBlockMessage) {\n setError(dataSourceBlockMessage);\n setSubmitting(false);\n\n return;\n }\n\n // What the renderer shows, not just what has been touched: a table seeds\n // its `minRows` rows and a field can carry a `defaultValue`, and neither\n // reaches this state until the filler edits something. Validating and\n // submitting the raw state would reject a table the user can plainly see\n // rows in — and submit a default the backend never receives.\n const submittedValues = readApplicantSubmission(\n buildFormRendererValues(applicantSchema.fields, formValues),\n context.templateVersion.workflowDefinition,\n );\n const validation = validateFormRendererValues({\n schema: applicantSchema,\n uiSchema: context.formVersion.uiSchema,\n values: submittedValues,\n });\n\n if (!validation.valid) {\n setFormErrors(validation.errors);\n setError('請先補齊必填欄位。');\n\n if (validation.firstInvalidFieldKey) {\n focusFormRendererField(validation.firstInvalidFieldKey);\n }\n\n setSubmitting(false);\n\n return;\n }\n\n try {\n const instanceId = await submitApprovalInstance({\n formData: submittedValues,\n initiatorMemberId: currentMemberId,\n templateId: context.template.id,\n title: readFormDataCaseTitle({\n fallbackTitle: context.template.name,\n formData: submittedValues,\n schema: applicantSchema,\n uiSchema: context.formVersion.uiSchema,\n }),\n });\n\n router.push(routes.caseDetail(instanceId));\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n } finally {\n setSubmitting(false);\n }\n }\n\n async function handleUploadAttachment(\n field: FormFieldDefinition,\n file: File,\n ): Promise<{ readonly id: string }> {\n if (!currentMemberId) {\n throw new Error('尚未登入,無法上傳附件');\n }\n\n const attachment = await uploadAttachment({\n file,\n formFieldPath: `form.${field.fieldKey}`,\n });\n\n return { id: attachment.id };\n }\n\n return (\n <>\n <PageHeader>\n <ContentHeader\n description={\n context\n ? `${context.template.name} · 表單 v${context.formVersion.version}`\n : '選擇可發起的已發布模板後填寫表單內容。'\n }\n title=\"發起簽核\"\n >\n {context ? (\n <Button\n disabled={loading || submitting}\n icon={CheckedIcon}\n iconType=\"leading\"\n onClick={handleSubmit}\n variant=\"base-primary\"\n >\n 送出\n </Button>\n ) : null}\n </ContentHeader>\n </PageHeader>\n\n <SectionGroup>\n <Section>\n <div style={FORM_SECTION_STYLE}>\n {error ? (\n <Typography color=\"text-error\" variant=\"body\">\n {error}\n </Typography>\n ) : null}\n\n {loading ? (\n <Typography color=\"text-neutral\" variant=\"body\">\n 載入中...\n </Typography>\n ) : null}\n\n {context && applicantSchema ? (\n <FormRenderer\n dataSourceContext={{\n kind: 'runtime',\n templateId: context.template.id,\n }}\n errors={formErrors}\n maxWidth={480}\n onChange={(values): void => {\n setFormValues(values);\n setFormErrors({});\n }}\n onDataSourceStateChange={handleDataSourceStateChange}\n onUploadAttachment={handleUploadAttachment}\n schema={applicantSchema}\n singleColumn\n uiSchema={context.formVersion.uiSchema}\n value={formValues}\n />\n ) : null}\n\n {!templateId && !loading ? (\n rows.length > 0 ? (\n <Table\n actions={tableActions}\n columns={columns}\n dataSource={rows}\n fullWidth\n />\n ) : (\n <Typography color=\"text-neutral\" variant=\"body\">\n 目前沒有可發起的已發布模板。\n </Typography>\n )\n ) : null}\n </div>\n </Section>\n </SectionGroup>\n </>\n );\n}\n\nfunction NewApprovalInstanceLoading(): ReactElement {\n return (\n <>\n <PageHeader>\n <ContentHeader\n description=\"選擇可發起的已發布模板後填寫表單內容。\"\n title=\"發起簽核\"\n />\n </PageHeader>\n\n <SectionGroup>\n <Section>\n <Typography color=\"text-neutral\" variant=\"body\">\n 載入中...\n </Typography>\n </Section>\n </SectionGroup>\n </>\n );\n}\n\nfunction readErrorMessage(error: unknown): string {\n // DataSource failures arrive as stable codes so the backend never leaks\n // upstream transport detail; translate them instead of showing the raw code.\n const dataSourceMessage = readFormDataSourceErrorMessage(error);\n\n if (dataSourceMessage) {\n return dataSourceMessage;\n }\n\n return error instanceof Error ? error.message : '發生未知錯誤';\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqDA,IAAMS,KAAoC;CACxC,SAAS;CACT,KAAK;AACP;AAwBA,SAAgBC,EACd,IAA8B,CAAC,GACjB;CACd,OACE,kBAACC,GAAD;EAAU,UAAU,kBAACC,GAAD,CAA6B,CAAA;EAC/C,UAAA,kBAACC,GAAD,EAA4B,YAAYC,EAAM,cAAc,KAAA,EAAY,CAAA;CAChE,CAAA;AAEd;AAEA,SAASD,EAA2B,EAClC,YAAYE,KAGG;CACf,IAAMC,IAASf,EAAiB,GAC1BgB,IAASC,EAAa,GACtB,EAAE,cAAWhB,EAAQ,GACrBiB,IAAkBC,GAAQ,YAAY,MACtCC,IAAaN,KAAkB,MAC/B,CAACO,GAASC,KAAcC,EAA+B,IAAI,GAC3D,CAACC,GAAYC,KAAiBF,EAA6B,CAAC,CAAC,GAC7D,CAACG,GAAWC,KAAgBJ,EAEhC,CAAC,CAAC,GACE,CAACK,GAAOC,KAAYN,EAAwB,IAAI,GAChD,CAACO,GAAYC,KAAiBR,EAElC,CAAC,CAAC,GACE,CAACS,GAASC,KAAcV,EAAS,EAAI,GACrC,CAACW,GAAYC,KAAiBZ,EAAS,EAAK,GAC5C,CAACa,GAAkBC,KAAuBd,EAI9C,CAAC,CAAC,GAIEe,IAAkBC,QAEpBlB,IACIlB,EACEkB,EAAQ,YAAY,QACpBA,EAAQ,gBAAgB,kBAC1B,IACA,MACN,CAACA,CAAO,CACV,GAEMmB,KAA8BC,IAEhC,GACA,MAIS;EACT,GAAqB,MAAkB;GACrC,IAAMC,IAAeC,EAAcC;GASnC,OAN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A2C;CAClD,OACE,kBAAAZ,GAAA,EAAA,UAAA,CACI,kBAACyE,GAAD,EAAA,UACE,kBAACjE,GAAD;EACE,aAAY;EACZ,OAAM;CACP,CAAA,EACS,CAAA,GAEZ,kBAACoE,GAAD,EAAA,UACE,kBAACC,GAAD,EAAA,UACE,kBAACC,GAAD;EAAY,OAAM;EAAe,SAAQ;EAAO,UAAA;CAEpC,CAAA,EACL,CAAA,EACG,CAAA,CACd,EAAA,CAAA;AAER;AAEA,SAAStB,EAAiB,GAAwB;CAShD,OAN0ByB,EAA+BpD,CAErD,MAIGA,aAAiB,QAAQA,EAAM,UAAU;AAClD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","readApplicantFormSchema","readApplicantSubmission","formatDateTime","useAuth","useRouterAdapter","useBPMRoutes","readFormDataSourceSubmissionBlockMessage","FormRenderer","Fragment$1","ContentHeader","FORM_SECTION_STYLE","InstanceNewView","Suspense","NewApprovalInstanceLoading","NewApprovalInstanceContent","props","templateIdProp","router","routes","currentMemberId","member","templateId","context","setContext","useState","formValues","setFormValues","templates","setTemplates","error","setError","formErrors","setFormErrors","loading","setLoading","submitting","setSubmitting","dataSourceStates","setDataSourceStates","applicantSchema","useMemo","handleDataSourceStateChange","useCallback","currentState","currentStates","fieldKey","state","refreshContext","refreshTemplates","rows","template","columns","tableActions","record","listLaunchableTemplates","requestError","readErrorMessage","readLaunchContext","nextTemplateId","handleSubmit","dataSourceBlockMessage","submittedValues","buildFormRendererValues","validation","validateFormRendererValuesInWorker","focusFormRendererField","instanceId","submitApprovalInstance","readFormDataCaseTitle","handleUploadAttachment","uploadAttachment","field","PageHeader","Button","CheckedIcon","SectionGroup","Section","Typography","values","Table","readFormDataSourceErrorMessage"],"sources":["../../../../src/views/instances/new/InstanceNewView.tsx"],"sourcesContent":["'use client';\n\nimport {\n CSSProperties,\n ReactElement,\n Suspense,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n Button,\n PageHeader,\n Section,\n SectionGroup,\n Table,\n Typography,\n} from '@mezzanine-ui/react';\nimport ContentHeader from '@mezzanine-ui/react/ContentHeader';\nimport { CheckedIcon } from '@mezzanine-ui/icons';\nimport type { TableActions, TableColumn } from '@mezzanine-ui/core/table';\nimport { FormFieldDefinition } from '@rytass/bpm-core-shared/form';\nimport {\n buildFormRendererValues,\n focusFormRendererField,\n FormRendererValues,\n readFormDataSourceErrorMessage,\n validateFormRendererValuesInWorker,\n} from '@rytass/bpm-core-client/form';\nimport {\n LaunchContext,\n LaunchableTemplateRecord,\n listLaunchableTemplates,\n readFormDataCaseTitle,\n readLaunchContext,\n submitApprovalInstance,\n uploadAttachment,\n} from '@rytass/bpm-core-client/workflow';\nimport {\n readApplicantFormSchema,\n readApplicantSubmission,\n} from '../approver-filled-form';\nimport { formatDateTime } from '../../../lib/format-date-time';\nimport { useAuth } from '../../../lib/auth-provider';\nimport { useRouterAdapter } from '../../../lib/router-adapter';\nimport { useBPMRoutes } from '../../../lib/routes-config';\nimport { FormRenderer } from '../../forms/renderer/FormRendererView';\nimport {\n readFormDataSourceSubmissionBlockMessage,\n type FormDataSourceFieldState,\n} from '../../forms/renderer/form-data-source-field';\n\nconst FORM_SECTION_STYLE: CSSProperties = {\n display: 'grid',\n gap: 16,\n};\n\ntype LaunchableTemplateRow = Readonly<\n Record<string, unknown> &\n LaunchableTemplateRecord & {\n key: string;\n versionLabel: string;\n }\n>;\n\nexport interface InstanceNewViewProps {\n /**\n * Optional template id pre-selected by the host. The Server Component\n * page should read `?templateId=` from its `searchParams` and pass the\n * value through this prop.\n */\n readonly templateId?: string | null;\n}\n\n/**\n * Framework-agnostic view for the BPM \"發起簽核\" launch page. Mechanical port\n * of `apps/client/src/app/instances/new/page.tsx` — picks a launchable\n * template and submits the launch form.\n */\nexport function InstanceNewView(\n props: InstanceNewViewProps = {},\n): ReactElement {\n return (\n <Suspense fallback={<NewApprovalInstanceLoading />}>\n <NewApprovalInstanceContent templateId={props.templateId ?? undefined} />\n </Suspense>\n );\n}\n\nfunction NewApprovalInstanceContent({\n templateId: templateIdProp,\n}: {\n readonly templateId?: string;\n}): ReactElement {\n const router = useRouterAdapter();\n const routes = useBPMRoutes();\n const { member } = useAuth();\n const currentMemberId = member?.memberId ?? null;\n const templateId = templateIdProp ?? null;\n const [context, setContext] = useState<LaunchContext | null>(null);\n const [formValues, setFormValues] = useState<FormRendererValues>({});\n const [templates, setTemplates] = useState<\n readonly LaunchableTemplateRecord[]\n >([]);\n const [error, setError] = useState<string | null>(null);\n const [formErrors, setFormErrors] = useState<\n Readonly<Record<string, string>>\n >({});\n const [loading, setLoading] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n const [dataSourceStates, setDataSourceStates] = useState<\n Readonly<\n Record<string, Pick<FormDataSourceFieldState, 'hasValue' | 'status'>>\n >\n >({});\n\n // The form the applicant sees: approver-filled fields are not theirs to fill\n // (the server drops them), so they are left out of everything below.\n const applicantSchema = useMemo(\n () =>\n context\n ? readApplicantFormSchema(\n context.formVersion.schema,\n context.templateVersion.workflowDefinition,\n )\n : null,\n [context],\n );\n\n const handleDataSourceStateChange = useCallback(\n (\n fieldKey: string,\n state: Pick<\n FormDataSourceFieldState,\n 'hasValue' | 'invalidValues' | 'status'\n >,\n ): void => {\n setDataSourceStates((currentStates) => {\n const currentState = currentStates[fieldKey];\n\n if (\n currentState?.hasValue === state.hasValue &&\n currentState.status === state.status\n ) {\n return currentStates;\n }\n\n return {\n ...currentStates,\n [fieldKey]: {\n hasValue: state.hasValue,\n status: state.status,\n },\n };\n });\n },\n [],\n );\n\n useEffect((): void => {\n if (!templateId) {\n void refreshTemplates();\n\n return;\n }\n\n void refreshContext(templateId);\n }, [templateId]);\n\n const rows = useMemo(\n (): LaunchableTemplateRow[] =>\n templates.map((template) => ({\n ...template,\n key: template.id,\n updatedAt: formatDateTime(template.updatedAt),\n versionLabel: `v${template.version}`,\n })),\n [templates],\n );\n const columns = useMemo(\n (): TableColumn<LaunchableTemplateRow>[] => [\n { dataIndex: 'name', key: 'name', title: '模板名稱', width: 240 },\n {\n dataIndex: 'versionLabel',\n key: 'versionLabel',\n title: '發布版本',\n width: 120,\n },\n {\n dataIndex: 'updatedAt',\n key: 'updatedAt',\n title: '更新時間',\n width: 220,\n },\n ],\n [],\n );\n const tableActions = useMemo(\n (): TableActions<LaunchableTemplateRow> => ({\n render: (\n record,\n ): ReturnType<TableActions<LaunchableTemplateRow>['render']> => [\n {\n name: '發起',\n onClick: (): void =>\n router.push(routes.caseNew(record.id)),\n variant: 'base-primary',\n },\n ],\n variant: 'base-secondary',\n width: 88,\n }),\n [router],\n );\n\n async function refreshTemplates(): Promise<void> {\n setLoading(true);\n setError(null);\n setContext(null);\n setDataSourceStates({});\n\n try {\n setTemplates(await listLaunchableTemplates());\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n } finally {\n setLoading(false);\n }\n }\n\n async function refreshContext(nextTemplateId: string): Promise<void> {\n setLoading(true);\n setError(null);\n setTemplates([]);\n setDataSourceStates({});\n\n try {\n setContext(await readLaunchContext(nextTemplateId));\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n } finally {\n setLoading(false);\n }\n }\n\n async function handleSubmit(): Promise<void> {\n if (!context || !applicantSchema || !currentMemberId) {\n return;\n }\n\n setSubmitting(true);\n setError(null);\n setFormErrors({});\n\n const dataSourceBlockMessage = readFormDataSourceSubmissionBlockMessage(\n Object.values(dataSourceStates),\n );\n\n if (dataSourceBlockMessage) {\n setError(dataSourceBlockMessage);\n setSubmitting(false);\n\n return;\n }\n\n // What the renderer shows, not just what has been touched: a table seeds\n // its `minRows` rows and a field can carry a `defaultValue`, and neither\n // reaches this state until the filler edits something. Validating and\n // submitting the raw state would reject a table the user can plainly see\n // rows in — and submit a default the backend never receives.\n const submittedValues = readApplicantSubmission(\n buildFormRendererValues(applicantSchema.fields, formValues),\n context.templateVersion.workflowDefinition,\n );\n // Inside the `try`, so a validation that throws still clears `submitting`\n // and shows its error instead of leaving the button busy for good.\n try {\n // The format patterns run in a worker under the engine's time budget, so\n // a pattern that backtracks cannot freeze the page.\n const validation = await validateFormRendererValuesInWorker({\n schema: applicantSchema,\n uiSchema: context.formVersion.uiSchema,\n values: submittedValues,\n });\n\n if (!validation.valid) {\n setFormErrors(validation.errors);\n setError('請先修正表單中標示的欄位。');\n\n if (validation.firstInvalidFieldKey) {\n focusFormRendererField(validation.firstInvalidFieldKey);\n }\n\n return;\n }\n\n const instanceId = await submitApprovalInstance({\n formData: submittedValues,\n initiatorMemberId: currentMemberId,\n templateId: context.template.id,\n title: readFormDataCaseTitle({\n fallbackTitle: context.template.name,\n formData: submittedValues,\n schema: applicantSchema,\n uiSchema: context.formVersion.uiSchema,\n }),\n });\n\n router.push(routes.caseDetail(instanceId));\n } catch (requestError: unknown) {\n setError(readErrorMessage(requestError));\n } finally {\n setSubmitting(false);\n }\n }\n\n async function handleUploadAttachment(\n field: FormFieldDefinition,\n file: File,\n ): Promise<{ readonly id: string }> {\n if (!currentMemberId) {\n throw new Error('尚未登入,無法上傳附件');\n }\n\n const attachment = await uploadAttachment({\n file,\n formFieldPath: `form.${field.fieldKey}`,\n });\n\n return { id: attachment.id };\n }\n\n return (\n <>\n <PageHeader>\n <ContentHeader\n description={\n context\n ? `${context.template.name} · 表單 v${context.formVersion.version}`\n : '選擇可發起的已發布模板後填寫表單內容。'\n }\n title=\"發起簽核\"\n >\n {context ? (\n <Button\n disabled={loading || submitting}\n icon={CheckedIcon}\n iconType=\"leading\"\n onClick={handleSubmit}\n variant=\"base-primary\"\n >\n 送出\n </Button>\n ) : null}\n </ContentHeader>\n </PageHeader>\n\n <SectionGroup>\n <Section>\n <div style={FORM_SECTION_STYLE}>\n {error ? (\n <Typography color=\"text-error\" variant=\"body\">\n {error}\n </Typography>\n ) : null}\n\n {loading ? (\n <Typography color=\"text-neutral\" variant=\"body\">\n 載入中...\n </Typography>\n ) : null}\n\n {context && applicantSchema ? (\n <FormRenderer\n dataSourceContext={{\n kind: 'runtime',\n templateId: context.template.id,\n }}\n errors={formErrors}\n maxWidth={480}\n onChange={(values): void => {\n setFormValues(values);\n setFormErrors({});\n }}\n onDataSourceStateChange={handleDataSourceStateChange}\n onUploadAttachment={handleUploadAttachment}\n schema={applicantSchema}\n singleColumn\n uiSchema={context.formVersion.uiSchema}\n value={formValues}\n />\n ) : null}\n\n {!templateId && !loading ? (\n rows.length > 0 ? (\n <Table\n actions={tableActions}\n columns={columns}\n dataSource={rows}\n fullWidth\n />\n ) : (\n <Typography color=\"text-neutral\" variant=\"body\">\n 目前沒有可發起的已發布模板。\n </Typography>\n )\n ) : null}\n </div>\n </Section>\n </SectionGroup>\n </>\n );\n}\n\nfunction NewApprovalInstanceLoading(): ReactElement {\n return (\n <>\n <PageHeader>\n <ContentHeader\n description=\"選擇可發起的已發布模板後填寫表單內容。\"\n title=\"發起簽核\"\n />\n </PageHeader>\n\n <SectionGroup>\n <Section>\n <Typography color=\"text-neutral\" variant=\"body\">\n 載入中...\n </Typography>\n </Section>\n </SectionGroup>\n </>\n );\n}\n\nfunction readErrorMessage(error: unknown): string {\n // DataSource failures arrive as stable codes so the backend never leaks\n // upstream transport detail; translate them instead of showing the raw code.\n const dataSourceMessage = readFormDataSourceErrorMessage(error);\n\n if (dataSourceMessage) {\n return dataSourceMessage;\n }\n\n return error instanceof Error ? error.message : '發生未知錯誤';\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqDA,IAAMW,KAAoC;CACxC,SAAS;CACT,KAAK;AACP;AAwBA,SAAgBC,EACd,IAA8B,CAAC,GACjB;CACd,OACE,kBAACC,GAAD;EAAU,UAAU,kBAACC,GAAD,CAA6B,CAAA;EAC/C,UAAA,kBAACC,GAAD,EAA4B,YAAYC,EAAM,cAAc,KAAA,EAAY,CAAA;CAChE,CAAA;AAEd;AAEA,SAASD,EAA2B,EAClC,YAAYE,KAGG;CACf,IAAMC,IAASb,EAAiB,GAC1Bc,IAASb,EAAa,GACtB,EAAE,cAAWF,EAAQ,GACrBgB,IAAkBC,GA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A,IACV;GAEHvD,KAAWiB,IACV,kBAAChC,GAAD;IACE,mBAAmB;KACjB,MAAM;KACN,YAAYe,EAAQ,SAAS;IAC/B;IACA,QAAQS;IACR,UAAU;IACV,WAAW,MAAiB;KAE1B,AADAL,EAAcoD,CAAM,GACpB9C,EAAc,CAAC,CAAC;IAClB;IACA,yBAAyBS;IACzB,oBAAoB4B;IACpB,QAAQ9B;IACR,cAAA;IACA,UAAUjB,EAAQ,YAAY;IAC9B,OAAOG;GACR,CAAA,IACC;GAEH,CAACJ,KAAc,CAACY,IACfgB,EAAK,SAAS,IACZ,kBAAC8B,IAAD;IACE,SAAS3B;IACA;IACT,YAAYH;IACZ,WAAA;GACD,CAAA,IAED,kBAAC4B,GAAD;IAAY,OAAM;IAAe,SAAQ;IAAO,UAAA;GAEpC,CAAA,IAEZ;EACD;CACE,CAAA,EAAA,CAAA,EACG,CAAA,CACd,EAAA,CAAA;AAER;AAEA,SAAShE,IAA2C;CAClD,OACE,kBAAAd,GAAA,EAAA,UAAA,CACI,kBAACyE,GAAD,EAAA,UACE,kBAAC/D,GAAD;EACE,aAAY;EACZ,OAAM;CACP,CAAA,EACS,CAAA,GAEZ,kBAACkE,GAAD,EAAA,UACE,kBAACC,GAAD,EAAA,UACE,kBAACC,GAAD;EAAY,OAAM;EAAe,SAAQ;EAAO,UAAA;CAEpC,CAAA,EACL,CAAA,EACG,CAAA,CACd,EAAA,CAAA;AAER;AAEA,SAASrB,EAAiB,GAAwB;CAShD,OAN0BwB,EAA+BnD,CAErD,MAIGA,aAAiB,QAAQA,EAAM,UAAU;AAClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/login-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/login-uvVcltrS.cjs");exports.LoginView=e.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as LoginView } from "../../chunks/login-
|
|
1
|
+
export { t as LoginView } from "../../chunks/login-D6cc3bo7.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-fqvmkBlg.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`以關鍵字與狀態查詢你有權限查看的簽核案件。`,emptyMessage:`沒有符合條件的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`案件搜尋`,view:`ALL`})}exports.SearchView=n;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["ApprovalInstanceListPage","require_approval_instance_list_page","react_jsx_runtime","SearchView"],"sources":["../../../src/views/search/SearchView.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement } from 'react';\nimport { ApprovalInstanceListPage } from '../../components/approval-instance-list-page';\n\n\n/**\n * Framework-agnostic view for the BPM case search page — list of all\n * instances the current member has visibility on. Mechanical port of\n * `apps/client/src/app/search/page.tsx`.\n */\nexport function SearchView(): ReactElement {\n return (\n <ApprovalInstanceListPage\n defaultState={null}\n description=\"以關鍵字與狀態查詢你有權限查看的簽核案件。\"\n emptyMessage=\"沒有符合條件的簽核案件。\"\n searchPlaceholder=\"關鍵字:搜尋案件、發起人、模板或狀態\"\n title=\"案件搜尋\"\n view=\"ALL\"\n />\n );\n}\n"],"mappings":"4LAWA,SAAgBG,GAA2B,CACzC,OACE,EAAAD,EAAA,IAAA,CAACF,EAAAA,EAAD,CACE,aAAc,KACd,YAAY,wBACZ,aAAa,eACb,kBAAkB,qBAClB,MAAM,OACN,KAAK,KACN,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ApprovalInstanceListPage","require_approval_instance_list_page","react_jsx_runtime","SearchView"],"sources":["../../../src/views/search/SearchView.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement } from 'react';\nimport { ApprovalInstanceListPage } from '../../components/approval-instance-list-page';\n\n\n/**\n * Framework-agnostic view for the BPM case search page — list of all\n * instances the current member has visibility on. Mechanical port of\n * `apps/client/src/app/search/page.tsx`.\n */\nexport function SearchView(): ReactElement {\n return (\n <ApprovalInstanceListPage\n defaultState={null}\n description=\"以關鍵字與狀態查詢你有權限查看的簽核案件。\"\n emptyMessage=\"沒有符合條件的簽核案件。\"\n searchPlaceholder=\"關鍵字:搜尋案件、發起人、模板或狀態\"\n title=\"案件搜尋\"\n view=\"ALL\"\n />\n );\n}\n"],"mappings":"A,4LAWA,SAAgBG,GAA2B,CACzC,OACE,EAAAD,EAAA,IAAA,CAACF,EAAAA,EAAD,CACE,aAAc,KACd,YAAY,wBACZ,aAAa,eACb,kBAAkB,qBAClB,MAAM,OACN,KAAK,KACN,CAAA,CAEL,C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../../chunks/approval-instance-list-page-
|
|
2
|
+
import { t as e } from "../../chunks/approval-instance-list-page-BnI4t5mD.js";
|
|
3
3
|
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/views/search/SearchView.tsx
|
|
5
5
|
function n() {
|
|
6
6
|
return /* @__PURE__ */ t(e, {
|
|
7
7
|
defaultState: null,
|
|
@@ -12,7 +12,6 @@ function n() {
|
|
|
12
12
|
view: "ALL"
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { n as SearchView };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/approval-instance-list-page-fqvmkBlg.cjs");let t=require("react/jsx-runtime");function n(){return(0,t.jsx)(e.t,{defaultState:null,description:`查看由你發起或代為送出的簽核案件與目前流程狀態。`,emptyMessage:`目前沒有由你發起或代為送出的簽核案件。`,searchPlaceholder:`關鍵字:搜尋案件、發起人、模板或狀態`,title:`我發起的`,view:`SENT`})}exports.SentView=n;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["ApprovalInstanceListPage","require_approval_instance_list_page","react_jsx_runtime","SentView"],"sources":["../../../src/views/sent/SentView.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement } from 'react';\nimport { ApprovalInstanceListPage } from '../../components/approval-instance-list-page';\n\n\n/**\n * Framework-agnostic view for the BPM \"sent\" inbox — instances the current\n * member has initiated or submitted on someone's behalf. Mechanical port of\n * `apps/client/src/app/sent/page.tsx`.\n */\nexport function SentView(): ReactElement {\n return (\n <ApprovalInstanceListPage\n defaultState={null}\n description=\"查看由你發起或代為送出的簽核案件與目前流程狀態。\"\n emptyMessage=\"目前沒有由你發起或代為送出的簽核案件。\"\n searchPlaceholder=\"關鍵字:搜尋案件、發起人、模板或狀態\"\n title=\"我發起的\"\n view=\"SENT\"\n />\n );\n}\n"],"mappings":"4LAWA,SAAgBG,GAAyB,CACvC,OACE,EAAAD,EAAA,IAAA,CAACF,EAAAA,EAAD,CACE,aAAc,KACd,YAAY,2BACZ,aAAa,sBACb,kBAAkB,qBAClB,MAAM,OACN,KAAK,MACN,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ApprovalInstanceListPage","require_approval_instance_list_page","react_jsx_runtime","SentView"],"sources":["../../../src/views/sent/SentView.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement } from 'react';\nimport { ApprovalInstanceListPage } from '../../components/approval-instance-list-page';\n\n\n/**\n * Framework-agnostic view for the BPM \"sent\" inbox — instances the current\n * member has initiated or submitted on someone's behalf. Mechanical port of\n * `apps/client/src/app/sent/page.tsx`.\n */\nexport function SentView(): ReactElement {\n return (\n <ApprovalInstanceListPage\n defaultState={null}\n description=\"查看由你發起或代為送出的簽核案件與目前流程狀態。\"\n emptyMessage=\"目前沒有由你發起或代為送出的簽核案件。\"\n searchPlaceholder=\"關鍵字:搜尋案件、發起人、模板或狀態\"\n title=\"我發起的\"\n view=\"SENT\"\n />\n );\n}\n"],"mappings":"A,4LAWA,SAAgBG,GAAyB,CACvC,OACE,EAAAD,EAAA,IAAA,CAACF,EAAAA,EAAD,CACE,aAAc,KACd,YAAY,2BACZ,aAAa,sBACb,kBAAkB,qBAClB,MAAM,OACN,KAAK,MACN,CAAA,CAEL,C"}
|
package/dist/views/sent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../../chunks/approval-instance-list-page-
|
|
2
|
+
import { t as e } from "../../chunks/approval-instance-list-page-BnI4t5mD.js";
|
|
3
3
|
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/views/sent/SentView.tsx
|
|
5
5
|
function n() {
|
|
6
6
|
return /* @__PURE__ */ t(e, {
|
|
7
7
|
defaultState: null,
|
|
@@ -12,7 +12,6 @@ function n() {
|
|
|
12
12
|
view: "SENT"
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { n as SentView };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as SettingsNotificationsView } from "../../chunks/notifications-
|
|
1
|
+
export { t as SettingsNotificationsView } from "../../chunks/notifications-Cvme5Qbl.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as SettingsNotificationsView } from "../../../chunks/notifications-
|
|
1
|
+
export { t as SettingsNotificationsView } from "../../../chunks/notifications-Cvme5Qbl.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/categories-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/categories-DQUtVEiV.cjs");exports.TemplateCategoriesView=e.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as TemplateCategoriesView } from "../../../chunks/categories-
|
|
1
|
+
export { t as TemplateCategoriesView } from "../../../chunks/categories-BAdxjNSA.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/compose-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/compose-DtfX8DQ9.cjs");exports.EMPTY_COMPOSE_FORM_SCHEMA=e.n,exports.EMPTY_COMPOSE_FORM_UI_SCHEMA=e.r,exports.TemplateComposeWizardView=e.t,exports.useTemplateComposeWizard=e.i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as EMPTY_COMPOSE_FORM_SCHEMA, r as EMPTY_COMPOSE_FORM_UI_SCHEMA, t as TemplateComposeWizardView, i as useTemplateComposeWizard } from "../../../chunks/compose-
|
|
1
|
+
export { n as EMPTY_COMPOSE_FORM_SCHEMA, r as EMPTY_COMPOSE_FORM_UI_SCHEMA, t as TemplateComposeWizardView, i as useTemplateComposeWizard } from "../../../chunks/compose-D9ipJpF_.js";
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { ApproverResolver, ApproverResolverFallback } from '@rytass/bpm-core-shared/workflow';
|
|
2
|
+
import { FormDefinitionSchema } from '@rytass/bpm-core-shared/form';
|
|
3
|
+
import { OrgUnitRecord, PositionRecord } from '@rytass/bpm-core-client/organization';
|
|
4
|
+
import { OrgUnitOption, PositionOption } from '../../../components/admin-picker-options.cjs';
|
|
5
|
+
export type ApproverResolverMode = Extract<ApproverResolver['type'], 'DIRECT' | 'DYNAMIC_FORM' | 'NODE_ACTOR' | 'ORG_MANAGER' | 'ORG_MANAGER_CHAIN' | 'ORG_UNIT_MANAGER' | 'ORG_UNIT_MEMBER' | 'ORG_UNIT_POSITION' | 'POSITION'>;
|
|
6
|
+
export type ApproverResolverModeOption = Readonly<{
|
|
7
|
+
id: ApproverResolverMode;
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type ManagerLevelOption = Readonly<{
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
value: number;
|
|
14
|
+
}>;
|
|
15
|
+
export type MemberSelectOption = Readonly<{
|
|
16
|
+
displayName: string;
|
|
17
|
+
email: string;
|
|
18
|
+
id: string;
|
|
19
|
+
memberId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
/**
|
|
22
|
+
* Set on the placeholder written when a member's profile could not be
|
|
23
|
+
* fetched. Marking it explicitly lets {@link mergeMemberOptions} replace the
|
|
24
|
+
* placeholder once the real profile turns up, instead of the "未知會員"
|
|
25
|
+
* sentinel sticking for the rest of the session.
|
|
26
|
+
*/
|
|
27
|
+
unresolved?: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const APPROVER_RESOLVER_MODE_OPTIONS: readonly ApproverResolverModeOption[];
|
|
30
|
+
export declare const MANAGER_LEVEL_OPTIONS: readonly ManagerLevelOption[];
|
|
31
|
+
export type NodeNameRecord = Readonly<{
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* The 簽核人 choices of the two sources that start from "someone": the person
|
|
37
|
+
* the source names, or their manager one to three levels up. `value` 0 is the
|
|
38
|
+
* person themselves; it is what the select stores for a source with no
|
|
39
|
+
* manager level.
|
|
40
|
+
*/
|
|
41
|
+
export declare const FORM_MEMBER_SUBJECT_OPTIONS: readonly ManagerLevelOption[];
|
|
42
|
+
export declare const NODE_ACTOR_SUBJECT_OPTIONS: readonly ManagerLevelOption[];
|
|
43
|
+
export type OrgUnitManagerSource = 'FIXED' | 'FORM_FIELD';
|
|
44
|
+
export declare const ORG_UNIT_SOURCE_OPTIONS: readonly Readonly<{
|
|
45
|
+
id: OrgUnitManagerSource;
|
|
46
|
+
name: string;
|
|
47
|
+
}>[];
|
|
48
|
+
/**
|
|
49
|
+
* The option for a stored level. A level this screen has no option for (a
|
|
50
|
+
* hand-written or AI-written definition) is shown as itself rather than
|
|
51
|
+
* mistaken for another one.
|
|
52
|
+
*/
|
|
53
|
+
export declare function readApproverSubjectOption(options: readonly ManagerLevelOption[], levelsUp: number): ManagerLevelOption;
|
|
54
|
+
/**
|
|
55
|
+
* The option for the manager level a FORM_MEMBER_MANAGER / NODE_ACTOR_MANAGER
|
|
56
|
+
* definition stores. Those types always name a manager, so a level below 1 (or
|
|
57
|
+
* not a whole number) is a broken definition: it is shown as an invalid level
|
|
58
|
+
* rather than as the option whose `value` happens to be 0 (本人). The stored
|
|
59
|
+
* JSON is never touched by this read; the publish lint is what blocks it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readStoredManagerLevelOption(options: readonly ManagerLevelOption[], levelsUp: number): ManagerLevelOption;
|
|
62
|
+
export declare function readApproverResolverMode(value: string): ApproverResolverMode;
|
|
63
|
+
export declare function readDefaultApproverResolver(value: string | null, positions: readonly PositionRecord[]): ApproverResolver;
|
|
64
|
+
export declare function updateApproverResolverFallback(resolver: ApproverResolver, fallback: ApproverResolverFallback): ApproverResolver;
|
|
65
|
+
export declare function readManagerLevelOption(levelsUp: number): ManagerLevelOption;
|
|
66
|
+
export declare function readManagerLevelOptionById(id: string | null): ManagerLevelOption;
|
|
67
|
+
/**
|
|
68
|
+
* Every member id a resolver names outright, so the designer can pre-fetch
|
|
69
|
+
* their display names on load.
|
|
70
|
+
*
|
|
71
|
+
* The manager resolvers' `DIRECT` fallback ("固定改派") counts: it is a member
|
|
72
|
+
* the author picked and the property form renders it through
|
|
73
|
+
* `readMemberSelectOption`, which falls back to the "未知會員" sentinel for any
|
|
74
|
+
* id it cannot find. Leaving it out meant a saved fallback always rendered as
|
|
75
|
+
* 未知會員 until an unrelated search happened to return that member.
|
|
76
|
+
*/
|
|
77
|
+
export declare function readApproverResolverMemberIds(resolver: ApproverResolver): readonly string[];
|
|
78
|
+
export declare function readApproverResolverSummary(resolver: ApproverResolver, memberOptions: readonly MemberSelectOption[], orgUnits: readonly OrgUnitRecord[], positions: readonly PositionRecord[], formSchema: FormDefinitionSchema | null, nodes?: readonly NodeNameRecord[]): string;
|
|
79
|
+
export declare function readMemberEmailSummary(memberIds: readonly string[], memberOptions: readonly MemberSelectOption[], emptyLabel: string): string;
|
|
80
|
+
export declare function readOrgUnitDisplayName(orgUnits: readonly OrgUnitRecord[], orgUnitId: string): string;
|
|
81
|
+
export declare function readPositionDisplayName(positions: readonly PositionRecord[], positionId: string): string;
|
|
82
|
+
export declare function readSelectedOrgUnitOption(orgUnits: readonly OrgUnitRecord[], orgUnitId: string): OrgUnitOption | null;
|
|
83
|
+
export declare function readSelectedPositionOption(positions: readonly PositionRecord[], positionId: string): PositionOption | null;
|
|
84
|
+
export declare function readMemberSelectOption(options: readonly MemberSelectOption[], memberId: string): MemberSelectOption;
|
|
85
|
+
export declare function readFallbackMemberSelectOption(memberId: string): MemberSelectOption;
|
|
86
|
+
/**
|
|
87
|
+
* The one label for a resolver `type` this build does not know (a definition
|
|
88
|
+
* saved by a newer BPMCore): the designer's read-only 簽核來源 entry, the node
|
|
89
|
+
* summary and the compose review table all say it with this.
|
|
90
|
+
*/
|
|
91
|
+
export declare function readUnsupportedApproverSourceLabel(type: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* The short 簽核方式 label the compose review table shows for a user task.
|
|
94
|
+
*/
|
|
95
|
+
export declare function readApproverResolverDetail(resolver: ApproverResolver): string;
|
|
96
|
+
type ManagerRule = Readonly<{
|
|
97
|
+
fallback?: ApproverResolverFallback;
|
|
98
|
+
preferClosestOrgUnit?: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* What the 簽核來源 panel edits. The three sources with two stored types each
|
|
102
|
+
* (本人/主管, 固定組織/表單欄位) carry the screen's own choice instead of the
|
|
103
|
+
* JSON type; every other known type is held as saved and edited field by
|
|
104
|
+
* field, and a type this build does not know is held as saved, read-only.
|
|
105
|
+
*
|
|
106
|
+
* `levelsUp` is `null` for the 本人 choice (no manager level), otherwise the
|
|
107
|
+
* stored level.
|
|
108
|
+
*/
|
|
109
|
+
export type ApproverResolverEditorState = (Readonly<{
|
|
110
|
+
formPath: string;
|
|
111
|
+
levelsUp: number | null;
|
|
112
|
+
mode: 'DYNAMIC_FORM';
|
|
113
|
+
}> & ManagerRule) | (Readonly<{
|
|
114
|
+
formPath: string;
|
|
115
|
+
mode: 'ORG_UNIT_MANAGER';
|
|
116
|
+
orgSource: OrgUnitManagerSource;
|
|
117
|
+
orgUnitId: string;
|
|
118
|
+
}> & ManagerRule) | (Readonly<{
|
|
119
|
+
levelsUp: number | null;
|
|
120
|
+
mode: 'NODE_ACTOR';
|
|
121
|
+
nodeIds: readonly string[];
|
|
122
|
+
}> & ManagerRule) | Readonly<{
|
|
123
|
+
mode: 'AS_STORED';
|
|
124
|
+
resolver: ApproverResolver;
|
|
125
|
+
}> | Readonly<{
|
|
126
|
+
mode: 'UNSUPPORTED';
|
|
127
|
+
resolver: ApproverResolver;
|
|
128
|
+
type: string;
|
|
129
|
+
}>;
|
|
130
|
+
export declare function readApproverResolverEditorState(resolver: ApproverResolver): ApproverResolverEditorState;
|
|
131
|
+
/**
|
|
132
|
+
* The JSON for a screen state. Only the fields that belong to the chosen type
|
|
133
|
+
* are written, so a field left over from the choice the author switched away
|
|
134
|
+
* from (the manager level after 回到欄位裡的人, the formPath after 改選固定組織)
|
|
135
|
+
* never reaches the saved definition.
|
|
136
|
+
*/
|
|
137
|
+
export declare function buildApproverResolver(state: ApproverResolverEditorState): ApproverResolver;
|
|
138
|
+
/**
|
|
139
|
+
* Applies the 簽核人 select: 0 is the person themselves, 1-3 their manager.
|
|
140
|
+
* Sources with no such choice come back as the same state.
|
|
141
|
+
*/
|
|
142
|
+
export declare function withApproverSubject(state: ApproverResolverEditorState, value: number): ApproverResolverEditorState;
|
|
143
|
+
/**
|
|
144
|
+
* Applies the 組織 choice of 指定組織主管. A form-field org starts with 只取最近
|
|
145
|
+
* 一層主管 on (SPEC 3.3) unless the author already chose; a fixed org keeps the
|
|
146
|
+
* stored choice as it is. Switching back does not take the default off again:
|
|
147
|
+
* the toggle keeps whatever value the resolver has, and stays visible.
|
|
148
|
+
*/
|
|
149
|
+
export declare function withOrgUnitSource(state: ApproverResolverEditorState, source: OrgUnitManagerSource): ApproverResolverEditorState;
|
|
150
|
+
/** The id of the read-only entry an unknown resolver type is shown as. */
|
|
151
|
+
export declare const UNSUPPORTED_APPROVER_SOURCE_OPTION_ID = "UNSUPPORTED";
|
|
152
|
+
export type ApproverSourceChoice = Readonly<{
|
|
153
|
+
/** Hint under the select, `null` when nothing needs saying. */
|
|
154
|
+
hint: string | null;
|
|
155
|
+
options: readonly Readonly<{
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
}>[];
|
|
159
|
+
selected: Readonly<{
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
}>;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* The 簽核來源 select: the source options, plus, for a type this build does
|
|
166
|
+
* not know, a read-only entry carrying its name that is the current value: it
|
|
167
|
+
* is shown, never edited, and nothing is written unless the author explicitly
|
|
168
|
+
* picks a different source (which replaces the stored one).
|
|
169
|
+
* `readApproverResolverMode` would call such a type 指定會員.
|
|
170
|
+
*/
|
|
171
|
+
export declare function readApproverSourceChoice(state: ApproverResolverEditorState): ApproverSourceChoice;
|
|
172
|
+
/**
|
|
173
|
+
* The resolver a 簽核來源 pick produces, or `null` when the pick must change
|
|
174
|
+
* nothing: no option, an id that is not an option (the read-only unsupported
|
|
175
|
+
* entry included), or the source already stored. Re-picking the shown source
|
|
176
|
+
* used to rebuild a clean default and wipe what the author had filled in.
|
|
177
|
+
*
|
|
178
|
+
* "Already stored" is the state's own mode, not the displayed option: an
|
|
179
|
+
* EXPRESSION resolver is displayed as 指定會員 but is not one, so picking 指定會員
|
|
180
|
+
* still switches it.
|
|
181
|
+
*/
|
|
182
|
+
export declare function readApproverSourcePick(resolver: ApproverResolver, optionId: string | null, positions: readonly PositionRecord[]): ApproverResolver | null;
|
|
183
|
+
export type ApproverSubjectChoice = Readonly<{
|
|
184
|
+
/** The stored level is below 1 (or fractional): shown, not offered again. */
|
|
185
|
+
invalid: boolean;
|
|
186
|
+
options: readonly ManagerLevelOption[];
|
|
187
|
+
selected: ManagerLevelOption;
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* The 簽核人 select of ② and ③. A stored manager level the list has no option
|
|
191
|
+
* for (invalid, or a level above 3) is appended so the select can show it.
|
|
192
|
+
*/
|
|
193
|
+
export declare function readApproverSubjectChoice(state: ApproverResolverEditorState): ApproverSubjectChoice | null;
|
|
194
|
+
/**
|
|
195
|
+
* The state a 簽核人 pick produces, or `null` for a no-op (the shown choice
|
|
196
|
+
* picked again, the invalid-level entry, an id that is not an option).
|
|
197
|
+
*/
|
|
198
|
+
export declare function readApproverSubjectPick(state: ApproverResolverEditorState, optionId: string | null): ApproverResolverEditorState | null;
|
|
199
|
+
export type ApproverManagerRuleView = Readonly<{
|
|
200
|
+
fallback: ApproverResolverFallback;
|
|
201
|
+
preferClosestOrgUnit: boolean;
|
|
202
|
+
/** 主管鏈 has no 只取最近一層主管. */
|
|
203
|
+
showPreferClosestOrgUnit: boolean;
|
|
204
|
+
}>;
|
|
205
|
+
/**
|
|
206
|
+
* The 只取最近一層主管 / 無主管時 pair of a resolver that looks a manager up,
|
|
207
|
+
* `null` for one that does not (so 本人 shows neither).
|
|
208
|
+
*/
|
|
209
|
+
export declare function readApproverManagerRule(resolver: ApproverResolver): ApproverManagerRuleView | null;
|
|
210
|
+
export declare function withPreferClosestOrgUnit(resolver: ApproverResolver, preferClosestOrgUnit: boolean): ApproverResolver;
|
|
211
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { ApproverResolver, ApproverResolverFallback } from '@rytass/bpm-core-shared/workflow';
|
|
2
|
+
import { FormDefinitionSchema } from '@rytass/bpm-core-shared/form';
|
|
3
|
+
import { OrgUnitRecord, PositionRecord } from '@rytass/bpm-core-client/organization';
|
|
4
|
+
import { OrgUnitOption, PositionOption } from '../../../components/admin-picker-options.js';
|
|
5
|
+
export type ApproverResolverMode = Extract<ApproverResolver['type'], 'DIRECT' | 'DYNAMIC_FORM' | 'NODE_ACTOR' | 'ORG_MANAGER' | 'ORG_MANAGER_CHAIN' | 'ORG_UNIT_MANAGER' | 'ORG_UNIT_MEMBER' | 'ORG_UNIT_POSITION' | 'POSITION'>;
|
|
6
|
+
export type ApproverResolverModeOption = Readonly<{
|
|
7
|
+
id: ApproverResolverMode;
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type ManagerLevelOption = Readonly<{
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
value: number;
|
|
14
|
+
}>;
|
|
15
|
+
export type MemberSelectOption = Readonly<{
|
|
16
|
+
displayName: string;
|
|
17
|
+
email: string;
|
|
18
|
+
id: string;
|
|
19
|
+
memberId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
/**
|
|
22
|
+
* Set on the placeholder written when a member's profile could not be
|
|
23
|
+
* fetched. Marking it explicitly lets {@link mergeMemberOptions} replace the
|
|
24
|
+
* placeholder once the real profile turns up, instead of the "未知會員"
|
|
25
|
+
* sentinel sticking for the rest of the session.
|
|
26
|
+
*/
|
|
27
|
+
unresolved?: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const APPROVER_RESOLVER_MODE_OPTIONS: readonly ApproverResolverModeOption[];
|
|
30
|
+
export declare const MANAGER_LEVEL_OPTIONS: readonly ManagerLevelOption[];
|
|
31
|
+
export type NodeNameRecord = Readonly<{
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* The 簽核人 choices of the two sources that start from "someone": the person
|
|
37
|
+
* the source names, or their manager one to three levels up. `value` 0 is the
|
|
38
|
+
* person themselves; it is what the select stores for a source with no
|
|
39
|
+
* manager level.
|
|
40
|
+
*/
|
|
41
|
+
export declare const FORM_MEMBER_SUBJECT_OPTIONS: readonly ManagerLevelOption[];
|
|
42
|
+
export declare const NODE_ACTOR_SUBJECT_OPTIONS: readonly ManagerLevelOption[];
|
|
43
|
+
export type OrgUnitManagerSource = 'FIXED' | 'FORM_FIELD';
|
|
44
|
+
export declare const ORG_UNIT_SOURCE_OPTIONS: readonly Readonly<{
|
|
45
|
+
id: OrgUnitManagerSource;
|
|
46
|
+
name: string;
|
|
47
|
+
}>[];
|
|
48
|
+
/**
|
|
49
|
+
* The option for a stored level. A level this screen has no option for (a
|
|
50
|
+
* hand-written or AI-written definition) is shown as itself rather than
|
|
51
|
+
* mistaken for another one.
|
|
52
|
+
*/
|
|
53
|
+
export declare function readApproverSubjectOption(options: readonly ManagerLevelOption[], levelsUp: number): ManagerLevelOption;
|
|
54
|
+
/**
|
|
55
|
+
* The option for the manager level a FORM_MEMBER_MANAGER / NODE_ACTOR_MANAGER
|
|
56
|
+
* definition stores. Those types always name a manager, so a level below 1 (or
|
|
57
|
+
* not a whole number) is a broken definition: it is shown as an invalid level
|
|
58
|
+
* rather than as the option whose `value` happens to be 0 (本人). The stored
|
|
59
|
+
* JSON is never touched by this read; the publish lint is what blocks it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readStoredManagerLevelOption(options: readonly ManagerLevelOption[], levelsUp: number): ManagerLevelOption;
|
|
62
|
+
export declare function readApproverResolverMode(value: string): ApproverResolverMode;
|
|
63
|
+
export declare function readDefaultApproverResolver(value: string | null, positions: readonly PositionRecord[]): ApproverResolver;
|
|
64
|
+
export declare function updateApproverResolverFallback(resolver: ApproverResolver, fallback: ApproverResolverFallback): ApproverResolver;
|
|
65
|
+
export declare function readManagerLevelOption(levelsUp: number): ManagerLevelOption;
|
|
66
|
+
export declare function readManagerLevelOptionById(id: string | null): ManagerLevelOption;
|
|
67
|
+
/**
|
|
68
|
+
* Every member id a resolver names outright, so the designer can pre-fetch
|
|
69
|
+
* their display names on load.
|
|
70
|
+
*
|
|
71
|
+
* The manager resolvers' `DIRECT` fallback ("固定改派") counts: it is a member
|
|
72
|
+
* the author picked and the property form renders it through
|
|
73
|
+
* `readMemberSelectOption`, which falls back to the "未知會員" sentinel for any
|
|
74
|
+
* id it cannot find. Leaving it out meant a saved fallback always rendered as
|
|
75
|
+
* 未知會員 until an unrelated search happened to return that member.
|
|
76
|
+
*/
|
|
77
|
+
export declare function readApproverResolverMemberIds(resolver: ApproverResolver): readonly string[];
|
|
78
|
+
export declare function readApproverResolverSummary(resolver: ApproverResolver, memberOptions: readonly MemberSelectOption[], orgUnits: readonly OrgUnitRecord[], positions: readonly PositionRecord[], formSchema: FormDefinitionSchema | null, nodes?: readonly NodeNameRecord[]): string;
|
|
79
|
+
export declare function readMemberEmailSummary(memberIds: readonly string[], memberOptions: readonly MemberSelectOption[], emptyLabel: string): string;
|
|
80
|
+
export declare function readOrgUnitDisplayName(orgUnits: readonly OrgUnitRecord[], orgUnitId: string): string;
|
|
81
|
+
export declare function readPositionDisplayName(positions: readonly PositionRecord[], positionId: string): string;
|
|
82
|
+
export declare function readSelectedOrgUnitOption(orgUnits: readonly OrgUnitRecord[], orgUnitId: string): OrgUnitOption | null;
|
|
83
|
+
export declare function readSelectedPositionOption(positions: readonly PositionRecord[], positionId: string): PositionOption | null;
|
|
84
|
+
export declare function readMemberSelectOption(options: readonly MemberSelectOption[], memberId: string): MemberSelectOption;
|
|
85
|
+
export declare function readFallbackMemberSelectOption(memberId: string): MemberSelectOption;
|
|
86
|
+
/**
|
|
87
|
+
* The one label for a resolver `type` this build does not know (a definition
|
|
88
|
+
* saved by a newer BPMCore): the designer's read-only 簽核來源 entry, the node
|
|
89
|
+
* summary and the compose review table all say it with this.
|
|
90
|
+
*/
|
|
91
|
+
export declare function readUnsupportedApproverSourceLabel(type: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* The short 簽核方式 label the compose review table shows for a user task.
|
|
94
|
+
*/
|
|
95
|
+
export declare function readApproverResolverDetail(resolver: ApproverResolver): string;
|
|
96
|
+
type ManagerRule = Readonly<{
|
|
97
|
+
fallback?: ApproverResolverFallback;
|
|
98
|
+
preferClosestOrgUnit?: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* What the 簽核來源 panel edits. The three sources with two stored types each
|
|
102
|
+
* (本人/主管, 固定組織/表單欄位) carry the screen's own choice instead of the
|
|
103
|
+
* JSON type; every other known type is held as saved and edited field by
|
|
104
|
+
* field, and a type this build does not know is held as saved, read-only.
|
|
105
|
+
*
|
|
106
|
+
* `levelsUp` is `null` for the 本人 choice (no manager level), otherwise the
|
|
107
|
+
* stored level.
|
|
108
|
+
*/
|
|
109
|
+
export type ApproverResolverEditorState = (Readonly<{
|
|
110
|
+
formPath: string;
|
|
111
|
+
levelsUp: number | null;
|
|
112
|
+
mode: 'DYNAMIC_FORM';
|
|
113
|
+
}> & ManagerRule) | (Readonly<{
|
|
114
|
+
formPath: string;
|
|
115
|
+
mode: 'ORG_UNIT_MANAGER';
|
|
116
|
+
orgSource: OrgUnitManagerSource;
|
|
117
|
+
orgUnitId: string;
|
|
118
|
+
}> & ManagerRule) | (Readonly<{
|
|
119
|
+
levelsUp: number | null;
|
|
120
|
+
mode: 'NODE_ACTOR';
|
|
121
|
+
nodeIds: readonly string[];
|
|
122
|
+
}> & ManagerRule) | Readonly<{
|
|
123
|
+
mode: 'AS_STORED';
|
|
124
|
+
resolver: ApproverResolver;
|
|
125
|
+
}> | Readonly<{
|
|
126
|
+
mode: 'UNSUPPORTED';
|
|
127
|
+
resolver: ApproverResolver;
|
|
128
|
+
type: string;
|
|
129
|
+
}>;
|
|
130
|
+
export declare function readApproverResolverEditorState(resolver: ApproverResolver): ApproverResolverEditorState;
|
|
131
|
+
/**
|
|
132
|
+
* The JSON for a screen state. Only the fields that belong to the chosen type
|
|
133
|
+
* are written, so a field left over from the choice the author switched away
|
|
134
|
+
* from (the manager level after 回到欄位裡的人, the formPath after 改選固定組織)
|
|
135
|
+
* never reaches the saved definition.
|
|
136
|
+
*/
|
|
137
|
+
export declare function buildApproverResolver(state: ApproverResolverEditorState): ApproverResolver;
|
|
138
|
+
/**
|
|
139
|
+
* Applies the 簽核人 select: 0 is the person themselves, 1-3 their manager.
|
|
140
|
+
* Sources with no such choice come back as the same state.
|
|
141
|
+
*/
|
|
142
|
+
export declare function withApproverSubject(state: ApproverResolverEditorState, value: number): ApproverResolverEditorState;
|
|
143
|
+
/**
|
|
144
|
+
* Applies the 組織 choice of 指定組織主管. A form-field org starts with 只取最近
|
|
145
|
+
* 一層主管 on (SPEC 3.3) unless the author already chose; a fixed org keeps the
|
|
146
|
+
* stored choice as it is. Switching back does not take the default off again:
|
|
147
|
+
* the toggle keeps whatever value the resolver has, and stays visible.
|
|
148
|
+
*/
|
|
149
|
+
export declare function withOrgUnitSource(state: ApproverResolverEditorState, source: OrgUnitManagerSource): ApproverResolverEditorState;
|
|
150
|
+
/** The id of the read-only entry an unknown resolver type is shown as. */
|
|
151
|
+
export declare const UNSUPPORTED_APPROVER_SOURCE_OPTION_ID = "UNSUPPORTED";
|
|
152
|
+
export type ApproverSourceChoice = Readonly<{
|
|
153
|
+
/** Hint under the select, `null` when nothing needs saying. */
|
|
154
|
+
hint: string | null;
|
|
155
|
+
options: readonly Readonly<{
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
}>[];
|
|
159
|
+
selected: Readonly<{
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
}>;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* The 簽核來源 select: the source options, plus, for a type this build does
|
|
166
|
+
* not know, a read-only entry carrying its name that is the current value: it
|
|
167
|
+
* is shown, never edited, and nothing is written unless the author explicitly
|
|
168
|
+
* picks a different source (which replaces the stored one).
|
|
169
|
+
* `readApproverResolverMode` would call such a type 指定會員.
|
|
170
|
+
*/
|
|
171
|
+
export declare function readApproverSourceChoice(state: ApproverResolverEditorState): ApproverSourceChoice;
|
|
172
|
+
/**
|
|
173
|
+
* The resolver a 簽核來源 pick produces, or `null` when the pick must change
|
|
174
|
+
* nothing: no option, an id that is not an option (the read-only unsupported
|
|
175
|
+
* entry included), or the source already stored. Re-picking the shown source
|
|
176
|
+
* used to rebuild a clean default and wipe what the author had filled in.
|
|
177
|
+
*
|
|
178
|
+
* "Already stored" is the state's own mode, not the displayed option: an
|
|
179
|
+
* EXPRESSION resolver is displayed as 指定會員 but is not one, so picking 指定會員
|
|
180
|
+
* still switches it.
|
|
181
|
+
*/
|
|
182
|
+
export declare function readApproverSourcePick(resolver: ApproverResolver, optionId: string | null, positions: readonly PositionRecord[]): ApproverResolver | null;
|
|
183
|
+
export type ApproverSubjectChoice = Readonly<{
|
|
184
|
+
/** The stored level is below 1 (or fractional): shown, not offered again. */
|
|
185
|
+
invalid: boolean;
|
|
186
|
+
options: readonly ManagerLevelOption[];
|
|
187
|
+
selected: ManagerLevelOption;
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* The 簽核人 select of ② and ③. A stored manager level the list has no option
|
|
191
|
+
* for (invalid, or a level above 3) is appended so the select can show it.
|
|
192
|
+
*/
|
|
193
|
+
export declare function readApproverSubjectChoice(state: ApproverResolverEditorState): ApproverSubjectChoice | null;
|
|
194
|
+
/**
|
|
195
|
+
* The state a 簽核人 pick produces, or `null` for a no-op (the shown choice
|
|
196
|
+
* picked again, the invalid-level entry, an id that is not an option).
|
|
197
|
+
*/
|
|
198
|
+
export declare function readApproverSubjectPick(state: ApproverResolverEditorState, optionId: string | null): ApproverResolverEditorState | null;
|
|
199
|
+
export type ApproverManagerRuleView = Readonly<{
|
|
200
|
+
fallback: ApproverResolverFallback;
|
|
201
|
+
preferClosestOrgUnit: boolean;
|
|
202
|
+
/** 主管鏈 has no 只取最近一層主管. */
|
|
203
|
+
showPreferClosestOrgUnit: boolean;
|
|
204
|
+
}>;
|
|
205
|
+
/**
|
|
206
|
+
* The 只取最近一層主管 / 無主管時 pair of a resolver that looks a manager up,
|
|
207
|
+
* `null` for one that does not (so 本人 shows neither).
|
|
208
|
+
*/
|
|
209
|
+
export declare function readApproverManagerRule(resolver: ApproverResolver): ApproverManagerRuleView | null;
|
|
210
|
+
export declare function withPreferClosestOrgUnit(resolver: ApproverResolver, preferClosestOrgUnit: boolean): ApproverResolver;
|
|
211
|
+
export {};
|
|
@@ -11,6 +11,8 @@ export type DryRunAssigneeDirectory = Readonly<{
|
|
|
11
11
|
formFields: readonly FormFieldRecord[];
|
|
12
12
|
/** Display name of a real member id, or `null` when it is not known. */
|
|
13
13
|
memberName: (memberId: string) => string | null;
|
|
14
|
+
/** Nodes of the workflow, to name the stages a `nodeActor:` placeholder lists. */
|
|
15
|
+
nodes: readonly NamedRecord[];
|
|
14
16
|
orgUnits: readonly NamedRecord[];
|
|
15
17
|
positions: readonly NamedRecord[];
|
|
16
18
|
}>;
|