@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.
- package/CHANGELOG.md +84 -0
- package/README.md +1 -0
- package/dist/chunks/FormBuilderView-Bg9ftYz-.cjs +4 -0
- package/dist/chunks/FormBuilderView-Bg9ftYz-.cjs.map +1 -0
- package/dist/chunks/{FormBuilderView-DbfbLZCI.js → FormBuilderView-CBvdcg_t.js} +675 -614
- package/dist/chunks/FormBuilderView-CBvdcg_t.js.map +1 -0
- package/dist/chunks/FormRendererView-D-p6GDQB.cjs +6 -0
- package/dist/chunks/FormRendererView-D-p6GDQB.cjs.map +1 -0
- package/dist/chunks/FormRendererView-DHXmekC3.js +1319 -0
- package/dist/chunks/FormRendererView-DHXmekC3.js.map +1 -0
- package/dist/chunks/{approval-instance-list-page-Cv5I1YPX.cjs → approval-instance-list-page-BqkG9jiR.cjs} +2 -2
- package/dist/chunks/{approval-instance-list-page-Cv5I1YPX.cjs.map → approval-instance-list-page-BqkG9jiR.cjs.map} +1 -1
- package/dist/chunks/{approval-instance-list-page-BI5fIXc-.js → approval-instance-list-page-CsSpIN4C.js} +2 -2
- package/dist/chunks/{approval-instance-list-page-BI5fIXc-.js.map → approval-instance-list-page-CsSpIN4C.js.map} +1 -1
- package/dist/chunks/compose-B43jtdyL.cjs +2 -0
- package/dist/chunks/compose-B43jtdyL.cjs.map +1 -0
- package/dist/chunks/{compose-U1zs3Yof.js → compose-C7yS6bJm.js} +162 -148
- package/dist/chunks/compose-C7yS6bJm.js.map +1 -0
- package/dist/chunks/{dashboard-page-BoqNhjT_.js → dashboard-page-DBJCsPya.js} +2 -2
- package/dist/chunks/{dashboard-page-BoqNhjT_.js.map → dashboard-page-DBJCsPya.js.map} +1 -1
- package/dist/chunks/{dashboard-page-D7YJ3udk.cjs → dashboard-page-lqlLELKs.cjs} +2 -2
- package/dist/chunks/{dashboard-page-D7YJ3udk.cjs.map → dashboard-page-lqlLELKs.cjs.map} +1 -1
- package/dist/chunks/{designer-DPG7R_WP.js → designer-B9Ut4xze.js} +1786 -1463
- package/dist/chunks/designer-B9Ut4xze.js.map +1 -0
- package/dist/chunks/designer-eXw7R9ug.cjs +69 -0
- package/dist/chunks/designer-eXw7R9ug.cjs.map +1 -0
- package/dist/chunks/{detail-CHZDNNM6.js → detail-BB_uYaoM.js} +904 -896
- package/dist/chunks/detail-BB_uYaoM.js.map +1 -0
- package/dist/chunks/detail-DN8pEzUJ.cjs +5 -0
- package/dist/chunks/detail-DN8pEzUJ.cjs.map +1 -0
- package/dist/chunks/instance-error-message-BKt07-Bo.js +270 -0
- package/dist/chunks/instance-error-message-BKt07-Bo.js.map +1 -0
- package/dist/chunks/instance-error-message-BL_X7Af8.cjs +2 -0
- package/dist/chunks/instance-error-message-BL_X7Af8.cjs.map +1 -0
- package/dist/chunks/member-profile-resolution-CJlgVdTR.js +44 -0
- package/dist/chunks/member-profile-resolution-CJlgVdTR.js.map +1 -0
- package/dist/chunks/member-profile-resolution-DiH-P-Vh.cjs +2 -0
- package/dist/chunks/member-profile-resolution-DiH-P-Vh.cjs.map +1 -0
- package/dist/chunks/{providers-CQWekD7_.js → providers-D35lBOTd.js} +2 -2
- package/dist/chunks/{providers-CQWekD7_.js.map → providers-D35lBOTd.js.map} +1 -1
- package/dist/chunks/{providers-VUOh6i0i.cjs → providers-Dz4Wqxr6.cjs} +2 -2
- package/dist/chunks/{providers-VUOh6i0i.cjs.map → providers-Dz4Wqxr6.cjs.map} +1 -1
- package/dist/chunks/{routes-config-C1j_vFKo.cjs → routes-config-BWjZDAU3.cjs} +2 -2
- package/dist/chunks/{routes-config-C1j_vFKo.cjs.map → routes-config-BWjZDAU3.cjs.map} +1 -1
- package/dist/chunks/{routes-config-BcNaWJWJ.js → routes-config-DjEOE9eP.js} +3 -2
- package/dist/chunks/{routes-config-BcNaWJWJ.js.map → routes-config-DjEOE9eP.js.map} +1 -1
- package/dist/chunks/users-C_Dtw_sR.cjs +2 -0
- package/dist/chunks/users-C_Dtw_sR.cjs.map +1 -0
- package/dist/chunks/users-wgM3TqU3.js +513 -0
- package/dist/chunks/users-wgM3TqU3.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/lib/routes-config.d.cts +2 -0
- package/dist/lib/routes-config.d.ts +2 -0
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.js +2 -2
- package/dist/pages/admin/stuck-instances/index.cjs +2 -0
- package/dist/pages/admin/stuck-instances/index.cjs.map +1 -0
- package/dist/pages/admin/stuck-instances/index.d.cts +4 -0
- package/dist/pages/admin/stuck-instances/index.d.ts +4 -0
- package/dist/pages/admin/stuck-instances/index.js +13 -0
- package/dist/pages/admin/stuck-instances/index.js.map +1 -0
- package/dist/pages/admin/users/index.cjs +1 -1
- package/dist/pages/admin/users/index.js +1 -1
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.js +1 -1
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.js +1 -1
- package/dist/views/admin/index.cjs +1 -1
- package/dist/views/admin/index.d.cts +1 -0
- package/dist/views/admin/index.d.ts +1 -0
- package/dist/views/admin/index.js +3 -2
- package/dist/views/admin/stuck-instances/AdminStuckInstancesView.d.cts +10 -0
- package/dist/views/admin/stuck-instances/AdminStuckInstancesView.d.ts +10 -0
- package/dist/views/admin/stuck-instances/StuckInstanceCancelModal.d.cts +14 -0
- package/dist/views/admin/stuck-instances/StuckInstanceCancelModal.d.ts +14 -0
- package/dist/views/admin/stuck-instances/index.cjs +2 -0
- package/dist/views/admin/stuck-instances/index.cjs.map +1 -0
- package/dist/views/admin/stuck-instances/index.d.cts +2 -0
- package/dist/views/admin/stuck-instances/index.d.ts +2 -0
- package/dist/views/admin/stuck-instances/index.js +237 -0
- package/dist/views/admin/stuck-instances/index.js.map +1 -0
- package/dist/views/admin/users/index.cjs +1 -1
- package/dist/views/admin/users/index.js +1 -1
- package/dist/views/cc/index.cjs +1 -1
- package/dist/views/cc/index.js +1 -1
- package/dist/views/dashboard/index.cjs +1 -1
- package/dist/views/dashboard/index.js +1 -1
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -1
- package/dist/views/forms/renderer/FormRendererView.d.cts +26 -1
- package/dist/views/forms/renderer/FormRendererView.d.ts +26 -1
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.js +1 -1
- package/dist/views/inbox/index.cjs +1 -1
- package/dist/views/inbox/index.js +1 -1
- package/dist/views/instances/approver-filled-form.d.cts +56 -20
- package/dist/views/instances/approver-filled-form.d.ts +56 -20
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +7 -0
- package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +7 -0
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +1 -1
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +1 -1
- package/dist/views/instances/new/index.cjs +1 -1
- package/dist/views/instances/new/index.js +5 -5
- package/dist/views/instances/new/index.js.map +1 -1
- package/dist/views/search/index.cjs +1 -1
- package/dist/views/search/index.js +1 -1
- package/dist/views/sent/index.cjs +1 -1
- package/dist/views/sent/index.js +1 -1
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.js +1 -1
- package/dist/views/templates/compose/steps/ComposeReviewStep.d.cts +3 -1
- package/dist/views/templates/compose/steps/ComposeReviewStep.d.ts +3 -1
- package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.cts +4 -1
- package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.ts +4 -1
- package/dist/views/templates/compose/use-template-compose-wizard.d.cts +3 -1
- package/dist/views/templates/compose/use-template-compose-wizard.d.ts +3 -1
- package/dist/views/templates/designer/TemplateDesignerView.d.cts +10 -1
- package/dist/views/templates/designer/TemplateDesignerView.d.ts +10 -1
- package/dist/views/templates/designer/approver-resolver-model.d.cts +31 -0
- package/dist/views/templates/designer/approver-resolver-model.d.ts +31 -0
- package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.cts +3 -1
- package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.ts +3 -1
- package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.cts +3 -2
- package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.ts +3 -2
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.js +1 -1
- package/dist/views/templates/designer/launch-mode.d.cts +19 -0
- package/dist/views/templates/designer/launch-mode.d.ts +19 -0
- package/dist/views/templates/designer/node-actor-resolver-options.d.cts +30 -3
- package/dist/views/templates/designer/node-actor-resolver-options.d.ts +30 -3
- package/dist/views/templates/designer/publish-default-value-check.d.cts +36 -0
- package/dist/views/templates/designer/publish-default-value-check.d.ts +36 -0
- package/dist/views/templates/index.cjs +1 -1
- package/dist/views/templates/index.js +1 -1
- package/dist/views/templates/versions/index.cjs +1 -1
- package/dist/views/templates/versions/index.js +1 -1
- package/package.json +23 -3
- package/dist/chunks/FormBuilderView-Bok4Y59D.cjs +0 -4
- package/dist/chunks/FormBuilderView-Bok4Y59D.cjs.map +0 -1
- package/dist/chunks/FormBuilderView-DbfbLZCI.js.map +0 -1
- package/dist/chunks/FormRendererView-CAyPXhPq.js +0 -1351
- package/dist/chunks/FormRendererView-CAyPXhPq.js.map +0 -1
- package/dist/chunks/FormRendererView-iLlHFIUR.cjs +0 -6
- package/dist/chunks/FormRendererView-iLlHFIUR.cjs.map +0 -1
- package/dist/chunks/compose-DP1N4twA.cjs +0 -2
- package/dist/chunks/compose-DP1N4twA.cjs.map +0 -1
- package/dist/chunks/compose-U1zs3Yof.js.map +0 -1
- package/dist/chunks/designer-CWL-dCQ_.cjs +0 -69
- package/dist/chunks/designer-CWL-dCQ_.cjs.map +0 -1
- package/dist/chunks/designer-DPG7R_WP.js.map +0 -1
- package/dist/chunks/detail-BUfsSal0.cjs +0 -5
- package/dist/chunks/detail-BUfsSal0.cjs.map +0 -1
- package/dist/chunks/detail-CHZDNNM6.js.map +0 -1
- package/dist/chunks/instance-error-message-BEM4O_Kj.js +0 -208
- package/dist/chunks/instance-error-message-BEM4O_Kj.js.map +0 -1
- package/dist/chunks/instance-error-message-BpCLCOjp.cjs +0 -2
- package/dist/chunks/instance-error-message-BpCLCOjp.cjs.map +0 -1
- package/dist/chunks/users-BBtiZ9QQ.js +0 -486
- package/dist/chunks/users-BBtiZ9QQ.js.map +0 -1
- package/dist/chunks/users-EqSzDhuj.cjs +0 -2
- package/dist/chunks/users-EqSzDhuj.cjs.map +0 -1
|
@@ -13,7 +13,7 @@ export type NodeActorStageChoice = Readonly<{
|
|
|
13
13
|
problems: readonly string[];
|
|
14
14
|
selected: readonly NodeActorOption[];
|
|
15
15
|
}>;
|
|
16
|
-
export declare const NO_UPSTREAM_USER_TASK_HINT = "\u9019\u500B\u7BC0\u9EDE\u524D\u9762\u6C92\u6709\u53EF\u4EE5\u9078\u7684\u7C3D\u6838\u95DC\u5361\uFF0C\u8ACB\u5148\u5728\u5B83\u524D\u9762\u52A0\u5165\u7C3D\u6838\u7BC0\u9EDE\uFF08\u6C92\u6709\u9032\u5165\u689D\u4EF6\u3001\u6C92\u8A2D\u8DF3\u904E\u6B64\u95DC\
|
|
16
|
+
export declare const NO_UPSTREAM_USER_TASK_HINT = "\u9019\u500B\u7BC0\u9EDE\u524D\u9762\u6C92\u6709\u53EF\u4EE5\u9078\u7684\u7C3D\u6838\u95DC\u5361\uFF0C\u8ACB\u5148\u5728\u5B83\u524D\u9762\u52A0\u5165\u7C3D\u6838\u7BC0\u9EDE\uFF08\u6C92\u6709\u9032\u5165\u689D\u4EF6\u3001\u6C92\u8A2D\u8DF3\u904E\u6B64\u95DC\u3001\u6C92\u8A2D\u903E\u6642\u81EA\u52D5\u6838\u51C6\uFF0C\u4E3B\u7BA1\u93C8\u4E5F\u6C92\u8A2D\u7565\u904E\uFF09";
|
|
17
17
|
/** The 關卡 picker's hint while the selection has no problem to report. */
|
|
18
18
|
export declare const NODE_ACTOR_STAGE_HINT = "\u7C3D\u6838\u4EBA\u53D6\u81EA\u4F60\u9078\u7684\u524D\u9762\u95DC\u5361\u5BE6\u969B\u7C3D\u6838\u7684\u4EBA\uFF1B\u53EF\u8907\u9078\uFF0C\u6574\u7D44\u8981\u6DB5\u84CB\u6BCF\u689D\u8DEF\u5F91\u3002\u8907\u9078\u591A\u500B\u95DC\u5361\u6642\uFF0C\u53D6\u6700\u8FD1\u5BE6\u969B\u8D70\u5230\u7684\u90A3\u4E00\u95DC\u7684\u7C3D\u6838\u4EBA\uFF0C\u4E0D\u662F\u5168\u90E8\u95DC\u5361\u7684\u7C3D\u6838\u4EBA\u3002";
|
|
19
19
|
/**
|
|
@@ -57,9 +57,9 @@ export declare function readOrgManagerChainStageChoice(definition: WorkflowDefin
|
|
|
57
57
|
*/
|
|
58
58
|
export declare function readNodeActorGraphIssues(definition: WorkflowDefinition): readonly string[];
|
|
59
59
|
/** The hint under the 不可與前面關卡同一人 picker while it has no problem to report. */
|
|
60
|
-
export declare const EXCLUDE_NODE_ACTORS_STAGE_HINT = "\u6B64\u95DC\u7684\u7C3D\u6838\u4EBA\u4E0D\u6703\u662F\u4F60\u9078\u7684\u524D\u9762\u95DC\u5361\u5BE6\u969B\u7C3D\u6838\u7684\u4EBA\uFF08\u542B\u5176\u4EE3\u7406\u4EBA\uFF09\uFF0C\u4E5F\u4E0D\u80FD\u88AB\u8F49\u7C3D\u6216\u52A0\u7C3D\u5230\u6B64\u95DC\uFF1B\u53EF\u8907\u9078\uFF0C\u6BCF\u500B\u95DC\u5361\u90FD\u6703\u6392\u9664\u3002\u53EA\u80FD\u9078\u6BCF\u689D\u8DEF\u5F91\u90FD\u6703\u7D93\u904E\u3001\u800C\u4E14\u4E00\u5B9A\u6709\u4EBA\u5BE6\u969B\u7C3D\u6838\u7684\u95DC\u5361\uFF08\u6C92\u6709\u9032\u5165\u689D\u4EF6\u3001\u6C92\u8A2D\u8DF3\u904E\u6B64\u95DC\u3001\u6C92\u8A2D\u903E\u6642\u81EA\u52D5\u6838\u51C6\uFF09\uFF1B\u689D\u4EF6\u5F0F\u7684\u95DC\u5361\u3001\u5E73\u884C\u5206\u652F\u4E0A\u7684\u95DC\u5361\u90FD\u4E0D\u652F\u63F4\uFF0C\u689D\u4EF6\u5F0F\u7684\u8ACB\u6539\u7528\u5206\u6D41\u628A\u5169\u95DC\u653E\u5728\u540C\u4E00\u689D\u8DEF\u7DDA\u4E0A\uFF0C\u5E73\u884C\u5206\u652F\u4E0A\u7684\u8ACB\u6539\u6210\u5148\u5F8C\u4E32\u63A5\u3002";
|
|
60
|
+
export declare const EXCLUDE_NODE_ACTORS_STAGE_HINT = "\u6B64\u95DC\u7684\u7C3D\u6838\u4EBA\u4E0D\u6703\u662F\u4F60\u9078\u7684\u524D\u9762\u95DC\u5361\u5BE6\u969B\u7C3D\u6838\u7684\u4EBA\uFF08\u542B\u5176\u4EE3\u7406\u4EBA\uFF09\uFF0C\u4E5F\u4E0D\u80FD\u88AB\u8F49\u7C3D\u6216\u52A0\u7C3D\u5230\u6B64\u95DC\uFF1B\u53EF\u8907\u9078\uFF0C\u6BCF\u500B\u95DC\u5361\u90FD\u6703\u6392\u9664\u3002\u53EA\u80FD\u9078\u6BCF\u689D\u8DEF\u5F91\u90FD\u6703\u7D93\u904E\u3001\u800C\u4E14\u4E00\u5B9A\u6709\u4EBA\u5BE6\u969B\u7C3D\u6838\u7684\u95DC\u5361\uFF08\u6C92\u6709\u9032\u5165\u689D\u4EF6\u3001\u6C92\u8A2D\u8DF3\u904E\u6B64\u95DC\u3001\u6C92\u8A2D\u903E\u6642\u81EA\u52D5\u6838\u51C6\uFF0C\u4E3B\u7BA1\u93C8\u4E5F\u6C92\u8A2D\u7565\u904E\uFF09\uFF1B\u689D\u4EF6\u5F0F\u7684\u95DC\u5361\u3001\u5E73\u884C\u5206\u652F\u4E0A\u7684\u95DC\u5361\u90FD\u4E0D\u652F\u63F4\uFF0C\u689D\u4EF6\u5F0F\u7684\u8ACB\u6539\u7528\u5206\u6D41\u628A\u5169\u95DC\u653E\u5728\u540C\u4E00\u689D\u8DEF\u7DDA\u4E0A\uFF0C\u5E73\u884C\u5206\u652F\u4E0A\u7684\u8ACB\u6539\u6210\u5148\u5F8C\u4E32\u63A5\u3002";
|
|
61
61
|
/** Shown when no earlier stage can be picked. */
|
|
62
|
-
export declare const NO_EXCLUDABLE_STAGE_HINT = "\u9019\u500B\u7BC0\u9EDE\u524D\u9762\u6C92\u6709\u53EF\u4EE5\u9078\u7684\u7C3D\u6838\u95DC\u5361\uFF0C\u8ACB\u5148\u5728\u5B83\u524D\u9762\u52A0\u5165\u7C3D\u6838\u7BC0\u9EDE\uFF08\u6BCF\u689D\u8DEF\u5F91\u90FD\u6703\u7D93\u904E\u3001\u6C92\u6709\u9032\u5165\u689D\u4EF6\u3001\u6C92\u8A2D\u8DF3\u904E\u6B64\u95DC\
|
|
62
|
+
export declare const NO_EXCLUDABLE_STAGE_HINT = "\u9019\u500B\u7BC0\u9EDE\u524D\u9762\u6C92\u6709\u53EF\u4EE5\u9078\u7684\u7C3D\u6838\u95DC\u5361\uFF0C\u8ACB\u5148\u5728\u5B83\u524D\u9762\u52A0\u5165\u7C3D\u6838\u7BC0\u9EDE\uFF08\u6BCF\u689D\u8DEF\u5F91\u90FD\u6703\u7D93\u904E\u3001\u6C92\u6709\u9032\u5165\u689D\u4EF6\u3001\u6C92\u8A2D\u8DF3\u904E\u6B64\u95DC\u3001\u6C92\u8A2D\u903E\u6642\u81EA\u52D5\u6838\u51C6\uFF0C\u4E3B\u7BA1\u93C8\u4E5F\u6C92\u8A2D\u7565\u904E\uFF09";
|
|
63
63
|
/**
|
|
64
64
|
* The 不可與前面關卡同一人 picker: the user tasks that pass the publish
|
|
65
65
|
* check on their own (`readExcludeNodeActorsIssues` with just that stage
|
|
@@ -79,3 +79,30 @@ export declare function readExcludeNodeActorStageChoice(definition: WorkflowDefi
|
|
|
79
79
|
* which blocks saving.
|
|
80
80
|
*/
|
|
81
81
|
export declare function readExcludeNodeActorsGraphIssues(definition: WorkflowDefinition): readonly string[];
|
|
82
|
+
export type ChainContinuationSourceChoice = Readonly<{
|
|
83
|
+
/** The upstream manager chains that can be continued, plus a stale stored choice. */
|
|
84
|
+
options: readonly NodeActorOption[];
|
|
85
|
+
/** Live problems of the stored choice (the publish check's own lines). */
|
|
86
|
+
problems: readonly string[];
|
|
87
|
+
selected: NodeActorOption | null;
|
|
88
|
+
}>;
|
|
89
|
+
/** Shown when no upstream manager chain can be continued. */
|
|
90
|
+
export declare const NO_CONTINUABLE_CHAIN_HINT = "\u9019\u500B\u7BC0\u9EDE\u524D\u9762\u6C92\u6709\u53EF\u4EE5\u63A5\u7E8C\u7684\u4E3B\u7BA1\u93C8\u95DC\u5361\uFF1B\u9700\u8981\u662F\u6BCF\u689D\u8DEF\u5F91\u90FD\u6703\u7D93\u904E\u3001\u8D77\u9EDE\u70BA\u7533\u8ACB\u4EBA\u6216\u524D\u9762\u95DC\u5361\u7C3D\u6838\u8005\u3001\u672C\u8EAB\u4E0D\u662F\u63A5\u7E8C\u578B\u3001\u6C92\u6709\u9032\u5165\u689D\u4EF6\u3001\u4E5F\u6C92\u8A2D\u8DF3\u904E\u6B64\u95DC\u7684\u300C\u6CBF\u4E3B\u7BA1\u93C8\u7C3D\u6838\u300D\u95DC\u5361\u3002";
|
|
91
|
+
/**
|
|
92
|
+
* The 接續哪一關 picker of a manager chain that continues an earlier one: the
|
|
93
|
+
* manager-chain stages for which `readChainContinuationSourceIssues` has
|
|
94
|
+
* nothing to say when `nodeId` continues them (at an unreachably high level, so
|
|
95
|
+
* the level rule never decides). Judged by the shared check itself, not by
|
|
96
|
+
* matching strings, so the list cannot drift from the publish lint. A stage with
|
|
97
|
+
* 起點本人已達簽到職等時略過 is still offered: the engine reads its skip record.
|
|
98
|
+
* A stored stage that does not qualify stays in the list, marked, and the
|
|
99
|
+
* `problems` say why, so the stored choice is never dropped silently.
|
|
100
|
+
*/
|
|
101
|
+
export declare function readChainContinuationSourceChoice(definition: WorkflowDefinition, nodeId: string, selectedId: string | null): ChainContinuationSourceChoice;
|
|
102
|
+
/**
|
|
103
|
+
* The graph problems of every manager chain that continues an earlier one,
|
|
104
|
+
* naming the node: the checks the backend publish lint runs
|
|
105
|
+
* (`readChainContinuationSourceIssues`), for the designer to show before
|
|
106
|
+
* publish. A missing stage id is left to `readOrgManagerChainIssue`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function readChainContinuationGraphIssues(definition: WorkflowDefinition): readonly string[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FormDataSourceResolveResultRecord, PreviewResolveFormFieldOptionsInput } from '@rytass/bpm-core-client/form';
|
|
2
|
+
import { FormDefinitionSchema, FormFieldValue, FormUiSchema } from '@rytass/bpm-core-shared/form';
|
|
3
|
+
export type PublishDefaultValueNoticeStatus = 'UNRESOLVED' | 'CHECK_FAILED';
|
|
4
|
+
export interface PublishDefaultValueNotice {
|
|
5
|
+
readonly fieldKey: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly status: PublishDefaultValueNoticeStatus;
|
|
8
|
+
/** The default values the source no longer offers (empty on CHECK_FAILED). */
|
|
9
|
+
readonly values: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export type PreviewResolveFormFieldOptions = (input: PreviewResolveFormFieldOptionsInput) => Promise<FormDataSourceResolveResultRecord>;
|
|
12
|
+
/**
|
|
13
|
+
* Reads a saved option default as the strings the data source is asked about.
|
|
14
|
+
* An empty string is "no value", not a value the source should be asked for.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readDefaultValueStrings(value: FormFieldValue | undefined): readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Checks, without blocking, that each top-level dynamic option field's default
|
|
19
|
+
* is still offered by its data source (ADR 27 §8). Only fields with no
|
|
20
|
+
* dependency binding are checked: a dependent field may not carry a default at
|
|
21
|
+
* all (the form validator rejects it), and its options cannot be known before
|
|
22
|
+
* a respondent fills the other fields in.
|
|
23
|
+
*
|
|
24
|
+
* Never throws. A failed lookup comes back as a `CHECK_FAILED` notice so the
|
|
25
|
+
* publish that already succeeded is not reported as a failure.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readPublishDefaultValueNotices(input: {
|
|
28
|
+
readonly preview: PreviewResolveFormFieldOptions;
|
|
29
|
+
readonly schema: FormDefinitionSchema;
|
|
30
|
+
readonly uiSchema: FormUiSchema;
|
|
31
|
+
}): Promise<readonly PublishDefaultValueNotice[]>;
|
|
32
|
+
/**
|
|
33
|
+
* One line for the designer. The publish has already succeeded when this shows,
|
|
34
|
+
* so the text tells the author what to fix in the form, not that publish failed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readPublishDefaultValueNoticeMessage(notice: PublishDefaultValueNotice): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FormDataSourceResolveResultRecord, PreviewResolveFormFieldOptionsInput } from '@rytass/bpm-core-client/form';
|
|
2
|
+
import { FormDefinitionSchema, FormFieldValue, FormUiSchema } from '@rytass/bpm-core-shared/form';
|
|
3
|
+
export type PublishDefaultValueNoticeStatus = 'UNRESOLVED' | 'CHECK_FAILED';
|
|
4
|
+
export interface PublishDefaultValueNotice {
|
|
5
|
+
readonly fieldKey: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly status: PublishDefaultValueNoticeStatus;
|
|
8
|
+
/** The default values the source no longer offers (empty on CHECK_FAILED). */
|
|
9
|
+
readonly values: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export type PreviewResolveFormFieldOptions = (input: PreviewResolveFormFieldOptionsInput) => Promise<FormDataSourceResolveResultRecord>;
|
|
12
|
+
/**
|
|
13
|
+
* Reads a saved option default as the strings the data source is asked about.
|
|
14
|
+
* An empty string is "no value", not a value the source should be asked for.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readDefaultValueStrings(value: FormFieldValue | undefined): readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Checks, without blocking, that each top-level dynamic option field's default
|
|
19
|
+
* is still offered by its data source (ADR 27 §8). Only fields with no
|
|
20
|
+
* dependency binding are checked: a dependent field may not carry a default at
|
|
21
|
+
* all (the form validator rejects it), and its options cannot be known before
|
|
22
|
+
* a respondent fills the other fields in.
|
|
23
|
+
*
|
|
24
|
+
* Never throws. A failed lookup comes back as a `CHECK_FAILED` notice so the
|
|
25
|
+
* publish that already succeeded is not reported as a failure.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readPublishDefaultValueNotices(input: {
|
|
28
|
+
readonly preview: PreviewResolveFormFieldOptions;
|
|
29
|
+
readonly schema: FormDefinitionSchema;
|
|
30
|
+
readonly uiSchema: FormUiSchema;
|
|
31
|
+
}): Promise<readonly PublishDefaultValueNotice[]>;
|
|
32
|
+
/**
|
|
33
|
+
* One line for the designer. The publish has already succeeded when this shows,
|
|
34
|
+
* so the text tells the author what to fix in the form, not that publish failed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readPublishDefaultValueNoticeMessage(notice: PublishDefaultValueNotice): string;
|
|
@@ -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/categories-CyyqG6wG.cjs"),n=require("../../chunks/format-date-time-D-cx5M8z.cjs"),r=require("../../chunks/router-adapter--gYs13E8.cjs"),i=require("../../chunks/routes-config-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../chunks/categories-CyyqG6wG.cjs"),n=require("../../chunks/format-date-time-D-cx5M8z.cjs"),r=require("../../chunks/router-adapter--gYs13E8.cjs"),i=require("../../chunks/routes-config-BWjZDAU3.cjs"),a=require("./versions/index.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/core/form"),d=require("@mezzanine-ui/react/ContentHeader");d=e.t(d,1);let f=require("@rytass/bpm-core-client/template"),p=require("@mezzanine-ui/icons");var m=[10,20,50],h=[{key:`ALL`,label:`全部`},{key:`PUBLISHED`,label:`已發布`},{key:`DRAFT`,label:`草稿`}],g=100;function _(){let e=r.r(),a=i.r(),[_,O]=(0,o.useState)([]),[k,A]=(0,o.useState)(C),[j,M]=(0,o.useState)([]),[N,P]=(0,o.useState)(new Set),[F,I]=(0,o.useState)(null),[L,R]=(0,o.useState)(!0),[z,B]=(0,o.useState)(1),[V,H]=(0,o.useState)(10),[U,W]=(0,o.useState)(``),[G,K]=(0,o.useState)(`ALL`),[q,J]=(0,o.useState)(0),[Y,X]=(0,o.useState)(null),Z=(0,o.useRef)(0),Q=(0,o.useCallback)(async()=>{let e=Z.current+1;Z.current=e,R(!0),I(null),P(new Set),(0,l.listLaunchableTemplates)().then(t=>{e===Z.current&&P(new Set(t.map(e=>e.id)))}).catch(()=>{e===Z.current&&P(new Set)});try{let[t,n]=await Promise.all([(0,f.listApprovalTemplatesPage)({categoryId:k.categoryId,page:z,pageSize:V,searchText:U,status:G===`ALL`?null:G}),(0,f.listApprovalTemplateCategoriesPage)({page:1,pageSize:g,searchText:``,status:`ACTIVE`})]);if(e!==Z.current)return;M([...n.categories.map(w)]),O(t.templates),J(t.totalCount)}catch(t){e===Z.current&&I(v(t))}finally{e===Z.current&&R(!1)}},[k,z,V,U,G]);(0,o.useEffect)(()=>{Q()},[Q]);let $=(0,o.useCallback)(async e=>{X(e.id),I(null);try{await(e.isActive?(0,f.deactivateApprovalTemplate)(e.id):(0,f.activateApprovalTemplate)(e.id)),await Q()}catch(e){I(v(e))}finally{X(null)}},[Q]),ee=(0,o.useMemo)(()=>_.map(e=>({...e,categoryLabel:D(e),key:e.id,status:e.currentVersionId?`PUBLISHED`:`DRAFT`,updatedAt:n.t(e.updatedAt)})),[_]),te=(0,o.useMemo)(()=>[{dataIndex:`name`,key:`name`,title:`模板名稱`,width:220},{key:`status`,render:e=>(0,c.jsx)(b,{status:e.status}),title:`狀態`,width:120},{key:`isActive`,render:e=>(0,c.jsx)(x,{isActive:e.isActive}),title:`服務狀態`,width:120},{key:`category`,render:e=>(0,c.jsx)(S,{record:e}),title:`分類`,width:160},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:220}],[]),ne=(0,o.useMemo)(()=>({render:t=>[{disabled:e=>!N.has(e.id),name:`發起`,onClick:()=>e.push(a.caseNew(t.id)),variant:`base-primary`},{name:`設計`,onClick:()=>e.push(a.templateDesigner(t.id))},{name:`版本`,onClick:()=>e.push(a.templateVersions(t.id))},{disabled:e=>Y===e.id,name:t.isActive?`停用`:`啟用`,onClick:e=>{$(e)},variant:t.isActive?`destructive-secondary`:`base-secondary`}],variant:`base-secondary`,width:264}),[Y,N,e,$]);return(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.PageHeader,{children:(0,c.jsx)(d.default,{description:`建立流程模板、維護草稿與發布版本。`,title:`簽核模板`,children:(0,c.jsx)(s.Button,{icon:p.PlusIcon,iconType:`leading`,onClick:()=>e.push(a.templateCompose()),variant:`base-primary`,children:`建立模板`})})}),(0,c.jsx)(s.SectionGroup,{children:(0,c.jsxs)(s.Section,{filterArea:(0,c.jsx)(s.FilterArea,{className:t.n.templateFilterArea,size:`sub`,children:(0,c.jsxs)(s.FilterLine,{children:[(0,c.jsx)(s.Filter,{span:3,children:(0,c.jsx)(s.FormField,{fullWidth:!0,layout:u.FormFieldLayout.VERTICAL,name:`templateSearchText`,children:(0,c.jsx)(s.Input,{fullWidth:!0,onChange:e=>{W(e.target.value),B(1)},placeholder:`關鍵字:搜尋模板名稱、分類或描述`,size:`sub`,value:U,variant:`base`})})}),(0,c.jsx)(s.Filter,{span:2,children:(0,c.jsx)(s.FormField,{fullWidth:!0,layout:u.FormFieldLayout.VERTICAL,name:`templateCategoryFilter`,children:(0,c.jsx)(s.Select,{clearable:!1,fullWidth:!0,onChange:e=>{A(T(e,j)),B(1)},options:[C,...j],placeholder:`分類`,renderValue:e=>`分類:${E(e)}`,size:`sub`,value:k})})})]})}),tab:(0,c.jsx)(s.Tab,{activeKey:G,onChange:e=>{K(y(e)),B(1)},children:h.map(e=>(0,c.jsx)(s.TabItem,{children:e.label},e.key))}),children:[F?(0,c.jsx)(s.Typography,{color:`text-error`,variant:`body`,children:F}):null,(0,c.jsx)(s.Table,{actions:ne,columns:te,dataSource:ee,fullWidth:!0,loading:L,pagination:{current:z,onChange:e=>{B(e)},onChangePageSize:e=>{B(1),H(e)},pageSize:V,pageSizeLabel:`每頁筆數`,pageSizeOptions:m,renderResultSummary:(e,t,n)=>`顯示 ${e}-${t} 筆,共 ${n} 筆`,showPageSizeOptions:!0,total:q}})]})})]})})}function v(e){return e instanceof Error?e.message:`發生未知錯誤`}function y(e){return e===`PUBLISHED`||e===`DRAFT`?e:`ALL`}function b({status:e}){return e===`PUBLISHED`?(0,c.jsx)(s.Badge,{size:`sub`,text:`已發布`,variant:`dot-success`}):(0,c.jsx)(s.Badge,{size:`sub`,text:`草稿`,variant:`dot-inactive`})}function x({isActive:e}){return e?(0,c.jsx)(s.Badge,{size:`sub`,text:`啟用中`,variant:`dot-success`}):(0,c.jsx)(s.Badge,{size:`sub`,text:`已停用`,variant:`dot-inactive`})}function S({record:e}){return e.categoryDetail?.isActive===!1?(0,c.jsx)(s.Badge,{size:`sub`,text:`${e.categoryLabel}(停用)`,variant:`dot-inactive`}):(0,c.jsx)(s.Typography,{component:`span`,variant:`body`,children:e.categoryLabel})}var C={categoryId:null,id:`ALL_CATEGORIES`,name:`全部分類`};function w(e){return{categoryId:e.id,id:e.id,name:e.name}}function T(e,t){if(!O(e))return C;let n=typeof e.id==`string`?e.id:null;return n===C.id?C:t.find(e=>e.id===n)??C}function E(e){return Array.isArray(e)||!O(e)?C.name:typeof e.name==`string`?e.name:C.name}function D(e){return e.categoryDetail?.name??e.category??`未分類`}function O(e){return typeof e==`object`&&!!e}exports.TemplateCategoriesView=t.t,exports.TemplateVersionsView=a.TemplateVersionsView,exports.TemplatesView=_;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { n as e, t } from "../../chunks/categories-f7E-RJEc.js";
|
|
3
3
|
import { t as n } from "../../chunks/format-date-time-B0LdmWg4.js";
|
|
4
4
|
import { r as ee } from "../../chunks/router-adapter-CkxCyzf5.js";
|
|
5
|
-
import { r as te } from "../../chunks/routes-config-
|
|
5
|
+
import { r as te } from "../../chunks/routes-config-DjEOE9eP.js";
|
|
6
6
|
import { TemplateVersionsView as r } from "./versions/index.js";
|
|
7
7
|
import { useCallback as i, useEffect as ne, useMemo as a, useRef as o, useState as s } from "react";
|
|
8
8
|
import { Badge as c, Button as re, Filter as l, FilterArea as ie, FilterLine as u, FormField as d, Input as f, PageHeader as p, Section as m, SectionGroup as h, Select as ae, Tab as oe, TabItem as se, Table as ce, Typography as g } from "@mezzanine-ui/react";
|
|
@@ -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/router-adapter--gYs13E8.cjs"),n=require("../../../chunks/routes-config-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunks/rolldown-runtime-BocRIvOZ.cjs"),t=require("../../../chunks/router-adapter--gYs13E8.cjs"),n=require("../../../chunks/routes-config-BWjZDAU3.cjs"),r=require("../../../chunks/format-date-time-D-cx5M8z.cjs");let i=require("react"),a=require("@mezzanine-ui/react"),o=require("react/jsx-runtime"),s=require("@mezzanine-ui/react/ContentHeader");s=e.t(s,1);let c=require("@rytass/bpm-core-client/template");function l({templateId:e}){let l=t.r(),d=n.r(),[f,p]=(0,i.useState)(null),[m,h]=(0,i.useState)(null),[g,_]=(0,i.useState)(!0),[v,y]=(0,i.useState)(!1);(0,i.useEffect)(()=>{C()},[e]);let b=(0,i.useMemo)(()=>(f?.versions??[]).map(e=>({formVersion:f?.formVersions.find(t=>t.id===e.formDefinitionVersionId)?.label??`未綁定`,key:e.id,publishedAt:r.t(e.publishedAt),status:e.status,updatedAt:r.t(e.updatedAt),version:`v${e.version}`,versionId:e.id})),[f]),x=(0,i.useMemo)(()=>[{dataIndex:`version`,key:`version`,title:`版本`,width:100},{dataIndex:`status`,key:`status`,title:`狀態`,width:140},{dataIndex:`formVersion`,key:`formVersion`,title:`表單版本`,width:220},{dataIndex:`publishedAt`,key:`publishedAt`,title:`發布時間`,width:200},{dataIndex:`updatedAt`,key:`updatedAt`,title:`更新時間`,width:200}],[]),S=(0,i.useMemo)(()=>({render:e=>[{disabled:()=>v||e.status===`DRAFT`,name:`Rollback`,onClick:()=>void w(e.versionId)}],variant:`base-secondary`,width:104}),[v]);async function C(){_(!0),h(null);try{p(await(0,c.readTemplateDesigner)(e))}catch(e){h(u(e))}finally{_(!1)}}async function w(e){y(!0),h(null);try{await(0,c.rollbackApprovalTemplateVersion)(e),await C()}catch(e){h(u(e))}finally{y(!1)}}return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.PageHeader,{children:(0,o.jsx)(s.default,{description:`查看發布、歸檔與 rollback 狀態。`,onBackClick:()=>l.push(d.templates()),title:f?.template.name??`模板版本`})}),(0,o.jsx)(a.SectionGroup,{children:(0,o.jsxs)(a.Section,{children:[m?(0,o.jsx)(a.Typography,{color:`text-error`,variant:`body`,children:m}):null,(0,o.jsx)(a.Table,{actions:S,columns:x,dataSource:b,fullWidth:!0,loading:g})]})})]})}function u(e){return e instanceof Error?e.message:`發生未知錯誤`}exports.TemplateVersionsView=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { r as e } from "../../../chunks/router-adapter-CkxCyzf5.js";
|
|
3
|
-
import { r as t } from "../../../chunks/routes-config-
|
|
3
|
+
import { r as t } from "../../../chunks/routes-config-DjEOE9eP.js";
|
|
4
4
|
import { t as n } from "../../../chunks/format-date-time-B0LdmWg4.js";
|
|
5
5
|
import { useEffect as r, useMemo as i, useState as a } from "react";
|
|
6
6
|
import { PageHeader as o, Section as s, SectionGroup as c, Table as l, Typography as u } from "@mezzanine-ui/react";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rytass/bpm-core-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "BPM approval workflow React components and views for the Rytass BPM stack. Ships AuthProvider, NotificationDrawer + bell widget, host-facing hooks (useBPMMember / useBPMLogout / useBPMRoutes), and full page-body views for inbox / instances / templates / forms / admin / settings on top of Mezzanine UI and the BPM client functions. The host owns the navigation shell — BPM does not bundle a layout.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bpm",
|
|
@@ -326,6 +326,16 @@
|
|
|
326
326
|
"default": "./dist/views/admin/webhook-endpoints/index.cjs"
|
|
327
327
|
}
|
|
328
328
|
},
|
|
329
|
+
"./views/admin/stuck-instances": {
|
|
330
|
+
"import": {
|
|
331
|
+
"types": "./dist/views/admin/stuck-instances/index.d.ts",
|
|
332
|
+
"default": "./dist/views/admin/stuck-instances/index.js"
|
|
333
|
+
},
|
|
334
|
+
"require": {
|
|
335
|
+
"types": "./dist/views/admin/stuck-instances/index.d.cts",
|
|
336
|
+
"default": "./dist/views/admin/stuck-instances/index.cjs"
|
|
337
|
+
}
|
|
338
|
+
},
|
|
329
339
|
"./pages/root": {
|
|
330
340
|
"import": {
|
|
331
341
|
"types": "./dist/pages/root/index.d.ts",
|
|
@@ -525,6 +535,16 @@
|
|
|
525
535
|
"types": "./dist/pages/admin/webhook-endpoints/index.d.cts",
|
|
526
536
|
"default": "./dist/pages/admin/webhook-endpoints/index.cjs"
|
|
527
537
|
}
|
|
538
|
+
},
|
|
539
|
+
"./pages/admin/stuck-instances": {
|
|
540
|
+
"import": {
|
|
541
|
+
"types": "./dist/pages/admin/stuck-instances/index.d.ts",
|
|
542
|
+
"default": "./dist/pages/admin/stuck-instances/index.js"
|
|
543
|
+
},
|
|
544
|
+
"require": {
|
|
545
|
+
"types": "./dist/pages/admin/stuck-instances/index.d.cts",
|
|
546
|
+
"default": "./dist/pages/admin/stuck-instances/index.cjs"
|
|
547
|
+
}
|
|
528
548
|
}
|
|
529
549
|
},
|
|
530
550
|
"peerDependencies": {
|
|
@@ -536,8 +556,8 @@
|
|
|
536
556
|
"@mezzanine-ui/core": ">=1.0.0",
|
|
537
557
|
"@mezzanine-ui/icons": ">=1.0.0",
|
|
538
558
|
"@mezzanine-ui/react": ">=1.0.0",
|
|
539
|
-
"@rytass/bpm-core-client": "^0.
|
|
540
|
-
"@rytass/bpm-core-shared": "^0.
|
|
559
|
+
"@rytass/bpm-core-client": "^0.24.0",
|
|
560
|
+
"@rytass/bpm-core-shared": "^0.24.0",
|
|
541
561
|
"@uiw/react-codemirror": ">=4.0.0",
|
|
542
562
|
"@xyflow/react": ">=12.0.0",
|
|
543
563
|
"ai": ">=6.0.0",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use client";const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./bpm-form-field-Bc6k4ZEO.cjs"),n=require("./FormRendererView-iLlHFIUR.cjs");let r=require("react"),i=require("@mezzanine-ui/react"),a=require("react/jsx-runtime"),o=require("@rytass/bpm-core-client/workflow"),s=require("@rytass/bpm-core-shared"),c=require("@mezzanine-ui/core/form"),l=require("@rytass/bpm-core-client/template"),u=require("@rytass/bpm-core-client/form"),d=require("@mezzanine-ui/icons"),f=require("@rytass/bpm-core-shared/form"),p=require("@hello-pangea/dnd"),m=require("next/dynamic");m=e.t(m,1);let h=require("@codemirror/lang-json"),g=require("@codemirror/view");var ee={alignItems:`center`,border:`1px solid var(--mzn-color-border-neutral)`,borderRadius:4,color:`var(--mzn-color-text-neutral)`,display:`flex`,minHeight:160,padding:12,width:`100%`},te=[(0,h.json)(),g.EditorView.lineWrapping,g.EditorView.theme({"&":{border:`1px solid var(--mzn-color-border-neutral)`,borderRadius:`4px`,fontSize:`13px`,width:`100%`},"&.cm-focused":{outline:`1px solid var(--mzn-color-border-primary)`},".cm-content":{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,minHeight:`100%`},".cm-editor":{width:`100%`},".cm-gutters":{borderRight:`1px solid var(--mzn-color-border-neutral)`},".cm-scroller":{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`}})],_=(0,m.default)(()=>import(`@uiw/react-codemirror`),{loading:()=>(0,a.jsx)(`div`,{style:ee,children:`載入 JSON 編輯器`}),ssr:!1});function ne({disabled:e=!1,height:t,name:n,onChange:r,placeholder:i,value:o}){return(0,a.jsx)(_,{"aria-label":n,basicSetup:{autocompletion:!0,bracketMatching:!0,closeBrackets:!0,defaultKeymap:!0,foldGutter:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,lineNumbers:!0,syntaxHighlighting:!0},editable:!e,extensions:[...te],height:t,indentWithTab:!1,onChange:r,placeholder:i,readOnly:e,theme:`light`,value:o,width:`100%`})}var re=[{description:`單行文字、姓名、編號`,icon:d.AlignLeftIcon,label:`文字`,type:`text`},{description:`多行補充內容`,icon:d.FileIcon,label:`長文字`,type:`textarea`},{description:`金額、數量、分數`,icon:d.CurrencyDollarIcon,label:`數字`,type:`number`},{description:`金額與費用`,icon:d.CurrencyDollarIcon,label:`金額`,type:`money`},{description:`日期或到期日`,icon:d.CalendarIcon,label:`日期`,type:`date`},{description:`日期與時間`,icon:d.CalendarIcon,label:`日期時間`,type:`datetime`},{description:`是 / 否狀態`,icon:d.CheckedIcon,label:`開關`,type:`boolean`},{description:`固定選項擇一`,icon:d.ListIcon,label:`下拉選單`,type:`select`},{description:`可搜尋的固定選項`,icon:d.ListIcon,label:`自動完成`,type:`autocomplete`},{description:`固定選項單選`,icon:d.DotGridIcon,label:`單選`,type:`radio`},{description:`固定選項複選`,icon:d.CheckedOutlineIcon,label:`複選`,type:`checkbox`},{description:`附件或佐證資料`,icon:d.FileAttachmentIcon,label:`附件`,type:`file_upload`},{description:`從成員名單挑選一或多位人員`,icon:d.UserIcon,label:`人員選擇`,type:`member`},{description:`從組織圖挑選一個組織`,icon:d.FolderIcon,label:`組織選擇`,type:`org_unit`},{description:`多列多欄明細`,icon:d.DotGridIcon,label:`表格`,type:`table`}],v=re.filter(e=>(0,f.isTableColumnFieldType)(e.type)).map(e=>({id:e.type,name:e.label})),ie={alignItems:`start`,display:`flex`,flexWrap:`wrap`,gap:16},ae={flex:`0.55 1 300px`,minWidth:0},oe={flex:`1.45 1 720px`,minWidth:620,paddingBottom:260},se=240,ce={BOOLEAN:`開關`,NUMBER:`數字`,STRING:`文字或選單`,STRING_ARRAY:`多選`},le=/^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings missing required parameter: (.+)$/u,ue=/^schema\.fields\[(\d+)\](?:\.columns\[(\d+)\])?\.dataSource\.bindings unknown parameter: (.+)$/u,y={display:`grid`,gap:12},de={display:`flex`,flexWrap:`wrap`,gap:6},fe={flex:`0 0 auto`,whiteSpace:`nowrap`},pe={display:`grid`,gap:8},me={alignItems:`center`,cursor:`grab`,display:`flex`,gap:12,touchAction:`none`},he={display:`grid`,flex:`1 1 auto`,gap:2,minWidth:0},ge={alignItems:`center`,display:`flex`,flex:`0 0 auto`,gap:4},_e={alignItems:`center`,display:`flex`,gap:6},ve={cursor:`pointer`,userSelect:`none`},ye={filter:`drop-shadow(0 8px 18px rgba(0, 0, 0, 0.12))`},be={backgroundColor:`color-mix(in srgb, var(--mzn-color-primary) 8%, var(--mzn-color-bg-surface))`,boxShadow:`inset 0 0 0 1px var(--mzn-color-border-primary)`},xe={alignItems:`center`,border:`1px dashed var(--mzn-color-border-neutral)`,borderRadius:6,display:`grid`,gap:12,minHeight:240,padding:32,textAlign:`center`},Se={display:`flex`,gap:8,justifyContent:`center`},Ce={display:`grid`,gap:14},we={display:`grid`,columnGap:16,gridTemplateColumns:`repeat(auto-fit, minmax(280px, 360px))`,justifyContent:`start`,maxWidth:736,rowGap:8},Te={gridColumn:`1 / -1`},Ee={alignItems:`center`,display:`flex`,gap:8,gridColumn:`1 / -1`,justifyContent:`flex-end`},b={gridColumn:`1 / -1`},De={alignItems:`start`,display:`block`,width:`100%`},Oe={...De,gridColumn:`1 / -1`},ke={minWidth:0,width:`100%`},Ae={minWidth:`100%`,width:`100%`},je={display:`grid`,gap:14},Me={alignItems:`start`,display:`block`,width:`100%`},Ne={minWidth:0,width:`100%`},Pe={gridColumn:`2 / -1`},Fe={display:`grid`,gap:10,width:`100%`},Ie={display:`grid`,gap:8,gridTemplateColumns:`repeat(auto-fit, minmax(160px, 1fr))`},Le={display:`inline-flex`},Re={display:`grid`,gap:16},ze={display:`grid`,gap:8},Be={display:`flex`,justifyContent:`flex-end`},Ve={color:`var(--mzn-color-text-error)`,fontSize:`0.72em`,lineHeight:0,marginLeft:2,verticalAlign:`super`},He={display:`grid`,gap:10,gridColumn:`1 / -1`},Ue={display:`grid`,gap:2},x={display:`grid`,gap:8},We={display:`flex`,justifyContent:`flex-start`},Ge={display:`flex`,flexWrap:`wrap`,gap:4},Ke={backgroundColor:`var(--mzn-color-bg-surface-secondary)`,borderRadius:6,display:`grid`,gap:4,padding:10},qe={...we,gridTemplateColumns:`minmax(280px, 520px)`,padding:`4px 0 8px`},Je={display:`grid`,gap:8,gridColumn:`1 / -1`},Ye={alignItems:`center`,display:`flex`,gap:12,justifyContent:`space-between`},Xe={alignItems:`baseline`,display:`flex`,gap:2},Ze={display:`grid`,gap:4};function Qe(e){e&&(e.style.width=`100%`)}var $e={fields:[],schemaVersion:1},et={layout:[],schemaVersion:1},S=`__STATIC_OPTIONS__`,C=`__CONSTANT__`,w=`__EXPRESSION__`,T=`__UNSUPPORTED__`,tt=`__ROW_FIELD__:`,nt=`__UNBOUND__`,rt=[{id:S,name:`靜態選項`}],it=[{id:`single`,name:`單選`},{id:`multiple`,name:`複選`}],at=[{id:`unset`,name:`不預設`},{id:`true`,name:`是`},{id:`false`,name:`否`}],ot=[{id:`true`,name:`是`},{id:`false`,name:`否`}],st=[{label:`顯示`,name:`fieldVisibleWhen`,supportingText:`符合條件時才顯示這個欄位。`,target:`visibleWhen`},{label:`必填`,name:`fieldRequiredWhen`,supportingText:`符合條件時才要求填寫這個欄位。`,target:`requiredWhen`},{label:`唯讀`,name:`fieldReadonlyWhen`,supportingText:`符合條件時不允許修改這個欄位。`,target:`readonlyWhen`}],ct={whiteSpace:`pre-line`},lt=`勾選後,此欄位的 key 與型別在之後的版本不能再改。HIDE/hidden 不是保密手段。`;function E({formDefinitionId:e,onChange:m,templateId:h,value:g}){let ee=g?.schema??$e,te=g?.uiSchema??et,[_,E]=(0,r.useState)(ee),[D,O]=(0,r.useState)(te),[k,A]=(0,r.useState)(M(ee)),[Mt,Pt]=(0,r.useState)(M(te)),[Ft,It]=(0,r.useState)({}),[Lt,N]=(0,r.useState)(null),[P,Rt]=(0,r.useState)([]),[zt,Bt]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(!h&&!e||(0,s.readFilterableFieldPaths)(_).length===0)return Rt([]),Bt(null),()=>void 0;let t=!1,n=setTimeout(()=>{(0,o.listFilterableFieldIssues)({formDefinitionId:e,schemaJson:M(_),templateId:h}).then(e=>{t||(Rt(e),Bt(null))}).catch(e=>{t||(Rt([]),Bt(e instanceof Error?e.message:`無法檢查可篩選欄位。`))})},400);return()=>{t=!0,clearTimeout(n)}},[e,_,h]);let Vt=(0,r.useMemo)(()=>new Map(P.map(e=>[e.path,e.message])),[P]),[F,Ht]=(0,r.useState)(`design`),[I,L]=(0,r.useState)(null),[R,Ut]=(0,r.useState)([]),[Wt,Gt]=(0,r.useState)(null),[Kt,qt]=(0,r.useState)(`loading`),[Jt,z]=(0,r.useState)(null),[Yt,Xt]=(0,r.useState)(!1),[B,V]=(0,r.useState)(null),[Zt,H]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=!0;return(0,u.listFormDataSources)().then(t=>{e&&(Ut(t),Gt(null),qt(`ready`))}).catch(t=>{e&&(Ut([]),Gt(`目前無法載入 DataSource Catalog,請稍後重試。`),qt(`unavailable`))}),()=>{e=!1}},[]),(0,r.useEffect)(()=>{_.fields.some(e=>e.fieldKey===I)||L(_.fields[0]?.fieldKey??null)},[_.fields,I]),(0,r.useEffect)(()=>{It(e=>(0,u.buildFormRendererValues)(_.fields,e))},[_.fields]),(0,r.useEffect)(()=>{F!==`advanced`&&(A(M(_)),Pt(M(D)))},[F,_,D]);let U=(0,r.useMemo)(()=>_.fields.find(e=>e.fieldKey===I)??_.fields[0]??null,[_.fields,I]);(0,r.useEffect)(()=>{m?.({schema:_,uiSchema:D})},[_,D]);function Qt(e){let t=_.fields.length+1,n=(0,u.createFieldDefinition)(e,t);E({..._,fields:[..._.fields,n]}),O({...D,layout:[...D.layout,{fieldKey:n.fieldKey,width:e===`textarea`||e===`file_upload`||e===`table`?`FULL`:`HALF`}]}),L(n.fieldKey),Ht(`design`),N(null)}function $t(e){let t=e;t===`advanced`&&F!==`advanced`&&(A(M(_)),Pt(M(D))),Ht(t)}function en(e){let t=_.fields.flatMap(t=>(0,f.isTableFieldDefinition)(t)?t.columns.flatMap(n=>(0,f.isFormDataSourceFieldDefinition)(n)&&(0,u.readFormDataSourceFieldDependencyKeys)(n).includes(e)?[`${t.fieldKey}.${n.fieldKey}`]:[]):(0,f.isFormDataSourceFieldDefinition)(t)&&(0,u.readFormDataSourceFieldDependencyKeys)(t).includes(e)?[t.fieldKey]:[]);t.length>0?V({affectedFieldKeys:t,fieldKey:e,kind:`remove-field`}):tn(e)}function tn(e){let t=_.fields.filter(t=>t.fieldKey!==e);E({..._,fields:t}),O({...D,layout:D.layout.filter(t=>t.fieldKey!==e)}),L(I===e?t[0]?.fieldKey??null:I),N(null),z(null)}function nn(e){let t=e.destination;t&&e.source.index!==t.index&&(E(n=>({...n,fields:Nt(n.fields,e.source.index,t.index)})),O(n=>({...n,layout:Nt(n.layout,e.source.index,t.index)})),N(null))}function W(e){G(t=>({...t,...e}))}function G(e){if(!U)return;let t=U.fieldKey,n=e(U),r=n.fieldKey,i={..._,fields:_.fields.map(e=>e.fieldKey===t?n:e)},a=t===r?i:(0,u.renameFormDataSourceFieldBindings)(i,t,r);E(a),O({...D,layout:D.layout.map(e=>e.fieldKey===t?{...e,fieldKey:r}:e)}),L(r),N(null),z(null)}function rn(e){G(()=>e)}function K(e,t){E(n=>({...n,fields:n.fields.map(n=>n.fieldKey===e&&(0,f.isTableFieldDefinition)(n)?t(n):n)})),N(null),z(null)}function q(e,t,n){let r=e.columns[t]?.fieldKey;K(e.fieldKey,e=>{let i={...e,columns:e.columns.map((e,r)=>r===t?n:e)};return typeof r==`string`&&r!==n.fieldKey?(0,u.renameFormTableColumnBindings)(i,r,n.fieldKey):i})}function an(e){let t=(0,u.createTableColumnDefinition)(e.columns,`text`);K(e.fieldKey,e=>({...e,columns:[...e.columns,t]})),H(e.columns.length)}function on(e,t){K(e,e=>({...e,columns:e.columns.filter((e,n)=>n!==t)})),H(e=>e===null||e<t?e:e===t?null:e-1)}function sn(e,t,n){K(e.fieldKey,e=>({...e,columns:Nt(e.columns,t,n)})),H(e=>e===null?e:e===t?n:e>t&&e<=n?e-1:e<t&&e>=n?e+1:e)}function cn(e,t,n){if(e.type!==`select`&&e.type!==`autocomplete`||(0,f.readFormFieldSelectionMode)(e)===t)return;let r=e.defaultValue,i=t===`multiple`?typeof r==`string`?[r]:r:Array.isArray(r)?r[0]:r;n(e,{...e,defaultValue:i,mode:t},`選擇模式變更可能轉換或捨棄既有預設值。`)}function ln(e,t,n=`此變更會替換目前選項來源;既有 options、dynamic reference 或 bindings 可能失效。`){JSON.stringify(e)!==JSON.stringify(t)&&V({fieldKey:e.fieldKey,impact:n,kind:`replace-field`,nextField:t})}function un(e,t,n){if(!t)return;if(t===S){if(!(0,f.isFormDataSourceFieldDefinition)(e))return;let{dataSource:t,defaultValue:r,...i}=e;n({...i,options:[]});return}let r=R.find(e=>dt(e)===t);if(!r)return;if((0,f.isFormDataSourceFieldDefinition)(e)){let t=new Set(r.parameters.map(e=>e.key)),i=e.dataSource.bindings.filter(e=>t.has(e.parameter));n({...e,dataSource:{bindings:i,key:r.key,version:r.version}});return}let{options:i,defaultValue:a,...o}=e;n({...o,dataSource:{bindings:[],key:r.key,version:r.version}})}function dn(){B&&(fn(B),V(null))}function fn(e){e.kind===`remove-field`?tn(e.fieldKey):e.kind===`remove-column`?on(e.fieldKey,e.columnIndex):e.kind===`replace-column`?(K(e.fieldKey,t=>({...t,columns:t.columns.map(t=>t.fieldKey===e.columnKey?e.nextColumn:t)})),H(e.columnIndex)):(E({..._,fields:_.fields.map(t=>t.fieldKey===e.fieldKey?e.nextField:t)}),N(null),z(null))}async function pn(){Xt(!0);try{let e=await(0,u.lintFormSchema)(_,D);z(e.errors.map(mn))}catch{z([`目前無法完成 DataSource schema 驗證。`])}finally{Xt(!1)}}function mn(e){let t=le.exec(e);if(t?.[1]&&t[3])return`${hn(t[1],t[2])}尚未指定必要參數「${gn(t[1],t[2],t[3])}」的來源`;let n=(0,l.parseFormBindingExpressionLintLine)(e);if(n){let e=String(n.fieldIndex),t=n.columnIndex===null?void 0:String(n.columnIndex),r=_.fields[n.fieldIndex],i=r?J(r,t):void 0,a=_n(e,t,String(n.bindingIndex))??``;return(0,l.readFormBindingExpressionLintMessage)({code:n.code,columnLabel:i?i.label||i.fieldKey:null,fieldLabel:r?r.label||r.fieldKey:``,parameterLabel:gn(e,t,a),subject:n.subject})}let r=ue.exec(e);return r?.[1]&&r[3]?`${hn(r[1],r[2])}綁定了來源沒有的參數「${r[3]}」`:(0,u.readFormSchemaLintMessage)(e)}function hn(e,t){let n=_.fields[Number(e)];if(!n)return``;let r=n.label||n.fieldKey,i=J(n,t);return i?`「${r}」表格的「${i.label||i.fieldKey}」欄`:`「${r}」欄位`}function gn(e,t,n){let r=_.fields[Number(e)];if(!r)return n;let i=J(r,t)??r,a=(0,f.isFormDataSourceFieldDefinition)(i)?i.dataSource:null;return(a?R.find(e=>e.key===a.key&&e.version===a.version):void 0)?.parameters.find(e=>e.key===n)?.label||n}function _n(e,t,n){let r=_.fields[Number(e)],i=r?J(r,t)??r:null;return i&&(0,f.isFormDataSourceFieldDefinition)(i)?i.dataSource.bindings[Number(n)]?.parameter??null:null}function J(e,t){return typeof t==`string`&&(0,f.isTableFieldDefinition)(e)?e.columns[Number(t)]:void 0}function vn(e){It(e)}function yn(e,t){E(n=>({...n,fields:n.fields.map(n=>n.fieldKey===e?{...n,required:t}:n)})),N(null)}function bn(e){A(e);try{E(JSON.parse(e)),N(null)}catch{N(`Form Schema JSON 格式不正確`)}}function xn(e){Pt(e);try{O(JSON.parse(e)),N(null)}catch{N(`UI Schema JSON 格式不正確`)}}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(a.Fragment,{children:[zt?(0,a.jsx)(i.InlineMessage,{content:zt,severity:`warning`}):null,P.length>0?(0,a.jsx)(i.Typography,{color:`text-error`,style:ct,variant:`body`,children:P.map(e=>e.message).join(`
|
|
2
|
-
`)}):null,(0,a.jsx)(i.SectionGroup,{children:(0,a.jsx)(i.Section,{children:(0,a.jsxs)(`div`,{style:Re,children:[(0,a.jsxs)(i.Tab,{activeKey:F,onChange:$t,size:`sub`,children:[(0,a.jsx)(i.TabItem,{children:`設計`},`design`),(0,a.jsx)(i.TabItem,{children:`預覽`},`preview`),(0,a.jsx)(i.TabItem,{children:`進階`},`advanced`)]}),F===`design`?Sn():null,F===`preview`?cr():null,F===`advanced`?lr():null]})})})]}),B?(0,a.jsx)(i.Modal,{cancelText:`返回`,confirmText:`確認變更`,modalType:`standard`,onCancel:()=>V(null),onClose:()=>V(null),onConfirm:dn,open:!0,showModalFooter:!0,showModalHeader:!0,title:_t(B),children:B.kind===`remove-field`?(0,a.jsxs)(`div`,{style:ze,children:[(0,a.jsx)(i.Typography,{variant:`body`,children:`此欄位仍被下列 DataSource binding 使用;移除後請重新設定這些欄位。`}),(0,a.jsx)(i.Typography,{color:`text-warning`,variant:`body`,children:B.affectedFieldKeys.join(`、`)})]}):B.kind===`remove-column`?(0,a.jsxs)(i.Typography,{variant:`body`,children:[`移除欄「`,B.columnKey,`」後,既有案件仍保留原本的表單版本,但新版本的這一欄資料將不再被填寫。`]}):(0,a.jsx)(i.Typography,{variant:`body`,children:B.impact})}):null]});function Sn(){return(0,a.jsxs)(`div`,{style:y,children:[(0,a.jsxs)(`div`,{style:pe,children:[(0,a.jsx)(i.Typography,{component:`h2`,variant:`label-primary`,children:`新增欄位`}),(0,a.jsx)(`div`,{style:de,children:re.map(e=>(0,a.jsx)(i.Button,{icon:e.icon,iconType:`leading`,onClick:()=>Qt(e.type),size:`sub`,style:fe,type:`button`,variant:`base-secondary`,children:e.label},e.type))})]}),(0,a.jsxs)(`div`,{style:ie,children:[(0,a.jsxs)(`div`,{style:{...y,...ae},children:[(0,a.jsx)(i.Typography,{component:`h2`,variant:`label-primary`,children:`表單畫布`}),_.fields.length>0?(0,a.jsx)(p.DragDropContext,{onDragEnd:nn,children:(0,a.jsx)(p.Droppable,{droppableId:`form-builder-fields`,children:e=>(0,a.jsxs)(`div`,{...e.droppableProps,ref:e.innerRef,style:y,children:[_.fields.map((e,t)=>(0,a.jsx)(p.Draggable,{draggableId:e.fieldKey,index:t,children:(t,n)=>or(e,t,n.isDragging)},e.fieldKey)),e.placeholder]})})}):(0,a.jsxs)(`div`,{style:xe,children:[(0,a.jsxs)(`div`,{style:y,children:[(0,a.jsx)(i.Typography,{component:`h3`,variant:`h3`,children:`尚未建立欄位`}),(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`body`,children:`從上方新增第一個欄位,或直接建立常用文字欄位開始設計。`})]}),(0,a.jsxs)(`div`,{style:Se,children:[(0,a.jsx)(i.Button,{onClick:()=>Qt(`text`),variant:`base-primary`,children:`新增文字欄位`}),(0,a.jsx)(i.Button,{onClick:()=>Qt(`textarea`),variant:`base-secondary`,children:`新增長文字`})]})]})]}),(0,a.jsxs)(`div`,{style:{...y,...oe},children:[(0,a.jsx)(i.Typography,{component:`h2`,variant:`label-primary`,children:`欄位設定`}),U?Cn(U):(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`body`,children:`請先新增或選取欄位。`})]})]})]})}function Cn(e){return(0,a.jsxs)(`div`,{style:Ce,children:[wn(e),(0,f.isTableFieldDefinition)(e)?On(e):null,Tn(e)]})}function wn(e){return(0,a.jsxs)(`div`,{style:we,children:[(0,a.jsx)(`div`,{style:Ee,children:(0,a.jsx)(i.Badge,{size:`main`,text:ut(e.type),variant:`text-info`})}),$(`標題`,`fieldLabel`,(0,a.jsx)(i.Input,{onChange:e=>W({label:e.target.value}),placeholder:`例如:申請金額`,value:e.label,variant:`base`})),$(`欄位 Key`,`fieldKey`,(0,a.jsx)(i.Input,{onChange:e=>W({fieldKey:e.target.value}),placeholder:`例如:amount`,value:e.fieldKey,variant:`base`})),(0,f.isTableFieldDefinition)(e)?null:$(`提示文字`,`fieldPlaceholder`,(0,a.jsx)(i.Input,{onChange:e=>W({placeholder:e.target.value||void 0}),placeholder:`例如:請輸入申請金額`,value:e.placeholder??``,variant:`base`})),En(e,rn,ln),j(e)?$(`以連結顯示`,`fieldDisplayAsLink`,(0,a.jsx)(i.Toggle,{checked:e.displayAs===`link`,onChange:e=>G(t=>e.target.checked?j(t)?{...t,displayAs:`link`}:t:wt(t,`displayAs`))})):null,$(`可篩選`,`fieldFilterable`,(0,a.jsx)(i.Toggle,{checked:e.filterable===!0,onChange:e=>G(t=>e.target.checked?{...t,filterable:!0}:wt(t,`filterable`))})),e.filterable===!0?(0,a.jsx)(i.Typography,{color:`text-neutral`,style:b,variant:`body`,children:lt}):null,Vt.has(e.fieldKey)?(0,a.jsx)(i.Typography,{color:`text-error`,style:b,variant:`body`,children:Vt.get(e.fieldKey)}):null,$(`只存不顯示(系統整合用)`,`fieldHidden`,(0,a.jsx)(i.Toggle,{checked:e.hidden===!0,onChange:e=>G(t=>e.target.checked?{...t,hidden:!0,required:!1}:wt(t,`hidden`))})),e.hidden===!0?(0,a.jsx)(i.Typography,{color:`text-neutral`,style:b,variant:`body`,children:`填寫、唯讀與重送畫面都不會顯示這個欄位,值仍會存下來; 透過 API 仍然讀得到這個值,不是權限控管。`}):null]})}function Tn(e){return(0,a.jsx)(i.Accordion,{defaultExpanded:Tt(e),size:`sub`,title:`進階設定`,children:(0,a.jsxs)(`div`,{style:we,children:[(0,a.jsx)(i.Typography,{component:`h3`,style:Te,variant:`label-primary`,children:`條件規則`}),(0,a.jsx)(i.Typography,{color:`text-neutral`,style:b,variant:`body`,children:`只有需要根據其他欄位改變顯示、必填或唯讀狀態時才需要設定。`}),tr(e)]})})}function En(e,t,n,r){return j(e)?Nn(e,t):(0,u.isNumberFieldDefinition)(e)?Pn(e,t):(0,u.isDateFieldDefinition)(e)?Fn(e,t):(0,f.isFormOptionFieldDefinition)(e)?In(e,t,n,r):e.type===`boolean`?Qn(e,t):e.type===`file_upload`?er(e,t):(0,f.isMemberFieldDefinition)(e)?$n(e,t):(0,f.isTableFieldDefinition)(e)?Dn(e):null}function Dn(e){let t=(0,u.readFormTableRowBounds)(e);return(0,a.jsxs)(a.Fragment,{children:[$(`最少列數`,`fieldMinRows`,Q(e.minRows,t=>K(e.fieldKey,e=>({...e,minRows:t})),`例如:1`,{max:t.maxRows,min:0})),$(`最多列數`,`fieldMaxRows`,Q(e.maxRows,t=>K(e.fieldKey,e=>({...e,maxRows:t})),`未設定即為 ${f.FORM_TABLE_MAX_ROWS}`,{max:f.FORM_TABLE_MAX_ROWS,min:Math.max(t.minRows,1)})),$(`新增列按鈕文字`,`fieldAddRowLabel`,(0,a.jsx)(i.Input,{onChange:t=>K(e.fieldKey,e=>({...e,addRowLabel:t.target.value||void 0})),placeholder:`預設為「新增一列」`,value:e.addRowLabel??``,variant:`base`}))]})}function On(e){return(0,a.jsxs)(`div`,{style:Je,children:[(0,a.jsxs)(`div`,{style:Ye,children:[(0,a.jsxs)(i.Typography,{component:`h3`,variant:`label-primary`,children:[`欄(`,e.columns.length,`)`]}),(0,a.jsx)(i.Button,{icon:d.PlusIcon,iconType:`leading`,onClick:()=>an(e),size:`sub`,type:`button`,variant:`base-secondary`,children:`新增欄`})]}),kn(e)]})}function kn(e){let t=e.columns.map((t,n)=>({fieldKey:t.fieldKey,index:n,key:`${e.fieldKey}-column-${n}`,label:t.label,type:t.type})),n=[{key:`label`,render:t=>(0,a.jsx)(i.Input,{fullWidth:!0,onChange:n=>q(e,t.index,{...Y(e,t.index),label:n.target.value}),placeholder:`例如:數量`,size:`sub`,value:t.label,variant:`base`}),title:`標題`},{key:`type`,render:t=>(0,a.jsx)(i.Select,{fullWidth:!0,clearable:!1,menuMaxHeight:se,onChange:n=>jn(e,t.index,n?.id),options:[...v],size:`sub`,value:(0,u.readSelectOption)(v,t.type)}),title:`型別`},{key:`required`,render:t=>(0,a.jsx)(i.Toggle,{checked:Y(e,t.index).required===!0,inputProps:{"aria-label":`${t.label||t.fieldKey} 必填`},onChange:n=>q(e,t.index,{...Y(e,t.index),required:n.target.checked}),size:`sub`}),title:`必填`},{key:`filterable`,render:t=>{let n=Y(e,t.index),r=Vt.get(`${e.fieldKey}.${n.fieldKey}`);return(0,a.jsxs)(`div`,{children:[(0,a.jsx)(i.Toggle,{checked:n.filterable===!0,inputProps:{"aria-label":`${t.label||t.fieldKey} 可篩選`},onChange:r=>q(e,t.index,{...n,filterable:r.target.checked}),size:`sub`}),n.filterable===!0?(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`caption`,children:lt}):null,r?(0,a.jsx)(i.Typography,{color:`text-error`,variant:`caption`,children:r}):null]})},title:`可篩選`}],r={render:t=>[{disabled:()=>e.columns.length<=1,icon:d.TrashIcon,iconType:`leading`,name:`移除此欄`,onClick:()=>V({columnIndex:t.index,columnKey:t.fieldKey,fieldKey:e.fieldKey,kind:`remove-column`}),variant:`destructive-ghost`}],width:104},o=Zt===null?void 0:t[Zt]?.key;return(0,a.jsx)(i.Table,{actions:r,columns:n,dataSource:t,draggable:{enabled:!0,onDragEnd:(t,n)=>sn(e,n.fromIndex,n.toIndex)},expandable:{expandedRowKeys:o?[o]:[],expandedRowRender:t=>An(e,t.index),onExpand:(e,t)=>H(e?t.index:null)},fullWidth:!0,rowHeightPreset:`roomy`,showHeader:!0,size:`sub`})}function An(e,t){let n=e.columns[t];return n?(0,a.jsxs)(`div`,{style:qe,children:[$(`欄位 Key`,`columnFieldKey`,(0,a.jsx)(i.Input,{onChange:r=>q(e,t,{...n,fieldKey:r.target.value}),placeholder:`例如:qty`,value:n.fieldKey,variant:`base`})),$(`提示文字`,`columnPlaceholder`,(0,a.jsx)(i.Input,{onChange:r=>q(e,t,{...n,placeholder:r.target.value||void 0}),placeholder:`例如:請輸入數量`,value:n.placeholder??``,variant:`base`})),En(n,n=>{(0,f.isTableColumnFieldType)(n.type)&&q(e,t,n)},(n,r)=>{(0,f.isTableColumnFieldType)(r.type)&&q(e,t,r)},e.columns)]}):null}function jn(e,t,n){let r=e.columns[t],i=v.find(e=>e.id===n)?.id;if(!r||!i||r.type===i)return;let a=Ct(r,i),o=vt(r);o.length===0?(q(e,t,a),H(t)):V({columnIndex:t,columnKey:r.fieldKey,fieldKey:e.fieldKey,impact:`「${r.label||r.fieldKey}」改為${Mn(i)}後,這一欄的${o.join(`、`)}會被捨棄。`,kind:`replace-column`,nextColumn:a})}function Mn(e){return v.find(t=>t.id===e)?.name??e}function Y(e,t){let n=e.columns[t];if(!n)throw Error(`Table ${e.fieldKey} has no column at index ${t}.`);return n}function Nn(e,t){return(0,a.jsxs)(a.Fragment,{children:[$(`預設值`,`fieldDefaultValue`,e.type===`textarea`?Z({name:`fieldDefaultValue`,onChange:n=>t({...e,defaultValue:n||void 0}),placeholder:`輸入此欄位的預設文字`,rows:3,value:Dt(e.defaultValue)}):(0,a.jsx)(i.Input,{onChange:n=>t({...e,defaultValue:n.target.value||void 0}),placeholder:`輸入此欄位的預設文字`,value:Dt(e.defaultValue),variant:`base`})),$(`最小長度`,`fieldMinLength`,Q(e.minLength,n=>t({...e,minLength:n}),`例如:2`,{min:0})),$(`最大長度`,`fieldMaxLength`,Q(e.maxLength,n=>t({...e,maxLength:n}),`例如:100`,{min:1})),$(`格式(正規表示式)`,`fieldPattern`,(0,a.jsx)(i.Input,{onChange:n=>t(yt(e,n.target.value)),placeholder:`例如:[0-9]{8}`,value:e.pattern??``,variant:`base`}),!1,xt(e.pattern)),e.pattern?$(`格式錯誤訊息`,`fieldPatternErrorMessage`,(0,a.jsx)(i.Input,{onChange:n=>t(bt(e,n.target.value)),placeholder:`例如:統一編號為 8 位數字。`,value:e.patternErrorMessage??``,variant:`base`}),!1,St(e.patternErrorMessage)):null]})}function Pn(e,t){return(0,a.jsxs)(a.Fragment,{children:[$(`預設值`,`fieldDefaultValue`,Q(typeof e.defaultValue==`number`?e.defaultValue:void 0,n=>t({...e,defaultValue:n}),e.type===`money`?`例如:1000`:`輸入預設數值`,{max:e.maximum,min:e.minimum})),$(`最小值`,`fieldMinimum`,Q(e.minimum,n=>t({...e,minimum:n}),`例如:0`)),$(`最大值`,`fieldMaximum`,Q(e.maximum,n=>t({...e,maximum:n}),`例如:999999`))]})}function Fn(e,t){return $(`預設值`,`fieldDefaultValue`,ir(e,Dt(e.defaultValue),n=>t({...e,defaultValue:n})))}function In(e,t,n,r){let o=(0,u.readCompatibleFormDataSourceDescriptors)(e.type,R),s={commit:e=>t(e),rowColumns:r},c=(0,f.isFormDataSourceFieldDefinition)(e)?dt(e.dataSource):S,l=(0,f.isFormDataSourceFieldDefinition)(e)?R.find(t=>t.key===e.dataSource.key&&t.version===e.dataSource.version):null,d=l?o.some(e=>e.key===l.key&&e.version===l.version):!1,p=[...rt,...o.map(pt),...(0,f.isFormDataSourceFieldDefinition)(e)&&!d?[{id:c,name:`${e.dataSource.key} v${e.dataSource.version}(目前不可用或不支援)`}]:[]],m=(0,f.readFormFieldSelectionMode)(e);return(0,a.jsxs)(a.Fragment,{children:[e.type===`select`||e.type===`autocomplete`?$(`選擇模式`,`fieldSelectionMode`,(0,a.jsx)(i.Select,{clearable:!1,onChange:t=>{(t?.id===`single`||t?.id===`multiple`)&&cn(e,t.id,n)},options:[...it],value:(0,u.readSelectOption)(it,m)})):$(`選擇模式`,`fieldSelectionMode`,(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`body`,children:m===`multiple`?`固定複選`:`固定單選`})),$(`選項來源`,`fieldOptionSource`,(0,a.jsx)(i.Select,{clearable:!1,disabled:Kt===`loading`&&!(0,f.isFormDataSourceFieldDefinition)(e),onChange:n=>un(e,n?.id,t),options:p,placeholder:`選擇選項來源`,value:(0,u.readSelectOption)(p,c)})),(0,f.isFormDataSourceFieldDefinition)(e)?Ln(e,o,s):Zn(e,t)]})}function Ln(e,t,n){let r=R.find(t=>t.key===e.dataSource.key&&t.version===e.dataSource.version),o=r&&!(0,u.isFormDataSourceDescriptorCompatible)(r,e.type);return(0,a.jsxs)(`div`,{style:He,children:[Kt===`loading`?(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`body`,children:`正在載入可用的選項來源…`}):null,Wt?(0,a.jsx)(i.Typography,{color:`text-error`,variant:`body`,children:Wt}):null,r?null:(0,a.jsx)(i.Typography,{color:`text-warning`,variant:`body`,children:`找不到目前設定的來源版本。設定會保留,但這張表單在來源恢復前無法發布。`}),o?(0,a.jsx)(i.Typography,{color:`text-error`,variant:`body`,children:`這個來源不支援目前的控制項,請改選其他來源。`}):null,r?Rn(r):null,r&&r.parameters.length>0?zn(e,r,n):null,t.length===0&&!Wt?(0,a.jsx)(i.Typography,{color:`text-warning`,variant:`body`,children:`沒有支援目前控制項的已註冊來源。`}):null,(0,a.jsx)(`div`,{style:We,children:(0,a.jsx)(i.Button,{disabled:Yt,loading:Yt,onClick:()=>void pn(),size:`sub`,type:`button`,variant:`base-secondary`,children:`檢查全部動態選項設定`})}),Jt?(0,a.jsx)(`div`,{style:Ue,children:Jt.length>0?Jt.map(e=>(0,a.jsx)(i.Typography,{color:`text-error`,variant:`caption`,children:e},e)):(0,a.jsx)(i.Typography,{color:`text-success`,variant:`caption`,children:`這張表單的動態選項設定都可以使用。`})}):null]})}function Rn(e){return(0,a.jsxs)(`div`,{style:Ke,children:[e.description?(0,a.jsx)(i.Typography,{variant:`body`,children:e.description}):null,(0,a.jsx)(`div`,{style:Ge,children:ft(e).map(e=>(0,a.jsx)(i.Tag,{label:e,readOnly:!0,size:`minor`},e))}),(0,a.jsxs)(i.Typography,{color:`text-neutral`,variant:`caption`,children:[`來源代號:`,e.key,` · v`,e.version]})]})}function zn(e,t,n){let r=t.parameters.map((e,t)=>({key:e.key,index:t,parameter:e}));return(0,a.jsxs)(`div`,{style:x,children:[(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`label-secondary`,children:`這個來源需要的條件`}),(0,a.jsx)(i.Table,{columns:[{key:`parameter`,render:e=>(0,a.jsxs)(`div`,{style:Xe,children:[(0,a.jsx)(i.Typography,{variant:`input`,children:e.parameter.label??e.parameter.key}),e.parameter.required?(0,a.jsx)(i.Typography,{color:`text-error`,variant:`input`,children:`*`}):null]}),title:`條件`,width:100},{key:`binding`,width:268,render:t=>Hn(e,t.parameter,n),title:`值從哪裡來`},{key:`constant`,width:140,render:t=>{let r=(0,u.readFormDataSourceBindingValueKind)((0,u.readFormDataSourceBinding)(e,t.parameter.key));return r===`CONSTANT`?Kn(e,t.parameter.key,t.parameter.type,(0,u.readFormDataSourceBinding)(e,t.parameter.key),n):(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`caption`,children:r===`EXPRESSION`?`見下方運算式`:`—`})},title:`固定值`},{key:`meaning`,render:t=>(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`caption`,children:Wn((0,u.readFormDataSourceBinding)(e,t.parameter.key),t.parameter,n,Vn(e,t.parameter,n))}),title:`填寫時的行為`}],dataSource:r,fullWidth:!0,showHeader:!0,size:`sub`}),Bn(e,t,n)]})}function Bn(e,t,n){let r=t.parameters.filter(t=>(0,u.readFormDataSourceBindingValueKind)((0,u.readFormDataSourceBinding)(e,t.key))===`EXPRESSION`);return r.length===0?null:(0,a.jsx)(`div`,{style:x,children:r.map(t=>{let r=`${t.label??t.key} 的運算式`;return(0,a.jsxs)(`div`,{"data-data-source-expression":t.key,style:x,children:[(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`label-secondary`,children:r}),Z({name:r,onChange:r=>Yn(e,t.key,r,n),placeholder:n.rowColumns?`例如:row.plant == "" ? form.plant : row.plant`:`例如:form.chargeTo == "OTHER" ? "TW02" : form.plant`,rows:2,value:(0,u.readFormDataSourceBindingExpression)(e,t.key)??``}),(0,a.jsx)(i.Typography,{color:`text-neutral`,variant:`caption`,children:n.rowColumns?`以 form.欄位代號 讀表單欄位、row.欄位代號 讀同列欄位;只能使用內建函式,結果須符合條件的型別。`:`以 form.欄位代號 讀表單欄位;只能使用內建函式,結果須符合條件的型別。`})]},t.key)})})}function Vn(e,t,n){return(0,u.readCompatibleFormDataSourceBindingFields)(t.type,_.fields,e.fieldKey).length+(n.rowColumns?(0,u.readCompatibleFormTableColumnBindingFields)(t.type,n.rowColumns,e.fieldKey).length:0)}function Hn(e,t,n){let r=mt((0,u.readFormDataSourceBinding)(e,t.key)),o=n.rowColumns?(0,u.readCompatibleFormTableColumnBindingFields)(t.type,n.rowColumns,e.fieldKey).map(e=>({id:`${tt}${e.id}`,name:`同列:${e.name}`})):[],s=[...t.required?[]:[{id:nt,name:`未綁定`}],...o,...(0,u.readCompatibleFormDataSourceBindingFields)(t.type,_.fields,e.fieldKey),...t.type===`STRING_ARRAY`?[]:[{id:C,name:`固定常數`},{id:w,name:`運算式`}],...r===T?[{id:T,name:`不支援的來源(請重新設定)`}]:[]];return(0,a.jsx)(`div`,{"data-data-source-parameter":t.key,style:Ze,children:(0,a.jsx)(i.Select,{clearable:!1,fullWidth:!0,inputProps:{"aria-label":`${t.label??t.key} 的值來源`,title:(0,u.readSelectOption)(s,r)?.name??``},onChange:r=>Jn(e,t.key,t.type,r?.id,n),options:s,placeholder:`選擇欄位或常數`,size:`sub`,value:(0,u.readSelectOption)(s,r)})})}function Un(e){return ce[e]}function Wn(e,t,n,r){let i=(0,u.readFormDataSourceBindingValueKind)(e);return i===`CONSTANT`?`固定值,不隨填寫變動`:i===`FIELD`?`隨欄位「${Gn(e,n)}」變動`:i===`ROW_FIELD`?`隨同列「${Gn(e,n)}」變動`:i===`EXPRESSION`?`由運算式計算,隨引用的欄位變動`:e?`這個來源目前的版本不支援,選項無法載入`:t.required?r>0?`尚未設定,選項無法載入`:`沒有相容的${Un(t.type)}欄位,請改用固定值`:`未設定,不做這層篩選`}function Gn(e,t){let n=e?.from;if(n?.kind===`FIELD`){let e=_.fields.find(e=>e.fieldKey===n.fieldKey);return e?e.label||e.fieldKey:``}if(n?.kind===`ROW_FIELD`){let e=t.rowColumns?.find(e=>e.fieldKey===n.columnKey);return e?e.label||e.fieldKey:``}return``}function Kn(e,t,n,r,i){return(0,a.jsx)(`div`,{"data-data-source-constant":t,children:qn(e,t,n,r,i)})}function qn(e,t,n,r,o){let s=(0,u.readFormDataSourceBindingValue)(e,t);if(n===`BOOLEAN`){let n=[{id:`true`,name:`是`},{id:`false`,name:`否`}];return(0,a.jsx)(i.Select,{clearable:!1,fullWidth:!0,onChange:n=>Xn(e,t,n?.id===`true`,o),options:n,size:`sub`,value:(0,u.readSelectOption)(n,s===!0?`true`:`false`)})}return n===`STRING_ARRAY`?(0,a.jsx)(i.Typography,{color:`text-warning`,variant:`caption`,children:`這個條件要收多個值,請綁定一個複選欄位;不接受固定值。`}):(0,a.jsx)(i.Input,{onChange:r=>Xn(e,t,n===`NUMBER`?(0,u.parseOptionalNumberInput)(r.target.value)??0:r.target.value,o),placeholder:n===`NUMBER`?`輸入數字`:`輸入固定值`,value:ht(r,n),variant:`base`})}function Jn(e,t,n,r,i){r!==T&&i.commit((0,u.upsertFormDataSourceFieldBinding)(e,t,gt(t,n,r)))}function Yn(e,t,n,r){r.commit((0,u.upsertFormDataSourceFieldBinding)(e,t,{from:{expression:n,kind:`EXPRESSION`},parameter:t}))}function Xn(e,t,n,r){r.commit((0,u.upsertFormDataSourceFieldBinding)(e,t,{from:{kind:`CONSTANT`,value:n},parameter:t}))}function Zn(e,t){let n=(0,f.readFormFieldSelectionMode)(e),r=Array.isArray(e.defaultValue)?e.defaultValue:[],o=e.options.map(u.readFieldOptionAsSelectOption),s=o.filter(e=>r.includes(e.id));return(0,a.jsxs)(a.Fragment,{children:[$(`預設值`,`fieldDefaultValue`,n===`multiple`?(0,a.jsx)(i.Select,{clearable:!0,mode:`multiple`,onChange:n=>t({...e,defaultValue:n.length?n.map(e=>e.id):void 0}),options:o,placeholder:`選擇一或多個預設選項`,value:s}):(0,a.jsx)(i.Select,{clearable:!0,onChange:n=>t({...e,defaultValue:n?.id||void 0}),options:o,placeholder:`選擇預設選項`,value:typeof e.defaultValue==`string`?(0,u.readSelectOption)(o,e.defaultValue):null})),$(`選項`,`fieldOptions`,ar(e,t),!0)]})}function Qn(e,t){let n=typeof e.defaultValue==`boolean`?String(e.defaultValue):`unset`;return $(`預設值`,`fieldDefaultValue`,(0,a.jsx)(i.Select,{clearable:!1,onChange:n=>t({...e,defaultValue:n?.id===`true`||n?.id!==`false`&&void 0}),options:[...at],placeholder:`選擇預設狀態`,value:(0,u.readSelectOption)(at,n)}))}function $n(e,t){return $(`可複選`,`fieldMemberMultiple`,(0,a.jsx)(i.Toggle,{checked:e.multiple===!0,label:e.multiple===!0?`可選多位`:`只能選一位`,onChange:n=>t({...e,defaultValue:void 0,multiple:n.target.checked||void 0}),size:`sub`}))}function er(e,t){return(0,a.jsxs)(a.Fragment,{children:[$(`檔案數`,`fieldMaxFiles`,Q(e.maxFiles,n=>t({...e,maxFiles:n}),`例如:1`,{min:1})),$(`MIME`,`fieldAcceptedMimeTypes`,Z({name:`fieldAcceptedMimeTypes`,onChange:n=>t({...e,acceptedMimeTypes:Ot(n)}),placeholder:`每行一個 MIME type,例如:application/pdf`,rows:3,value:kt(e.acceptedMimeTypes)}),!1)]})}function tr(e){let t=_.fields.filter(t=>t.fieldKey!==e.fieldKey&&!(0,f.isMemberFieldDefinition)(t)&&!(0,f.isOrgUnitFieldDefinition)(t));return t.length?(0,a.jsx)(a.Fragment,{children:st.map(n=>nr(e,n,t))}):(0,a.jsx)(i.Typography,{color:`text-neutral`,style:b,variant:`body`,children:`目前沒有其他欄位可作為條件來源。新增更多欄位後即可設定條件規則。`})}function nr(e,t,n){let r=e[t.target],o=r?(0,u.parseConditionRule)(r):null,s=n.find(e=>e.fieldKey===o?.fieldKey),c=s??n[0],l=n.map(Et),d=(0,u.readConditionOperatorOptions)(c),f=o&&d.some(e=>e.id===o.operator)?o.operator:(0,u.readDefaultConditionOperator)(c),p=o?.value??(0,u.readDefaultConditionValue)(c),m=!!r,h=m&&(!o||!s);return $(t.label,t.name,(0,a.jsxs)(`div`,{style:Fe,children:[(0,a.jsx)(i.Toggle,{checked:m,label:m?`已啟用`:`不啟用`,onChange:e=>X(t.target,e.target.checked?(0,u.buildConditionExpression)(c,(0,u.readDefaultConditionOperator)(c),(0,u.readDefaultConditionValue)(c)):void 0),size:`sub`,supportingText:t.supportingText}),m?h?(0,a.jsx)(i.Typography,{color:`text-warning`,variant:`body`,children:`這個規則不是目前 UI 支援的格式。重新選擇條件後會取代既有規則。`}):(0,a.jsxs)(`div`,{style:Ie,children:[(0,a.jsx)(i.Select,{clearable:!1,onChange:e=>{let r=n.find(t=>t.fieldKey===e?.id)??c;X(t.target,(0,u.buildConditionExpression)(r,(0,u.readDefaultConditionOperator)(r),(0,u.readDefaultConditionValue)(r)))},options:l,placeholder:`選擇欄位`,value:(0,u.readSelectOption)(l,c.fieldKey)}),(0,a.jsx)(i.Select,{clearable:!1,onChange:e=>X(t.target,(0,u.buildConditionExpression)(c,(0,u.readConditionOperatorOption)(e?.id)??f,p)),options:[...d],placeholder:`判斷方式`,value:(0,u.readSelectOption)(d,f)}),rr(c,p,e=>X(t.target,(0,u.buildConditionExpression)(c,f,e)))]}):null]}),!0)}function X(e,t){W({[e]:t})}function rr(e,t,n){if(e.type===`boolean`)return(0,a.jsx)(i.Select,{clearable:!1,onChange:e=>n(e?.id??`true`),options:[...ot],placeholder:`比較值`,value:(0,u.readSelectOption)(ot,t===`false`?`false`:`true`)});if((0,u.isSelectFieldDefinition)(e)){let r=e.options.map(u.readFieldOptionAsSelectOption);return(0,a.jsx)(i.Select,{clearable:!1,onChange:e=>n(e?.id??r[0]?.id??``),options:r,placeholder:`比較值`,value:(0,u.readSelectOption)(r,t)})}return(0,u.isNumberFieldDefinition)(e)?Q((0,u.parseOptionalNumberInput)(t),e=>n(String(e??0)),`比較值`):(0,u.isDateFieldDefinition)(e)?ir(e,t,e=>n(e??``)):(0,a.jsx)(i.Input,{onChange:e=>n(e.target.value),placeholder:`比較值`,value:t,variant:`base`})}function Z({name:e,onChange:t,placeholder:n,rows:r,value:o}){return(0,a.jsx)(i.Textarea,{"aria-label":e,onChange:e=>t(e.target.value),placeholder:n,ref:Qe,resize:`vertical`,rows:r,style:Ae,value:o})}function Q(e,t,n,r={}){return(0,a.jsx)(i.Input,{max:r.max,min:r.min,onChange:e=>t((0,u.clampOptionalNumber)((0,u.parseOptionalNumberInput)(e.target.value),r)),placeholder:n,showSpinner:!0,step:r.step??1,value:typeof e==`number`?String(e):``,variant:`measure`})}function ir(e,t,n){return e.type===`datetime`?(0,a.jsx)(i.DateTimePicker,{formatDate:`YYYY-MM-DD`,formatTime:`HH:mm`,hideSecond:!0,onChange:e=>n((0,u.formatDateTimePickerValue)(e)),placeholderLeft:`選擇日期`,placeholderRight:`選擇時間`,value:(0,u.readDatePickerValue)(t)}):(0,a.jsx)(i.DatePicker,{format:`YYYY-MM-DD`,onChange:e=>n((0,u.formatDatePickerValue)(e)),placeholder:`選擇日期`,value:(0,u.readDatePickerValue)(t)})}function ar(e,t){let n=e.options.map((t,n)=>({index:n,key:`${e.fieldKey}-${n}`,label:t.label,value:t.value}));return(0,a.jsxs)(`div`,{style:ze,children:[(0,a.jsx)(i.Table,{actions:{render:n=>[{disabled:()=>e.options.length<=1,icon:d.TrashIcon,iconType:`icon-only`,name:`移除選項`,onClick:()=>t({...e,options:e.options.filter((e,t)=>t!==n.index)}),variant:`destructive-ghost`}],width:56},columns:[{key:`label`,render:n=>(0,a.jsx)(i.Input,{onChange:r=>t({...e,options:At(e.options,n.index,{label:r.target.value})}),placeholder:`例如:主管`,size:`sub`,value:n.label,variant:`base`}),title:`Label`},{key:`value`,render:n=>(0,a.jsx)(i.Input,{onChange:r=>t({...e,options:At(e.options,n.index,{value:r.target.value})}),placeholder:`例如:manager`,size:`sub`,value:n.value,variant:`base`}),title:`Value`}],dataSource:n,showHeader:!0,size:`sub`}),(0,a.jsx)(`div`,{style:Be,children:(0,a.jsx)(i.Button,{icon:d.PlusIcon,iconType:`leading`,onClick:()=>t({...e,options:[...e.options,jt(e.options)]}),variant:`base-secondary`,children:`新增選項`})})]})}function or(e,t,n){return(0,a.jsx)(`div`,{...t.draggableProps,"data-form-builder-field-key":e.fieldKey,ref:t.innerRef,style:{...ve,...n?ye:null,...t.draggableProps.style},children:(0,a.jsx)(i.BaseCard,{style:e.fieldKey===U?.fieldKey?be:void 0,children:sr(e,t,n)})})}function $(e,n,r,i=!1,o){return(0,a.jsx)(`div`,{style:i?Oe:De,children:(0,a.jsx)(`div`,{style:ke,children:(0,a.jsx)(t.t,{label:e,layout:i?c.FormFieldLayout.VERTICAL:c.FormFieldLayout.STRETCH,name:n,...o?{hintText:o.text,severity:o.severity}:{},children:r})})})}function sr(e,t,n){return(0,a.jsxs)(`div`,{...t.dragHandleProps??{},"aria-label":`選取或拖曳排序欄位`,onClick:()=>L(e.fieldKey),style:me,title:`點擊選取,拖曳排序`,children:[(0,a.jsx)(`span`,{"aria-label":`拖曳排序`,role:`img`,style:Le,title:`拖曳排序`,children:(0,a.jsx)(i.Icon,{icon:d.DotDragVerticalIcon,size:20})}),(0,a.jsxs)(`div`,{style:he,children:[(0,a.jsxs)(i.Typography,{component:`span`,ellipsis:!0,variant:`label-primary`,children:[e.label,e.required?(0,a.jsx)(`sup`,{"aria-label":`必填`,style:Ve,children:`*`}):null]}),(0,a.jsxs)(i.Typography,{color:`text-neutral`,component:`span`,ellipsis:!0,variant:`caption`,children:[ut(e.type),` ·`,e.required?` 必填`:` 選填`,` ·`,e.fieldKey,e.hidden?` · 只存不顯示`:null]})]}),(0,a.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:ge,children:[(0,a.jsx)(`div`,{style:_e,children:(0,a.jsx)(i.Toggle,{checked:!!e.required,disabled:n||e.hidden===!0,label:`必填`,onChange:t=>yn(e.fieldKey,t.target.checked)})}),(0,a.jsx)(i.Button,{disabled:n,icon:d.TrashIcon,iconType:`icon-only`,onClick:()=>en(e.fieldKey),variant:`destructive-ghost`,children:`移除欄位`})]})]})}function cr(){return(0,a.jsxs)(`div`,{style:y,children:[(0,a.jsx)(i.Typography,{component:`h2`,variant:`h3`,children:`填寫預覽`}),(0,a.jsx)(n.t,{dataSourceContext:{kind:`preview`},onChange:vn,schema:_,uiSchema:D,value:Ft})]})}function lr(){return(0,a.jsxs)(`div`,{style:y,children:[(0,a.jsx)(i.Typography,{component:`h2`,variant:`h3`,children:`Schema`}),(0,a.jsxs)(`div`,{style:je,children:[ur(`Form Schema`,`schemaJson`,(0,a.jsx)(ne,{height:`360px`,name:`schemaJson`,onChange:bn,placeholder:`輸入 Form Schema JSON`,value:k})),ur(`UI Schema`,`uiSchemaJson`,(0,a.jsx)(ne,{height:`240px`,name:`uiSchemaJson`,onChange:xn,placeholder:`輸入 UI Schema JSON`,value:Mt})),Lt?(0,a.jsx)(i.Typography,{color:`text-error`,style:Pe,variant:`body`,children:Lt}):null]})]})}function ur(e,n,r){return(0,a.jsx)(`div`,{style:Me,children:(0,a.jsx)(`div`,{style:Ne,children:(0,a.jsx)(t.t,{label:e,name:n,children:r})})})}}function ut(e){return re.find(t=>t.type===e)?.label??e}function dt(e){return`${e.key}@${e.version}`}function ft(e){return[e.supportsSearch?`可輸入關鍵字搜尋${e.minimumSearchLength>1?`(至少 ${e.minimumSearchLength} 字)`:``}`:`不支援搜尋`,e.paginationMode===`CURSOR`?`捲動載入更多(每次 ${e.pageSize} 筆)`:`一次載入完整清單(最多 ${e.maximumResultCount} 筆)`,e.revalidationPolicy===`ALWAYS`?`退回重送時一律重新確認`:`值與條件未變時沿用上次結果`]}function pt(e){return{id:dt(e),name:e.label}}function mt(e){if(!e)return nt;let t=e.from;switch(t.kind){case`FIELD`:return t.fieldKey;case`ROW_FIELD`:return`${tt}${t.columnKey}`;case`CONSTANT`:return C;case`EXPRESSION`:return w;default:return D(t)}}function D(e){return T}function O(e){switch(e){case`BOOLEAN`:return!1;case`NUMBER`:return 0;case`STRING_ARRAY`:return``;case`STRING`:return``;default:return``}}function ht(e,t){let n=e?.from.kind===`CONSTANT`?e.from.value:``;return t===`NUMBER`?typeof n==`number`?String(n):``:typeof n==`string`?n:``}function gt(e,t,n){return!n||n===nt?null:n===w?{from:{expression:``,kind:`EXPRESSION`},parameter:e}:n===C?{from:{kind:`CONSTANT`,value:O(t)},parameter:e}:n.startsWith(tt)?{from:{columnKey:n.slice(14),kind:`ROW_FIELD`},parameter:e}:{from:{fieldKey:n,kind:`FIELD`},parameter:e}}function _t(e){return e.kind===`remove-field`?`確認移除 dependency 欄位`:e.kind===`remove-column`?`確認移除表格欄`:e.kind===`replace-column`?`確認變更欄型別`:`確認變更選擇模式`}var k=[{label:`選項 A`,value:`option_a`},{label:`選項 B`,value:`option_b`}];function vt(e){let t=[];return e.defaultValue!==void 0&&t.push(`預設值`),e.type===`text`&&(typeof e.minLength==`number`||typeof e.maxLength==`number`)&&t.push(`長度限制`),e.type===`text`&&e.pattern&&t.push(`格式`),e.type!==`number`&&e.type!==`money`||typeof e.minimum!=`number`&&typeof e.maximum!=`number`||t.push(`數值範圍`),(0,f.isFormDataSourceFieldDefinition)(e)?t.push(`選項來源設定`):(0,f.isFormStaticOptionFieldDefinition)(e)&&!A(e.options)&&t.push(`${e.options.length} 個選項`),(e.type===`select`||e.type===`autocomplete`)&&e.mode===`multiple`&&t.push(`選擇模式`),t}function A(e){return e.length===k.length&&e.every((e,t)=>e.label===k[t]?.label&&e.value===k[t]?.value)}function yt(e,t){return t?{...e,pattern:t}:Object.fromEntries(Object.entries(e).filter(([e])=>e!==`pattern`&&e!==`patternErrorMessage`))}function bt(e,t){return t?{...e,patternErrorMessage:t}:Object.fromEntries(Object.entries(e).filter(([e])=>e!==`patternErrorMessage`))}function xt(e){return e&&!e.trim()?{severity:`error`,text:`格式不能只有空白,儲存時會被拒絕。`}:e&&e.length>f.TEXT_FIELD_PATTERN_MAX_LENGTH?{severity:`error`,text:`格式最多 ${f.TEXT_FIELD_PATTERN_MAX_LENGTH} 個字元,儲存時會被拒絕。`}:e&&!(0,f.compileTextFieldPattern)(e)?{severity:`error`,text:`這不是有效的正規表示式,儲存時會被拒絕。格式以 u 模式檢查,多餘的跳脫(例如在方括號 [ ] 外寫 \\-)也算錯誤。`}:e&&(0,f.hasRepeatedTextFieldPatternGroup)(e)?{severity:`error`,text:`格式裡的括號群組後面不能接重複次數(例如 (ab)+、(\\w|\\d)*、(ab){2}),填寫的內容可能讓系統卡住,儲存時會被拒絕。請把重複的部分直接寫出來,或改用 [ ] 字元集合加次數。`}:{severity:`info`,text:`填寫的內容要整段符合格式才能送出;留空表示不檢查格式。`}}function St(e){return e&&e.length>f.TEXT_FIELD_PATTERN_ERROR_MESSAGE_MAX_LENGTH?{severity:`error`,text:`錯誤訊息最多 ${f.TEXT_FIELD_PATTERN_ERROR_MESSAGE_MAX_LENGTH} 個字元,儲存時會被拒絕。`}:void 0}function Ct(e,t){let n={fieldKey:e.fieldKey,label:e.label,required:e.required,...e.description?{description:e.description}:{},...e.placeholder?{placeholder:e.placeholder}:{}};return t===`select`||t===`autocomplete`?{...n,mode:`single`,options:[...k],type:t}:{...n,type:t}}function wt(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}function Tt(e){return!!(e.visibleWhen||e.requiredWhen||e.readonlyWhen)}function Et(e){return{id:e.fieldKey,name:e.label}}function j(e){return e.type===`text`||e.type===`textarea`}function Dt(e){return typeof e==`string`?e:``}function Ot(e){let t=e.split(/[\n,]/u).map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function kt(e){return e?.join(`
|
|
3
|
-
`)??``}function M(e){return JSON.stringify(e,null,2)}function At(e,t,n){return e.map((e,r)=>r===t?{...e,...n}:e)}function jt(e){let t=e.length+1;return{label:`選項 ${t}`,value:Mt(e,t)}}function Mt(e,t){let n=`option_${t}`;return e.some(e=>e.value===n)?Mt(e,t+1):n}function Nt(e,t,n){let r=e[t];if(!r||t===n)return[...e];let i=e.filter((e,n)=>n!==t);return[...i.slice(0,n),r,...i.slice(n)]}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return E}});
|
|
4
|
-
//# sourceMappingURL=FormBuilderView-Bok4Y59D.cjs.map
|