@rytass/bpm-core-react 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +1 -0
  3. package/dist/chunks/FormBuilderView-Bg9ftYz-.cjs +4 -0
  4. package/dist/chunks/FormBuilderView-Bg9ftYz-.cjs.map +1 -0
  5. package/dist/chunks/{FormBuilderView-DbfbLZCI.js → FormBuilderView-CBvdcg_t.js} +675 -614
  6. package/dist/chunks/FormBuilderView-CBvdcg_t.js.map +1 -0
  7. package/dist/chunks/FormRendererView-D-p6GDQB.cjs +6 -0
  8. package/dist/chunks/FormRendererView-D-p6GDQB.cjs.map +1 -0
  9. package/dist/chunks/FormRendererView-DHXmekC3.js +1319 -0
  10. package/dist/chunks/FormRendererView-DHXmekC3.js.map +1 -0
  11. package/dist/chunks/{approval-instance-list-page-Cv5I1YPX.cjs → approval-instance-list-page-BqkG9jiR.cjs} +2 -2
  12. package/dist/chunks/{approval-instance-list-page-Cv5I1YPX.cjs.map → approval-instance-list-page-BqkG9jiR.cjs.map} +1 -1
  13. package/dist/chunks/{approval-instance-list-page-BI5fIXc-.js → approval-instance-list-page-CsSpIN4C.js} +2 -2
  14. package/dist/chunks/{approval-instance-list-page-BI5fIXc-.js.map → approval-instance-list-page-CsSpIN4C.js.map} +1 -1
  15. package/dist/chunks/compose-B43jtdyL.cjs +2 -0
  16. package/dist/chunks/compose-B43jtdyL.cjs.map +1 -0
  17. package/dist/chunks/{compose-U1zs3Yof.js → compose-C7yS6bJm.js} +162 -148
  18. package/dist/chunks/compose-C7yS6bJm.js.map +1 -0
  19. package/dist/chunks/{dashboard-page-BoqNhjT_.js → dashboard-page-DBJCsPya.js} +2 -2
  20. package/dist/chunks/{dashboard-page-BoqNhjT_.js.map → dashboard-page-DBJCsPya.js.map} +1 -1
  21. package/dist/chunks/{dashboard-page-D7YJ3udk.cjs → dashboard-page-lqlLELKs.cjs} +2 -2
  22. package/dist/chunks/{dashboard-page-D7YJ3udk.cjs.map → dashboard-page-lqlLELKs.cjs.map} +1 -1
  23. package/dist/chunks/{designer-DPG7R_WP.js → designer-B9Ut4xze.js} +1786 -1463
  24. package/dist/chunks/designer-B9Ut4xze.js.map +1 -0
  25. package/dist/chunks/designer-eXw7R9ug.cjs +69 -0
  26. package/dist/chunks/designer-eXw7R9ug.cjs.map +1 -0
  27. package/dist/chunks/{detail-CHZDNNM6.js → detail-BB_uYaoM.js} +904 -896
  28. package/dist/chunks/detail-BB_uYaoM.js.map +1 -0
  29. package/dist/chunks/detail-DN8pEzUJ.cjs +5 -0
  30. package/dist/chunks/detail-DN8pEzUJ.cjs.map +1 -0
  31. package/dist/chunks/instance-error-message-BKt07-Bo.js +270 -0
  32. package/dist/chunks/instance-error-message-BKt07-Bo.js.map +1 -0
  33. package/dist/chunks/instance-error-message-BL_X7Af8.cjs +2 -0
  34. package/dist/chunks/instance-error-message-BL_X7Af8.cjs.map +1 -0
  35. package/dist/chunks/member-profile-resolution-CJlgVdTR.js +44 -0
  36. package/dist/chunks/member-profile-resolution-CJlgVdTR.js.map +1 -0
  37. package/dist/chunks/member-profile-resolution-DiH-P-Vh.cjs +2 -0
  38. package/dist/chunks/member-profile-resolution-DiH-P-Vh.cjs.map +1 -0
  39. package/dist/chunks/{providers-CQWekD7_.js → providers-D35lBOTd.js} +2 -2
  40. package/dist/chunks/{providers-CQWekD7_.js.map → providers-D35lBOTd.js.map} +1 -1
  41. package/dist/chunks/{providers-VUOh6i0i.cjs → providers-Dz4Wqxr6.cjs} +2 -2
  42. package/dist/chunks/{providers-VUOh6i0i.cjs.map → providers-Dz4Wqxr6.cjs.map} +1 -1
  43. package/dist/chunks/{routes-config-C1j_vFKo.cjs → routes-config-BWjZDAU3.cjs} +2 -2
  44. package/dist/chunks/{routes-config-C1j_vFKo.cjs.map → routes-config-BWjZDAU3.cjs.map} +1 -1
  45. package/dist/chunks/{routes-config-BcNaWJWJ.js → routes-config-DjEOE9eP.js} +3 -2
  46. package/dist/chunks/{routes-config-BcNaWJWJ.js.map → routes-config-DjEOE9eP.js.map} +1 -1
  47. package/dist/chunks/users-C_Dtw_sR.cjs +2 -0
  48. package/dist/chunks/users-C_Dtw_sR.cjs.map +1 -0
  49. package/dist/chunks/users-wgM3TqU3.js +513 -0
  50. package/dist/chunks/users-wgM3TqU3.js.map +1 -0
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +4 -4
  53. package/dist/lib/routes-config.d.cts +2 -0
  54. package/dist/lib/routes-config.d.ts +2 -0
  55. package/dist/next/index.cjs +1 -1
  56. package/dist/next/index.js +2 -2
  57. package/dist/pages/admin/stuck-instances/index.cjs +2 -0
  58. package/dist/pages/admin/stuck-instances/index.cjs.map +1 -0
  59. package/dist/pages/admin/stuck-instances/index.d.cts +4 -0
  60. package/dist/pages/admin/stuck-instances/index.d.ts +4 -0
  61. package/dist/pages/admin/stuck-instances/index.js +13 -0
  62. package/dist/pages/admin/stuck-instances/index.js.map +1 -0
  63. package/dist/pages/admin/users/index.cjs +1 -1
  64. package/dist/pages/admin/users/index.js +1 -1
  65. package/dist/pages/instances/detail/index.cjs +1 -1
  66. package/dist/pages/instances/detail/index.js +1 -1
  67. package/dist/pages/templates/compose/index.cjs +1 -1
  68. package/dist/pages/templates/compose/index.js +1 -1
  69. package/dist/pages/templates/designer/index.cjs +1 -1
  70. package/dist/pages/templates/designer/index.js +1 -1
  71. package/dist/views/admin/index.cjs +1 -1
  72. package/dist/views/admin/index.d.cts +1 -0
  73. package/dist/views/admin/index.d.ts +1 -0
  74. package/dist/views/admin/index.js +3 -2
  75. package/dist/views/admin/stuck-instances/AdminStuckInstancesView.d.cts +10 -0
  76. package/dist/views/admin/stuck-instances/AdminStuckInstancesView.d.ts +10 -0
  77. package/dist/views/admin/stuck-instances/StuckInstanceCancelModal.d.cts +14 -0
  78. package/dist/views/admin/stuck-instances/StuckInstanceCancelModal.d.ts +14 -0
  79. package/dist/views/admin/stuck-instances/index.cjs +2 -0
  80. package/dist/views/admin/stuck-instances/index.cjs.map +1 -0
  81. package/dist/views/admin/stuck-instances/index.d.cts +2 -0
  82. package/dist/views/admin/stuck-instances/index.d.ts +2 -0
  83. package/dist/views/admin/stuck-instances/index.js +237 -0
  84. package/dist/views/admin/stuck-instances/index.js.map +1 -0
  85. package/dist/views/admin/users/index.cjs +1 -1
  86. package/dist/views/admin/users/index.js +1 -1
  87. package/dist/views/cc/index.cjs +1 -1
  88. package/dist/views/cc/index.js +1 -1
  89. package/dist/views/dashboard/index.cjs +1 -1
  90. package/dist/views/dashboard/index.js +1 -1
  91. package/dist/views/forms/builder/index.cjs +1 -1
  92. package/dist/views/forms/builder/index.js +1 -1
  93. package/dist/views/forms/renderer/FormRendererView.d.cts +26 -1
  94. package/dist/views/forms/renderer/FormRendererView.d.ts +26 -1
  95. package/dist/views/forms/renderer/index.cjs +1 -1
  96. package/dist/views/forms/renderer/index.js +1 -1
  97. package/dist/views/inbox/index.cjs +1 -1
  98. package/dist/views/inbox/index.js +1 -1
  99. package/dist/views/instances/approver-filled-form.d.cts +56 -20
  100. package/dist/views/instances/approver-filled-form.d.ts +56 -20
  101. package/dist/views/instances/detail/index.cjs +1 -1
  102. package/dist/views/instances/detail/index.js +1 -1
  103. package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +7 -0
  104. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +7 -0
  105. package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +1 -1
  106. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +1 -1
  107. package/dist/views/instances/new/index.cjs +1 -1
  108. package/dist/views/instances/new/index.js +5 -5
  109. package/dist/views/instances/new/index.js.map +1 -1
  110. package/dist/views/search/index.cjs +1 -1
  111. package/dist/views/search/index.js +1 -1
  112. package/dist/views/sent/index.cjs +1 -1
  113. package/dist/views/sent/index.js +1 -1
  114. package/dist/views/templates/compose/index.cjs +1 -1
  115. package/dist/views/templates/compose/index.js +1 -1
  116. package/dist/views/templates/compose/steps/ComposeReviewStep.d.cts +3 -1
  117. package/dist/views/templates/compose/steps/ComposeReviewStep.d.ts +3 -1
  118. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.cts +4 -1
  119. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.ts +4 -1
  120. package/dist/views/templates/compose/use-template-compose-wizard.d.cts +3 -1
  121. package/dist/views/templates/compose/use-template-compose-wizard.d.ts +3 -1
  122. package/dist/views/templates/designer/TemplateDesignerView.d.cts +10 -1
  123. package/dist/views/templates/designer/TemplateDesignerView.d.ts +10 -1
  124. package/dist/views/templates/designer/approver-resolver-model.d.cts +31 -0
  125. package/dist/views/templates/designer/approver-resolver-model.d.ts +31 -0
  126. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.cts +3 -1
  127. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.ts +3 -1
  128. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.cts +3 -2
  129. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.ts +3 -2
  130. package/dist/views/templates/designer/index.cjs +1 -1
  131. package/dist/views/templates/designer/index.js +1 -1
  132. package/dist/views/templates/designer/launch-mode.d.cts +19 -0
  133. package/dist/views/templates/designer/launch-mode.d.ts +19 -0
  134. package/dist/views/templates/designer/node-actor-resolver-options.d.cts +30 -3
  135. package/dist/views/templates/designer/node-actor-resolver-options.d.ts +30 -3
  136. package/dist/views/templates/designer/publish-default-value-check.d.cts +36 -0
  137. package/dist/views/templates/designer/publish-default-value-check.d.ts +36 -0
  138. package/dist/views/templates/index.cjs +1 -1
  139. package/dist/views/templates/index.js +1 -1
  140. package/dist/views/templates/versions/index.cjs +1 -1
  141. package/dist/views/templates/versions/index.js +1 -1
  142. package/package.json +23 -3
  143. package/dist/chunks/FormBuilderView-Bok4Y59D.cjs +0 -4
  144. package/dist/chunks/FormBuilderView-Bok4Y59D.cjs.map +0 -1
  145. package/dist/chunks/FormBuilderView-DbfbLZCI.js.map +0 -1
  146. package/dist/chunks/FormRendererView-CAyPXhPq.js +0 -1351
  147. package/dist/chunks/FormRendererView-CAyPXhPq.js.map +0 -1
  148. package/dist/chunks/FormRendererView-iLlHFIUR.cjs +0 -6
  149. package/dist/chunks/FormRendererView-iLlHFIUR.cjs.map +0 -1
  150. package/dist/chunks/compose-DP1N4twA.cjs +0 -2
  151. package/dist/chunks/compose-DP1N4twA.cjs.map +0 -1
  152. package/dist/chunks/compose-U1zs3Yof.js.map +0 -1
  153. package/dist/chunks/designer-CWL-dCQ_.cjs +0 -69
  154. package/dist/chunks/designer-CWL-dCQ_.cjs.map +0 -1
  155. package/dist/chunks/designer-DPG7R_WP.js.map +0 -1
  156. package/dist/chunks/detail-BUfsSal0.cjs +0 -5
  157. package/dist/chunks/detail-BUfsSal0.cjs.map +0 -1
  158. package/dist/chunks/detail-CHZDNNM6.js.map +0 -1
  159. package/dist/chunks/instance-error-message-BEM4O_Kj.js +0 -208
  160. package/dist/chunks/instance-error-message-BEM4O_Kj.js.map +0 -1
  161. package/dist/chunks/instance-error-message-BpCLCOjp.cjs +0 -2
  162. package/dist/chunks/instance-error-message-BpCLCOjp.cjs.map +0 -1
  163. package/dist/chunks/users-BBtiZ9QQ.js +0 -486
  164. package/dist/chunks/users-BBtiZ9QQ.js.map +0 -1
  165. package/dist/chunks/users-EqSzDhuj.cjs +0 -2
  166. package/dist/chunks/users-EqSzDhuj.cjs.map +0 -1
@@ -4,6 +4,22 @@ import { FormRendererValues } from '@rytass/bpm-core-client/form';
4
4
  import { ResolvedFieldAccess } from '@rytass/bpm-core-shared';
5
5
  import { FormDataSourceFieldState, FormRendererDataSourceContext } from './form-data-source-field.cjs';
6
6
  import { FileUploadFieldState, FormRendererAttachment } from './file-upload-field.cjs';
7
+ /**
8
+ * What a viewer may do inside one table field, for approver fill in column mode
9
+ * (ADR 27 §4(a)). Keyed by the table's `fieldKey` in `FormRendererProps.tableAccess`.
10
+ */
11
+ export interface FormRendererTableAccess {
12
+ /**
13
+ * Column `fieldKey`s whose cells the viewer may edit. Every other column is
14
+ * read-only in that table.
15
+ */
16
+ readonly editableColumns: readonly string[];
17
+ /**
18
+ * When true, the row actions and the add-row button are hidden, so the viewer
19
+ * cannot add, remove or reorder rows.
20
+ */
21
+ readonly lockRows: boolean;
22
+ }
7
23
  export interface FormRendererProps {
8
24
  readonly dataSourceContext?: FormRendererDataSourceContext;
9
25
  readonly dataSourceInitialValues?: FormRendererValues;
@@ -24,6 +40,15 @@ export interface FormRendererProps {
24
40
  * map leaves out follows `readonly`; leaving the prop out changes nothing.
25
41
  */
26
42
  readonly fieldAccess?: Readonly<Record<string, ResolvedFieldAccess>>;
43
+ /**
44
+ * Per table field, which columns this viewer may edit and whether it may add
45
+ * or remove rows (ADR 27 §4(a)). A table listed here takes its cell
46
+ * editability from this map instead of `fieldAccess`, so a column-only grant
47
+ * does not lock the whole table; `fieldAccess` still decides visibility. The
48
+ * form's `readonly` prop still locks every cell. Tables left out follow
49
+ * `fieldAccess` and `readonly` as before.
50
+ */
51
+ readonly tableAccess?: Readonly<Record<string, FormRendererTableAccess>>;
27
52
  /**
28
53
  * Short text shown after a field's label (Mezzanine `labelOptionalMarker`),
29
54
  * per top-level field — e.g. 「本關補填」 on the fields an approver fills.
@@ -58,5 +83,5 @@ export interface FormRendererProps {
58
83
  readonly uiSchema: FormUiSchema;
59
84
  readonly value?: FormRendererValues;
60
85
  }
61
- export declare function FormRenderer({ attachments, dataSourceContext, dataSourceInitialValues, emptyText, errors, fieldAccess, fieldLabelMarkers, maxWidth, onChange, onDataSourceStateChange, onDownloadAttachment, onFileUploadStateChange, onUploadAttachment, optionSnapshots, readonly, schema, singleColumn, uiSchema, value, }: FormRendererProps): ReactElement;
86
+ export declare function FormRenderer({ attachments, dataSourceContext, dataSourceInitialValues, emptyText, errors, fieldAccess, fieldLabelMarkers, maxWidth, onChange, onDataSourceStateChange, onDownloadAttachment, onFileUploadStateChange, onUploadAttachment, optionSnapshots, readonly, schema, singleColumn, tableAccess, uiSchema, value, }: FormRendererProps): ReactElement;
62
87
  export { FormRenderer as FormRendererView };
@@ -4,6 +4,22 @@ import { FormRendererValues } from '@rytass/bpm-core-client/form';
4
4
  import { ResolvedFieldAccess } from '@rytass/bpm-core-shared';
5
5
  import { FormDataSourceFieldState, FormRendererDataSourceContext } from './form-data-source-field.js';
6
6
  import { FileUploadFieldState, FormRendererAttachment } from './file-upload-field.js';
7
+ /**
8
+ * What a viewer may do inside one table field, for approver fill in column mode
9
+ * (ADR 27 §4(a)). Keyed by the table's `fieldKey` in `FormRendererProps.tableAccess`.
10
+ */
11
+ export interface FormRendererTableAccess {
12
+ /**
13
+ * Column `fieldKey`s whose cells the viewer may edit. Every other column is
14
+ * read-only in that table.
15
+ */
16
+ readonly editableColumns: readonly string[];
17
+ /**
18
+ * When true, the row actions and the add-row button are hidden, so the viewer
19
+ * cannot add, remove or reorder rows.
20
+ */
21
+ readonly lockRows: boolean;
22
+ }
7
23
  export interface FormRendererProps {
8
24
  readonly dataSourceContext?: FormRendererDataSourceContext;
9
25
  readonly dataSourceInitialValues?: FormRendererValues;
@@ -24,6 +40,15 @@ export interface FormRendererProps {
24
40
  * map leaves out follows `readonly`; leaving the prop out changes nothing.
25
41
  */
26
42
  readonly fieldAccess?: Readonly<Record<string, ResolvedFieldAccess>>;
43
+ /**
44
+ * Per table field, which columns this viewer may edit and whether it may add
45
+ * or remove rows (ADR 27 §4(a)). A table listed here takes its cell
46
+ * editability from this map instead of `fieldAccess`, so a column-only grant
47
+ * does not lock the whole table; `fieldAccess` still decides visibility. The
48
+ * form's `readonly` prop still locks every cell. Tables left out follow
49
+ * `fieldAccess` and `readonly` as before.
50
+ */
51
+ readonly tableAccess?: Readonly<Record<string, FormRendererTableAccess>>;
27
52
  /**
28
53
  * Short text shown after a field's label (Mezzanine `labelOptionalMarker`),
29
54
  * per top-level field — e.g. 「本關補填」 on the fields an approver fills.
@@ -58,5 +83,5 @@ export interface FormRendererProps {
58
83
  readonly uiSchema: FormUiSchema;
59
84
  readonly value?: FormRendererValues;
60
85
  }
61
- export declare function FormRenderer({ attachments, dataSourceContext, dataSourceInitialValues, emptyText, errors, fieldAccess, fieldLabelMarkers, maxWidth, onChange, onDataSourceStateChange, onDownloadAttachment, onFileUploadStateChange, onUploadAttachment, optionSnapshots, readonly, schema, singleColumn, uiSchema, value, }: FormRendererProps): ReactElement;
86
+ export declare function FormRenderer({ attachments, dataSourceContext, dataSourceInitialValues, emptyText, errors, fieldAccess, fieldLabelMarkers, maxWidth, onChange, onDataSourceStateChange, onDownloadAttachment, onFileUploadStateChange, onUploadAttachment, optionSnapshots, readonly, schema, singleColumn, tableAccess, uiSchema, value, }: FormRendererProps): ReactElement;
62
87
  export { FormRenderer as FormRendererView };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/FormRendererView-iLlHFIUR.cjs");exports.FormRenderer=e.t,exports.FormRendererView=e.t,exports.isFormDataSourceFieldSubmissionBlocked=e.s,exports.readFileUploadSubmissionBlockMessage=e.a,exports.readFormDataSourceFieldStatusMessage=e.c,exports.readFormDataSourceSubmissionBlockMessage=e.l,exports.useFormDataSourceField=e.u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/FormRendererView-D-p6GDQB.cjs");exports.FormRenderer=e.t,exports.FormRendererView=e.t,exports.isFormDataSourceFieldSubmissionBlocked=e.a,exports.readFileUploadSubmissionBlockMessage=e.r,exports.readFormDataSourceFieldStatusMessage=e.o,exports.readFormDataSourceSubmissionBlockMessage=e.s,exports.useFormDataSourceField=e.c;
@@ -1 +1 @@
1
- export { t as FormRenderer, t as FormRendererView, s as isFormDataSourceFieldSubmissionBlocked, a as readFileUploadSubmissionBlockMessage, c as readFormDataSourceFieldStatusMessage, l as readFormDataSourceSubmissionBlockMessage, u as useFormDataSourceField } from "../../../chunks/FormRendererView-CAyPXhPq.js";
1
+ export { t as FormRenderer, t as FormRendererView, a as isFormDataSourceFieldSubmissionBlocked, r as readFileUploadSubmissionBlockMessage, o as readFormDataSourceFieldStatusMessage, s as readFormDataSourceSubmissionBlockMessage, c as useFormDataSourceField } from "../../../chunks/FormRendererView-DHXmekC3.js";
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../chunks/format-date-time-D-cx5M8z.cjs"),n=require("../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../chunks/task-decision-CqZ4WQOC.cjs"),i=require("../../chunks/router-adapter--gYs13E8.cjs"),a=require("../../chunks/routes-config-C1j_vFKo.cjs");let o=require("react"),s=require("@mezzanine-ui/react"),c=require("react/jsx-runtime"),l=require("@rytass/bpm-core-client/workflow"),u=require("@mezzanine-ui/react/ContentHeader");u=e.t(u,1);let d=require("@mezzanine-ui/icons");var f=100,p={display:`grid`,gap:`var(--mzn-spacing-gap-base)`,marginBottom:`var(--mzn-spacing-padding-vertical-spacious)`},m=[10,20,50],h={page:1,pageSize:20};function g(){let e=i.r(),r=a.r(),{member:f}=n.n(),m=f?.memberId??null,[g,S]=(0,o.useState)(`pending`),[T,E]=(0,o.useState)(null),[D,O]=(0,o.useState)(h),[A,M]=(0,o.useState)(h),[P,F]=(0,o.useState)(h),I=_(m,{enabled:!0,paging:D,setPaging:O},E,async(e,t)=>v(await(0,l.listInboxTasksPage)({assigneeMemberId:e,...t}),C)),L=_(m,{enabled:!0,paging:A,setPaging:M},E,async(e,t)=>v(await(0,l.listApprovalHistoryTasksPage)({assigneeMemberId:e,instanceState:`RUNNING`,...t}),t=>w(t,e))),z=_(m,{enabled:g===`history`,paging:P,setPaging:F},E,async(e,t)=>v(await(0,l.listApprovalHistoryTasksPage)({assigneeMemberId:e,...t}),t=>w(t,e))),[B,V]=(0,o.useState)([]),[H,U]=(0,o.useState)(!1);(0,o.useEffect)(()=>{m?x(m).then(e=>{V(e?.rows??[]),U(e?.truncated??!1)},e=>E(R(e))):(V([]),U(!1))},[m]);let W=(0,o.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeText`,key:`nodeText`,title:`節點`,width:180},{dataIndex:`statusLabel`,key:`statusLabel`,title:`狀態`,width:120},{key:`fill`,render:e=>e.hasFillableFields?(0,c.jsx)(s.Badge,{size:`sub`,text:`需補填`,variant:`dot-warning`}):null,title:`補填`,width:120},{key:`slaDueAt`,render:e=>(0,c.jsx)(s.Typography,{color:e.slaStatusColor,component:`span`,variant:`body`,children:e.slaStatusText}),title:`SLA`,width:180},{key:`createdAt`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:t.t(e.createdAt)}),title:`建立時間`,width:220}],[]),G=(0,o.useMemo)(()=>({render:t=>[{name:`處理`,onClick:()=>e.push(r.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,r]),K=(0,o.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{key:`startedAt`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:t.t(e.startedAt)}),title:`發起時間`,width:220}],[]),q=(0,o.useMemo)(()=>({render:t=>[{name:`重新送出`,onClick:()=>e.push(r.caseDetail(t.id))}],variant:`base-secondary`,width:120}),[e,r]),J=(0,o.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeText`,key:`nodeText`,title:`節點`,width:180},{key:`decisionLabel`,render:e=>(0,c.jsx)(s.Typography,{color:k(e.decisionAction),component:`span`,variant:`body`,children:e.decisionLabel}),title:`決議`,width:120},{key:`decisionComment`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:e.decisionCommentText}),title:`意見`,width:240},{key:`instanceStateLabel`,render:e=>(0,c.jsx)(s.Typography,{color:j(e.instanceState),component:`span`,variant:`body`,children:e.instanceStateLabel}),title:`流程狀態`,width:140},{key:`decidedAt`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:N(e.decidedAt)}),title:`簽核時間`,width:220}],[]),Y=(0,o.useMemo)(()=>({render:t=>[{name:`查看`,onClick:()=>e.push(r.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,r]);function X(e){S(e===`history`||e===`pending`||e===`tracking`?e:`pending`)}return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(u.default,{description:`目前以 ${f?.name??m??`目前登入會員`} 查詢待處理與歷史簽核任務。`,title:`我的待簽`,children:(0,c.jsx)(s.Button,{icon:d.PlusIcon,iconType:`leading`,onClick:()=>e.push(r.caseNew()),variant:`base-primary`,children:`發起簽核`})})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsxs)(s.Section,{children:[T?(0,c.jsx)(s.Typography,{color:`text-error`,variant:`body`,children:T}):null,(0,c.jsxs)(s.Tab,{activeKey:g,onChange:X,size:`sub`,children:[(0,c.jsx)(s.TabItem,{badgeCount:I.loading?void 0:I.total,children:`待簽核`},`pending`),(0,c.jsx)(s.TabItem,{badgeCount:L.loading?void 0:L.total,children:`已處理未結束`},`tracking`),(0,c.jsx)(s.TabItem,{children:`歷史簽核記錄`},`history`)]}),g===`pending`&&(B.length>0||H)?(0,c.jsxs)(`div`,{"data-returned-instances":``,style:p,children:[B.length>0?(0,c.jsx)(s.Typography,{component:`h2`,variant:`label-primary`,children:`被退回待重送`}):null,(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`caption`,children:b(B.length>0,H)}),B.length>0?(0,c.jsx)(s.Table,{actions:q,columns:K,dataSource:[...B],fullWidth:!0}):null]}):null,g===`pending`?(0,c.jsx)(s.Table,{actions:G,columns:W,dataSource:[...I.rows],fullWidth:!0,loading:I.loading,pagination:y(D,I.total,O)}):null,g===`tracking`?(0,c.jsx)(s.Table,{actions:Y,columns:J,dataSource:[...L.rows],fullWidth:!0,loading:L.loading,pagination:y(A,L.total,M)}):null,g===`history`?(0,c.jsx)(s.Table,{actions:Y,columns:J,dataSource:[...z.rows],fullWidth:!0,loading:z.loading,pagination:y(P,z.total,F)}):null]})})]})}function _(e,{enabled:t,paging:n,setPaging:r},i,a){let[s,c]=(0,o.useState)({loading:!0,rows:[],total:0}),l=(0,o.useRef)(0),u=(0,o.useRef)(a);u.current=a;let d=(0,o.useCallback)(async()=>{let t=l.current+1;if(l.current=t,!e)c({loading:!1,rows:[],total:0});else{c(e=>({...e,loading:!0}));try{let i=await u.current(e,n);if(l.current!==t)return;let a=Math.max(1,Math.ceil(i.total/n.pageSize));if(!i.rows.length&&n.page>a){r({...n,page:a});return}c({loading:!1,...i})}catch(e){l.current===t&&(i(R(e)),c(e=>({...e,loading:!1})))}}},[e,i,n,r]);return(0,o.useEffect)(()=>{t&&d()},[t,d]),s}async function v(e,t){return{rows:await t(e.tasks),total:e.totalCount}}function y(e,t,n){return{current:e.page,onChange:t=>n({...e,page:t}),onChangePageSize:e=>n({page:1,pageSize:e}),pageSize:e.pageSize,pageSizeLabel:`每頁筆數`,pageSizeOptions:m,renderResultSummary:(e,t,n)=>`顯示 ${e}-${t} 筆,共 ${n} 筆`,showPageSizeOptions:!0,total:t}}function b(e,t){return e?t?`你發起的案件被退回,請修改後重新送出。可能還有其他被退回的案件,請到「我發起的」查看。`:`你發起的案件被退回,請修改後重新送出。`:`前 ${f} 筆被退回的案件中沒有你發起的,可能還有其他被退回的案件,請到「我發起的」查看。`}async function x(e){try{let t=await(0,l.listApprovalInstancesPage)({page:1,pageSize:f,searchText:null,state:`RETURNED`,templateId:null,view:`SENT`});return{rows:S(t.instances,e),truncated:t.totalCount>t.instances.length}}catch{return null}}function S(e,t){return e.filter(e=>e.initiatorMemberId===t).map(e=>({caseTitle:(0,l.readApprovalInstanceCaseTitle)(e),id:e.id,key:e.id,startedAt:e.startedAt}))}async function C(e){let t=await T(e);return e.map((e,n)=>({...e,caseTitle:E(e,t[n]??null),key:e.id,nodeText:r.o(e),slaStatusColor:F(e.slaDueAt),slaStatusText:P(e.slaDueAt),statusLabel:L(e.status)}))}async function w(e,t){let[n,i]=await Promise.all([Promise.all(e.map(e=>(0,l.listTaskDecisions)(e.id))),T(e)]);return e.map((e,a)=>{let o=n[a]??[],s=D(o,t),c=i[a]??null;return{...e,caseTitle:E(e,c),decisionAction:s?.action??null,decisionComment:s?.comment??null,decisionCommentText:M(s?.comment??null),decisionLabel:O(s?.action??null),decidedAt:s?.decidedAt??(o.length===0?e.completedAt:null),instanceState:c?.state??null,instanceStateLabel:A(c?.state??null),key:e.id,nodeText:r.o(e)}})}async function T(e){return Promise.all(e.map(async e=>{try{return(await(0,l.readApprovalInstance)(e.instanceId)).instance}catch{return null}}))}function E(e,t){return t?(0,l.readApprovalInstanceCaseTitle)(t):e.instanceId}function D(e,t){return r.i(e.filter(e=>e.decidedByMemberId===t))}function O(e){return e===`APPROVED`?`同意`:e===`REJECTED`?`拒絕`:e===`RETURNED`?`退回`:e===`TRANSFERRED`?`轉派`:`未記錄`}function k(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`RETURNED`?`text-error`:`text-neutral`}function A(e){return e===`RUNNING`?`進行中`:e===`APPROVED`?`已通過`:e===`REJECTED`?`已拒絕`:e===`RETURNED`?`已退回`:e===`CANCELLED`?`已取消`:e===`EXPIRED`?`已逾期`:e===`DRAFT`?`草稿`:`-`}function j(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`CANCELLED`||e===`EXPIRED`?`text-error`:`text-neutral`}function M(e){return(e?.trim()??``)||`-`}function N(e){return t.t(e)}function P(e){if(!e)return`-`;let t=new Date(e).getTime(),n=Date.now(),r=I(Math.abs(t-n));return t<n?`已逾期 ${r}`:`剩餘 ${r}`}function F(e){return e?new Date(e).getTime()<Date.now()?`text-error`:`text-success`:`text-neutral`}function I(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?`${n}天 ${r}小時`:r>0?`${r}小時 ${i}分鐘`:`${i}分鐘`}function L(e){return e===`PENDING`?`待處理`:e===`IN_PROGRESS`?`處理中`:e===`COMPLETED`?`已完成`:e===`TRANSFERRED`?`已轉派`:e===`CANCELLED`?`已取消`:e}function R(e){return e instanceof Error?e.message:`發生未知錯誤`}exports.InboxView=g;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../chunks/format-date-time-D-cx5M8z.cjs"),n=require("../../chunks/auth-provider-4BeCw7cI.cjs"),r=require("../../chunks/task-decision-CqZ4WQOC.cjs"),i=require("../../chunks/router-adapter--gYs13E8.cjs"),a=require("../../chunks/routes-config-BWjZDAU3.cjs");let o=require("react"),s=require("@mezzanine-ui/react"),c=require("react/jsx-runtime"),l=require("@rytass/bpm-core-client/workflow"),u=require("@mezzanine-ui/react/ContentHeader");u=e.t(u,1);let d=require("@mezzanine-ui/icons");var f=100,p={display:`grid`,gap:`var(--mzn-spacing-gap-base)`,marginBottom:`var(--mzn-spacing-padding-vertical-spacious)`},m=[10,20,50],h={page:1,pageSize:20};function g(){let e=i.r(),r=a.r(),{member:f}=n.n(),m=f?.memberId??null,[g,S]=(0,o.useState)(`pending`),[T,E]=(0,o.useState)(null),[D,O]=(0,o.useState)(h),[A,M]=(0,o.useState)(h),[P,F]=(0,o.useState)(h),I=_(m,{enabled:!0,paging:D,setPaging:O},E,async(e,t)=>v(await(0,l.listInboxTasksPage)({assigneeMemberId:e,...t}),C)),L=_(m,{enabled:!0,paging:A,setPaging:M},E,async(e,t)=>v(await(0,l.listApprovalHistoryTasksPage)({assigneeMemberId:e,instanceState:`RUNNING`,...t}),t=>w(t,e))),z=_(m,{enabled:g===`history`,paging:P,setPaging:F},E,async(e,t)=>v(await(0,l.listApprovalHistoryTasksPage)({assigneeMemberId:e,...t}),t=>w(t,e))),[B,V]=(0,o.useState)([]),[H,U]=(0,o.useState)(!1);(0,o.useEffect)(()=>{m?x(m).then(e=>{V(e?.rows??[]),U(e?.truncated??!1)},e=>E(R(e))):(V([]),U(!1))},[m]);let W=(0,o.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeText`,key:`nodeText`,title:`節點`,width:180},{dataIndex:`statusLabel`,key:`statusLabel`,title:`狀態`,width:120},{key:`fill`,render:e=>e.hasFillableFields?(0,c.jsx)(s.Badge,{size:`sub`,text:`需補填`,variant:`dot-warning`}):null,title:`補填`,width:120},{key:`slaDueAt`,render:e=>(0,c.jsx)(s.Typography,{color:e.slaStatusColor,component:`span`,variant:`body`,children:e.slaStatusText}),title:`SLA`,width:180},{key:`createdAt`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:t.t(e.createdAt)}),title:`建立時間`,width:220}],[]),G=(0,o.useMemo)(()=>({render:t=>[{name:`處理`,onClick:()=>e.push(r.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,r]),K=(0,o.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{key:`startedAt`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:t.t(e.startedAt)}),title:`發起時間`,width:220}],[]),q=(0,o.useMemo)(()=>({render:t=>[{name:`重新送出`,onClick:()=>e.push(r.caseDetail(t.id))}],variant:`base-secondary`,width:120}),[e,r]),J=(0,o.useMemo)(()=>[{dataIndex:`caseTitle`,key:`caseTitle`,title:`案件`,width:280},{dataIndex:`nodeText`,key:`nodeText`,title:`節點`,width:180},{key:`decisionLabel`,render:e=>(0,c.jsx)(s.Typography,{color:k(e.decisionAction),component:`span`,variant:`body`,children:e.decisionLabel}),title:`決議`,width:120},{key:`decisionComment`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:e.decisionCommentText}),title:`意見`,width:240},{key:`instanceStateLabel`,render:e=>(0,c.jsx)(s.Typography,{color:j(e.instanceState),component:`span`,variant:`body`,children:e.instanceStateLabel}),title:`流程狀態`,width:140},{key:`decidedAt`,render:e=>(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:N(e.decidedAt)}),title:`簽核時間`,width:220}],[]),Y=(0,o.useMemo)(()=>({render:t=>[{name:`查看`,onClick:()=>e.push(r.caseDetail(t.instanceId))}],variant:`base-secondary`,width:88}),[e,r]);function X(e){S(e===`history`||e===`pending`||e===`tracking`?e:`pending`)}return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(u.default,{description:`目前以 ${f?.name??m??`目前登入會員`} 查詢待處理與歷史簽核任務。`,title:`我的待簽`,children:(0,c.jsx)(s.Button,{icon:d.PlusIcon,iconType:`leading`,onClick:()=>e.push(r.caseNew()),variant:`base-primary`,children:`發起簽核`})})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsxs)(s.Section,{children:[T?(0,c.jsx)(s.Typography,{color:`text-error`,variant:`body`,children:T}):null,(0,c.jsxs)(s.Tab,{activeKey:g,onChange:X,size:`sub`,children:[(0,c.jsx)(s.TabItem,{badgeCount:I.loading?void 0:I.total,children:`待簽核`},`pending`),(0,c.jsx)(s.TabItem,{badgeCount:L.loading?void 0:L.total,children:`已處理未結束`},`tracking`),(0,c.jsx)(s.TabItem,{children:`歷史簽核記錄`},`history`)]}),g===`pending`&&(B.length>0||H)?(0,c.jsxs)(`div`,{"data-returned-instances":``,style:p,children:[B.length>0?(0,c.jsx)(s.Typography,{component:`h2`,variant:`label-primary`,children:`被退回待重送`}):null,(0,c.jsx)(s.Typography,{color:`text-neutral`,variant:`caption`,children:b(B.length>0,H)}),B.length>0?(0,c.jsx)(s.Table,{actions:q,columns:K,dataSource:[...B],fullWidth:!0}):null]}):null,g===`pending`?(0,c.jsx)(s.Table,{actions:G,columns:W,dataSource:[...I.rows],fullWidth:!0,loading:I.loading,pagination:y(D,I.total,O)}):null,g===`tracking`?(0,c.jsx)(s.Table,{actions:Y,columns:J,dataSource:[...L.rows],fullWidth:!0,loading:L.loading,pagination:y(A,L.total,M)}):null,g===`history`?(0,c.jsx)(s.Table,{actions:Y,columns:J,dataSource:[...z.rows],fullWidth:!0,loading:z.loading,pagination:y(P,z.total,F)}):null]})})]})}function _(e,{enabled:t,paging:n,setPaging:r},i,a){let[s,c]=(0,o.useState)({loading:!0,rows:[],total:0}),l=(0,o.useRef)(0),u=(0,o.useRef)(a);u.current=a;let d=(0,o.useCallback)(async()=>{let t=l.current+1;if(l.current=t,!e)c({loading:!1,rows:[],total:0});else{c(e=>({...e,loading:!0}));try{let i=await u.current(e,n);if(l.current!==t)return;let a=Math.max(1,Math.ceil(i.total/n.pageSize));if(!i.rows.length&&n.page>a){r({...n,page:a});return}c({loading:!1,...i})}catch(e){l.current===t&&(i(R(e)),c(e=>({...e,loading:!1})))}}},[e,i,n,r]);return(0,o.useEffect)(()=>{t&&d()},[t,d]),s}async function v(e,t){return{rows:await t(e.tasks),total:e.totalCount}}function y(e,t,n){return{current:e.page,onChange:t=>n({...e,page:t}),onChangePageSize:e=>n({page:1,pageSize:e}),pageSize:e.pageSize,pageSizeLabel:`每頁筆數`,pageSizeOptions:m,renderResultSummary:(e,t,n)=>`顯示 ${e}-${t} 筆,共 ${n} 筆`,showPageSizeOptions:!0,total:t}}function b(e,t){return e?t?`你發起的案件被退回,請修改後重新送出。可能還有其他被退回的案件,請到「我發起的」查看。`:`你發起的案件被退回,請修改後重新送出。`:`前 ${f} 筆被退回的案件中沒有你發起的,可能還有其他被退回的案件,請到「我發起的」查看。`}async function x(e){try{let t=await(0,l.listApprovalInstancesPage)({page:1,pageSize:f,searchText:null,state:`RETURNED`,templateId:null,view:`SENT`});return{rows:S(t.instances,e),truncated:t.totalCount>t.instances.length}}catch{return null}}function S(e,t){return e.filter(e=>e.initiatorMemberId===t).map(e=>({caseTitle:(0,l.readApprovalInstanceCaseTitle)(e),id:e.id,key:e.id,startedAt:e.startedAt}))}async function C(e){let t=await T(e);return e.map((e,n)=>({...e,caseTitle:E(e,t[n]??null),key:e.id,nodeText:r.o(e),slaStatusColor:F(e.slaDueAt),slaStatusText:P(e.slaDueAt),statusLabel:L(e.status)}))}async function w(e,t){let[n,i]=await Promise.all([Promise.all(e.map(e=>(0,l.listTaskDecisions)(e.id))),T(e)]);return e.map((e,a)=>{let o=n[a]??[],s=D(o,t),c=i[a]??null;return{...e,caseTitle:E(e,c),decisionAction:s?.action??null,decisionComment:s?.comment??null,decisionCommentText:M(s?.comment??null),decisionLabel:O(s?.action??null),decidedAt:s?.decidedAt??(o.length===0?e.completedAt:null),instanceState:c?.state??null,instanceStateLabel:A(c?.state??null),key:e.id,nodeText:r.o(e)}})}async function T(e){return Promise.all(e.map(async e=>{try{return(await(0,l.readApprovalInstance)(e.instanceId)).instance}catch{return null}}))}function E(e,t){return t?(0,l.readApprovalInstanceCaseTitle)(t):e.instanceId}function D(e,t){return r.i(e.filter(e=>e.decidedByMemberId===t))}function O(e){return e===`APPROVED`?`同意`:e===`REJECTED`?`拒絕`:e===`RETURNED`?`退回`:e===`TRANSFERRED`?`轉派`:`未記錄`}function k(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`RETURNED`?`text-error`:`text-neutral`}function A(e){return e===`RUNNING`?`進行中`:e===`APPROVED`?`已通過`:e===`REJECTED`?`已拒絕`:e===`RETURNED`?`已退回`:e===`CANCELLED`?`已取消`:e===`EXPIRED`?`已逾期`:e===`DRAFT`?`草稿`:`-`}function j(e){return e===`APPROVED`?`text-success`:e===`REJECTED`||e===`CANCELLED`||e===`EXPIRED`?`text-error`:`text-neutral`}function M(e){return(e?.trim()??``)||`-`}function N(e){return t.t(e)}function P(e){if(!e)return`-`;let t=new Date(e).getTime(),n=Date.now(),r=I(Math.abs(t-n));return t<n?`已逾期 ${r}`:`剩餘 ${r}`}function F(e){return e?new Date(e).getTime()<Date.now()?`text-error`:`text-success`:`text-neutral`}function I(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?`${n}天 ${r}小時`:r>0?`${r}小時 ${i}分鐘`:`${i}分鐘`}function L(e){return e===`PENDING`?`待處理`:e===`IN_PROGRESS`?`處理中`:e===`COMPLETED`?`已完成`:e===`TRANSFERRED`?`已轉派`:e===`CANCELLED`?`已取消`:e}function R(e){return e instanceof Error?e.message:`發生未知錯誤`}exports.InboxView=g;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -3,7 +3,7 @@ import { t as e } from "../../chunks/format-date-time-B0LdmWg4.js";
3
3
  import { n as t } from "../../chunks/auth-provider-C2b-5mGt.js";
4
4
  import { i as n, o as r } from "../../chunks/task-decision-3d17ZvZE.js";
5
5
  import { r as i } from "../../chunks/router-adapter-CkxCyzf5.js";
6
- import { r as a } from "../../chunks/routes-config-BcNaWJWJ.js";
6
+ import { r as a } from "../../chunks/routes-config-DjEOE9eP.js";
7
7
  import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
8
8
  import { Badge as d, Button as f, PageHeader as p, Section as m, SectionGroup as ee, Tab as te, TabItem as h, Table as g, Typography as _ } from "@mezzanine-ui/react";
9
9
  import { Fragment as ne, jsx as v, jsxs as y } from "react/jsx-runtime";
@@ -1,28 +1,53 @@
1
- import { UserTaskNode, WorkflowDefinition } from '@rytass/bpm-core-shared';
1
+ import { FieldAccessFillUnit, UserTaskNode, WorkflowDefinition } from '@rytass/bpm-core-shared';
2
2
  import { FormDefinitionSchema, FormDataIssue } from '@rytass/bpm-core-shared/form';
3
3
  import { WorkflowFormData } from '@rytass/bpm-core-client/workflow';
4
+ /** A fill grant on one column: the open cell's fill. */
5
+ type ColumnFill = FieldAccessFillUnit['fill'];
4
6
  /**
5
- * The form as the applicant sees it: without the fields some approver fills in.
6
- * The server drops those keys from a submission, so rendering one would swallow
7
- * what the applicant types, and a `minRows` or `required` on it would block a
8
- * launch nobody can complete. Returns an equal schema when nothing is
9
- * approver-filled; never mutates its input.
7
+ * The form as the applicant sees it: without the fields some approver fills in
8
+ * as a whole, and without the columns some approver fills per column. A table
9
+ * keeps its other columns, and is dropped when none remain. The server drops
10
+ * those keys from a submission, so rendering one would swallow what the
11
+ * applicant types, and a `minRows` or `required` on it would block a launch
12
+ * nobody can complete. Never mutates its input.
10
13
  */
11
14
  export declare function readApplicantFormSchema(schema: FormDefinitionSchema, definition: WorkflowDefinition): FormDefinitionSchema;
12
- /** The payload the applicant may send: `values` without approver-filled keys. */
15
+ /**
16
+ * The payload the applicant may send: `values` without the keys an approver
17
+ * fills as a whole, and without the open cells of the tables an approver fills
18
+ * per column. A table left with no applicant cell at all is omitted, so the
19
+ * server keeps the approver's cells as they are.
20
+ *
21
+ * Known limit: the schema is not passed in, so a table whose every column is
22
+ * approver-filled is recognised by its rows, not by its columns. A table that
23
+ * had no rows is omitted for the same reason.
24
+ */
13
25
  export declare function readApplicantSubmission(values: WorkflowFormData, definition: WorkflowDefinition): WorkflowFormData;
14
26
  /**
15
- * The form an approver's fill is validated against: only the fields `node`
16
- * lets them fill in, each required exactly when the node says `REQUIRED`. A
17
- * required table needs at least one row, the rule `validateFormRendererValues`
18
- * already applies, so the result agrees with the server's fill check. Never
19
- * mutates its input.
27
+ * Top-level fields this node lets its approver fill only per column (ADR 27
28
+ * §4(a)). A field the node also grants whole is not in this set.
29
+ */
30
+ export declare function readFillColumnModeFieldKeys(node: UserTaskNode): ReadonlySet<string>;
31
+ /**
32
+ * The columns of `fieldKey` this node opens to its approver, each with its
33
+ * fill. Empty when the node opens none of them.
34
+ */
35
+ export declare function readFillOpenColumns(node: UserTaskNode, fieldKey: string): ReadonlyMap<string, ColumnFill>;
36
+ /**
37
+ * The form an approver's fill is validated against: only what `node` lets them
38
+ * fill in, each whole field required exactly when the node says `REQUIRED`,
39
+ * and each column-only table reduced to its open columns. A required table
40
+ * needs at least one row, the rule `validateFormRendererValues` already
41
+ * applies, so the result agrees with the server's fill check. Never mutates its
42
+ * input.
20
43
  */
21
44
  export declare function readFillValidationSchema(schema: FormDefinitionSchema, node: UserTaskNode): FormDefinitionSchema;
22
45
  /**
23
46
  * The schema the fill node's approver sees: every field as the form defines
24
47
  * it, except that the node's fillable fields are required exactly when the
25
- * node says `REQUIRED`, so the asterisk matches what approving will check.
48
+ * node says `REQUIRED`, so the asterisk matches what approving will check. A
49
+ * column-only table keeps every column, so the closed ones still show; their
50
+ * requirement is cleared, and the open ones follow the node.
26
51
  */
27
52
  export declare function readFillDisplaySchema(schema: FormDefinitionSchema, node: UserTaskNode): FormDefinitionSchema;
28
53
  /**
@@ -35,17 +60,21 @@ export declare function readFillLabelMarkers(definition: WorkflowDefinition, vie
35
60
  /**
36
61
  * What approving sends as `fill.formData`: the keys of `values` that `node`
37
62
  * lets its approver fill, and nothing else (the server refuses any other key).
38
- * `values` is what the approver changed, not the rendered form — a renderer
39
- * default the approver never touched (a table's empty rows, a boolean's
40
- * `false`) is not theirs to sign, and would otherwise show up as filled in.
63
+ * `values` is the fill changes from `readFillChanges`, not the rendered form:
64
+ * a renderer default the approver never touched (a table's empty rows, an
65
+ * OPTIONAL boolean's `false`) is not theirs to sign and stays out. A REQUIRED
66
+ * boolean is the exception; its shown value is sent, see `readFillChanges`.
41
67
  */
42
- export declare function readFillPayload(values: WorkflowFormData, node: UserTaskNode): Readonly<Record<string, unknown>>;
68
+ export declare function readFillPayload(values: WorkflowFormData, node: UserTaskNode, stored?: WorkflowFormData): Readonly<Record<string, unknown>>;
43
69
  /**
44
70
  * What the approver's fill amounts to: the fields they changed (`draft`), plus
45
71
  * each fill table the page seeds with `minRows` rows that the case does not
46
- * store yet. The page shows those rows and validates them, so they are sent
47
- * too — left out, the server would refuse the approval for missing rows the
48
- * approver can see on screen.
72
+ * store yet, and each REQUIRED boolean fill field at the value the page shows.
73
+ * The page shows those rows and values and validates them, so they are sent
74
+ * too. Left out, the server would refuse the approval for a missing row, and
75
+ * for a missing `false` that the approver can see on screen: a boolean that
76
+ * is never sent reads as empty, while `false` is a value. Changed values
77
+ * override the displayed ones.
49
78
  */
50
79
  export declare function readFillChanges({ draft, node, schema, stored, values, }: {
51
80
  readonly draft: WorkflowFormData;
@@ -56,6 +85,12 @@ export declare function readFillChanges({ draft, node, schema, stored, values, }
56
85
  }): WorkflowFormData;
57
86
  /** The server message of a fill against form data someone else changed. */
58
87
  export declare function isFillConflictMessage(message: string): boolean;
88
+ /**
89
+ * The stable code the server answers when an approver's fill adds, removes or
90
+ * reorders rows of a column-only table (ADR 27 §4(a)). Its message is English;
91
+ * callers show their own copy from this code.
92
+ */
93
+ export declare const FILL_TABLE_ROWS_LOCKED_CODE = "FORM_FIELD_ACCESS_TABLE_ROWS_LOCKED";
59
94
  /**
60
95
  * Turns the server's fill validation refusal (docs/08 §8.5, error table 2)
61
96
  * into field errors keyed the way `FormRenderer` addresses them, so a check
@@ -84,3 +119,4 @@ export declare function readFillOrgUnitIds(schema: FormDefinitionSchema, values:
84
119
  * unit field names its unit from `orgUnitNames` and shows 「未知組織」 otherwise.
85
120
  */
86
121
  export declare function readFillSummary(schema: FormDefinitionSchema, node: UserTaskNode, values: WorkflowFormData, memberNames?: ReadonlyMap<string, string>, orgUnitNames?: ReadonlyMap<string, string>): readonly FillSummaryItem[];
122
+ export {};
@@ -1,28 +1,53 @@
1
- import { UserTaskNode, WorkflowDefinition } from '@rytass/bpm-core-shared';
1
+ import { FieldAccessFillUnit, UserTaskNode, WorkflowDefinition } from '@rytass/bpm-core-shared';
2
2
  import { FormDefinitionSchema, FormDataIssue } from '@rytass/bpm-core-shared/form';
3
3
  import { WorkflowFormData } from '@rytass/bpm-core-client/workflow';
4
+ /** A fill grant on one column: the open cell's fill. */
5
+ type ColumnFill = FieldAccessFillUnit['fill'];
4
6
  /**
5
- * The form as the applicant sees it: without the fields some approver fills in.
6
- * The server drops those keys from a submission, so rendering one would swallow
7
- * what the applicant types, and a `minRows` or `required` on it would block a
8
- * launch nobody can complete. Returns an equal schema when nothing is
9
- * approver-filled; never mutates its input.
7
+ * The form as the applicant sees it: without the fields some approver fills in
8
+ * as a whole, and without the columns some approver fills per column. A table
9
+ * keeps its other columns, and is dropped when none remain. The server drops
10
+ * those keys from a submission, so rendering one would swallow what the
11
+ * applicant types, and a `minRows` or `required` on it would block a launch
12
+ * nobody can complete. Never mutates its input.
10
13
  */
11
14
  export declare function readApplicantFormSchema(schema: FormDefinitionSchema, definition: WorkflowDefinition): FormDefinitionSchema;
12
- /** The payload the applicant may send: `values` without approver-filled keys. */
15
+ /**
16
+ * The payload the applicant may send: `values` without the keys an approver
17
+ * fills as a whole, and without the open cells of the tables an approver fills
18
+ * per column. A table left with no applicant cell at all is omitted, so the
19
+ * server keeps the approver's cells as they are.
20
+ *
21
+ * Known limit: the schema is not passed in, so a table whose every column is
22
+ * approver-filled is recognised by its rows, not by its columns. A table that
23
+ * had no rows is omitted for the same reason.
24
+ */
13
25
  export declare function readApplicantSubmission(values: WorkflowFormData, definition: WorkflowDefinition): WorkflowFormData;
14
26
  /**
15
- * The form an approver's fill is validated against: only the fields `node`
16
- * lets them fill in, each required exactly when the node says `REQUIRED`. A
17
- * required table needs at least one row, the rule `validateFormRendererValues`
18
- * already applies, so the result agrees with the server's fill check. Never
19
- * mutates its input.
27
+ * Top-level fields this node lets its approver fill only per column (ADR 27
28
+ * §4(a)). A field the node also grants whole is not in this set.
29
+ */
30
+ export declare function readFillColumnModeFieldKeys(node: UserTaskNode): ReadonlySet<string>;
31
+ /**
32
+ * The columns of `fieldKey` this node opens to its approver, each with its
33
+ * fill. Empty when the node opens none of them.
34
+ */
35
+ export declare function readFillOpenColumns(node: UserTaskNode, fieldKey: string): ReadonlyMap<string, ColumnFill>;
36
+ /**
37
+ * The form an approver's fill is validated against: only what `node` lets them
38
+ * fill in, each whole field required exactly when the node says `REQUIRED`,
39
+ * and each column-only table reduced to its open columns. A required table
40
+ * needs at least one row, the rule `validateFormRendererValues` already
41
+ * applies, so the result agrees with the server's fill check. Never mutates its
42
+ * input.
20
43
  */
21
44
  export declare function readFillValidationSchema(schema: FormDefinitionSchema, node: UserTaskNode): FormDefinitionSchema;
22
45
  /**
23
46
  * The schema the fill node's approver sees: every field as the form defines
24
47
  * it, except that the node's fillable fields are required exactly when the
25
- * node says `REQUIRED`, so the asterisk matches what approving will check.
48
+ * node says `REQUIRED`, so the asterisk matches what approving will check. A
49
+ * column-only table keeps every column, so the closed ones still show; their
50
+ * requirement is cleared, and the open ones follow the node.
26
51
  */
27
52
  export declare function readFillDisplaySchema(schema: FormDefinitionSchema, node: UserTaskNode): FormDefinitionSchema;
28
53
  /**
@@ -35,17 +60,21 @@ export declare function readFillLabelMarkers(definition: WorkflowDefinition, vie
35
60
  /**
36
61
  * What approving sends as `fill.formData`: the keys of `values` that `node`
37
62
  * lets its approver fill, and nothing else (the server refuses any other key).
38
- * `values` is what the approver changed, not the rendered form — a renderer
39
- * default the approver never touched (a table's empty rows, a boolean's
40
- * `false`) is not theirs to sign, and would otherwise show up as filled in.
63
+ * `values` is the fill changes from `readFillChanges`, not the rendered form:
64
+ * a renderer default the approver never touched (a table's empty rows, an
65
+ * OPTIONAL boolean's `false`) is not theirs to sign and stays out. A REQUIRED
66
+ * boolean is the exception; its shown value is sent, see `readFillChanges`.
41
67
  */
42
- export declare function readFillPayload(values: WorkflowFormData, node: UserTaskNode): Readonly<Record<string, unknown>>;
68
+ export declare function readFillPayload(values: WorkflowFormData, node: UserTaskNode, stored?: WorkflowFormData): Readonly<Record<string, unknown>>;
43
69
  /**
44
70
  * What the approver's fill amounts to: the fields they changed (`draft`), plus
45
71
  * each fill table the page seeds with `minRows` rows that the case does not
46
- * store yet. The page shows those rows and validates them, so they are sent
47
- * too — left out, the server would refuse the approval for missing rows the
48
- * approver can see on screen.
72
+ * store yet, and each REQUIRED boolean fill field at the value the page shows.
73
+ * The page shows those rows and values and validates them, so they are sent
74
+ * too. Left out, the server would refuse the approval for a missing row, and
75
+ * for a missing `false` that the approver can see on screen: a boolean that
76
+ * is never sent reads as empty, while `false` is a value. Changed values
77
+ * override the displayed ones.
49
78
  */
50
79
  export declare function readFillChanges({ draft, node, schema, stored, values, }: {
51
80
  readonly draft: WorkflowFormData;
@@ -56,6 +85,12 @@ export declare function readFillChanges({ draft, node, schema, stored, values, }
56
85
  }): WorkflowFormData;
57
86
  /** The server message of a fill against form data someone else changed. */
58
87
  export declare function isFillConflictMessage(message: string): boolean;
88
+ /**
89
+ * The stable code the server answers when an approver's fill adds, removes or
90
+ * reorders rows of a column-only table (ADR 27 §4(a)). Its message is English;
91
+ * callers show their own copy from this code.
92
+ */
93
+ export declare const FILL_TABLE_ROWS_LOCKED_CODE = "FORM_FIELD_ACCESS_TABLE_ROWS_LOCKED";
59
94
  /**
60
95
  * Turns the server's fill validation refusal (docs/08 §8.5, error table 2)
61
96
  * into field errors keyed the way `FormRenderer` addresses them, so a check
@@ -84,3 +119,4 @@ export declare function readFillOrgUnitIds(schema: FormDefinitionSchema, values:
84
119
  * unit field names its unit from `orgUnitNames` and shows 「未知組織」 otherwise.
85
120
  */
86
121
  export declare function readFillSummary(schema: FormDefinitionSchema, node: UserTaskNode, values: WorkflowFormData, memberNames?: ReadonlyMap<string, string>, orgUnitNames?: ReadonlyMap<string, string>): readonly FillSummaryItem[];
122
+ export {};
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/detail-BUfsSal0.cjs");exports.InstanceAttachmentsSection=e.o,exports.InstanceDetailView=e.t,exports.InstanceFormSection=e.s,exports.InstanceHistorySection=e.r,exports.InstanceSignaturesSection=e.i,exports.InstanceTasksSection=e.a,exports.InstanceWebhookDeliveriesSection=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/detail-DN8pEzUJ.cjs");exports.InstanceAttachmentsSection=e.o,exports.InstanceDetailView=e.t,exports.InstanceFormSection=e.s,exports.InstanceHistorySection=e.r,exports.InstanceSignaturesSection=e.i,exports.InstanceTasksSection=e.a,exports.InstanceWebhookDeliveriesSection=e.n;
@@ -1 +1 @@
1
- export { o as InstanceAttachmentsSection, t as InstanceDetailView, s as InstanceFormSection, r as InstanceHistorySection, i as InstanceSignaturesSection, a as InstanceTasksSection, n as InstanceWebhookDeliveriesSection } from "../../../chunks/detail-CHZDNNM6.js";
1
+ export { o as InstanceAttachmentsSection, t as InstanceDetailView, s as InstanceFormSection, r as InstanceHistorySection, i as InstanceSignaturesSection, a as InstanceTasksSection, n as InstanceWebhookDeliveriesSection } from "../../../chunks/detail-BB_uYaoM.js";
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  import { ResolvedFieldAccess } from '@rytass/bpm-core-shared';
3
3
  import { FormDefinitionSchema, FormFieldDefinition } from '@rytass/bpm-core-shared/form';
4
4
  import { ApprovalInstanceRecord, WorkflowFormData } from '@rytass/bpm-core-client/workflow';
5
+ import { FormRendererTableAccess } from '../../../forms/renderer/FormRendererView.cjs';
5
6
  import { FormDataSourceFieldState } from '../../../forms/renderer/form-data-source-field.cjs';
6
7
  import { FileUploadFieldState, FormRendererAttachment } from '../../../forms/renderer/file-upload-field.cjs';
7
8
  /** The fill state of the viewer's own task at a node that fills in fields. */
@@ -16,6 +17,12 @@ export interface InstanceFormSectionFill {
16
17
  readonly schema: FormDefinitionSchema;
17
18
  /** The stored form data with the draft fill on top. */
18
19
  readonly value: WorkflowFormData;
20
+ /**
21
+ * Per table the node opens only column by column: the open columns the
22
+ * approver may edit, with the rows locked. Absent when the node opens no
23
+ * column-only table.
24
+ */
25
+ readonly tableAccess?: Readonly<Record<string, FormRendererTableAccess>>;
19
26
  }
20
27
  export interface InstanceFormSectionProps {
21
28
  /**
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  import { ResolvedFieldAccess } from '@rytass/bpm-core-shared';
3
3
  import { FormDefinitionSchema, FormFieldDefinition } from '@rytass/bpm-core-shared/form';
4
4
  import { ApprovalInstanceRecord, WorkflowFormData } from '@rytass/bpm-core-client/workflow';
5
+ import { FormRendererTableAccess } from '../../../forms/renderer/FormRendererView.js';
5
6
  import { FormDataSourceFieldState } from '../../../forms/renderer/form-data-source-field.js';
6
7
  import { FileUploadFieldState, FormRendererAttachment } from '../../../forms/renderer/file-upload-field.js';
7
8
  /** The fill state of the viewer's own task at a node that fills in fields. */
@@ -16,6 +17,12 @@ export interface InstanceFormSectionFill {
16
17
  readonly schema: FormDefinitionSchema;
17
18
  /** The stored form data with the draft fill on top. */
18
19
  readonly value: WorkflowFormData;
20
+ /**
21
+ * Per table the node opens only column by column: the open columns the
22
+ * approver may edit, with the rows locked. Absent when the node opens no
23
+ * column-only table.
24
+ */
25
+ readonly tableAccess?: Readonly<Record<string, FormRendererTableAccess>>;
19
26
  }
20
27
  export interface InstanceFormSectionProps {
21
28
  /**
@@ -51,7 +51,7 @@ export interface InstanceTasksSectionProps {
51
51
  * `true` means the container showed it (a conflict or field errors), so the
52
52
  * dialog closes instead of repeating it.
53
53
  */
54
- readonly onFillApproveError?: (message: string, formDataIssues?: readonly FormDataIssue[]) => boolean;
54
+ readonly onFillApproveError?: (message: string, formDataIssues?: readonly FormDataIssue[], code?: string | null) => boolean;
55
55
  /** All tasks for this instance. */
56
56
  readonly tasks: readonly TaskRecord[];
57
57
  /** Ad-hoc directives recorded on this instance. */
@@ -51,7 +51,7 @@ export interface InstanceTasksSectionProps {
51
51
  * `true` means the container showed it (a conflict or field errors), so the
52
52
  * dialog closes instead of repeating it.
53
53
  */
54
- readonly onFillApproveError?: (message: string, formDataIssues?: readonly FormDataIssue[]) => boolean;
54
+ readonly onFillApproveError?: (message: string, formDataIssues?: readonly FormDataIssue[], code?: string | null) => boolean;
55
55
  /** All tasks for this instance. */
56
56
  readonly tasks: readonly TaskRecord[];
57
57
  /** Ad-hoc directives recorded on this instance. */
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../../chunks/instance-error-message-BpCLCOjp.cjs"),n=require("../../../chunks/format-date-time-D-cx5M8z.cjs"),r=require("../../../chunks/auth-provider-4BeCw7cI.cjs"),i=require("../../../chunks/router-adapter--gYs13E8.cjs"),a=require("../../../chunks/routes-config-C1j_vFKo.cjs"),o=require("../../../chunks/FormRendererView-iLlHFIUR.cjs");let s=require("react"),c=require("@mezzanine-ui/react"),l=require("react/jsx-runtime"),u=require("@rytass/bpm-core-client/workflow"),d=require("@mezzanine-ui/react/ContentHeader");d=e.t(d,1);let f=require("@rytass/bpm-core-client/form"),p=require("@mezzanine-ui/icons");var m={display:`grid`,gap:16};function h(e={}){return(0,l.jsx)(s.Suspense,{fallback:(0,l.jsx)(_,{}),children:(0,l.jsx)(g,{templateId:e.templateId??void 0})})}function g({templateId:e}){let h=i.r(),g=a.r(),{member:_}=r.n(),v=_?.memberId??null,y=e??null,[b,x]=(0,s.useState)(null),[S,C]=(0,s.useState)({}),[w,T]=(0,s.useState)([]),[E,D]=(0,s.useState)(null),[O,k]=(0,s.useState)({}),[A,j]=(0,s.useState)(!0),[M,N]=(0,s.useState)(!1),[P,F]=(0,s.useState)({}),I=o.o(),L=(0,s.useMemo)(()=>b?t.r(b.formVersion.schema,b.templateVersion.workflowDefinition):null,[b]),R=(0,s.useCallback)((e,t)=>{F(n=>{let r=n[e];return r?.hasValue===t.hasValue&&r.selectionExpired===(t.selectionExpired===!0)&&r.status===t.status?n:{...n,[e]:{hasValue:t.hasValue,selectionExpired:t.selectionExpired===!0,status:t.status}}})},[]);(0,s.useEffect)(()=>{y?U(y):H()},[y]);let z=(0,s.useMemo)(()=>w.map(e=>({...e,key:e.id,updatedAt:n.t(e.updatedAt),versionLabel:`v${e.version}`})),[w]),B=(0,s.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:240},{dataIndex:`versionLabel`,key:`versionLabel`,title:`發布版本`,width:120},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),V=(0,s.useMemo)(()=>({render:e=>[{name:`發起`,onClick:()=>h.push(g.caseNew(e.id)),variant:`base-primary`}],variant:`base-secondary`,width:88}),[h]);async function H(){j(!0),D(null),x(null),F({});try{T(await(0,u.listLaunchableTemplates)())}catch(e){D(t.t(e))}finally{j(!1)}}async function U(e){j(!0),D(null),T([]),F({});try{x(await(0,u.readLaunchContext)(e))}catch(e){D(t.t(e))}finally{j(!1)}}async function W(){if(!b||!L||!v)return;N(!0),D(null),k({});let e=o.l(Object.values(P));if(e){D(e),N(!1);return}if(I.blockMessage){D(I.blockMessage),N(!1);return}let n=t.i((0,f.buildFormRendererValues)(L.fields,S),b.templateVersion.workflowDefinition);try{let e=await(0,f.validateFormRendererValuesInWorker)({schema:L,uiSchema:b.formVersion.uiSchema,values:n});if(!e.valid){k(e.errors),D(`請先修正表單中標示的欄位。`),e.firstInvalidFieldKey&&(0,f.focusFormRendererField)(e.firstInvalidFieldKey);return}let t=await(0,u.submitApprovalInstance)({formData:n,initiatorMemberId:v,templateId:b.template.id,title:(0,u.readFormDataCaseTitle)({fallbackTitle:b.template.name,formData:n,schema:L,uiSchema:b.formVersion.uiSchema})});h.push(g.caseDetail(t))}catch(e){D(t.t(e))}finally{N(!1)}}async function G(e,t){if(!v)throw Error(`尚未登入,無法上傳附件`);return{id:(await(0,u.uploadAttachment)({file:t,formFieldPath:`form.${e.fieldKey}`})).id}}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.PageHeader,{children:(0,l.jsx)(d.default,{description:b?`${b.template.name} · 表單 v${b.formVersion.version}`:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`,children:b?(0,l.jsx)(c.Button,{disabled:A||M,icon:p.CheckedIcon,iconType:`leading`,onClick:W,variant:`base-primary`,children:`送出`}):null})}),(0,l.jsx)(c.SectionGroup,{children:(0,l.jsx)(c.Section,{children:(0,l.jsxs)(`div`,{style:m,children:[E?(0,l.jsx)(c.Typography,{color:`text-error`,variant:`body`,children:E}):null,A?(0,l.jsx)(c.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`}):null,b&&L?(0,l.jsx)(o.t,{dataSourceContext:{kind:`runtime`,templateId:b.template.id},errors:O,maxWidth:480,onChange:e=>{C(e),k({})},onDataSourceStateChange:R,onFileUploadStateChange:I.onFileUploadStateChange,onUploadAttachment:G,schema:L,singleColumn:!0,uiSchema:b.formVersion.uiSchema,value:S}):null,!y&&!A?z.length>0?(0,l.jsx)(c.Table,{actions:V,columns:B,dataSource:z,fullWidth:!0}):(0,l.jsx)(c.Typography,{color:`text-neutral`,variant:`body`,children:`目前沒有可發起的已發布模板。`}):null]})})})]})}function _(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.PageHeader,{children:(0,l.jsx)(d.default,{description:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`})}),(0,l.jsx)(c.SectionGroup,{children:(0,l.jsx)(c.Section,{children:(0,l.jsx)(c.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`})})})]})}exports.InstanceNewView=h;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../../chunks/instance-error-message-BL_X7Af8.cjs"),n=require("../../../chunks/format-date-time-D-cx5M8z.cjs"),r=require("../../../chunks/auth-provider-4BeCw7cI.cjs"),i=require("../../../chunks/router-adapter--gYs13E8.cjs"),a=require("../../../chunks/routes-config-BWjZDAU3.cjs"),o=require("../../../chunks/FormRendererView-D-p6GDQB.cjs");let s=require("react"),c=require("@mezzanine-ui/react"),l=require("react/jsx-runtime"),u=require("@rytass/bpm-core-client/workflow"),d=require("@mezzanine-ui/react/ContentHeader");d=e.t(d,1);let f=require("@rytass/bpm-core-client/form"),p=require("@mezzanine-ui/icons");var m={display:`grid`,gap:16};function h(e={}){return(0,l.jsx)(s.Suspense,{fallback:(0,l.jsx)(_,{}),children:(0,l.jsx)(g,{templateId:e.templateId??void 0})})}function g({templateId:e}){let h=i.r(),g=a.r(),{member:_}=r.n(),v=_?.memberId??null,y=e??null,[b,x]=(0,s.useState)(null),[S,C]=(0,s.useState)({}),[w,T]=(0,s.useState)([]),[E,D]=(0,s.useState)(null),[O,k]=(0,s.useState)({}),[A,j]=(0,s.useState)(!0),[M,N]=(0,s.useState)(!1),[P,F]=(0,s.useState)({}),I=o.i(),L=(0,s.useMemo)(()=>b?t.i(b.formVersion.schema,b.templateVersion.workflowDefinition):null,[b]),R=(0,s.useCallback)((e,t)=>{F(n=>{let r=n[e];return r?.hasValue===t.hasValue&&r.selectionExpired===(t.selectionExpired===!0)&&r.status===t.status?n:{...n,[e]:{hasValue:t.hasValue,selectionExpired:t.selectionExpired===!0,status:t.status}}})},[]);(0,s.useEffect)(()=>{y?U(y):H()},[y]);let z=(0,s.useMemo)(()=>w.map(e=>({...e,key:e.id,updatedAt:n.t(e.updatedAt),versionLabel:`v${e.version}`})),[w]),B=(0,s.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:240},{dataIndex:`versionLabel`,key:`versionLabel`,title:`發布版本`,width:120},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),V=(0,s.useMemo)(()=>({render:e=>[{name:`發起`,onClick:()=>h.push(g.caseNew(e.id)),variant:`base-primary`}],variant:`base-secondary`,width:88}),[h]);async function H(){j(!0),D(null),x(null),F({});try{T(await(0,u.listLaunchableTemplates)())}catch(e){D(t.t(e))}finally{j(!1)}}async function U(e){j(!0),D(null),T([]),F({});try{x(await(0,u.readLaunchContext)(e))}catch(e){D(t.t(e))}finally{j(!1)}}async function W(){if(!b||!L||!v)return;N(!0),D(null),k({});let e=o.s(Object.values(P));if(e){D(e),N(!1);return}if(I.blockMessage){D(I.blockMessage),N(!1);return}let n=t.a((0,f.buildFormRendererValues)(L.fields,S),b.templateVersion.workflowDefinition);try{let e=await(0,f.validateFormRendererValuesInWorker)({schema:L,uiSchema:b.formVersion.uiSchema,values:n});if(!e.valid){k(e.errors),D(`請先修正表單中標示的欄位。`),e.firstInvalidFieldKey&&(0,f.focusFormRendererField)(e.firstInvalidFieldKey);return}let t=await(0,u.submitApprovalInstance)({formData:n,initiatorMemberId:v,templateId:b.template.id,title:(0,u.readFormDataCaseTitle)({fallbackTitle:b.template.name,formData:n,schema:L,uiSchema:b.formVersion.uiSchema})});h.push(g.caseDetail(t))}catch(e){D(t.t(e))}finally{N(!1)}}async function G(e,t){if(!v)throw Error(`尚未登入,無法上傳附件`);return{id:(await(0,u.uploadAttachment)({file:t,formFieldPath:`form.${e.fieldKey}`})).id}}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.PageHeader,{children:(0,l.jsx)(d.default,{description:b?`${b.template.name} · 表單 v${b.formVersion.version}`:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`,children:b?(0,l.jsx)(c.Button,{disabled:A||M,icon:p.CheckedIcon,iconType:`leading`,onClick:W,variant:`base-primary`,children:`送出`}):null})}),(0,l.jsx)(c.SectionGroup,{children:(0,l.jsx)(c.Section,{children:(0,l.jsxs)(`div`,{style:m,children:[E?(0,l.jsx)(c.Typography,{color:`text-error`,variant:`body`,children:E}):null,A?(0,l.jsx)(c.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`}):null,b&&L?(0,l.jsx)(o.t,{dataSourceContext:{kind:`runtime`,templateId:b.template.id},errors:O,maxWidth:480,onChange:e=>{C(e),k({})},onDataSourceStateChange:R,onFileUploadStateChange:I.onFileUploadStateChange,onUploadAttachment:G,schema:L,singleColumn:!0,uiSchema:b.formVersion.uiSchema,value:S}):null,!y&&!A?z.length>0?(0,l.jsx)(c.Table,{actions:V,columns:B,dataSource:z,fullWidth:!0}):(0,l.jsx)(c.Typography,{color:`text-neutral`,variant:`body`,children:`目前沒有可發起的已發布模板。`}):null]})})})]})}function _(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.PageHeader,{children:(0,l.jsx)(d.default,{description:`選擇可發起的已發布模板後填寫表單內容。`,title:`發起簽核`})}),(0,l.jsx)(c.SectionGroup,{children:(0,l.jsx)(c.Section,{children:(0,l.jsx)(c.Typography,{color:`text-neutral`,variant:`body`,children:`載入中...`})})})]})}exports.InstanceNewView=h;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { i as e, r as t, t as n } from "../../../chunks/instance-error-message-BEM4O_Kj.js";
2
+ import { a as e, i as t, t as n } from "../../../chunks/instance-error-message-BKt07-Bo.js";
3
3
  import { t as r } from "../../../chunks/format-date-time-B0LdmWg4.js";
4
4
  import { n as i } from "../../../chunks/auth-provider-C2b-5mGt.js";
5
5
  import { r as a } from "../../../chunks/router-adapter-CkxCyzf5.js";
6
- import { r as o } from "../../../chunks/routes-config-BcNaWJWJ.js";
7
- import { l as s, o as c, t as l } from "../../../chunks/FormRendererView-CAyPXhPq.js";
6
+ import { r as o } from "../../../chunks/routes-config-DjEOE9eP.js";
7
+ import { i as s, s as c, t as l } from "../../../chunks/FormRendererView-DHXmekC3.js";
8
8
  import { Suspense as u, useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
9
9
  import { Button as ee, PageHeader as h, Section as g, SectionGroup as _, Table as v, Typography as y } from "@mezzanine-ui/react";
10
10
  import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
@@ -24,7 +24,7 @@ function A(e = {}) {
24
24
  });
25
25
  }
26
26
  function j({ templateId: u }) {
27
- let A = a(), j = o(), { member: M } = i(), N = M?.memberId ?? null, P = u ?? null, [F, I] = m(null), [L, R] = m({}), [z, B] = m([]), [V, H] = m(null), [U, W] = m({}), [G, K] = m(!0), [q, J] = m(!1), [ae, Y] = m({}), X = c(), Z = p(() => F ? t(F.formVersion.schema, F.templateVersion.workflowDefinition) : null, [F]), oe = d((e, t) => {
27
+ let A = a(), j = o(), { member: M } = i(), N = M?.memberId ?? null, P = u ?? null, [F, I] = m(null), [L, R] = m({}), [z, B] = m([]), [V, H] = m(null), [U, W] = m({}), [G, K] = m(!0), [q, J] = m(!1), [ae, Y] = m({}), X = s(), Z = p(() => F ? t(F.formVersion.schema, F.templateVersion.workflowDefinition) : null, [F]), oe = d((e, t) => {
28
28
  Y((n) => {
29
29
  let r = n[e];
30
30
  return r?.hasValue === t.hasValue && r.selectionExpired === (t.selectionExpired === !0) && r.status === t.status ? n : {
@@ -96,7 +96,7 @@ function j({ templateId: u }) {
96
96
  async function ue() {
97
97
  if (!F || !Z || !N) return;
98
98
  J(!0), H(null), W({});
99
- let t = s(Object.values(ae));
99
+ let t = c(Object.values(ae));
100
100
  if (t) {
101
101
  H(t), J(!1);
102
102
  return;