@rytass/bpm-core-react 0.21.2 → 0.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/{FormBuilderView-CGKkuVFi.cjs → FormBuilderView-Bq4TXdxF.cjs} +2 -2
  3. package/dist/chunks/{FormBuilderView-CGKkuVFi.cjs.map → FormBuilderView-Bq4TXdxF.cjs.map} +1 -1
  4. package/dist/chunks/{FormBuilderView-6KdApi-D.js → FormBuilderView-DNsFwZgk.js} +2 -2
  5. package/dist/chunks/{FormBuilderView-6KdApi-D.js.map → FormBuilderView-DNsFwZgk.js.map} +1 -1
  6. package/dist/chunks/{FormRendererView-BcQKUi1A.js → FormRendererView-BF8Ge0Zk.js} +178 -153
  7. package/dist/chunks/FormRendererView-BF8Ge0Zk.js.map +1 -0
  8. package/dist/chunks/FormRendererView-ZIfSRWPi.cjs +6 -0
  9. package/dist/chunks/FormRendererView-ZIfSRWPi.cjs.map +1 -0
  10. package/dist/chunks/admin-pickers-BjbkBpSJ.cjs.map +1 -1
  11. package/dist/chunks/admin-pickers-DfGxsjpp.js.map +1 -1
  12. package/dist/chunks/approval-instance-list-page-BI5fIXc-.js.map +1 -1
  13. package/dist/chunks/approval-instance-list-page-Cv5I1YPX.cjs.map +1 -1
  14. package/dist/chunks/auth-provider-4BeCw7cI.cjs.map +1 -1
  15. package/dist/chunks/auth-provider-C2b-5mGt.js.map +1 -1
  16. package/dist/chunks/categories-CyyqG6wG.cjs.map +1 -1
  17. package/dist/chunks/categories-f7E-RJEc.js.map +1 -1
  18. package/dist/chunks/{compose-M-GR6smM.js → compose-C_Y38ENa.js} +4 -4
  19. package/dist/chunks/{compose-M-GR6smM.js.map → compose-C_Y38ENa.js.map} +1 -1
  20. package/dist/chunks/{compose-CtWuunwB.cjs → compose-NHbyjV73.cjs} +2 -2
  21. package/dist/chunks/{compose-CtWuunwB.cjs.map → compose-NHbyjV73.cjs.map} +1 -1
  22. package/dist/chunks/dashboard-page-BoqNhjT_.js.map +1 -1
  23. package/dist/chunks/dashboard-page-D7YJ3udk.cjs.map +1 -1
  24. package/dist/chunks/delegations-ClRCwD1I.cjs.map +1 -1
  25. package/dist/chunks/delegations-CqND-Qtz.js.map +1 -1
  26. package/dist/chunks/delegations-D43VDSz1.cjs.map +1 -1
  27. package/dist/chunks/delegations-zisffLwk.js.map +1 -1
  28. package/dist/chunks/{designer-BnMeiMVe.js → designer-BRYIpeTC.js} +3 -3
  29. package/dist/chunks/{designer-BnMeiMVe.js.map → designer-BRYIpeTC.js.map} +1 -1
  30. package/dist/chunks/{designer-D6fCDq_q.cjs → designer-oDGvHWBJ.cjs} +2 -2
  31. package/dist/chunks/{designer-D6fCDq_q.cjs.map → designer-oDGvHWBJ.cjs.map} +1 -1
  32. package/dist/chunks/{detail-C5KrUC7s.cjs → detail-BLhZp1mO.cjs} +2 -2
  33. package/dist/chunks/detail-BLhZp1mO.cjs.map +1 -0
  34. package/dist/chunks/{detail-Dnc4PPWO.js → detail-CkRgfU7l.js} +2 -2
  35. package/dist/chunks/detail-CkRgfU7l.js.map +1 -0
  36. package/dist/chunks/login-D6cc3bo7.js.map +1 -1
  37. package/dist/chunks/login-uvVcltrS.cjs.map +1 -1
  38. package/dist/chunks/notifications-Bc4mgSds.cjs.map +1 -1
  39. package/dist/chunks/notifications-Cvme5Qbl.js.map +1 -1
  40. package/dist/chunks/orgs-B_2J2tLX.cjs.map +1 -1
  41. package/dist/chunks/orgs-DqxMds26.js.map +1 -1
  42. package/dist/chunks/users-BBtiZ9QQ.js.map +1 -1
  43. package/dist/chunks/users-EqSzDhuj.cjs.map +1 -1
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/pages/instances/detail/index.cjs +1 -1
  47. package/dist/pages/instances/detail/index.js +1 -1
  48. package/dist/pages/templates/compose/index.cjs +1 -1
  49. package/dist/pages/templates/compose/index.js +1 -1
  50. package/dist/pages/templates/designer/index.cjs +1 -1
  51. package/dist/pages/templates/designer/index.js +1 -1
  52. package/dist/views/forms/builder/index.cjs +1 -1
  53. package/dist/views/forms/builder/index.js +1 -1
  54. package/dist/views/forms/renderer/form-control-menu.d.cts +7 -0
  55. package/dist/views/forms/renderer/form-control-menu.d.ts +7 -0
  56. package/dist/views/forms/renderer/form-data-source-field.d.cts +12 -0
  57. package/dist/views/forms/renderer/form-data-source-field.d.ts +12 -0
  58. package/dist/views/forms/renderer/index.cjs +1 -1
  59. package/dist/views/forms/renderer/index.js +1 -1
  60. package/dist/views/instances/detail/index.cjs +1 -1
  61. package/dist/views/instances/detail/index.js +1 -1
  62. package/dist/views/instances/new/index.cjs +1 -1
  63. package/dist/views/instances/new/index.js +1 -1
  64. package/dist/views/templates/compose/index.cjs +1 -1
  65. package/dist/views/templates/compose/index.js +1 -1
  66. package/dist/views/templates/designer/index.cjs +1 -1
  67. package/dist/views/templates/designer/index.js +1 -1
  68. package/package.json +3 -3
  69. package/dist/chunks/FormRendererView-B-xycC9S.cjs +0 -6
  70. package/dist/chunks/FormRendererView-B-xycC9S.cjs.map +0 -1
  71. package/dist/chunks/FormRendererView-BcQKUi1A.js.map +0 -1
  72. package/dist/chunks/detail-C5KrUC7s.cjs.map +0 -1
  73. package/dist/chunks/detail-Dnc4PPWO.js.map +0 -1
@@ -7,15 +7,17 @@ import { resolveMembers as b, searchMembers as x } from "@rytass/bpm-core-client
7
7
  import { jsx as S, jsxs as C } from "react/jsx-runtime";
8
8
  import { buildFormRendererValues as w, clampOptionalNumber as T, createFormTableRow as E, formatDatePickerValue as D, formatDateTimePickerValue as O, isFormRendererFieldReadonly as k, isFormRendererFieldRequired as A, mergeFormDataSourceOptions as j, parseOptionalNumberInput as M, previewFormFieldOptions as ee, previewResolveFormFieldOptions as te, readDatePickerValue as ne, readFieldOptionAsSelectOption as N, readFormDataSourceErrorCode as re, readFormDataSourceErrorMessage as ie, readFormDataSourceSelectedValues as ae, readFormDataSourceValueSignature as P, readFormFieldOptions as oe, readFormTableCellPath as se, readFormTableRowBounds as ce, readFormTableRows as le, readMissingFormDataSourceDependencies as ue, readMissingFormDataSourceOptionValues as de, readSelectOption as fe, readSelectedFormDataSourceOptions as pe, readVisibleFormRendererFields as F, resolveFormFieldOptions as me } from "@rytass/bpm-core-client/form";
9
9
  import { PlusIcon as I, TrashIcon as L } from "@mezzanine-ui/icons";
10
- import { isFormDataSourceFieldDefinition as he, isFormStaticOptionFieldDefinition as R, isFormTableCellValue as ge, isTableFieldDefinition as _e, readFormFieldSelectionMode as z, readFormMemberIds as ve } from "@rytass/bpm-core-shared/form";
11
- import { resolveOrgUnitOptions as ye, searchOrgUnitOptions as B } from "@rytass/bpm-core-client/organization";
10
+ import { isFormDataSourceFieldDefinition as he, isFormStaticOptionFieldDefinition as R, isFormTableCellValue as ge, isTableFieldDefinition as _e, readFormFieldSelectionMode as z, readFormMemberIds as B } from "@rytass/bpm-core-shared/form";
11
+ import { resolveOrgUnitOptions as ve, searchOrgUnitOptions as ye } from "@rytass/bpm-core-client/organization";
12
12
  // src/views/forms/renderer/form-data-source-field.ts
13
13
  var be = {
14
14
  canRetry: !1,
15
15
  error: null,
16
16
  hasValue: !1,
17
17
  hasNextPage: !1,
18
+ loadingNextPage: !1,
18
19
  invalidValues: [],
20
+ onOpen: () => void 0,
19
21
  onReachBottom: () => void 0,
20
22
  onSearch: () => void 0,
21
23
  options: [],
@@ -116,27 +118,27 @@ function H(e) {
116
118
  readonly: e.readonly
117
119
  }), L = !!(t && M && t.type !== "autocomplete"), R = Fe(fe, L && t !== null && ue(t, e.formData, e.row?.values).length > 0), ge = a(I);
118
120
  ge.current = I;
119
- let [_e, z] = o([]), [ve, ye] = o(""), [B, xe] = o(null), [V, De] = o(null), [ke, H] = o(() => t ? L ? R : I : "IDLE"), [je, U] = o(null), Me = a(0), W = a(0), G = a(0), K = a(null), Be = a(null), q = a({
121
+ let [_e, z] = o([]), [B, ve] = o(""), [ye, xe] = o(null), [V, De] = o(null), [ke, H] = o(() => t ? L ? R : I : "IDLE"), [je, U] = o(null), [Me, W] = o(!1), G = a(0), K = a(0), q = a(0), J = a(null), Be = a(null), Y = a(!1), Ve = a({
120
122
  cursor: null,
121
123
  searchText: ""
122
- }), J = i(() => ze(e.formData), [f]), Y = i(() => e.row ? ze(e.row.values) : void 0, [y]), Ve = i(() => j(d, _e), [_e, d]), X = V && V.signature === O && V.valueSignature === S ? V : null, He = F && !X, Ue = !!(de && X && X.unresolvedValues.length > 0), We = Ne({
123
- options: Ve,
124
- resolution: X,
125
- resolvePending: He,
124
+ }), X = i(() => ze(e.formData), [f]), Z = i(() => e.row ? ze(e.row.values) : void 0, [y]), He = i(() => j(d, _e), [_e, d]), Ue = V && V.signature === O && V.valueSignature === S ? V : null, We = F && !Ue, Ge = !!(de && Ue && Ue.unresolvedValues.length > 0), Ke = Ne({
125
+ options: He,
126
+ resolution: Ue,
127
+ resolvePending: We,
126
128
  value: x
127
- }), Z = n((n, r) => {
129
+ }), Q = n((n, r) => {
128
130
  if (!t || !M) return;
129
- let i = W.current + 1;
130
- W.current = i, q.current = {
131
+ let i = K.current + 1;
132
+ K.current = i, Y.current = !0, Ve.current = {
131
133
  cursor: r,
132
134
  searchText: n
133
- }, K.current?.abort();
135
+ }, J.current?.abort();
134
136
  let a = new AbortController();
135
- K.current = a, H(R), U(null), (M.kind === "preview" ? ee({
137
+ J.current = a, H(R), W(r !== null), U(null), (M.kind === "preview" ? ee({
136
138
  cursor: r,
137
139
  fieldKey: s,
138
- formData: J,
139
- rowValues: Y,
140
+ formData: X,
141
+ rowValues: Z,
140
142
  schema: e.schema,
141
143
  searchText: n,
142
144
  signal: a.signal,
@@ -144,19 +146,20 @@ function H(e) {
144
146
  }) : oe({
145
147
  cursor: r,
146
148
  fieldKey: s,
147
- formData: J,
149
+ formData: X,
148
150
  instanceId: M.instanceId ?? null,
149
- rowValues: Y,
151
+ rowValues: Z,
150
152
  searchText: n,
151
153
  signal: a.signal,
152
154
  templateId: M.templateId ?? null
153
155
  })).then((e) => {
154
- Re(a, W, i) || (z((t) => {
156
+ Re(a, K, i) || (W(!1), z((t) => {
155
157
  let n = pe(x, t);
156
158
  return j(n, r ? t : [], e.options);
157
- }), xe(e.nextCursor), U(null), Me.current = r ? Me.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && Me.current < Se && Ge.current(n, e.nextCursor), H(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
159
+ }), xe(e.nextCursor), U(null), G.current = r ? G.current + e.options.length : e.options.length, e.nextCursor && e.options.length > 0 && G.current < Se && qe.current(n, e.nextCursor), H(e.waitingForFieldKeys.length ? "WAITING_FOR_DEPENDENCIES" : "VALID"));
158
160
  }).catch((e) => {
159
- if (Re(a, W, i)) return;
161
+ if (Re(a, K, i)) return;
162
+ r === null && (Y.current = !1), W(!1);
160
163
  let t = ie(e) ?? "選項來源暫時無法使用。", n = re(e);
161
164
  U(t), H(Ie(!!(n && we.includes(n)), T));
162
165
  });
@@ -167,41 +170,41 @@ function H(e) {
167
170
  T,
168
171
  R,
169
172
  s,
170
- J,
171
- Y,
173
+ X,
174
+ Z,
172
175
  m,
173
176
  h
174
- ]), Ge = a(Z);
175
- Ge.current = Z;
176
- let Q = n(() => {
177
+ ]), qe = a(Q);
178
+ qe.current = Q;
179
+ let Je = n(() => {
177
180
  if (!t || !M || C.length === 0) return;
178
- let n = O, r = S, i = G.current + 1;
179
- G.current = i, Be.current?.abort();
181
+ let n = O, r = S, i = q.current + 1;
182
+ q.current = i, Be.current?.abort();
180
183
  let a = new AbortController();
181
184
  Be.current = a, U(null), (M.kind === "preview" ? te({
182
185
  fieldKey: s,
183
- formData: J,
184
- rowValues: Y,
186
+ formData: X,
187
+ rowValues: Z,
185
188
  schema: e.schema,
186
189
  signal: a.signal,
187
190
  uiSchema: e.uiSchema,
188
191
  values: C
189
192
  }) : me({
190
193
  fieldKey: s,
191
- formData: J,
194
+ formData: X,
192
195
  instanceId: M.instanceId ?? null,
193
- rowValues: Y,
196
+ rowValues: Z,
194
197
  signal: a.signal,
195
198
  templateId: M.templateId ?? null,
196
199
  values: C
197
200
  })).then((e) => {
198
- Re(a, G, i) || (e.waitingForFieldKeys.length ? H("WAITING_FOR_DEPENDENCIES") : (z((t) => j(t, e.options)), De({
201
+ Re(a, q, i) || (e.waitingForFieldKeys.length ? H("WAITING_FOR_DEPENDENCIES") : (z((t) => j(t, e.options)), De({
199
202
  signature: n,
200
203
  unresolvedValues: e.unresolvedValues,
201
204
  valueSignature: r
202
205
  }), H("VALID")));
203
206
  }).catch((e) => {
204
- Re(a, G, i) || (H("UNAVAILABLE"), U(ie(e) ?? "選項來源暫時無法使用。"));
207
+ Re(a, q, i) || (H("UNAVAILABLE"), U(ie(e) ?? "選項來源暫時無法使用。"));
205
208
  });
206
209
  }, [
207
210
  S,
@@ -209,14 +212,14 @@ function H(e) {
209
212
  l,
210
213
  M,
211
214
  s,
212
- J,
213
- Y,
215
+ X,
216
+ Z,
214
217
  m,
215
218
  C,
216
219
  h
217
- ]), Ke = a(Q);
218
- Ke.current = Q, r(() => {
219
- W.current += 1, K.current?.abort(), z((e) => pe(x, e)), xe((e) => e === null ? e : null), ye((e) => e && ""), U((e) => e && null), t ? L ? Ge.current("", null) : H(ge.current) : H("IDLE");
220
+ ]), Ye = a(Je);
221
+ Ye.current = Je, r(() => {
222
+ K.current += 1, Y.current = !1, J.current?.abort(), W(!1), z((e) => pe(x, e)), xe((e) => e === null ? e : null), ve((e) => e && ""), U((e) => e && null), t ? L ? qe.current("", null) : H(ge.current) : H("IDLE");
220
223
  }, [
221
224
  L,
222
225
  l,
@@ -234,7 +237,7 @@ function H(e) {
234
237
  l,
235
238
  I
236
239
  ]), r(() => {
237
- F && !A && Ke.current();
240
+ F && !A && Ye.current();
238
241
  }, [
239
242
  M,
240
243
  F,
@@ -242,37 +245,52 @@ function H(e) {
242
245
  k,
243
246
  D
244
247
  ]), r(() => () => {
245
- K.current?.abort(), Be.current?.abort();
248
+ J.current?.abort(), Be.current?.abort();
246
249
  }, []);
247
- let qe = n((e) => {
248
- ye(e), z((e) => pe(x, e)), xe(null), Z(e, null);
249
- }, [Z]), Je = n(() => {
250
- B && Z(ve, B);
250
+ let Xe = n((e) => {
251
+ ve(e), z((e) => pe(x, e)), xe(null), Q(e, null);
252
+ }, [Q]), Ze = n(() => {
253
+ L || !M || e.readonly || Y.current && B === "" || Xe("");
251
254
  }, [
252
- Z,
253
- B,
254
- ve
255
- ]), Ye = n(() => {
256
- M && (Z(q.current.searchText, q.current.cursor), F && Ke.current());
255
+ L,
256
+ M,
257
+ e.readonly,
258
+ Xe,
259
+ B
260
+ ]), Qe = a({
261
+ cursor: ye,
262
+ searchText: B
263
+ });
264
+ Qe.current = {
265
+ cursor: ye,
266
+ searchText: B
267
+ };
268
+ let $e = n(() => {
269
+ let { cursor: e, searchText: t } = Qe.current;
270
+ e && qe.current(t, e);
271
+ }, []), et = n(() => {
272
+ M && (Q(Ve.current.searchText, Ve.current.cursor), F && Ye.current());
257
273
  }, [
258
274
  M,
259
- Z,
275
+ Q,
260
276
  F
261
277
  ]);
262
278
  return t ? {
263
279
  canRetry: !!M,
264
280
  error: je,
265
281
  hasValue: T,
266
- hasNextPage: !!B,
267
- invalidValues: We,
268
- onReachBottom: Je,
269
- onSearch: qe,
270
- options: Ve,
271
- retry: Ye,
272
- selectionExpired: Ue,
282
+ hasNextPage: !!ye,
283
+ loadingNextPage: Me,
284
+ invalidValues: Ke,
285
+ onOpen: Ze,
286
+ onReachBottom: $e,
287
+ onSearch: Xe,
288
+ options: He,
289
+ retry: et,
290
+ selectionExpired: Ge,
273
291
  status: A && M && (L || T) ? L ? R : "STALE" : Le({
274
- invalidValues: We,
275
- resolvePending: He,
292
+ invalidValues: Ke,
293
+ resolvePending: We,
276
294
  status: ke
277
295
  })
278
296
  } : be;
@@ -348,8 +366,8 @@ function K() {
348
366
  onFileUploadStateChange: r
349
367
  };
350
368
  }
351
- var Be = "無法讀取檔名的附件", q = "此處無法上傳附件";
352
- function J({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onStateChange: l, onUploadAttachment: u, readonly: d, value: f }) {
369
+ var q = "無法讀取檔名的附件", J = "此處無法上傳附件";
370
+ function Be({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onStateChange: l, onUploadAttachment: u, readonly: d, value: f }) {
353
371
  let [p, m] = o([]), [h, g] = o(() => /* @__PURE__ */ new Map()), [_, v] = o([]), b = W(f), x = b.join("\n"), C = i(() => new Map((e ?? []).map((e) => [e.id, e])), [e]), w = i(() => {
354
372
  let e = new Map(_.map((e, t) => [e, t]));
355
373
  return [...b.map((e) => h.get(e) ?? Y(e, C.get(e))), ...p].sort((t, n) => (e.get(t.id) ?? -1) - (e.get(n.id) ?? -1));
@@ -381,7 +399,7 @@ function J({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onS
381
399
  T.current = e, v(e.map((e) => e.id)), m(e.filter((e) => e.status !== "done")), i.length > 0 && g((e) => new Map([...e, ...i.map((e) => [e.id, e])])), n.join("\n") !== x && s(n.length ? n : void 0);
382
400
  }
383
401
  async function ee(e) {
384
- if (!u) throw Error(q);
402
+ if (!u) throw Error(J);
385
403
  return {
386
404
  file: e,
387
405
  id: (await u(t, e)).id,
@@ -399,10 +417,10 @@ function J({ attachments: e, field: t, onChange: s, onDownloadAttachment: c, onS
399
417
  D.current(T.current.map((t) => t.id === e ? n : t));
400
418
  }
401
419
  function ne(e, t) {
402
- h.has(e) ? He(t) : c?.(e);
420
+ h.has(e) ? Z(t) : c?.(e);
403
421
  }
404
422
  let N = !!u && !d, re = [...!d && !u ? [{
405
- label: q,
423
+ label: J,
406
424
  type: "info"
407
425
  }] : [], ...p.filter((e) => e.status === "error").map((e) => ({
408
426
  label: `${e.file?.name ?? "檔案"}:${e.errorMessage ?? "上傳失敗"},未附加。請重試或刪除。`,
@@ -440,7 +458,7 @@ function Y(e, t) {
440
458
  id: e,
441
459
  progress: 100,
442
460
  status: "done",
443
- url: Be
461
+ url: q
444
462
  };
445
463
  }
446
464
  function Ve(e) {
@@ -450,33 +468,33 @@ function Ve(e) {
450
468
  function X(e) {
451
469
  return e instanceof Error && e.message ? `上傳失敗:${e.message}` : "上傳失敗,請重試。";
452
470
  }
453
- function He(e) {
471
+ function Z(e) {
454
472
  let t = URL.createObjectURL(e), n = document.createElement("a");
455
473
  n.href = t, n.download = e.name, n.style.display = "none", document.body.appendChild(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(t), 3e4);
456
474
  }
457
475
  // src/views/forms/renderer/form-field-link.ts
458
- var Ue = /\s/u;
459
- function We(e) {
476
+ var He = /\s/u;
477
+ function Ue(e) {
460
478
  return [...e].some((e) => {
461
479
  let t = e.codePointAt(0) ?? 0;
462
- return t <= 32 || t >= 127 && t <= 160 || Ue.test(e);
480
+ return t <= 32 || t >= 127 && t <= 160 || He.test(e);
463
481
  });
464
482
  }
465
- var Z = /^https?:\/\//iu;
483
+ var We = /^https?:\/\//iu;
466
484
  function Ge(e) {
467
- return typeof e != "string" || !e || e.includes("\\") || We(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Ke(e) ? {
485
+ return typeof e != "string" || !e || e.includes("\\") || Ue(e) ? null : e.startsWith("/") ? !e.startsWith("//") && Q(e) ? {
468
486
  external: !1,
469
487
  href: e
470
- } : null : Z.test(e) && qe(e) ? {
488
+ } : null : We.test(e) && qe(e) ? {
471
489
  external: !0,
472
490
  href: e
473
491
  } : null;
474
492
  }
475
- var Q = "http://placeholder.invalid";
476
- function Ke(e) {
493
+ var Ke = "http://placeholder.invalid";
494
+ function Q(e) {
477
495
  try {
478
- let t = new URL(e, Q);
479
- return t.origin === Q && !t.pathname.startsWith("//");
496
+ let t = new URL(e, Ke);
497
+ return t.origin === Ke && !t.pathname.startsWith("//");
480
498
  } catch {
481
499
  return !1;
482
500
  }
@@ -551,10 +569,10 @@ function et(e, t) {
551
569
  }
552
570
  function tt(e, t) {
553
571
  let n = new Set(t.filter((e) => !e.unresolved).map((e) => e.id));
554
- return ve(e).filter((e) => !n.has(e));
572
+ return B(e).filter((e) => !n.has(e));
555
573
  }
556
574
  function nt(e, t) {
557
- return ve(e).map((e) => t.find((t) => t.id === e) ?? $e(e));
575
+ return B(e).map((e) => t.find((t) => t.id === e) ?? $e(e));
558
576
  }
559
577
  function rt(e, t) {
560
578
  if (e.length !== 0) return t ? e.map((e) => e.id) : e[0]?.id;
@@ -599,6 +617,7 @@ function it({ multiple: e, name: t, onChange: n, placeholder: i, readonly: c, si
599
617
  },
600
618
  loading: h,
601
619
  loadingText: "搜尋成員中...",
620
+ menuMaxHeight: 320,
602
621
  onSearch: C,
603
622
  onVisibilityChange: (e) => {
604
623
  e && (m([]), C(""));
@@ -673,7 +692,7 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
673
692
  let [u, d] = o([]), [f, p] = o([]), [m, h] = o(!1), [g, _] = o(!1), y = a(0), b = pt(l, u);
674
693
  r(() => {
675
694
  let e = !1;
676
- return b === null ? () => void 0 : (ye([b]).then((e) => {
695
+ return b === null ? () => void 0 : (ve([b]).then((e) => {
677
696
  let t = e.map(st);
678
697
  return t.some((e) => e.id.toLowerCase() === b.toLowerCase()) ? t : [...t, lt(b)];
679
698
  }).catch(() => [lt(b)]).then((t) => {
@@ -686,7 +705,7 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
686
705
  let t = y.current + 1;
687
706
  y.current = t, h(!0);
688
707
  try {
689
- let n = (await B(e)).map(st);
708
+ let n = (await ye(e)).map(st);
690
709
  y.current === t && (p(n), _(!1), d((e) => mt(e, n)));
691
710
  } catch {
692
711
  y.current === t && (p([]), _(!0));
@@ -710,6 +729,7 @@ function _t({ name: e, onChange: t, placeholder: n, readonly: i, size: c, value:
710
729
  },
711
730
  loading: m,
712
731
  loadingText: "搜尋組織中...",
732
+ menuMaxHeight: 320,
713
733
  mode: "single",
714
734
  onChange: (e) => t(ht(e ?? null)),
715
735
  onSearch: x,
@@ -800,7 +820,7 @@ function Ct({ attachments: e, dataSourceContext: t, dataSourceInitialValues: n,
800
820
  schema: b,
801
821
  style: {
802
822
  ...bt,
803
- gridColumn: `span ${x ? 12 : Kt(e, C)}`,
823
+ gridColumn: `span ${x ? 12 : Wt(e, C)}`,
804
824
  ...x && !_e(e) ? { maxWidth: d } : {}
805
825
  },
806
826
  value: k[e.fieldKey],
@@ -860,7 +880,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
860
880
  ...u ? { labelOptionalMarker: u } : {},
861
881
  name: o.fieldKey,
862
882
  required: x,
863
- children: _e(o) ? /* @__PURE__ */ S(Lt, {
883
+ children: _e(o) ? /* @__PURE__ */ S(Ft, {
864
884
  dataSourceContext: t,
865
885
  dataSourceInitialValues: n,
866
886
  errors: a,
@@ -873,7 +893,7 @@ function Et({ dataSourceContext: t, dataSourceInitialValues: n, error: i, errors
873
893
  uiSchema: b,
874
894
  value: _,
875
895
  values: y
876
- }) : Ut(o, _, w, d, l, t, T)
896
+ }) : Vt(o, _, w, d, l, t, T)
877
897
  }),
878
898
  i ? /* @__PURE__ */ S(v, {
879
899
  color: "text-error",
@@ -913,30 +933,27 @@ var Dt = "(另開新分頁)", Ot = "另開新分頁", kt = {
913
933
  }, Mt = {
914
934
  display: "flex",
915
935
  justifyContent: "flex-start"
916
- }, Nt = {
917
- maxWidth: "100%",
918
- overflowX: "auto"
919
- }, Pt = 160, Ft = 56, It = {
936
+ }, Nt = 160, Pt = {
920
937
  display: "grid",
921
938
  gap: 4,
922
939
  minWidth: 0
923
940
  };
924
- function Lt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: m, values: g }) {
925
- let _ = le(m), v = ce(i), y = a(0), [b, x] = o(() => _.map(() => Bt(y)));
941
+ function Ft({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field: i, onChange: s, onDataSourceStateChange: l, optionSnapshots: u, readonly: d, schema: f, uiSchema: p, value: m, values: g }) {
942
+ let _ = le(m), v = ce(i), y = a(0), [b, x] = o(() => _.map(() => Rt(y)));
926
943
  r(() => {
927
- b.length !== _.length && x(_.map(() => Bt(y)));
944
+ b.length !== _.length && x(_.map(() => Rt(y)));
928
945
  }, [b.length, _.length]);
929
946
  function w(e) {
930
947
  s(i.fieldKey, e);
931
948
  }
932
949
  function T() {
933
- x([...b, Bt(y)]), w([..._, E(i.columns)]);
950
+ x([...b, Rt(y)]), w([..._, E(i.columns)]);
934
951
  }
935
952
  function D(e) {
936
953
  x(b.filter((t, n) => n !== e)), w(_.filter((t, n) => n !== e));
937
954
  }
938
955
  function O(e, t, n) {
939
- w(_.map((r, i) => i === e ? Vt(r, t, n) : r));
956
+ w(_.map((r, i) => i === e ? zt(r, t, n) : r));
940
957
  }
941
958
  let k = _.map((e, t) => ({
942
959
  ...e,
@@ -944,14 +961,15 @@ function Lt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
944
961
  key: b[t] ?? `row-${t}`
945
962
  })), A = i.columns.map((r) => ({
946
963
  key: r.fieldKey,
947
- render: (a) => /* @__PURE__ */ S(Rt, {
964
+ minWidth: Nt,
965
+ render: (a) => /* @__PURE__ */ S(It, {
948
966
  column: r,
949
967
  dataSourceContext: e,
950
968
  error: n[se(i.fieldKey, a.index, r.fieldKey)] ?? null,
951
969
  fieldPath: `${i.fieldKey}.${r.fieldKey}`,
952
970
  formData: g,
953
971
  initialFormData: t,
954
- initialRowValues: zt(t?.[i.fieldKey], a.index),
972
+ initialRowValues: Lt(t?.[i.fieldKey], a.index),
955
973
  onChange: (e) => O(a.index, r.fieldKey, e),
956
974
  onDataSourceStateChange: l,
957
975
  optionSnapshots: u,
@@ -971,23 +989,18 @@ function Lt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
971
989
  onClick: () => D(e.index),
972
990
  variant: "destructive-ghost"
973
991
  }],
992
+ fixed: "end",
974
993
  width: 56
975
994
  };
976
995
  return /* @__PURE__ */ C("div", {
977
996
  style: jt,
978
- children: [/* @__PURE__ */ S("div", {
979
- style: Nt,
980
- children: /* @__PURE__ */ S("div", {
981
- style: { minWidth: i.columns.length * Pt + (j ? Ft : 0) },
982
- children: /* @__PURE__ */ S(h, {
983
- ...j ? { actions: j } : {},
984
- columns: A,
985
- dataSource: [...k],
986
- rowHeightPreset: "roomy",
987
- showHeader: !0,
988
- size: "sub"
989
- })
990
- })
997
+ children: [/* @__PURE__ */ S(h, {
998
+ ...j ? { actions: j } : {},
999
+ columns: A,
1000
+ dataSource: [...k],
1001
+ rowHeightPreset: "roomy",
1002
+ showHeader: !0,
1003
+ size: "sub"
991
1004
  }), d ? null : /* @__PURE__ */ S("div", {
992
1005
  style: Mt,
993
1006
  children: /* @__PURE__ */ S(c, {
@@ -1003,14 +1016,14 @@ function Lt({ dataSourceContext: e, dataSourceInitialValues: t, errors: n, field
1003
1016
  })]
1004
1017
  });
1005
1018
  }
1006
- function Rt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData: a, initialFormData: o, initialRowValues: s, onChange: l, onDataSourceStateChange: u, optionSnapshots: d, path: f, readonly: p, rowValues: m, schema: h, uiSchema: g }) {
1007
- let _ = Ht(m, e.fieldKey), y = H({
1019
+ function It({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData: a, initialFormData: o, initialRowValues: s, onChange: l, onDataSourceStateChange: u, optionSnapshots: d, path: f, readonly: p, rowValues: m, schema: h, uiSchema: g }) {
1020
+ let _ = Bt(m, e.fieldKey), y = H({
1008
1021
  context: t,
1009
1022
  field: e,
1010
1023
  fieldPath: i,
1011
1024
  formData: a,
1012
1025
  initialFormData: o,
1013
- initialValue: s ? Ht(s, e.fieldKey) : void 0,
1026
+ initialValue: s ? Bt(s, e.fieldKey) : void 0,
1014
1027
  optionSnapshots: d,
1015
1028
  readonly: p,
1016
1029
  row: {
@@ -1045,9 +1058,9 @@ function Rt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
1045
1058
  x
1046
1059
  ]), /* @__PURE__ */ C("div", {
1047
1060
  "data-form-field-key": f,
1048
- style: It,
1061
+ style: Pt,
1049
1062
  children: [
1050
- Ut(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
1063
+ Vt(e, _, p, (e, t) => l(t), void 0, t, y, "sub"),
1051
1064
  n ? /* @__PURE__ */ S(v, {
1052
1065
  color: "text-error",
1053
1066
  variant: "caption",
@@ -1070,25 +1083,25 @@ function Rt({ column: e, dataSourceContext: t, error: n, fieldPath: i, formData:
1070
1083
  ]
1071
1084
  });
1072
1085
  }
1073
- function zt(e, t) {
1086
+ function Lt(e, t) {
1074
1087
  return le(e)[t];
1075
1088
  }
1076
- function Bt(e) {
1089
+ function Rt(e) {
1077
1090
  return e.current += 1, `table-row-${e.current}`;
1078
1091
  }
1079
- function Vt(e, t, n) {
1092
+ function zt(e, t, n) {
1080
1093
  return n === void 0 || !ge(n) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : {
1081
1094
  ...e,
1082
1095
  [t]: n
1083
1096
  };
1084
1097
  }
1085
- function Ht(e, t) {
1098
+ function Bt(e, t) {
1086
1099
  if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
1087
1100
  }
1088
- function Ut(e, t, n, r, i, a, o, s = "main") {
1089
- return he(e) ? Gt(e, t, n, r, a, o, s) : Wt(e, t, n, r, i, s);
1101
+ function Vt(e, t, n, r, i, a, o, s = "main") {
1102
+ return he(e) ? Ut(e, t, n, r, a, o, s) : Ht(e, t, n, r, i, s);
1090
1103
  }
1091
- function Wt(e, t, n, r, i, a = "main") {
1104
+ function Ht(e, t, n, r, i, a = "main") {
1092
1105
  let o = n && (e.type === "text" || e.type === "textarea") && e.displayAs === "link" ? Ge(t) : null;
1093
1106
  if (o) return /* @__PURE__ */ S(v, {
1094
1107
  color: "text-brand",
@@ -1113,7 +1126,7 @@ function Wt(e, t, n, r, i, a = "main") {
1113
1126
  ref: St,
1114
1127
  rows: 3,
1115
1128
  style: xt,
1116
- value: qt(t)
1129
+ value: Gt(t)
1117
1130
  });
1118
1131
  if (e.type === "boolean") return /* @__PURE__ */ S(_, {
1119
1132
  checked: t === !0,
@@ -1125,6 +1138,7 @@ function Wt(e, t, n, r, i, a = "main") {
1125
1138
  if (R(e) && e.type === "checkbox") {
1126
1139
  let i = e.options.map(N);
1127
1140
  return /* @__PURE__ */ S(m, {
1141
+ menuMaxHeight: 320,
1128
1142
  mode: "multiple",
1129
1143
  onChange: (t) => r(e.fieldKey, t?.length ? t.map((e) => e.id) : void 0),
1130
1144
  options: i,
@@ -1137,12 +1151,13 @@ function Wt(e, t, n, r, i, a = "main") {
1137
1151
  if (R(e)) {
1138
1152
  let i = e.options.map(N);
1139
1153
  return /* @__PURE__ */ S(m, {
1154
+ menuMaxHeight: 320,
1140
1155
  onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
1141
1156
  options: i,
1142
1157
  placeholder: e.placeholder ?? "請選擇",
1143
1158
  readOnly: n,
1144
1159
  size: a,
1145
- value: fe(i, qt(t))
1160
+ value: fe(i, Gt(t))
1146
1161
  });
1147
1162
  }
1148
1163
  return e.type === "member" ? /* @__PURE__ */ S(it, {
@@ -1156,11 +1171,11 @@ function Wt(e, t, n, r, i, a = "main") {
1156
1171
  }) : e.type === "org_unit" ? /* @__PURE__ */ S(_t, {
1157
1172
  name: e.fieldKey,
1158
1173
  onChange: (t) => r(e.fieldKey, t),
1159
- placeholder: e.placeholder ?? Yt(e.type),
1174
+ placeholder: e.placeholder ?? qt(e.type),
1160
1175
  readonly: n,
1161
1176
  size: a,
1162
1177
  value: t
1163
- }) : e.type === "file_upload" ? /* @__PURE__ */ S(J, {
1178
+ }) : e.type === "file_upload" ? /* @__PURE__ */ S(Be, {
1164
1179
  attachments: i?.attachments,
1165
1180
  field: e,
1166
1181
  onChange: (t) => r(e.fieldKey, t),
@@ -1173,7 +1188,7 @@ function Wt(e, t, n, r, i, a = "main") {
1173
1188
  format: "YYYY-MM-DD",
1174
1189
  fullWidth: !0,
1175
1190
  onChange: (t) => r(e.fieldKey, D(t)),
1176
- placeholder: e.placeholder ?? Yt(e.type),
1191
+ placeholder: e.placeholder ?? qt(e.type),
1177
1192
  readOnly: n,
1178
1193
  value: ne(t)
1179
1194
  }) : e.type === "datetime" ? /* @__PURE__ */ S(d, {
@@ -1195,34 +1210,38 @@ function Wt(e, t, n, r, i, a = "main") {
1195
1210
  max: e.maximum,
1196
1211
  min: e.minimum
1197
1212
  })),
1198
- placeholder: e.placeholder ?? Yt(e.type),
1213
+ placeholder: e.placeholder ?? qt(e.type),
1199
1214
  ...n ? { readonly: !0 } : {},
1200
1215
  showSpinner: !0,
1201
- value: Jt(t),
1216
+ value: Kt(t),
1202
1217
  variant: "measure"
1203
1218
  }) : /* @__PURE__ */ S(f, {
1204
1219
  fullWidth: !0,
1205
1220
  onChange: (t) => r(e.fieldKey, t.target.value),
1206
- placeholder: e.placeholder ?? Yt(e.type),
1221
+ placeholder: e.placeholder ?? qt(e.type),
1207
1222
  ...n ? { readonly: !0 } : {},
1208
1223
  size: a,
1209
- value: qt(t),
1224
+ value: Gt(t),
1210
1225
  variant: "base"
1211
1226
  });
1212
1227
  }
1213
- function Gt(e, t, n, r, i, a, o = "main") {
1214
- let c = a.options.map(N), u = pe(t, a.options).map(N), d = a.status === "LOADING", f = a.status === "WAITING_FOR_DEPENDENCIES", h = !!i && !n, g = n || f, _ = n;
1228
+ function Ut(e, t, n, r, i, a, o = "main") {
1229
+ let c = a.options.map(N), u = pe(t, a.options).map(N), d = a.status === "LOADING", f = d && !a.loadingNextPage, h = a.status === "WAITING_FOR_DEPENDENCIES", g = !!i && !n, _ = n || h, v = n;
1215
1230
  return e.type === "autocomplete" ? z(e) === "multiple" ? /* @__PURE__ */ S(s, {
1216
- asyncData: h,
1231
+ asyncData: g,
1217
1232
  clearSearchText: !0,
1218
- disabled: _,
1219
- disabledOptionsFilter: h,
1233
+ disabled: v,
1234
+ disabledOptionsFilter: g,
1220
1235
  globalPortal: !0,
1221
- loading: d,
1236
+ loading: f,
1237
+ menuMaxHeight: 320,
1222
1238
  mode: "multiple",
1223
1239
  onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
1224
- onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
1225
- onSearch: h ? a.onSearch : void 0,
1240
+ onReachBottom: a.onReachBottom,
1241
+ onSearch: g ? a.onSearch : void 0,
1242
+ onVisibilityChange: (e) => {
1243
+ e && g && a.onOpen();
1244
+ },
1226
1245
  options: c,
1227
1246
  placeholder: e.placeholder ?? "請輸入或選擇",
1228
1247
  readOnly: n,
@@ -1230,16 +1249,20 @@ function Gt(e, t, n, r, i, a, o = "main") {
1230
1249
  size: o,
1231
1250
  value: u
1232
1251
  }) : /* @__PURE__ */ S(s, {
1233
- asyncData: h,
1252
+ asyncData: g,
1234
1253
  clearSearchText: !0,
1235
- disabled: _,
1236
- disabledOptionsFilter: h,
1254
+ disabled: v,
1255
+ disabledOptionsFilter: g,
1237
1256
  globalPortal: !0,
1238
- loading: d,
1257
+ loading: f,
1258
+ menuMaxHeight: 320,
1239
1259
  mode: "single",
1240
1260
  onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
1241
- onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
1242
- onSearch: h ? a.onSearch : void 0,
1261
+ onReachBottom: a.onReachBottom,
1262
+ onSearch: g ? a.onSearch : void 0,
1263
+ onVisibilityChange: (e) => {
1264
+ e && g && a.onOpen();
1265
+ },
1243
1266
  options: c,
1244
1267
  placeholder: e.placeholder ?? "請輸入或選擇",
1245
1268
  readOnly: n,
@@ -1247,13 +1270,13 @@ function Gt(e, t, n, r, i, a, o = "main") {
1247
1270
  size: o,
1248
1271
  value: u[0] ?? null
1249
1272
  }) : e.type === "radio" ? /* @__PURE__ */ S(p, {
1250
- disabled: g,
1273
+ disabled: _,
1251
1274
  name: e.fieldKey,
1252
1275
  onChange: (t) => r(e.fieldKey, t.target.value || void 0),
1253
1276
  options: c,
1254
- value: qt(t)
1277
+ value: Gt(t)
1255
1278
  }) : e.type === "checkbox" ? /* @__PURE__ */ S(l, {
1256
- disabled: g,
1279
+ disabled: _,
1257
1280
  name: e.fieldKey,
1258
1281
  onChange: (t) => r(e.fieldKey, t.target.values.length ? t.target.values : void 0),
1259
1282
  options: c.map((e) => ({
@@ -1262,21 +1285,23 @@ function Gt(e, t, n, r, i, a, o = "main") {
1262
1285
  })),
1263
1286
  value: [...W(t)]
1264
1287
  }) : z(e) === "multiple" ? /* @__PURE__ */ S(m, {
1265
- disabled: g,
1288
+ disabled: _,
1266
1289
  loading: d,
1290
+ menuMaxHeight: 320,
1267
1291
  mode: "multiple",
1268
1292
  onChange: (t) => r(e.fieldKey, t.length ? t.map((e) => e.id) : void 0),
1269
- onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
1293
+ onReachBottom: a.onReachBottom,
1270
1294
  options: c,
1271
1295
  placeholder: e.placeholder ?? "請選擇一或多個選項",
1272
1296
  readOnly: n,
1273
1297
  size: o,
1274
1298
  value: u
1275
1299
  }) : /* @__PURE__ */ S(m, {
1276
- disabled: g,
1300
+ disabled: _,
1277
1301
  loading: d,
1302
+ menuMaxHeight: 320,
1278
1303
  onChange: (t) => r(e.fieldKey, t?.id ?? void 0),
1279
- onReachBottom: a.hasNextPage ? a.onReachBottom : void 0,
1304
+ onReachBottom: a.onReachBottom,
1280
1305
  options: c,
1281
1306
  placeholder: e.placeholder ?? "請選擇",
1282
1307
  readOnly: n,
@@ -1284,20 +1309,20 @@ function Gt(e, t, n, r, i, a, o = "main") {
1284
1309
  value: u[0] ?? null
1285
1310
  });
1286
1311
  }
1287
- function Kt(e, t) {
1312
+ function Wt(e, t) {
1288
1313
  return {
1289
1314
  FULL: 12,
1290
1315
  HALF: 6,
1291
1316
  THIRD: 4
1292
1317
  }[t.layout.find((t) => t.fieldKey === e.fieldKey)?.width ?? "FULL"];
1293
1318
  }
1294
- function qt(e) {
1319
+ function Gt(e) {
1295
1320
  return typeof e == "string" ? e : "";
1296
1321
  }
1297
- function Jt(e) {
1322
+ function Kt(e) {
1298
1323
  return typeof e == "number" ? String(e) : "";
1299
1324
  }
1300
- function Yt(e) {
1325
+ function qt(e) {
1301
1326
  return {
1302
1327
  boolean: "",
1303
1328
  autocomplete: "請輸入或選擇",
@@ -1318,4 +1343,4 @@ function Yt(e) {
1318
1343
  }
1319
1344
  export { G as a, je as c, Je as i, Me as l, st as n, K as o, Ye as r, U as s, Ct as t, H as u };
1320
1345
 
1321
- //# sourceMappingURL=FormRendererView-BcQKUi1A.js.map
1346
+ //# sourceMappingURL=FormRendererView-BF8Ge0Zk.js.map