@rytass/bpm-core-react 0.18.0 → 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.
Files changed (271) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/chunks/FormBuilderView-CHaAQL5v.cjs +3 -0
  3. package/dist/chunks/FormBuilderView-CHaAQL5v.cjs.map +1 -0
  4. package/dist/chunks/{FormBuilderView-BVKY1j_0.js → FormBuilderView-vQfVc08Z.js} +485 -481
  5. package/dist/chunks/FormBuilderView-vQfVc08Z.js.map +1 -0
  6. package/dist/chunks/{FormRendererView-BsTwZkqU.js → FormRendererView-CTLlG13b.js} +300 -189
  7. package/dist/chunks/FormRendererView-CTLlG13b.js.map +1 -0
  8. package/dist/chunks/FormRendererView-ChmM_4Yc.cjs +4 -0
  9. package/dist/chunks/FormRendererView-ChmM_4Yc.cjs.map +1 -0
  10. package/dist/chunks/admin-pickers-BjbkBpSJ.cjs +2 -0
  11. package/dist/chunks/admin-pickers-BjbkBpSJ.cjs.map +1 -0
  12. package/dist/chunks/{admin-pickers-Djq3h-UR.js → admin-pickers-DfGxsjpp.js} +42 -42
  13. package/dist/chunks/admin-pickers-DfGxsjpp.js.map +1 -0
  14. package/dist/chunks/{approval-instance-list-page-CPXMP3PL.js → approval-instance-list-page-BnI4t5mD.js} +7 -8
  15. package/dist/chunks/{approval-instance-list-page-CPXMP3PL.js.map → approval-instance-list-page-BnI4t5mD.js.map} +1 -1
  16. package/dist/chunks/{approval-instance-list-page-ax0pm8bt.cjs → approval-instance-list-page-fqvmkBlg.cjs} +2 -2
  17. package/dist/chunks/{approval-instance-list-page-ax0pm8bt.cjs.map → approval-instance-list-page-fqvmkBlg.cjs.map} +1 -1
  18. package/dist/chunks/{approver-filled-form-Dm3Iw7iw.cjs → approver-filled-form-B4zPg9kz.cjs} +2 -2
  19. package/dist/chunks/approver-filled-form-B4zPg9kz.cjs.map +1 -0
  20. package/dist/chunks/{approver-filled-form-ZEwpmsHJ.js → approver-filled-form-Bgazhbvd.js} +40 -36
  21. package/dist/chunks/approver-filled-form-Bgazhbvd.js.map +1 -0
  22. package/dist/chunks/auth-provider-4BeCw7cI.cjs.map +1 -1
  23. package/dist/chunks/{auth-provider-B5oPmvk2.js → auth-provider-C2b-5mGt.js} +2 -3
  24. package/dist/chunks/{auth-provider-B5oPmvk2.js.map → auth-provider-C2b-5mGt.js.map} +1 -1
  25. package/dist/chunks/{bpm-form-field-Cao0rMol.js → bpm-form-field-9B-Det0u.js} +2 -3
  26. package/dist/chunks/{bpm-form-field-Cao0rMol.js.map → bpm-form-field-9B-Det0u.js.map} +1 -1
  27. package/dist/chunks/bpm-form-field-Bc6k4ZEO.cjs.map +1 -1
  28. package/dist/chunks/{categories-riC33J_j.js → categories-BAdxjNSA.js} +14 -15
  29. package/dist/chunks/{categories-riC33J_j.js.map → categories-BAdxjNSA.js.map} +1 -1
  30. package/dist/chunks/{categories-AxxhqjLZ.cjs → categories-DQUtVEiV.cjs} +2 -2
  31. package/dist/chunks/{categories-AxxhqjLZ.cjs.map → categories-DQUtVEiV.cjs.map} +1 -1
  32. package/dist/chunks/{compose-B1GlrZW9.js → compose-D9ipJpF_.js} +131 -148
  33. package/dist/chunks/compose-D9ipJpF_.js.map +1 -0
  34. package/dist/chunks/compose-DtfX8DQ9.cjs +2 -0
  35. package/dist/chunks/compose-DtfX8DQ9.cjs.map +1 -0
  36. package/dist/chunks/{dashboard-page-DdBvV6YI.js → dashboard-page-BoqNhjT_.js} +5 -6
  37. package/dist/chunks/{dashboard-page-DdBvV6YI.js.map → dashboard-page-BoqNhjT_.js.map} +1 -1
  38. package/dist/chunks/{dashboard-page-BWQBSGDq.cjs → dashboard-page-D7YJ3udk.cjs} +2 -2
  39. package/dist/chunks/{dashboard-page-BWQBSGDq.cjs.map → dashboard-page-D7YJ3udk.cjs.map} +1 -1
  40. package/dist/chunks/{delegations-MxF3uJGW.js → delegations-BfhCDz5e.js} +15 -16
  41. package/dist/chunks/{delegations-MxF3uJGW.js.map → delegations-BfhCDz5e.js.map} +1 -1
  42. package/dist/chunks/{delegations-Ckf03icM.cjs → delegations-BmFGcuhA.cjs} +2 -2
  43. package/dist/chunks/{delegations-Ckf03icM.cjs.map → delegations-BmFGcuhA.cjs.map} +1 -1
  44. package/dist/chunks/{delegations-V9HIe3_P.cjs → delegations-CcS0SHbf.cjs} +2 -2
  45. package/dist/chunks/{delegations-V9HIe3_P.cjs.map → delegations-CcS0SHbf.cjs.map} +1 -1
  46. package/dist/chunks/{delegations-xUt1tj8d.js → delegations-DBh5TT6G.js} +16 -17
  47. package/dist/chunks/{delegations-xUt1tj8d.js.map → delegations-DBh5TT6G.js.map} +1 -1
  48. package/dist/chunks/designer-Df79YzUn.cjs +65 -0
  49. package/dist/chunks/designer-Df79YzUn.cjs.map +1 -0
  50. package/dist/chunks/{designer-BCLrjb4H.js → designer-ubnZbP-A.js} +1791 -1407
  51. package/dist/chunks/designer-ubnZbP-A.js.map +1 -0
  52. package/dist/chunks/detail-BBC9kqXd.cjs +5 -0
  53. package/dist/chunks/detail-BBC9kqXd.cjs.map +1 -0
  54. package/dist/chunks/{detail-4F39ggBn.js → detail-C6XKZjlF.js} +1033 -1005
  55. package/dist/chunks/detail-C6XKZjlF.js.map +1 -0
  56. package/dist/chunks/{format-date-time-CB-LxzqT.js → format-date-time-B0LdmWg4.js} +2 -3
  57. package/dist/chunks/{format-date-time-CB-LxzqT.js.map → format-date-time-B0LdmWg4.js.map} +1 -1
  58. package/dist/chunks/format-date-time-D-cx5M8z.cjs.map +1 -1
  59. package/dist/chunks/{format-member-label-DudVI55w.js → format-member-label-C73FuP-d.js} +2 -3
  60. package/dist/chunks/{format-member-label-DudVI55w.js.map → format-member-label-C73FuP-d.js.map} +1 -1
  61. package/dist/chunks/format-member-label-t7ANTF62.cjs.map +1 -1
  62. package/dist/chunks/language-provider-Bdnx3Gxl.cjs.map +1 -1
  63. package/dist/chunks/{language-provider-B3cEbLe4.js → language-provider-phkWOapf.js} +2 -3
  64. package/dist/chunks/{language-provider-B3cEbLe4.js.map → language-provider-phkWOapf.js.map} +1 -1
  65. package/dist/chunks/{login-C6qlTC6F.js → login-D6cc3bo7.js} +4 -5
  66. package/dist/chunks/{login-C6qlTC6F.js.map → login-D6cc3bo7.js.map} +1 -1
  67. package/dist/chunks/{login-AtVxZBsC.cjs → login-uvVcltrS.cjs} +2 -2
  68. package/dist/chunks/{login-AtVxZBsC.cjs.map → login-uvVcltrS.cjs.map} +1 -1
  69. package/dist/chunks/notifications-Bc4mgSds.cjs.map +1 -1
  70. package/dist/chunks/{notifications-DJ5wzCye.js → notifications-Cvme5Qbl.js} +2 -3
  71. package/dist/chunks/{notifications-DJ5wzCye.js.map → notifications-Cvme5Qbl.js.map} +1 -1
  72. package/dist/chunks/orgs-B_2J2tLX.cjs +2 -0
  73. package/dist/chunks/{orgs-BeeDDWL1.cjs.map → orgs-B_2J2tLX.cjs.map} +1 -1
  74. package/dist/chunks/{orgs-8hje_l2n.js → orgs-DqxMds26.js} +48 -49
  75. package/dist/chunks/{orgs-8hje_l2n.js.map → orgs-DqxMds26.js.map} +1 -1
  76. package/dist/chunks/{providers-B_d5tbCL.js → providers-BbCs23sk.js} +21 -25
  77. package/dist/chunks/{providers-B_d5tbCL.js.map → providers-BbCs23sk.js.map} +1 -1
  78. package/dist/chunks/{providers-chuJvMgv.cjs → providers-D_KAgOOu.cjs} +2 -2
  79. package/dist/chunks/{providers-chuJvMgv.cjs.map → providers-D_KAgOOu.cjs.map} +1 -1
  80. package/dist/chunks/router-adapter--gYs13E8.cjs.map +1 -1
  81. package/dist/chunks/{router-adapter-DftlFTOd.js → router-adapter-CkxCyzf5.js} +2 -3
  82. package/dist/chunks/{router-adapter-DftlFTOd.js.map → router-adapter-CkxCyzf5.js.map} +1 -1
  83. package/dist/chunks/{routes-config-yZbESPlw.js → routes-config-BcNaWJWJ.js} +2 -3
  84. package/dist/chunks/{routes-config-yZbESPlw.js.map → routes-config-BcNaWJWJ.js.map} +1 -1
  85. package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -1
  86. package/dist/chunks/task-decision-3d17ZvZE.js +29 -0
  87. package/dist/chunks/task-decision-3d17ZvZE.js.map +1 -0
  88. package/dist/chunks/task-decision-CqZ4WQOC.cjs +2 -0
  89. package/dist/chunks/task-decision-CqZ4WQOC.cjs.map +1 -0
  90. package/dist/chunks/{use-bpm-member-D57LKe_u.js → use-bpm-member-BPzcNU1g.js} +3 -4
  91. package/dist/chunks/{use-bpm-member-D57LKe_u.js.map → use-bpm-member-BPzcNU1g.js.map} +1 -1
  92. package/dist/chunks/use-bpm-member-DpNAQtNC.cjs.map +1 -1
  93. package/dist/chunks/{users-Pl6hY5Y5.js → users-BBtiZ9QQ.js} +22 -25
  94. package/dist/chunks/{users-Pl6hY5Y5.js.map → users-BBtiZ9QQ.js.map} +1 -1
  95. package/dist/chunks/{users-O2L_M3BK.cjs → users-EqSzDhuj.cjs} +2 -2
  96. package/dist/chunks/{users-O2L_M3BK.cjs.map → users-EqSzDhuj.cjs.map} +1 -1
  97. package/dist/components/admin-picker-options.d.cts +11 -0
  98. package/dist/components/admin-picker-options.d.ts +11 -0
  99. package/dist/components/admin-pickers.d.cts +2 -11
  100. package/dist/components/admin-pickers.d.ts +2 -11
  101. package/dist/index.cjs +1 -1
  102. package/dist/index.cjs.map +1 -1
  103. package/dist/index.js +17 -19
  104. package/dist/index.js.map +1 -1
  105. package/dist/lib/task-decision.d.cts +16 -0
  106. package/dist/lib/task-decision.d.ts +16 -0
  107. package/dist/lib/use-org-unit-names.d.cts +10 -0
  108. package/dist/lib/use-org-unit-names.d.ts +10 -0
  109. package/dist/next/index.cjs +1 -1
  110. package/dist/next/index.cjs.map +1 -1
  111. package/dist/next/index.js +7 -8
  112. package/dist/next/index.js.map +1 -1
  113. package/dist/next/workflow-chat-route.cjs +19 -1
  114. package/dist/next/workflow-chat-route.cjs.map +1 -1
  115. package/dist/next/workflow-chat-route.js +2 -3
  116. package/dist/next/workflow-chat-route.js.map +1 -1
  117. package/dist/pages/admin/delegations/index.cjs +1 -1
  118. package/dist/pages/admin/delegations/index.cjs.map +1 -1
  119. package/dist/pages/admin/delegations/index.js +2 -3
  120. package/dist/pages/admin/orgs/index.cjs +1 -1
  121. package/dist/pages/admin/orgs/index.cjs.map +1 -1
  122. package/dist/pages/admin/orgs/index.js +2 -3
  123. package/dist/pages/admin/users/index.cjs +1 -1
  124. package/dist/pages/admin/users/index.cjs.map +1 -1
  125. package/dist/pages/admin/users/index.js +2 -3
  126. package/dist/pages/admin/webhook-endpoints/index.cjs.map +1 -1
  127. package/dist/pages/admin/webhook-endpoints/index.js +1 -2
  128. package/dist/pages/cc/index.cjs.map +1 -1
  129. package/dist/pages/cc/index.js +1 -2
  130. package/dist/pages/dashboard/index.cjs.map +1 -1
  131. package/dist/pages/dashboard/index.js +1 -2
  132. package/dist/pages/delegations/index.cjs +1 -1
  133. package/dist/pages/delegations/index.cjs.map +1 -1
  134. package/dist/pages/delegations/index.js +2 -3
  135. package/dist/pages/inbox/index.cjs.map +1 -1
  136. package/dist/pages/inbox/index.js +1 -2
  137. package/dist/pages/instances/detail/index.cjs +1 -1
  138. package/dist/pages/instances/detail/index.cjs.map +1 -1
  139. package/dist/pages/instances/detail/index.js +2 -3
  140. package/dist/pages/instances/new/index.cjs.map +1 -1
  141. package/dist/pages/instances/new/index.js +1 -2
  142. package/dist/pages/login/index.cjs +1 -1
  143. package/dist/pages/login/index.cjs.map +1 -1
  144. package/dist/pages/login/index.js +2 -3
  145. package/dist/pages/root/index.cjs.map +1 -1
  146. package/dist/pages/root/index.js +1 -2
  147. package/dist/pages/search/index.cjs.map +1 -1
  148. package/dist/pages/search/index.js +1 -2
  149. package/dist/pages/sent/index.cjs.map +1 -1
  150. package/dist/pages/sent/index.js +1 -2
  151. package/dist/pages/settings/notifications/index.cjs.map +1 -1
  152. package/dist/pages/settings/notifications/index.js +2 -3
  153. package/dist/pages/templates/categories/index.cjs +1 -1
  154. package/dist/pages/templates/categories/index.cjs.map +1 -1
  155. package/dist/pages/templates/categories/index.js +2 -3
  156. package/dist/pages/templates/compose/index.cjs +1 -1
  157. package/dist/pages/templates/compose/index.cjs.map +1 -1
  158. package/dist/pages/templates/compose/index.js +2 -3
  159. package/dist/pages/templates/designer/index.cjs +1 -1
  160. package/dist/pages/templates/designer/index.cjs.map +1 -1
  161. package/dist/pages/templates/designer/index.js +2 -3
  162. package/dist/pages/templates/index.cjs.map +1 -1
  163. package/dist/pages/templates/index.js +1 -2
  164. package/dist/pages/templates/versions/index.cjs.map +1 -1
  165. package/dist/pages/templates/versions/index.js +1 -2
  166. package/dist/views/admin/delegations/index.cjs +1 -1
  167. package/dist/views/admin/delegations/index.js +1 -1
  168. package/dist/views/admin/index.cjs +1 -1
  169. package/dist/views/admin/index.js +3 -3
  170. package/dist/views/admin/orgs/index.cjs +1 -1
  171. package/dist/views/admin/orgs/index.js +1 -1
  172. package/dist/views/admin/users/index.cjs +1 -1
  173. package/dist/views/admin/users/index.js +1 -1
  174. package/dist/views/admin/webhook-endpoints/index.cjs +1 -1
  175. package/dist/views/admin/webhook-endpoints/index.cjs.map +1 -1
  176. package/dist/views/admin/webhook-endpoints/index.js +52 -53
  177. package/dist/views/admin/webhook-endpoints/index.js.map +1 -1
  178. package/dist/views/cc/index.cjs +1 -1
  179. package/dist/views/cc/index.cjs.map +1 -1
  180. package/dist/views/cc/index.js +2 -3
  181. package/dist/views/dashboard/index.cjs +1 -1
  182. package/dist/views/dashboard/index.cjs.map +1 -1
  183. package/dist/views/dashboard/index.js +2 -3
  184. package/dist/views/delegations/index.cjs +1 -1
  185. package/dist/views/delegations/index.js +1 -1
  186. package/dist/views/forms/builder/index.cjs +1 -1
  187. package/dist/views/forms/builder/index.js +1 -1
  188. package/dist/views/forms/renderer/index.cjs +1 -1
  189. package/dist/views/forms/renderer/index.js +1 -1
  190. package/dist/views/forms/renderer/org-unit-field-options.d.cts +44 -0
  191. package/dist/views/forms/renderer/org-unit-field-options.d.ts +44 -0
  192. package/dist/views/forms/renderer/org-unit-field.d.cts +23 -0
  193. package/dist/views/forms/renderer/org-unit-field.d.ts +23 -0
  194. package/dist/views/inbox/index.cjs +1 -1
  195. package/dist/views/inbox/index.cjs.map +1 -1
  196. package/dist/views/inbox/index.js +133 -137
  197. package/dist/views/inbox/index.js.map +1 -1
  198. package/dist/views/instances/approver-filled-form.d.cts +9 -2
  199. package/dist/views/instances/approver-filled-form.d.ts +9 -2
  200. package/dist/views/instances/detail/index.cjs +1 -1
  201. package/dist/views/instances/detail/index.js +1 -1
  202. package/dist/views/instances/detail/sections/InstanceHistorySection.d.cts +8 -1
  203. package/dist/views/instances/detail/sections/InstanceHistorySection.d.ts +8 -1
  204. package/dist/views/instances/detail/sections/container-helpers.d.cts +0 -1
  205. package/dist/views/instances/detail/sections/container-helpers.d.ts +0 -1
  206. package/dist/views/instances/detail/sections/shared.d.cts +2 -2
  207. package/dist/views/instances/detail/sections/shared.d.ts +2 -2
  208. package/dist/views/instances/new/index.cjs +1 -1
  209. package/dist/views/instances/new/index.cjs.map +1 -1
  210. package/dist/views/instances/new/index.js +14 -15
  211. package/dist/views/instances/new/index.js.map +1 -1
  212. package/dist/views/login/index.cjs +1 -1
  213. package/dist/views/login/index.js +1 -1
  214. package/dist/views/search/index.cjs +1 -1
  215. package/dist/views/search/index.cjs.map +1 -1
  216. package/dist/views/search/index.js +2 -3
  217. package/dist/views/sent/index.cjs +1 -1
  218. package/dist/views/sent/index.cjs.map +1 -1
  219. package/dist/views/sent/index.js +2 -3
  220. package/dist/views/settings/index.js +1 -1
  221. package/dist/views/settings/notifications/index.js +1 -1
  222. package/dist/views/templates/categories/index.cjs +1 -1
  223. package/dist/views/templates/categories/index.js +1 -1
  224. package/dist/views/templates/compose/index.cjs +1 -1
  225. package/dist/views/templates/compose/index.js +1 -1
  226. package/dist/views/templates/designer/approver-resolver-model.d.cts +211 -0
  227. package/dist/views/templates/designer/approver-resolver-model.d.ts +211 -0
  228. package/dist/views/templates/designer/dry-run-assignee-label.d.cts +2 -0
  229. package/dist/views/templates/designer/dry-run-assignee-label.d.ts +2 -0
  230. package/dist/views/templates/designer/dry-run-sample-data.d.cts +6 -0
  231. package/dist/views/templates/designer/dry-run-sample-data.d.ts +6 -0
  232. package/dist/views/templates/designer/dynamic-form-resolver-options.d.cts +25 -0
  233. package/dist/views/templates/designer/dynamic-form-resolver-options.d.ts +25 -0
  234. package/dist/views/templates/designer/index.cjs +1 -1
  235. package/dist/views/templates/designer/index.js +1 -1
  236. package/dist/views/templates/designer/node-actor-resolver-options.d.cts +38 -0
  237. package/dist/views/templates/designer/node-actor-resolver-options.d.ts +38 -0
  238. package/dist/views/templates/index.cjs +1 -1
  239. package/dist/views/templates/index.cjs.map +1 -1
  240. package/dist/views/templates/index.js +50 -51
  241. package/dist/views/templates/index.js.map +1 -1
  242. package/dist/views/templates/versions/index.cjs +1 -1
  243. package/dist/views/templates/versions/index.cjs.map +1 -1
  244. package/dist/views/templates/versions/index.js +7 -8
  245. package/dist/views/templates/versions/index.js.map +1 -1
  246. package/package.json +3 -3
  247. package/dist/chunks/FormBuilderView-BVKY1j_0.js.map +0 -1
  248. package/dist/chunks/FormBuilderView-SrGltzFT.cjs +0 -3
  249. package/dist/chunks/FormBuilderView-SrGltzFT.cjs.map +0 -1
  250. package/dist/chunks/FormRendererView-BsTwZkqU.js.map +0 -1
  251. package/dist/chunks/FormRendererView-GpsE03np.cjs +0 -4
  252. package/dist/chunks/FormRendererView-GpsE03np.cjs.map +0 -1
  253. package/dist/chunks/admin-pickers-BRHk3qKq.cjs +0 -2
  254. package/dist/chunks/admin-pickers-BRHk3qKq.cjs.map +0 -1
  255. package/dist/chunks/admin-pickers-Djq3h-UR.js.map +0 -1
  256. package/dist/chunks/approver-filled-form-Dm3Iw7iw.cjs.map +0 -1
  257. package/dist/chunks/approver-filled-form-ZEwpmsHJ.js.map +0 -1
  258. package/dist/chunks/compose-B1GlrZW9.js.map +0 -1
  259. package/dist/chunks/compose-DZk-SfHT.cjs +0 -2
  260. package/dist/chunks/compose-DZk-SfHT.cjs.map +0 -1
  261. package/dist/chunks/designer-BCLrjb4H.js.map +0 -1
  262. package/dist/chunks/designer-BYYxEN9L.cjs +0 -65
  263. package/dist/chunks/designer-BYYxEN9L.cjs.map +0 -1
  264. package/dist/chunks/detail-4F39ggBn.js.map +0 -1
  265. package/dist/chunks/detail-BkMtA_0K.cjs +0 -2
  266. package/dist/chunks/detail-BkMtA_0K.cjs.map +0 -1
  267. package/dist/chunks/orgs-BeeDDWL1.cjs +0 -2
  268. package/dist/chunks/task-node-label-BF6UllxP.cjs +0 -2
  269. package/dist/chunks/task-node-label-BF6UllxP.cjs.map +0 -1
  270. package/dist/chunks/task-node-label-CWZgOBj0.js +0 -9
  271. 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","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,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;AA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AAD;IAAY,OAAM;IAAa,SAAQ;IACpC,UAAAjD;GACS,CAAA,IACV;GAEHI,IACC,kBAAC6C,GAAD;IAAY,OAAM;IAAe,SAAQ;IAAO,UAAA;GAEpC,CAAA,IACV;GAEHxD,KAAWiB,IACV,kBAACjC,GAAD;IACE,mBAAmB;KACjB,MAAM;KACN,YAAYgB,EAAQ,SAAS;IAC/B;IACA,QAAQS;IACR,UAAU;IACV,WAAW,MAAiB;KAE1B,AADAL,EAAcqD,CAAM,GACpB/C,EAAc,CAAC,CAAC;IAClB;IACA,yBAAyBS;IACzB,oBAAoB6B;IACpB,QAAQ/B;IACR,cAAA;IACA,UAAUjB,EAAQ,YAAY;IAC9B,OAAOG;GACR,CAAA,IACC;GAEH,CAACJ,KAAc,CAACY,IACfgB,EAAK,SAAS,IACZ,kBAAC+B,IAAD;IACE,SAAS5B;IACA;IACT,YAAYH;IACZ,WAAA;GACD,CAAA,IAED,kBAAC6B,GAAD;IAAY,OAAM;IAAe,SAAQ;IAAO,UAAA;GAEpC,CAAA,IAEZ;EACD;CACE,CAAA,EAAA,CAAA,EACG,CAAA,CACd,EAAA,CAAA;AAER;AAEA,SAASlE,IAA2C;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,GAAQ,YAAY,MACtCC,IAAaL,KAAkB,MAC/B,CAACM,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,IACItB,EACEsB,EAAQ,YAAY,QACpBA,EAAQ,gBAAgB,kBAC1B,IACA,MACN,CAACA,CAAO,CACV,GAEMmB,KAA8BC,IAEhC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;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-AtVxZBsC.cjs");exports.LoginView=e.t;
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-C6qlTC6F.js";
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-ax0pm8bt.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;
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-CPXMP3PL.js";
2
+ import { t as e } from "../../chunks/approval-instance-list-page-BnI4t5mD.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
- //#region src/views/search/SearchView.tsx
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-ax0pm8bt.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;
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"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { t as e } from "../../chunks/approval-instance-list-page-CPXMP3PL.js";
2
+ import { t as e } from "../../chunks/approval-instance-list-page-BnI4t5mD.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
- //#region src/views/sent/SentView.tsx
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-DJ5wzCye.js";
1
+ export { t as SettingsNotificationsView } from "../../chunks/notifications-Cvme5Qbl.js";
@@ -1 +1 @@
1
- export { t as SettingsNotificationsView } from "../../../chunks/notifications-DJ5wzCye.js";
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-AxxhqjLZ.cjs");exports.TemplateCategoriesView=e.t;
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-riC33J_j.js";
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-DZk-SfHT.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
+ 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-B1GlrZW9.js";
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
  }>;