@rytass/bpm-core-react 0.17.3 → 0.17.5

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.
@@ -4,76 +4,75 @@ import { i as t } from "./language-provider-B3cEbLe4.js";
4
4
  import { r as n } from "./routes-config-yZbESPlw.js";
5
5
  import { t as r } from "./FormRendererView-cZGOOjU5.js";
6
6
  import { t as i } from "./FormBuilderView-BYL42M0d.js";
7
- import { t as a } from "./designer-DzmrgVjO.js";
8
- import { useCallback as o, useEffect as s, useState as c } from "react";
9
- import { Button as l, Empty as u, FormField as d, Input as f, PageHeader as p, Section as m, SectionGroup as h, Select as g, Step as _, Stepper as v, Table as y, Tag as b, Typography as x } from "@mezzanine-ui/react";
10
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
11
- import { FormFieldLayout as T } from "@mezzanine-ui/core/form";
12
- import E from "@mezzanine-ui/react/ContentHeader";
13
- import { readFormSchemaLintMessage as D } from "@rytass/bpm-core-client/form";
14
- import { composeApprovalTemplateWithForm as O, listApprovalTemplateCategoriesPage as k, readWorkflowLintMessage as A } from "@rytass/bpm-core-client/template";
7
+ import { n as a, t as o } from "./designer-DBBrktom.js";
8
+ import { useCallback as s, useEffect as c, useState as l } from "react";
9
+ import { Button as u, Empty as d, FormField as f, Input as p, PageHeader as m, Section as h, SectionGroup as g, Select as _, Step as v, Stepper as y, Table as b, Tag as x, Typography as S } from "@mezzanine-ui/react";
10
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
11
+ import { FormFieldLayout as E } from "@mezzanine-ui/core/form";
12
+ import D from "@mezzanine-ui/react/ContentHeader";
13
+ import { composeApprovalTemplateWithForm as O, listApprovalTemplateCategoriesPage as k } from "@rytass/bpm-core-client/template";
15
14
  //#region src/views/templates/compose/steps/ComposeFormStep.tsx
16
- var j = {
15
+ var A = {
17
16
  id: "UNCATEGORIZED",
18
17
  name: "未分類"
19
- }, M = 100;
20
- function N({ categoryId: e, formSchema: t, formUiSchema: n, name: r, onCategoryIdChange: a, onFormChange: o, onNameChange: l }) {
21
- let [u, p] = c([]);
22
- s(() => {
18
+ }, j = 100;
19
+ function M({ categoryId: e, formSchema: t, formUiSchema: n, name: r, onCategoryIdChange: a, onFormChange: o, onNameChange: s }) {
20
+ let [u, d] = l([]);
21
+ c(() => {
23
22
  let e = !0;
24
23
  return (async () => {
25
24
  try {
26
25
  let t = await k({
27
26
  page: 1,
28
- pageSize: M,
27
+ pageSize: j,
29
28
  searchText: "",
30
29
  status: "ACTIVE"
31
30
  });
32
- e && p(t.categories);
31
+ e && d(t.categories);
33
32
  } catch {
34
- e && p([]);
33
+ e && d([]);
35
34
  }
36
35
  })(), () => {
37
36
  e = !1;
38
37
  };
39
38
  }, []);
40
- let m = [j, ...u.map((e) => ({
39
+ let m = [A, ...u.map((e) => ({
41
40
  id: e.id,
42
41
  name: e.name
43
- }))], h = m.find((t) => t.id === e) ?? j;
44
- return /* @__PURE__ */ w(S, { children: [
45
- /* @__PURE__ */ w("div", {
46
- style: P,
47
- children: [/* @__PURE__ */ C(d, {
42
+ }))], h = m.find((t) => t.id === e) ?? A;
43
+ return /* @__PURE__ */ T(C, { children: [
44
+ /* @__PURE__ */ T("div", {
45
+ style: N,
46
+ children: [/* @__PURE__ */ w(f, {
48
47
  label: "名稱",
49
- layout: T.VERTICAL,
48
+ layout: E.VERTICAL,
50
49
  name: "composeName",
51
- children: /* @__PURE__ */ C(f, {
50
+ children: /* @__PURE__ */ w(p, {
52
51
  fullWidth: !0,
53
- onChange: (e) => l(e.target.value),
52
+ onChange: (e) => s(e.target.value),
54
53
  placeholder: "例如:請款簽核",
55
54
  value: r
56
55
  })
57
- }), /* @__PURE__ */ C(d, {
56
+ }), /* @__PURE__ */ w(f, {
58
57
  label: "分類(選填)",
59
- layout: T.VERTICAL,
58
+ layout: E.VERTICAL,
60
59
  name: "composeCategory",
61
- children: /* @__PURE__ */ C(g, {
60
+ children: /* @__PURE__ */ w(_, {
62
61
  clearable: !1,
63
62
  fullWidth: !0,
64
- onChange: (e) => a(e && e.id !== j.id ? e.id : null),
63
+ onChange: (e) => a(e && e.id !== A.id ? e.id : null),
65
64
  options: m,
66
65
  placeholder: "未分類",
67
66
  value: h
68
67
  })
69
68
  })]
70
69
  }),
71
- /* @__PURE__ */ C(x, {
70
+ /* @__PURE__ */ w(S, {
72
71
  color: "text-neutral",
73
72
  variant: "caption",
74
73
  children: "先設計表單欄位,下一步的流程條件分流即可直接引用這些欄位。"
75
74
  }),
76
- /* @__PURE__ */ C(i, {
75
+ /* @__PURE__ */ w(i, {
77
76
  onChange: o,
78
77
  value: {
79
78
  schema: t,
@@ -82,75 +81,75 @@ function N({ categoryId: e, formSchema: t, formUiSchema: n, name: r, onCategoryI
82
81
  })
83
82
  ] });
84
83
  }
85
- var P = {
84
+ var N = {
86
85
  display: "grid",
87
86
  gap: 16,
88
87
  gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))"
89
88
  };
90
89
  //#endregion
91
90
  //#region src/views/templates/compose/steps/ComposeReviewStep.tsx
92
- function F({ formSchema: e, formUiSchema: t, initiatorPolicyCel: n, name: i, publishError: a, workflowDefinition: o }) {
93
- let s = o?.nodes ?? [], c = o?.edges ?? [], l = e.fields.length, d = new Map(s.map((e) => [e.id, e.data.label])), f = s.map((e) => ({
94
- detail: z(e) ?? "—",
91
+ function P({ formSchema: e, formUiSchema: t, initiatorPolicyCel: n, name: i, publishError: a, workflowDefinition: o }) {
92
+ let s = o?.nodes ?? [], c = o?.edges ?? [], l = e.fields.length, u = new Map(s.map((e) => [e.id, e.data.label])), f = s.map((e) => ({
93
+ detail: R(e) ?? "—",
95
94
  key: e.id,
96
95
  label: e.data.label,
97
- typeLabel: R(e)
96
+ typeLabel: L(e)
98
97
  })), p = c.filter((e) => !!e.data.condition).map((e) => ({
99
98
  condition: e.data.condition ?? "",
100
99
  key: e.id,
101
- source: d.get(e.source) ?? e.source,
102
- target: d.get(e.target) ?? e.target
100
+ source: u.get(e.source) ?? e.source,
101
+ target: u.get(e.target) ?? e.target
103
102
  }));
104
- return /* @__PURE__ */ w("div", {
105
- style: B,
103
+ return /* @__PURE__ */ T("div", {
104
+ style: z,
106
105
  children: [
107
- /* @__PURE__ */ C(x, {
106
+ /* @__PURE__ */ w(S, {
108
107
  component: "h2",
109
- style: V,
108
+ style: B,
110
109
  variant: "h2",
111
110
  children: i || "(未命名)"
112
111
  }),
113
- /* @__PURE__ */ w("div", {
114
- style: B,
115
- children: [/* @__PURE__ */ C(x, {
112
+ /* @__PURE__ */ T("div", {
113
+ style: z,
114
+ children: [/* @__PURE__ */ w(S, {
116
115
  variant: "h3",
117
116
  children: "表單預覽"
118
- }), l > 0 ? /* @__PURE__ */ C(r, {
117
+ }), l > 0 ? /* @__PURE__ */ w(r, {
119
118
  dataSourceContext: { kind: "preview" },
120
119
  readonly: !0,
121
120
  schema: e,
122
121
  uiSchema: t
123
- }) : /* @__PURE__ */ C(u, { title: "尚未設計表單欄位" })]
122
+ }) : /* @__PURE__ */ w(d, { title: "尚未設計表單欄位" })]
124
123
  }),
125
- /* @__PURE__ */ w("div", {
126
- style: B,
124
+ /* @__PURE__ */ T("div", {
125
+ style: z,
127
126
  children: [
128
- /* @__PURE__ */ C(x, {
127
+ /* @__PURE__ */ w(S, {
129
128
  variant: "h3",
130
129
  children: "流程概覽"
131
130
  }),
132
- s.length > 0 ? /* @__PURE__ */ C(y, {
133
- columns: I,
131
+ s.length > 0 ? /* @__PURE__ */ w(b, {
132
+ columns: F,
134
133
  dataSource: f,
135
134
  fullWidth: !0
136
- }) : /* @__PURE__ */ C(u, { title: "尚未設計流程節點" }),
137
- p.length > 0 ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(x, {
135
+ }) : /* @__PURE__ */ w(d, { title: "尚未設計流程節點" }),
136
+ p.length > 0 ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(S, {
138
137
  color: "text-neutral",
139
138
  variant: "caption",
140
139
  children: "條件分流"
141
- }), /* @__PURE__ */ C(y, {
142
- columns: L,
140
+ }), /* @__PURE__ */ w(b, {
141
+ columns: I,
143
142
  dataSource: p,
144
143
  fullWidth: !0
145
144
  })] }) : null,
146
- n ? /* @__PURE__ */ w(x, {
145
+ n ? /* @__PURE__ */ T(S, {
147
146
  color: "text-neutral",
148
147
  variant: "caption",
149
148
  children: ["發起權限:", n]
150
149
  }) : null
151
150
  ]
152
151
  }),
153
- a ? /* @__PURE__ */ C(x, {
152
+ a ? /* @__PURE__ */ w(S, {
154
153
  color: "text-error",
155
154
  variant: "body",
156
155
  children: a
@@ -158,10 +157,10 @@ function F({ formSchema: e, formUiSchema: t, initiatorPolicyCel: n, name: i, pub
158
157
  ]
159
158
  });
160
159
  }
161
- var I = [
160
+ var F = [
162
161
  {
163
162
  key: "type",
164
- render: (e) => /* @__PURE__ */ C(b, {
163
+ render: (e) => /* @__PURE__ */ w(x, {
165
164
  label: e.typeLabel,
166
165
  size: "sub",
167
166
  type: "static"
@@ -180,7 +179,7 @@ var I = [
180
179
  title: "簽核方式",
181
180
  width: 160
182
181
  }
183
- ], L = [
182
+ ], I = [
184
183
  {
185
184
  dataIndex: "source",
186
185
  key: "source",
@@ -199,7 +198,7 @@ var I = [
199
198
  title: "條件"
200
199
  }
201
200
  ];
202
- function R(e) {
201
+ function L(e) {
203
202
  switch (e.type) {
204
203
  case "startEvent": return "開始";
205
204
  case "endEvent": return e.data.endState === "REJECTED" ? "結束(駁回)" : "結束(核准)";
@@ -210,7 +209,7 @@ function R(e) {
210
209
  default: return "節點";
211
210
  }
212
211
  }
213
- function z(e) {
212
+ function R(e) {
214
213
  if (e.type !== "userTask") return null;
215
214
  switch (e.data.approverResolver.type) {
216
215
  case "DIRECT": return "指定成員";
@@ -225,18 +224,18 @@ function z(e) {
225
224
  default: return "簽核人";
226
225
  }
227
226
  }
228
- var B = {
227
+ var z = {
229
228
  display: "grid",
230
229
  gap: 12
231
- }, V = { marginTop: "var(--mzn-spacing-padding-vertical-spacious)" };
230
+ }, B = { marginTop: "var(--mzn-spacing-padding-vertical-spacious)" };
232
231
  //#endregion
233
232
  //#region src/views/templates/compose/steps/ComposeWorkflowStep.tsx
234
- function H({ aiAssistantAvailable: e = !1, formSchema: t, initiatorPolicyCel: n, onInitiatorPolicyChange: r, onWorkflowChange: i, showAiAssistant: o = !1, workflowDefinition: s }) {
235
- return /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(x, {
233
+ function V({ aiAssistantAvailable: e = !1, formSchema: t, initiatorPolicyCel: n, onInitiatorPolicyChange: r, onWorkflowChange: i, showAiAssistant: a = !1, workflowDefinition: s }) {
234
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(S, {
236
235
  color: "text-neutral",
237
236
  variant: "caption",
238
237
  children: "設計簽核節點與條件分流;條件可直接引用上一步設計的表單欄位。"
239
- }), /* @__PURE__ */ C(a, {
238
+ }), /* @__PURE__ */ w(o, {
240
239
  aiAssistantAvailable: e,
241
240
  embedded: !0,
242
241
  formSchemaOverride: t,
@@ -244,88 +243,88 @@ function H({ aiAssistantAvailable: e = !1, formSchema: t, initiatorPolicyCel: n,
244
243
  initialWorkflowDefinition: s ?? void 0,
245
244
  onInitiatorPolicyChange: r,
246
245
  onWorkflowChange: i,
247
- showAiAssistant: o
246
+ showAiAssistant: a
248
247
  })] });
249
248
  }
250
249
  //#endregion
251
250
  //#region src/views/templates/compose/use-template-compose-wizard.ts
252
- var U = {
251
+ var H = {
253
252
  fields: [],
254
253
  schemaVersion: 1
255
- }, W = {
254
+ }, U = {
256
255
  layout: [],
257
256
  schemaVersion: 1
258
257
  };
259
- function G() {
260
- let e = t(), [n, r] = c(0), [i, a] = c(""), [s, l] = c(null), [u, d] = c(U), [f, p] = c(W), [m, h] = c(null), [g, _] = c(null), [v, y] = c("idle"), [b, x] = c(null), S = i.trim().length > 0 && u.fields.length > 0, C = o((e) => {
258
+ function W() {
259
+ let e = t(), [n, r] = l(0), [i, o] = l(""), [c, u] = l(null), [d, f] = l(H), [p, m] = l(U), [h, g] = l(null), [_, v] = l(null), [y, b] = l("idle"), [x, S] = l(null), C = i.trim().length > 0 && d.fields.length > 0, w = s((e) => {
261
260
  r(e);
262
- }, []), w = o(() => {
261
+ }, []), T = s(() => {
263
262
  r((e) => e < 2 ? e + 1 : e);
264
- }, []), T = o(() => {
263
+ }, []), E = s(() => {
265
264
  r((e) => e > 0 ? e - 1 : e);
266
- }, []), E = o((e) => {
267
- d(e.schema), p(e.uiSchema);
268
- }, []), D = o((e) => {
269
- h(e);
270
- }, []), k = o((e) => {
271
- _(e);
265
+ }, []), D = s((e) => {
266
+ f(e.schema), m(e.uiSchema);
267
+ }, []), k = s((e) => {
268
+ g(e);
269
+ }, []), A = s((e) => {
270
+ v(e);
272
271
  }, []);
273
272
  return {
274
- canLeaveBasics: S,
275
- categoryId: s,
273
+ canLeaveBasics: C,
274
+ categoryId: c,
276
275
  currentStep: n,
277
- formSchema: u,
278
- formUiSchema: f,
279
- goBack: T,
280
- goNext: w,
281
- goToStep: C,
282
- initiatorPolicyCel: g,
276
+ formSchema: d,
277
+ formUiSchema: p,
278
+ goBack: E,
279
+ goNext: T,
280
+ goToStep: w,
281
+ initiatorPolicyCel: _,
283
282
  name: i,
284
- publish: o(async () => {
285
- y("submitting"), x(null);
286
- let t = m ?? K;
283
+ publish: s(async () => {
284
+ b("submitting"), S(null);
285
+ let t = h ?? G;
287
286
  try {
288
287
  let e = await O({
289
288
  category: null,
290
- categoryId: s,
289
+ categoryId: c,
291
290
  formDefinitionId: null,
292
291
  formDescription: null,
293
292
  formName: i,
294
- initiatorPolicyCel: g,
293
+ initiatorPolicyCel: _,
295
294
  notificationConfig: null,
296
295
  publish: !0,
297
- schema: u,
296
+ schema: d,
298
297
  slaDefaults: null,
299
298
  templateDescription: null,
300
299
  templateId: null,
301
300
  templateName: i,
302
- uiSchema: f,
301
+ uiSchema: p,
303
302
  workflowDefinition: t
304
303
  });
305
- return y("success"), e;
304
+ return b("success"), e;
306
305
  } catch (n) {
307
- return x(J(n, t, e)), y("error"), null;
306
+ return S(a(n, e, t)), b("error"), null;
308
307
  }
309
308
  }, [
310
- s,
311
- u,
312
- f,
313
- g,
309
+ c,
310
+ d,
311
+ p,
312
+ _,
314
313
  e,
315
314
  i,
316
- m
315
+ h
317
316
  ]),
318
- publishError: b,
319
- publishPhase: v,
320
- setCategoryId: l,
321
- setFormValue: E,
322
- setInitiatorPolicyCel: k,
323
- setName: a,
324
- setWorkflowDefinition: D,
325
- workflowDefinition: m
317
+ publishError: x,
318
+ publishPhase: y,
319
+ setCategoryId: u,
320
+ setFormValue: D,
321
+ setInitiatorPolicyCel: A,
322
+ setName: o,
323
+ setWorkflowDefinition: k,
324
+ workflowDefinition: h
326
325
  };
327
326
  }
328
- var K = {
327
+ var G = {
329
328
  edges: [],
330
329
  meta: { schemaVersion: 1 },
331
330
  nodes: [{
@@ -349,49 +348,43 @@ var K = {
349
348
  },
350
349
  type: "endEvent"
351
350
  }]
352
- }, q = {
353
- en: "An unknown error occurred",
354
- "zh-TW": "發生未知錯誤"
355
351
  };
356
- function J(e, t, n) {
357
- return e instanceof Error ? D(A(e.message, t, n)) : q[n];
358
- }
359
352
  //#endregion
360
353
  //#region src/views/templates/compose/TemplateComposeWizardView.tsx
361
- function Y({ aiAssistantAvailable: t = !1, showAiAssistant: r = !1 } = {}) {
362
- let i = e(), a = n(), o = G(), s = o.publishPhase === "submitting";
354
+ function K({ aiAssistantAvailable: t = !1, showAiAssistant: r = !1 } = {}) {
355
+ let i = e(), a = n(), o = W(), s = o.publishPhase === "submitting";
363
356
  async function c() {
364
357
  let e = await o.publish();
365
358
  e && i.push(a.templateDesigner(e.templateId));
366
359
  }
367
- return /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(p, { children: /* @__PURE__ */ C(E, {
360
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(m, { children: /* @__PURE__ */ w(D, {
368
361
  description: "一次完成表單與流程設計,發佈後即可直接發起。",
369
362
  title: "建立模板(表單 + 流程)",
370
- children: /* @__PURE__ */ C(l, {
363
+ children: /* @__PURE__ */ w(u, {
371
364
  disabled: s,
372
365
  onClick: () => i.push(a.templates()),
373
366
  variant: "base-secondary",
374
367
  children: "返回模板列表"
375
368
  })
376
- }) }), /* @__PURE__ */ C(h, { children: /* @__PURE__ */ w(m, { children: [
377
- /* @__PURE__ */ w(v, {
369
+ }) }), /* @__PURE__ */ w(g, { children: /* @__PURE__ */ T(h, { children: [
370
+ /* @__PURE__ */ T(y, {
378
371
  currentStep: o.currentStep,
379
372
  children: [
380
- /* @__PURE__ */ C(_, {
373
+ /* @__PURE__ */ w(v, {
381
374
  description: "設計欄位與版面",
382
375
  title: "表單設計"
383
376
  }),
384
- /* @__PURE__ */ C(_, {
377
+ /* @__PURE__ */ w(v, {
385
378
  description: "設計簽核節點與條件",
386
379
  title: "流程設計"
387
380
  }),
388
- /* @__PURE__ */ C(_, {
381
+ /* @__PURE__ */ w(v, {
389
382
  description: "確認後發佈",
390
383
  title: "檢視並發佈"
391
384
  })
392
385
  ]
393
386
  }),
394
- o.currentStep === 0 ? /* @__PURE__ */ C(N, {
387
+ o.currentStep === 0 ? /* @__PURE__ */ w(M, {
395
388
  categoryId: o.categoryId,
396
389
  formSchema: o.formSchema,
397
390
  formUiSchema: o.formUiSchema,
@@ -400,7 +393,7 @@ function Y({ aiAssistantAvailable: t = !1, showAiAssistant: r = !1 } = {}) {
400
393
  onFormChange: o.setFormValue,
401
394
  onNameChange: o.setName
402
395
  }) : null,
403
- o.currentStep === 1 ? /* @__PURE__ */ C(H, {
396
+ o.currentStep === 1 ? /* @__PURE__ */ w(V, {
404
397
  aiAssistantAvailable: t,
405
398
  formSchema: o.formSchema,
406
399
  initiatorPolicyCel: o.initiatorPolicyCel,
@@ -409,7 +402,7 @@ function Y({ aiAssistantAvailable: t = !1, showAiAssistant: r = !1 } = {}) {
409
402
  showAiAssistant: r,
410
403
  workflowDefinition: o.workflowDefinition
411
404
  }) : null,
412
- o.currentStep === 2 ? /* @__PURE__ */ C(F, {
405
+ o.currentStep === 2 ? /* @__PURE__ */ w(P, {
413
406
  formSchema: o.formSchema,
414
407
  formUiSchema: o.formUiSchema,
415
408
  initiatorPolicyCel: o.initiatorPolicyCel,
@@ -417,25 +410,25 @@ function Y({ aiAssistantAvailable: t = !1, showAiAssistant: r = !1 } = {}) {
417
410
  publishError: o.publishError,
418
411
  workflowDefinition: o.workflowDefinition
419
412
  }) : null,
420
- /* @__PURE__ */ w("div", {
421
- style: X,
422
- children: [o.currentStep === 0 && !o.canLeaveBasics ? /* @__PURE__ */ C(x, {
413
+ /* @__PURE__ */ T("div", {
414
+ style: q,
415
+ children: [o.currentStep === 0 && !o.canLeaveBasics ? /* @__PURE__ */ w(S, {
423
416
  color: "text-neutral",
424
417
  variant: "caption",
425
418
  children: "請填寫模板名稱、表單名稱,並至少新增一個表單欄位。"
426
- }) : /* @__PURE__ */ C("span", {}), /* @__PURE__ */ w("div", {
427
- style: Z,
428
- children: [/* @__PURE__ */ C(l, {
419
+ }) : /* @__PURE__ */ w("span", {}), /* @__PURE__ */ T("div", {
420
+ style: J,
421
+ children: [/* @__PURE__ */ w(u, {
429
422
  disabled: o.currentStep === 0 || s,
430
423
  onClick: o.goBack,
431
424
  variant: "base-secondary",
432
425
  children: "上一步"
433
- }), o.currentStep < 2 ? /* @__PURE__ */ C(l, {
426
+ }), o.currentStep < 2 ? /* @__PURE__ */ w(u, {
434
427
  disabled: o.currentStep === 0 && !o.canLeaveBasics,
435
428
  onClick: o.goNext,
436
429
  variant: "base-primary",
437
430
  children: "下一步"
438
- }) : /* @__PURE__ */ C(l, {
431
+ }) : /* @__PURE__ */ w(u, {
439
432
  disabled: s,
440
433
  loading: s,
441
434
  onClick: () => {
@@ -448,17 +441,17 @@ function Y({ aiAssistantAvailable: t = !1, showAiAssistant: r = !1 } = {}) {
448
441
  })
449
442
  ] }) })] });
450
443
  }
451
- var X = {
444
+ var q = {
452
445
  alignItems: "center",
453
446
  display: "flex",
454
447
  marginTop: "var(--mzn-spacing-padding-vertical-spacious)",
455
448
  justifyContent: "space-between",
456
449
  gap: 16
457
- }, Z = {
450
+ }, J = {
458
451
  display: "flex",
459
452
  gap: 8
460
453
  };
461
454
  //#endregion
462
- export { G as i, U as n, W as r, Y as t };
455
+ export { W as i, H as n, U as r, K as t };
463
456
 
464
- //# sourceMappingURL=compose-CY3PAzhP.js.map
457
+ //# sourceMappingURL=compose-v1Vcw9hE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-v1Vcw9hE.js","names":["_Fragment","_Fragment","_Fragment","_Fragment","useRouterAdapter","useBPMLanguage","useBPMRoutes","FormRenderer","FormBuilderView","readTemplateErrorMessage","TemplateDesignerView","Fragment$1","ContentHeader","UNCATEGORIZED_OPTION","CATEGORY_PAGE_SIZE","ComposeFormStep","categoryOptions","setCategoryOptions","useState","active","result","listApprovalTemplateCategoriesPage","selectOptions","category","selectedOption","option","categoryId","BASICS_GRID_STYLE","FormField","FormFieldLayout","Input","onNameChange","event","name","Select","onCategoryIdChange","Typography","onFormChange","formSchema","formUiSchema","ComposeReviewStep","nodes","workflowDefinition","edges","fieldCount","nodeLabelById","node","nodeRows","readNodeDetail","readNodeTypeLabel","branchRows","edge","STACK_STYLE","TITLE_STYLE","Empty","Table","NODE_COLUMNS","BRANCH_COLUMNS","initiatorPolicyCel","publishError","Tag","record","ComposeWorkflowStep","EMPTY_COMPOSE_FORM_SCHEMA","EMPTY_COMPOSE_FORM_UI_SCHEMA","useTemplateComposeWizard","language","currentStep","setCurrentStep","setName","setCategoryId","setFormSchema","setFormUiSchema","setWorkflowDefinitionState","setInitiatorPolicyCelState","publishPhase","setPublishPhase","setPublishError","canLeaveBasics","goToStep","useCallback","step","goNext","goBack","setFormValue","next","setWorkflowDefinition","definition","setInitiatorPolicyCel","cel","submittedDefinition","EMPTY_WORKFLOW_DEFINITION","composeApprovalTemplateWithForm","requestError","TemplateComposeWizardView","router","routes","wizard","submitting","handlePublish","PageHeader","Button","SectionGroup","Section","Stepper","Step","FOOTER_STYLE","FOOTER_ACTIONS_STYLE"],"sources":["../../src/views/templates/compose/steps/ComposeFormStep.tsx","../../src/views/templates/compose/steps/ComposeReviewStep.tsx","../../src/views/templates/compose/steps/ComposeWorkflowStep.tsx","../../src/views/templates/compose/use-template-compose-wizard.ts","../../src/views/templates/compose/TemplateComposeWizardView.tsx"],"sourcesContent":["'use client';\n\nimport type { ChangeEvent, ReactElement } from 'react';\nimport { useEffect, useState } from 'react';\nimport { FormField, Input, Select, Typography } from '@mezzanine-ui/react';\nimport { FormFieldLayout } from '@mezzanine-ui/core/form';\nimport type { SelectValue } from '@mezzanine-ui/react/Select';\nimport type {\n FormDefinitionSchema,\n FormUiSchema,\n} from '@rytass/bpm-core-shared/form';\nimport {\n ApprovalTemplateCategoryRecord,\n listApprovalTemplateCategoriesPage,\n} from '@rytass/bpm-core-client/template';\nimport { FormBuilderView } from '../../../forms/builder';\n\nconst UNCATEGORIZED_OPTION: SelectValue = {\n id: 'UNCATEGORIZED',\n name: '未分類',\n};\n\nconst CATEGORY_PAGE_SIZE = 100;\n\nexport interface ComposeFormStepProps {\n readonly name: string;\n readonly categoryId: string | null;\n readonly formSchema: FormDefinitionSchema;\n readonly formUiSchema: FormUiSchema;\n readonly onNameChange: (value: string) => void;\n readonly onCategoryIdChange: (value: string | null) => void;\n readonly onFormChange: (next: {\n readonly schema: FormDefinitionSchema;\n readonly uiSchema: FormUiSchema;\n }) => void;\n}\n\nexport function ComposeFormStep({\n categoryId,\n formSchema,\n formUiSchema,\n name,\n onCategoryIdChange,\n onFormChange,\n onNameChange,\n}: ComposeFormStepProps): ReactElement {\n const [categoryOptions, setCategoryOptions] = useState<\n readonly ApprovalTemplateCategoryRecord[]\n >([]);\n\n useEffect((): (() => void) => {\n let active = true;\n\n void (async (): Promise<void> => {\n try {\n const result = await listApprovalTemplateCategoriesPage({\n page: 1,\n pageSize: CATEGORY_PAGE_SIZE,\n searchText: '',\n status: 'ACTIVE',\n });\n\n if (active) {\n setCategoryOptions(result.categories);\n }\n } catch {\n if (active) {\n setCategoryOptions([]);\n }\n }\n })();\n\n return (): void => {\n active = false;\n };\n }, []);\n\n const selectOptions: SelectValue[] = [\n UNCATEGORIZED_OPTION,\n ...categoryOptions.map((category) => ({\n id: category.id,\n name: category.name,\n })),\n ];\n const selectedOption =\n selectOptions.find((option) => option.id === categoryId) ??\n UNCATEGORIZED_OPTION;\n\n return (\n <>\n <div style={BASICS_GRID_STYLE}>\n <FormField\n label=\"名稱\"\n layout={FormFieldLayout.VERTICAL}\n name=\"composeName\"\n >\n <Input\n fullWidth\n onChange={(event: ChangeEvent<HTMLInputElement>): void =>\n onNameChange(event.target.value)\n }\n placeholder=\"例如:請款簽核\"\n value={name}\n />\n </FormField>\n <FormField\n label=\"分類(選填)\"\n layout={FormFieldLayout.VERTICAL}\n name=\"composeCategory\"\n >\n <Select\n clearable={false}\n fullWidth\n onChange={(option): void =>\n onCategoryIdChange(\n option && option.id !== UNCATEGORIZED_OPTION.id\n ? option.id\n : null,\n )\n }\n options={selectOptions}\n placeholder=\"未分類\"\n value={selectedOption}\n />\n </FormField>\n </div>\n <Typography color=\"text-neutral\" variant=\"caption\">\n 先設計表單欄位,下一步的流程條件分流即可直接引用這些欄位。\n </Typography>\n <FormBuilderView\n onChange={onFormChange}\n value={{ schema: formSchema, uiSchema: formUiSchema }}\n />\n </>\n );\n}\n\nconst BASICS_GRID_STYLE = {\n display: 'grid',\n gap: 16,\n gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))',\n} as const;\n","'use client';\n\nimport type { CSSProperties, ReactElement } from 'react';\nimport { Empty, Table, Tag, Typography } from '@mezzanine-ui/react';\nimport type { TableColumn } from '@mezzanine-ui/core/table';\nimport type {\n FormDefinitionSchema,\n FormUiSchema,\n} from '@rytass/bpm-core-shared/form';\nimport type {\n WorkflowDefinition,\n WorkflowNode,\n} from '@rytass/bpm-core-shared/workflow';\nimport { FormRenderer } from '../../../forms/renderer/FormRendererView';\n\ntype FlowNodeRow = Readonly<\n Record<string, unknown> & {\n detail: string;\n key: string;\n label: string;\n typeLabel: string;\n }\n>;\n\ntype BranchRow = Readonly<\n Record<string, unknown> & {\n condition: string;\n key: string;\n source: string;\n target: string;\n }\n>;\n\nexport interface ComposeReviewStepProps {\n readonly name: string;\n readonly formSchema: FormDefinitionSchema;\n readonly formUiSchema: FormUiSchema;\n readonly workflowDefinition: WorkflowDefinition | null;\n readonly initiatorPolicyCel: string | null;\n readonly publishError: string | null;\n}\n\nexport function ComposeReviewStep({\n formSchema,\n formUiSchema,\n initiatorPolicyCel,\n name,\n publishError,\n workflowDefinition,\n}: ComposeReviewStepProps): ReactElement {\n const nodes = workflowDefinition?.nodes ?? [];\n const edges = workflowDefinition?.edges ?? [];\n const fieldCount = formSchema.fields.length;\n const nodeLabelById = new Map(\n nodes.map((node) => [node.id, node.data.label] as const),\n );\n const nodeRows: FlowNodeRow[] = nodes.map((node) => ({\n detail: readNodeDetail(node) ?? '—',\n key: node.id,\n label: node.data.label,\n typeLabel: readNodeTypeLabel(node),\n }));\n const branchRows: BranchRow[] = edges\n .filter((edge) => Boolean(edge.data.condition))\n .map((edge) => ({\n condition: edge.data.condition ?? '',\n key: edge.id,\n source: nodeLabelById.get(edge.source) ?? edge.source,\n target: nodeLabelById.get(edge.target) ?? edge.target,\n }));\n\n return (\n <div style={STACK_STYLE}>\n <Typography component=\"h2\" style={TITLE_STYLE} variant=\"h2\">\n {name || '(未命名)'}\n </Typography>\n\n <div style={STACK_STYLE}>\n <Typography variant=\"h3\">表單預覽</Typography>\n {fieldCount > 0 ? (\n <FormRenderer\n dataSourceContext={{ kind: 'preview' }}\n readonly\n schema={formSchema}\n uiSchema={formUiSchema}\n />\n ) : (\n <Empty title=\"尚未設計表單欄位\" />\n )}\n </div>\n\n <div style={STACK_STYLE}>\n <Typography variant=\"h3\">流程概覽</Typography>\n {nodes.length > 0 ? (\n <Table columns={NODE_COLUMNS} dataSource={nodeRows} fullWidth />\n ) : (\n <Empty title=\"尚未設計流程節點\" />\n )}\n {branchRows.length > 0 ? (\n <>\n <Typography color=\"text-neutral\" variant=\"caption\">\n 條件分流\n </Typography>\n <Table columns={BRANCH_COLUMNS} dataSource={branchRows} fullWidth />\n </>\n ) : null}\n {initiatorPolicyCel ? (\n <Typography color=\"text-neutral\" variant=\"caption\">\n 發起權限:{initiatorPolicyCel}\n </Typography>\n ) : null}\n </div>\n\n {publishError ? (\n <Typography color=\"text-error\" variant=\"body\">\n {publishError}\n </Typography>\n ) : null}\n </div>\n );\n}\n\nconst NODE_COLUMNS: TableColumn<FlowNodeRow>[] = [\n {\n key: 'type',\n render: (record: FlowNodeRow): ReactElement => (\n <Tag label={record.typeLabel} size=\"sub\" type=\"static\" />\n ),\n title: '類型',\n width: 130,\n },\n { dataIndex: 'label', key: 'label', title: '節點' },\n { dataIndex: 'detail', key: 'detail', title: '簽核方式', width: 160 },\n];\n\nconst BRANCH_COLUMNS: TableColumn<BranchRow>[] = [\n { dataIndex: 'source', key: 'source', title: '來源', width: 180 },\n { dataIndex: 'target', key: 'target', title: '目標', width: 180 },\n { dataIndex: 'condition', key: 'condition', title: '條件' },\n];\n\nfunction readNodeTypeLabel(node: WorkflowNode): string {\n switch (node.type) {\n case 'startEvent':\n return '開始';\n case 'endEvent':\n return node.data.endState === 'REJECTED' ? '結束(駁回)' : '結束(核准)';\n case 'userTask':\n return '簽核';\n case 'serviceTask':\n return '服務';\n case 'exclusiveGateway':\n return '條件閘道';\n case 'parallelGateway':\n return '平行閘道';\n default:\n return '節點';\n }\n}\n\nfunction readNodeDetail(node: WorkflowNode): string | null {\n if (node.type !== 'userTask') {\n return null;\n }\n\n switch (node.data.approverResolver.type) {\n case 'DIRECT':\n return '指定成員';\n case 'POSITION':\n return '指定職位';\n case 'ORG_UNIT_MEMBER':\n return '單位成員';\n case 'ORG_UNIT_POSITION':\n return '單位職位';\n case 'ORG_MANAGER':\n return '主管';\n case 'ORG_MANAGER_CHAIN':\n return '主管鏈';\n case 'ORG_UNIT_MANAGER':\n return '單位主管';\n case 'DYNAMIC_FORM':\n return '依表單欄位指定';\n case 'EXPRESSION':\n return '運算式';\n default:\n return '簽核人';\n }\n}\n\nconst STACK_STYLE: CSSProperties = {\n display: 'grid',\n gap: 12,\n};\n\n// Match the breathing room between the stepper and the PageHeader, which is the\n// Section's top padding token.\nconst TITLE_STYLE: CSSProperties = {\n marginTop: 'var(--mzn-spacing-padding-vertical-spacious)',\n};\n","'use client';\n\nimport type { ReactElement } from 'react';\nimport { Typography } from '@mezzanine-ui/react';\nimport type { FormDefinitionSchema } from '@rytass/bpm-core-shared/form';\nimport type { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';\nimport { TemplateDesignerView } from '../../designer';\n\nexport interface ComposeWorkflowStepProps {\n readonly formSchema: FormDefinitionSchema;\n readonly workflowDefinition: WorkflowDefinition | null;\n readonly initiatorPolicyCel: string | null;\n readonly onWorkflowChange: (definition: WorkflowDefinition) => void;\n readonly onInitiatorPolicyChange: (cel: string | null) => void;\n /**\n * Show the AI assistant button inside the embedded designer's side panel.\n * Follows the same opt-in contract as the standalone designer page; default\n * hidden. Wired up the stack from the server page's `BPM_AI_ASSISTANT_ENABLED`.\n */\n readonly showAiAssistant?: boolean;\n /**\n * Whether the LLM backend is configured (host has an API key). When `false`\n * the AI button shows disabled as a placeholder. Default `false`.\n */\n readonly aiAssistantAvailable?: boolean;\n}\n\nexport function ComposeWorkflowStep({\n aiAssistantAvailable = false,\n formSchema,\n initiatorPolicyCel,\n onInitiatorPolicyChange,\n onWorkflowChange,\n showAiAssistant = false,\n workflowDefinition,\n}: ComposeWorkflowStepProps): ReactElement {\n return (\n <>\n <Typography color=\"text-neutral\" variant=\"caption\">\n 設計簽核節點與條件分流;條件可直接引用上一步設計的表單欄位。\n </Typography>\n <TemplateDesignerView\n aiAssistantAvailable={aiAssistantAvailable}\n embedded\n formSchemaOverride={formSchema}\n initialInitiatorPolicyCel={initiatorPolicyCel}\n initialWorkflowDefinition={workflowDefinition ?? undefined}\n onInitiatorPolicyChange={onInitiatorPolicyChange}\n onWorkflowChange={onWorkflowChange}\n showAiAssistant={showAiAssistant}\n />\n </>\n );\n}\n","'use client';\n\nimport { useCallback, useState } from 'react';\nimport type {\n FormDefinitionSchema,\n FormUiSchema,\n} from '@rytass/bpm-core-shared/form';\nimport type { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';\nimport { useBPMLanguage } from '../../../lib/language-provider';\nimport {\n ComposeApprovalTemplateWithFormResult,\n composeApprovalTemplateWithForm,\n} from '@rytass/bpm-core-client/template';\nimport { readTemplateErrorMessage } from '../template-error-message';\n\nexport type ComposeWizardStep = 0 | 1 | 2;\n\nexport type ComposePublishPhase = 'error' | 'idle' | 'submitting' | 'success';\n\nexport const EMPTY_COMPOSE_FORM_SCHEMA: FormDefinitionSchema = {\n fields: [],\n schemaVersion: 1,\n};\n\nexport const EMPTY_COMPOSE_FORM_UI_SCHEMA: FormUiSchema = {\n layout: [],\n schemaVersion: 1,\n};\n\nexport interface TemplateComposeWizard {\n readonly currentStep: ComposeWizardStep;\n /**\n * Single user-facing name. Persisted to both the template and the form\n * (`templateName` / `formName`) at the `composeApprovalTemplateWithForm`\n * boundary — the DB keeps two columns, the UI keeps one field.\n */\n readonly name: string;\n readonly categoryId: string | null;\n readonly formSchema: FormDefinitionSchema;\n readonly formUiSchema: FormUiSchema;\n readonly workflowDefinition: WorkflowDefinition | null;\n readonly initiatorPolicyCel: string | null;\n readonly publishPhase: ComposePublishPhase;\n readonly publishError: string | null;\n readonly canLeaveBasics: boolean;\n readonly goToStep: (step: ComposeWizardStep) => void;\n readonly goNext: () => void;\n readonly goBack: () => void;\n readonly setName: (value: string) => void;\n readonly setCategoryId: (value: string | null) => void;\n readonly setFormValue: (next: {\n readonly schema: FormDefinitionSchema;\n readonly uiSchema: FormUiSchema;\n }) => void;\n readonly setWorkflowDefinition: (definition: WorkflowDefinition) => void;\n readonly setInitiatorPolicyCel: (cel: string | null) => void;\n readonly publish: () => Promise<ComposeApprovalTemplateWithFormResult | null>;\n}\n\n/**\n * Owns the cross-step state for the unified \"form + flow\" template wizard.\n *\n * Step 0 (表單) edits `formSchema`/`formUiSchema`; that same in-memory schema\n * feeds Step 1 (流程) as the field source for condition branches, so the\n * embedded designer never needs a published form version. Step 2 (檢視發佈)\n * submits everything through the atomic `composeApprovalTemplateWithForm`\n * mutation.\n */\nexport function useTemplateComposeWizard(): TemplateComposeWizard {\n const language = useBPMLanguage();\n const [currentStep, setCurrentStep] = useState<ComposeWizardStep>(0);\n const [name, setName] = useState('');\n const [categoryId, setCategoryId] = useState<string | null>(null);\n const [formSchema, setFormSchema] = useState<FormDefinitionSchema>(\n EMPTY_COMPOSE_FORM_SCHEMA,\n );\n const [formUiSchema, setFormUiSchema] = useState<FormUiSchema>(\n EMPTY_COMPOSE_FORM_UI_SCHEMA,\n );\n const [workflowDefinition, setWorkflowDefinitionState] =\n useState<WorkflowDefinition | null>(null);\n const [initiatorPolicyCel, setInitiatorPolicyCelState] = useState<\n string | null\n >(null);\n const [publishPhase, setPublishPhase] = useState<ComposePublishPhase>('idle');\n const [publishError, setPublishError] = useState<string | null>(null);\n\n const canLeaveBasics = name.trim().length > 0 && formSchema.fields.length > 0;\n\n const goToStep = useCallback((step: ComposeWizardStep): void => {\n setCurrentStep(step);\n }, []);\n\n const goNext = useCallback((): void => {\n setCurrentStep((step) =>\n step < 2 ? ((step + 1) as ComposeWizardStep) : step,\n );\n }, []);\n\n const goBack = useCallback((): void => {\n setCurrentStep((step) =>\n step > 0 ? ((step - 1) as ComposeWizardStep) : step,\n );\n }, []);\n\n const setFormValue = useCallback(\n (next: {\n readonly schema: FormDefinitionSchema;\n readonly uiSchema: FormUiSchema;\n }): void => {\n setFormSchema(next.schema);\n setFormUiSchema(next.uiSchema);\n },\n [],\n );\n\n const setWorkflowDefinition = useCallback(\n (definition: WorkflowDefinition): void => {\n setWorkflowDefinitionState(definition);\n },\n [],\n );\n\n const setInitiatorPolicyCel = useCallback((cel: string | null): void => {\n setInitiatorPolicyCelState(cel);\n }, []);\n\n const publish =\n useCallback(async (): Promise<ComposeApprovalTemplateWithFormResult | null> => {\n setPublishPhase('submitting');\n setPublishError(null);\n\n const submittedDefinition =\n workflowDefinition ?? EMPTY_WORKFLOW_DEFINITION;\n\n try {\n const result = await composeApprovalTemplateWithForm({\n category: null,\n categoryId,\n formDefinitionId: null,\n formDescription: null,\n // One UI name fans out to both persisted columns.\n formName: name,\n initiatorPolicyCel,\n notificationConfig: null,\n publish: true,\n schema: formSchema,\n slaDefaults: null,\n templateDescription: null,\n templateId: null,\n templateName: name,\n uiSchema: formUiSchema,\n workflowDefinition: submittedDefinition,\n });\n\n setPublishPhase('success');\n\n return result;\n } catch (requestError: unknown) {\n setPublishError(\n readTemplateErrorMessage(requestError, language, submittedDefinition),\n );\n setPublishPhase('error');\n\n return null;\n }\n }, [\n categoryId,\n formSchema,\n formUiSchema,\n initiatorPolicyCel,\n language,\n name,\n workflowDefinition,\n ]);\n\n return {\n canLeaveBasics,\n categoryId,\n currentStep,\n formSchema,\n formUiSchema,\n goBack,\n goNext,\n goToStep,\n initiatorPolicyCel,\n name,\n publish,\n publishError,\n publishPhase,\n setCategoryId,\n setFormValue,\n setInitiatorPolicyCel,\n setName,\n setWorkflowDefinition,\n workflowDefinition,\n };\n}\n\nconst EMPTY_WORKFLOW_DEFINITION: WorkflowDefinition = {\n edges: [],\n meta: { schemaVersion: 1 },\n nodes: [\n {\n data: { label: '開始' },\n id: 'start',\n position: { x: 80, y: 160 },\n type: 'startEvent',\n },\n {\n data: { endState: 'APPROVED', label: '完成', triggerMode: 'AND' },\n id: 'end',\n position: { x: 560, y: 160 },\n type: 'endEvent',\n },\n ],\n};\n","'use client';\n\nimport type { ReactElement } from 'react';\nimport {\n Button,\n PageHeader,\n Section,\n SectionGroup,\n Step,\n Stepper,\n Typography,\n} from '@mezzanine-ui/react';\nimport ContentHeader from '@mezzanine-ui/react/ContentHeader';\nimport { useRouterAdapter } from '../../../lib/router-adapter';\nimport { useBPMRoutes } from '../../../lib/routes-config';\nimport { ComposeFormStep } from './steps/ComposeFormStep';\nimport { ComposeReviewStep } from './steps/ComposeReviewStep';\nimport { ComposeWorkflowStep } from './steps/ComposeWorkflowStep';\nimport { useTemplateComposeWizard } from './use-template-compose-wizard';\n\nexport interface TemplateComposeWizardViewProps {\n /**\n * Show the workflow designer AI assistant inside Step 1 (流程設計). Opt-in,\n * default hidden — the server page maps `BPM_AI_ASSISTANT_ENABLED` to it.\n */\n readonly showAiAssistant?: boolean;\n /**\n * Whether the LLM backend is configured (host has an API key). When `false`\n * the AI button shows disabled as a placeholder. Default `false`.\n */\n readonly aiAssistantAvailable?: boolean;\n}\n\n/**\n * Unified \"form + flow\" template creation wizard. Walks the user through\n * Step 0 表單設計 → Step 1 流程設計 → Step 2 檢視並發佈, then commits both\n * sides atomically through `composeApprovalTemplateWithForm`. This is the\n * template entry point; the form builder is intentionally controlled here\n * instead of exposed as a standalone `/forms` page.\n */\nexport function TemplateComposeWizardView({\n aiAssistantAvailable = false,\n showAiAssistant = false,\n}: TemplateComposeWizardViewProps = {}): ReactElement {\n const router = useRouterAdapter();\n const routes = useBPMRoutes();\n const wizard = useTemplateComposeWizard();\n const submitting = wizard.publishPhase === 'submitting';\n\n async function handlePublish(): Promise<void> {\n const result = await wizard.publish();\n\n if (result) {\n router.push(routes.templateDesigner(result.templateId));\n }\n }\n\n return (\n <>\n <PageHeader>\n <ContentHeader\n description=\"一次完成表單與流程設計,發佈後即可直接發起。\"\n title=\"建立模板(表單 + 流程)\"\n >\n <Button\n disabled={submitting}\n onClick={(): void => router.push(routes.templates())}\n variant=\"base-secondary\"\n >\n 返回模板列表\n </Button>\n </ContentHeader>\n </PageHeader>\n\n <SectionGroup>\n <Section>\n <Stepper currentStep={wizard.currentStep}>\n <Step description=\"設計欄位與版面\" title=\"表單設計\" />\n <Step description=\"設計簽核節點與條件\" title=\"流程設計\" />\n <Step description=\"確認後發佈\" title=\"檢視並發佈\" />\n </Stepper>\n\n {wizard.currentStep === 0 ? (\n <ComposeFormStep\n categoryId={wizard.categoryId}\n formSchema={wizard.formSchema}\n formUiSchema={wizard.formUiSchema}\n name={wizard.name}\n onCategoryIdChange={wizard.setCategoryId}\n onFormChange={wizard.setFormValue}\n onNameChange={wizard.setName}\n />\n ) : null}\n\n {wizard.currentStep === 1 ? (\n <ComposeWorkflowStep\n aiAssistantAvailable={aiAssistantAvailable}\n formSchema={wizard.formSchema}\n initiatorPolicyCel={wizard.initiatorPolicyCel}\n onInitiatorPolicyChange={wizard.setInitiatorPolicyCel}\n onWorkflowChange={wizard.setWorkflowDefinition}\n showAiAssistant={showAiAssistant}\n workflowDefinition={wizard.workflowDefinition}\n />\n ) : null}\n\n {wizard.currentStep === 2 ? (\n <ComposeReviewStep\n formSchema={wizard.formSchema}\n formUiSchema={wizard.formUiSchema}\n initiatorPolicyCel={wizard.initiatorPolicyCel}\n name={wizard.name}\n publishError={wizard.publishError}\n workflowDefinition={wizard.workflowDefinition}\n />\n ) : null}\n\n <div style={FOOTER_STYLE}>\n {wizard.currentStep === 0 && !wizard.canLeaveBasics ? (\n <Typography color=\"text-neutral\" variant=\"caption\">\n 請填寫模板名稱、表單名稱,並至少新增一個表單欄位。\n </Typography>\n ) : (\n <span />\n )}\n <div style={FOOTER_ACTIONS_STYLE}>\n <Button\n disabled={wizard.currentStep === 0 || submitting}\n onClick={wizard.goBack}\n variant=\"base-secondary\"\n >\n 上一步\n </Button>\n {wizard.currentStep < 2 ? (\n <Button\n disabled={wizard.currentStep === 0 && !wizard.canLeaveBasics}\n onClick={wizard.goNext}\n variant=\"base-primary\"\n >\n 下一步\n </Button>\n ) : (\n <Button\n disabled={submitting}\n loading={submitting}\n onClick={(): void => {\n void handlePublish();\n }}\n variant=\"base-primary\"\n >\n 發佈\n </Button>\n )}\n </div>\n </div>\n </Section>\n </SectionGroup>\n </>\n );\n}\n\nconst FOOTER_STYLE = {\n alignItems: 'center',\n display: 'flex',\n // Match the breathing room used elsewhere (the Section's top padding token).\n marginTop: 'var(--mzn-spacing-padding-vertical-spacious)',\n justifyContent: 'space-between',\n gap: 16,\n} as const;\n\nconst FOOTER_ACTIONS_STYLE = {\n display: 'flex',\n gap: 8,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAMa,IAAoC;CACxC,IAAI;CACJ,MAAM;AACR,GAEMC,IAAqB;AAe3B,SAAgBC,EAAgB,EAC9B,eACA,eACA,iBACA,SACA,uBACA,iBACA,mBACqC;CACrC,IAAM,CAACC,GAAiBC,KAAsBC,EAE5C,CAAC,CAAC;CAEJ,QAA8B;EAC5B,IAAIC,IAAS;EAqBb,QAnBM,YAA2B;GAC/B,IAAI;IACF,IAAMC,IAAS,MAAMC,EAAmC;KACtD,MAAM;KACN,UAAUP;KACV,YAAY;KACZ,QAAQ;IACV,CAAC;IAED,AAAIK,KACFF,EAAmBG,EAAO,UAAU;GAExC,QAAQ;IACN,AAAID,KACFF,EAAmB,CAAC,CAAC;GAEzB;EACF,EAAA,CAAG,SAEgB;GACjB,IAAS;EACX;CACF,GAAG,CAAC,CAAC;CAEL,IAAMK,IAA+B,CACnCT,GACA,GAAGG,EAAgB,KAAK,OAAc;EACpC,IAAIO,EAAS;EACb,MAAMA,EAAS;CACjB,EAAE,CACJ,GACMC,IACJF,EAAc,MAAM,MAAWG,EAAO,OAAOC,CAAU,KACvDb;CAEF,OACE,kBAAAb,GAAA,EAAA,UAAA;EACE,kBAAC,OAAD;GAAK,OAAO2B;GAAZ,UAAA,CACE,kBAACC,GAAD;IACE,OAAM;IACN,QAAQC,EAAgB;IACxB,MAAK;IAEL,UAAA,kBAACC,GAAD;KACE,WAAA;KACA,WAAW,MACTC,EAAaC,EAAM,OAAO,KAAK;KAEjC,aAAY;KACZ,OAAOC;IACR,CAAA;GACQ,CAAA,GACX,kBAACL,GAAD;IACE,OAAM;IACN,QAAQC,EAAgB;IACxB,MAAK;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