@rytass/bpm-core-react 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +21 -0
  3. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs +3 -0
  4. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs.map +1 -0
  5. package/dist/chunks/FormBuilderView-D8DrQOXD.js +1090 -0
  6. package/dist/chunks/FormBuilderView-D8DrQOXD.js.map +1 -0
  7. package/dist/chunks/{approval-instance-list-page-C5ZKPHdA.cjs → approval-instance-list-page-BMUKxzcz.cjs} +2 -2
  8. package/dist/chunks/{approval-instance-list-page-C5ZKPHdA.cjs.map → approval-instance-list-page-BMUKxzcz.cjs.map} +1 -1
  9. package/dist/chunks/{approval-instance-list-page-BF2r5D2-.js → approval-instance-list-page-YZcGGDD8.js} +2 -2
  10. package/dist/chunks/{approval-instance-list-page-BF2r5D2-.js.map → approval-instance-list-page-YZcGGDD8.js.map} +1 -1
  11. package/dist/chunks/compose-PMrmi-LE.js +451 -0
  12. package/dist/chunks/compose-PMrmi-LE.js.map +1 -0
  13. package/dist/chunks/compose-ziVbRYdo.cjs +2 -0
  14. package/dist/chunks/compose-ziVbRYdo.cjs.map +1 -0
  15. package/dist/chunks/{dashboard-page-Ib8srCMy.js → dashboard-page-DJ9vOPga.js} +2 -2
  16. package/dist/chunks/{dashboard-page-Ib8srCMy.js.map → dashboard-page-DJ9vOPga.js.map} +1 -1
  17. package/dist/chunks/{dashboard-page-CddG1MnK.cjs → dashboard-page-DwHQY6Ki.cjs} +2 -2
  18. package/dist/chunks/{dashboard-page-CddG1MnK.cjs.map → dashboard-page-DwHQY6Ki.cjs.map} +1 -1
  19. package/dist/chunks/designer-DCn6_v4b.cjs +65 -0
  20. package/dist/chunks/designer-DCn6_v4b.cjs.map +1 -0
  21. package/dist/chunks/designer-mOMxJ0Py.js +2576 -0
  22. package/dist/chunks/designer-mOMxJ0Py.js.map +1 -0
  23. package/dist/chunks/detail-Cci9tnoC.cjs +2 -0
  24. package/dist/chunks/detail-Cci9tnoC.cjs.map +1 -0
  25. package/dist/chunks/detail-kyolfdBu.js +1957 -0
  26. package/dist/chunks/detail-kyolfdBu.js.map +1 -0
  27. package/dist/chunks/{routes-config-dxahImVe.js → routes-config-RBYQtUd0.js} +2 -3
  28. package/dist/chunks/routes-config-RBYQtUd0.js.map +1 -0
  29. package/dist/chunks/routes-config-fDVHmvXi.cjs +2 -0
  30. package/dist/chunks/routes-config-fDVHmvXi.cjs.map +1 -0
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.js +268 -128
  34. package/dist/index.js.map +1 -1
  35. package/dist/lib/routes-config.d.ts +6 -4
  36. package/dist/next/index.cjs +1 -1
  37. package/dist/next/index.js +1 -1
  38. package/dist/next/workflow-chat-route.cjs +19 -0
  39. package/dist/next/workflow-chat-route.cjs.map +1 -0
  40. package/dist/next/workflow-chat-route.d.ts +17 -0
  41. package/dist/next/workflow-chat-route.js +31 -0
  42. package/dist/next/workflow-chat-route.js.map +1 -0
  43. package/dist/pages/instances/detail/index.cjs +1 -1
  44. package/dist/pages/instances/detail/index.js +1 -1
  45. package/dist/pages/templates/compose/index.cjs +2 -0
  46. package/dist/pages/templates/compose/index.cjs.map +1 -0
  47. package/dist/pages/templates/compose/index.d.ts +13 -0
  48. package/dist/pages/templates/compose/index.js +14 -0
  49. package/dist/pages/templates/compose/index.js.map +1 -0
  50. package/dist/pages/templates/designer/index.cjs +1 -1
  51. package/dist/pages/templates/designer/index.cjs.map +1 -1
  52. package/dist/pages/templates/designer/index.js +7 -2
  53. package/dist/pages/templates/designer/index.js.map +1 -1
  54. package/dist/pages/templates/index.cjs +1 -1
  55. package/dist/pages/templates/index.cjs.map +1 -1
  56. package/dist/pages/templates/index.js +3 -3
  57. package/dist/pages/templates/index.js.map +1 -1
  58. package/dist/views/cc/index.cjs +1 -1
  59. package/dist/views/cc/index.js +1 -1
  60. package/dist/views/dashboard/index.cjs +1 -1
  61. package/dist/views/dashboard/index.js +1 -1
  62. package/dist/views/forms/builder/FormBuilderView.d.ts +13 -4
  63. package/dist/views/forms/builder/index.cjs +1 -1
  64. package/dist/views/forms/builder/index.js +1 -1
  65. package/dist/views/forms/builder/json-code-editor.d.ts +1 -1
  66. package/dist/views/inbox/index.cjs +1 -1
  67. package/dist/views/inbox/index.js +1 -1
  68. package/dist/views/instances/detail/InstanceDetailView.d.ts +11 -1
  69. package/dist/views/instances/detail/index.cjs +1 -1
  70. package/dist/views/instances/detail/index.d.ts +5 -0
  71. package/dist/views/instances/detail/index.js +2 -2
  72. package/dist/views/instances/detail/sections/InstanceAttachmentsSection.d.ts +15 -0
  73. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +33 -0
  74. package/dist/views/instances/detail/sections/InstanceHistorySection.d.ts +29 -0
  75. package/dist/views/instances/detail/sections/InstanceSignaturesSection.d.ts +14 -0
  76. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +51 -0
  77. package/dist/views/instances/detail/sections/container-helpers.d.ts +9 -0
  78. package/dist/views/instances/detail/sections/shared.d.ts +103 -0
  79. package/dist/views/instances/new/index.cjs +1 -1
  80. package/dist/views/instances/new/index.js +1 -1
  81. package/dist/views/search/index.cjs +1 -1
  82. package/dist/views/search/index.js +1 -1
  83. package/dist/views/sent/index.cjs +1 -1
  84. package/dist/views/sent/index.js +1 -1
  85. package/dist/views/templates/TemplatesView.d.ts +5 -0
  86. package/dist/views/templates/compose/TemplateComposeWizardView.d.ts +8 -0
  87. package/dist/views/templates/compose/index.cjs +1 -0
  88. package/dist/views/templates/compose/index.d.ts +2 -0
  89. package/dist/views/templates/compose/index.js +2 -0
  90. package/dist/views/templates/compose/steps/ComposeFormStep.d.ts +15 -0
  91. package/dist/views/templates/compose/steps/ComposeReviewStep.d.ts +12 -0
  92. package/dist/views/templates/compose/steps/ComposeWorkflowStep.d.ts +11 -0
  93. package/dist/views/templates/compose/use-template-compose-wizard.d.ts +46 -0
  94. package/dist/views/templates/designer/TemplateDesignerView.d.ts +60 -2
  95. package/dist/views/templates/designer/chrome-workflow-chat.d.ts +12 -0
  96. package/dist/views/templates/designer/index.cjs +1 -51
  97. package/dist/views/templates/designer/index.js +2 -2272
  98. package/dist/views/templates/designer/use-workflow-chat.d.ts +21 -0
  99. package/dist/views/templates/designer/use-workflow-designer-controller.d.ts +41 -0
  100. package/dist/views/templates/designer/workflow-chat-drawer.d.ts +16 -0
  101. package/dist/views/templates/index.cjs +2 -1
  102. package/dist/views/templates/index.cjs.map +1 -0
  103. package/dist/views/templates/index.js +265 -4
  104. package/dist/views/templates/index.js.map +1 -0
  105. package/dist/views/templates/versions/index.cjs +1 -1
  106. package/dist/views/templates/versions/index.cjs.map +1 -1
  107. package/dist/views/templates/versions/index.js +38 -42
  108. package/dist/views/templates/versions/index.js.map +1 -1
  109. package/package.json +22 -19
  110. package/dist/chunks/builder-BLVnnpnP.js +0 -1300
  111. package/dist/chunks/builder-BLVnnpnP.js.map +0 -1
  112. package/dist/chunks/builder-DVE9zIKH.cjs +0 -3
  113. package/dist/chunks/builder-DVE9zIKH.cjs.map +0 -1
  114. package/dist/chunks/detail-Dcr5mM8g.cjs +0 -2
  115. package/dist/chunks/detail-Dcr5mM8g.cjs.map +0 -1
  116. package/dist/chunks/detail-u9DdLhDW.js +0 -1518
  117. package/dist/chunks/detail-u9DdLhDW.js.map +0 -1
  118. package/dist/chunks/form-name-modal-C3OEvkCV.js +0 -64
  119. package/dist/chunks/form-name-modal-C3OEvkCV.js.map +0 -1
  120. package/dist/chunks/form-name-modal-uZCHbtRH.cjs +0 -2
  121. package/dist/chunks/form-name-modal-uZCHbtRH.cjs.map +0 -1
  122. package/dist/chunks/routes-config-2aKbWq2H.cjs +0 -2
  123. package/dist/chunks/routes-config-2aKbWq2H.cjs.map +0 -1
  124. package/dist/chunks/routes-config-dxahImVe.js.map +0 -1
  125. package/dist/chunks/templates-D44FSB46.js +0 -380
  126. package/dist/chunks/templates-D44FSB46.js.map +0 -1
  127. package/dist/chunks/templates-w96t83N-.cjs +0 -2
  128. package/dist/chunks/templates-w96t83N-.cjs.map +0 -1
  129. package/dist/pages/forms/builder/index.cjs +0 -2
  130. package/dist/pages/forms/builder/index.cjs.map +0 -1
  131. package/dist/pages/forms/builder/index.d.ts +0 -21
  132. package/dist/pages/forms/builder/index.js +0 -15
  133. package/dist/pages/forms/builder/index.js.map +0 -1
  134. package/dist/pages/forms/index.cjs +0 -2
  135. package/dist/pages/forms/index.cjs.map +0 -1
  136. package/dist/pages/forms/index.d.ts +0 -17
  137. package/dist/pages/forms/index.js +0 -14
  138. package/dist/pages/forms/index.js.map +0 -1
  139. package/dist/views/forms/FormsView.d.ts +0 -2
  140. package/dist/views/forms/form-name-modal.d.ts +0 -12
  141. package/dist/views/forms/index.cjs +0 -2
  142. package/dist/views/forms/index.cjs.map +0 -1
  143. package/dist/views/forms/index.d.ts +0 -2
  144. package/dist/views/forms/index.js +0 -186
  145. package/dist/views/forms/index.js.map +0 -1
  146. package/dist/views/templates/designer/index.cjs.map +0 -1
  147. package/dist/views/templates/designer/index.js.map +0 -1
  148. package/dist/views/templates/template-name-modal.d.ts +0 -22
package/dist/index.js CHANGED
@@ -2,29 +2,31 @@
2
2
  import { n as e, r as t, t as n } from "./chunks/router-adapter-DftlFTOd.js";
3
3
  import { n as r, t as i } from "./chunks/auth-provider-B5oPmvk2.js";
4
4
  import { t as a } from "./chunks/format-date-time-CB-LxzqT.js";
5
- import { n as o, r as s, t as c } from "./chunks/routes-config-dxahImVe.js";
6
- import { a as l, i as u, n as d, o as f, r as p, t as m } from "./chunks/admin-pickers-DLlG_1du.js";
7
- import { t as h } from "./chunks/approval-instance-list-page-BF2r5D2-.js";
8
- import { t as g } from "./chunks/bpm-form-field-Cao0rMol.js";
9
- import { t as _ } from "./chunks/dashboard-page-Ib8srCMy.js";
10
- import { Fragment as v, createContext as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useState as w } from "react";
11
- import { NavigationIconButton as T } from "@mezzanine-ui/react";
12
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
13
- import { listNotifications as O, markAllNotificationsRead as k, markNotificationRead as A, readUnreadNotificationCount as j } from "@rytass/bpm-core-client/workflow";
14
- import { CalendarConfigProviderMoment as M, CalendarLocale as N } from "@mezzanine-ui/react/moment";
15
- import P from "@mezzanine-ui/react/Drawer";
16
- import F from "@mezzanine-ui/react/NotificationCenter";
17
- import { NotificationUnreadIcon as I } from "@mezzanine-ui/icons";
5
+ import { n as o, r as s, t as c } from "./chunks/routes-config-RBYQtUd0.js";
6
+ import { a as l, i as u, n as d, o as f, r as ee, t as p } from "./chunks/admin-pickers-DLlG_1du.js";
7
+ import { t as m } from "./chunks/approval-instance-list-page-YZcGGDD8.js";
8
+ import { t as h } from "./chunks/bpm-form-field-Cao0rMol.js";
9
+ import { t as g } from "./chunks/dashboard-page-DJ9vOPga.js";
10
+ import { Fragment as te, createContext as _, useCallback as v, useContext as y, useEffect as b, useMemo as x, useState as S } from "react";
11
+ import { NavigationIconButton as C } from "@mezzanine-ui/react";
12
+ import { Fragment as ne, jsx as w, jsxs as T } from "react/jsx-runtime";
13
+ import { decideTask as E, listNotifications as re, markAllNotificationsRead as ie, markNotificationRead as D, readUnreadNotificationCount as O } from "@rytass/bpm-core-client/workflow";
14
+ import { CalendarConfigProviderMoment as k, CalendarLocale as A } from "@mezzanine-ui/react/moment";
15
+ import ae from "@mezzanine-ui/react/Drawer";
16
+ import oe from "@mezzanine-ui/react/Modal";
17
+ import se from "@mezzanine-ui/react/NotificationCenter";
18
+ import ce from "@mezzanine-ui/react/Textarea";
19
+ import { NotificationUnreadIcon as j } from "@mezzanine-ui/icons";
18
20
  import './index.css';//#region src/lib/notification-drawer-provider.tsx
19
- var L = y(null);
20
- function R({ children: e }) {
21
- let [t, n] = w(!1), r = b(() => {
21
+ var M = _(null);
22
+ function N({ children: e }) {
23
+ let [t, n] = S(!1), r = v(() => {
22
24
  n(!0);
23
- }, []), i = b(() => {
25
+ }, []), i = v(() => {
24
26
  n(!1);
25
- }, []), a = b(() => {
27
+ }, []), a = v(() => {
26
28
  n((e) => !e);
27
- }, []), o = C(() => ({
29
+ }, []), o = x(() => ({
28
30
  close: i,
29
31
  isOpen: t,
30
32
  open: r,
@@ -35,13 +37,13 @@ function R({ children: e }) {
35
37
  r,
36
38
  a
37
39
  ]);
38
- return /* @__PURE__ */ E(L.Provider, {
40
+ return /* @__PURE__ */ w(M.Provider, {
39
41
  value: o,
40
42
  children: e
41
43
  });
42
44
  }
43
- function z() {
44
- return x(L) || {
45
+ function P() {
46
+ return y(M) || {
45
47
  close: () => void 0,
46
48
  isOpen: !1,
47
49
  open: () => void 0,
@@ -50,14 +52,14 @@ function z() {
50
52
  }
51
53
  //#endregion
52
54
  //#region src/lib/notification-unread-provider.tsx
53
- var B = y(null);
54
- function V({ children: e }) {
55
- let { member: t } = r(), n = t?.memberId ?? null, [i, a] = w(0), o = b(async () => {
55
+ var F = _(null);
56
+ function I({ children: e }) {
57
+ let { member: t } = r(), n = t?.memberId ?? null, [i, a] = S(0), o = v(async () => {
56
58
  if (!n) return a(0), 0;
57
- let e = await j(n);
59
+ let e = await O(n);
58
60
  return a(e), e;
59
61
  }, [n]);
60
- S(() => {
62
+ b(() => {
61
63
  let e = !0;
62
64
  return (async () => {
63
65
  try {
@@ -70,101 +72,133 @@ function V({ children: e }) {
70
72
  e = !1;
71
73
  };
72
74
  }, [o]);
73
- let s = C(() => ({
75
+ let s = x(() => ({
74
76
  refreshUnreadCount: o,
75
77
  unreadCount: i
76
78
  }), [o, i]);
77
- return /* @__PURE__ */ E(B.Provider, {
79
+ return /* @__PURE__ */ w(F.Provider, {
78
80
  value: s,
79
81
  children: e
80
82
  });
81
83
  }
82
- function H() {
83
- return x(B) || {
84
+ function L() {
85
+ return y(F) || {
84
86
  refreshUnreadCount: async () => 0,
85
87
  unreadCount: 0
86
88
  };
87
89
  }
88
90
  //#endregion
89
91
  //#region src/components/notification-drawer.tsx
90
- var U = [
92
+ var R = [
91
93
  "today",
92
94
  "yesterday",
93
95
  "past7Days",
94
96
  "earlier"
95
- ], W = {
97
+ ], le = {
96
98
  earlier: "更早",
97
99
  past7Days: "過去七天",
98
100
  today: "今天",
99
101
  yesterday: "昨天"
100
- }, G = 50;
101
- function K() {
102
- let e = t(), n = s(), { member: i } = r(), { close: a, isOpen: o } = z(), { refreshUnreadCount: c } = H(), l = i?.memberId ?? null, [u, d] = w([]), [f, p] = w(0), [m, h] = w(1), [g, _] = w(!1), [y, x] = w(!1), [T, j] = w(null), [M, N] = w("all"), I = b(async (e, t) => {
102
+ }, ue = 50;
103
+ function de(e) {
104
+ return [
105
+ ...e.actionable ? [{
106
+ id: "approve",
107
+ name: "同意"
108
+ }, {
109
+ id: "reject",
110
+ name: "拒絕"
111
+ }] : [],
112
+ ...e.instanceId ? [{
113
+ id: "view",
114
+ name: "查看案件"
115
+ }] : [],
116
+ ...e.status === "READ" ? [] : [{
117
+ id: "read",
118
+ name: "標為已讀"
119
+ }]
120
+ ];
121
+ }
122
+ var z = {
123
+ APPROVED: "簽核任務已同意",
124
+ REJECTED: "簽核任務已拒絕",
125
+ RETURNED: "簽核任務已退回",
126
+ SUPERSEDED: "簽核任務已結束",
127
+ TRANSFERRED: "簽核任務已轉派"
128
+ };
129
+ function fe(e) {
130
+ return e.resolution ? z[e.resolution] : e.title;
131
+ }
132
+ function pe(e) {
133
+ return e.resolution === "APPROVED" ? "success" : e.resolution === "REJECTED" ? "error" : e.resolution ? "info" : V(e.type);
134
+ }
135
+ function B() {
136
+ let e = t(), n = s(), { member: i } = r(), { close: a, isOpen: o } = P(), { refreshUnreadCount: c } = L(), l = i?.memberId ?? null, [u, d] = S([]), [f, ee] = S(0), [p, m] = S(1), [h, g] = S(!1), [_, y] = S(!1), [C, O] = S(null), [k, A] = S(null), [j, M] = S("all"), [N, F] = S(null), [I, z] = S(""), [B, V] = S(!1), U = I.trim(), W = v(async (e, t) => {
103
137
  if (l) {
104
- _(!0), j(null);
138
+ g(!0), O(null);
105
139
  try {
106
- let n = await O({
140
+ let n = await re({
107
141
  includeRead: !0,
108
142
  page: e,
109
- pageSize: G,
143
+ pageSize: ue,
110
144
  recipientMemberId: l
111
145
  });
112
- d((e) => t ? [...e, ...n.notifications] : n.notifications), p(n.totalCount), h(e), await c();
146
+ d((e) => t ? [...e, ...n.notifications] : n.notifications), ee(n.totalCount), m(e), await c();
113
147
  } catch (e) {
114
- j(Y(e));
148
+ O(H(e));
115
149
  } finally {
116
- _(!1);
150
+ g(!1);
117
151
  }
118
152
  }
119
153
  }, [l, c]);
120
- S(() => {
121
- !o || !l || I(1, !1);
154
+ b(() => {
155
+ !o || !l || (O(null), A(null), W(1, !1));
122
156
  }, [
123
157
  o,
124
158
  l,
125
- I
159
+ W
126
160
  ]);
127
- let L = b((e) => {
161
+ let G = v((e) => {
128
162
  let t = e.target.value;
129
- (t === "all" || t === "read" || t === "unread") && N(t);
130
- }, []), R = b(async () => {
131
- if (!(!l || y)) {
132
- x(!0), j(null);
163
+ (t === "all" || t === "read" || t === "unread") && M(t);
164
+ }, []), K = v(async () => {
165
+ if (!(!l || _)) {
166
+ y(!0), O(null);
133
167
  try {
134
- await k({ recipientMemberId: l }), await I(1, !1);
168
+ await ie({ recipientMemberId: l }), await W(1, !1);
135
169
  } catch (e) {
136
- j(Y(e));
170
+ O(H(e));
137
171
  } finally {
138
- x(!1);
172
+ y(!1);
139
173
  }
140
174
  }
141
175
  }, [
142
- y,
176
+ _,
143
177
  l,
144
- I
145
- ]), B = b(() => {
146
- g || I(m + 1, !0);
178
+ W
179
+ ]), q = v(() => {
180
+ h || W(p + 1, !0);
147
181
  }, [
148
- g,
149
- I,
150
- m
151
- ]), V = b(async (e) => {
182
+ h,
183
+ W,
184
+ p
185
+ ]), J = v(async (e) => {
152
186
  if (l) try {
153
- await A({
187
+ await D({
154
188
  id: e,
155
189
  readerMemberId: l
156
- }), await I(1, !1);
190
+ }), await W(1, !1);
157
191
  } catch (e) {
158
- j(Y(e));
192
+ O(H(e));
159
193
  }
160
- }, [l, I]), K = b(async (t) => {
194
+ }, [l, W]), Y = v(async (t) => {
161
195
  if (!(!t.instanceId || !l)) try {
162
- t.status !== "READ" && (await A({
196
+ t.status !== "READ" && (await D({
163
197
  id: t.id,
164
198
  readerMemberId: l
165
199
  }), await c()), a(), e.push(n.caseDetail(t.instanceId));
166
200
  } catch (e) {
167
- j(Y(e));
201
+ O(H(e));
168
202
  }
169
203
  }, [
170
204
  a,
@@ -172,89 +206,195 @@ function K() {
172
206
  c,
173
207
  e,
174
208
  n
175
- ]), X = C(() => u.filter((e) => M === "all" ? !0 : M === "read" ? e.status === "READ" : e.status !== "READ"), [M, u]), Z = C(() => {
176
- let e = /* @__PURE__ */ new Date(), t = U.reduce((e, t) => (e[t] = [], e), {
209
+ ]), X = v(async (e) => {
210
+ if (!(!e.taskId || !l || B)) {
211
+ V(!0), O(null), A(null);
212
+ try {
213
+ await E({
214
+ action: "APPROVED",
215
+ comment: null,
216
+ decidedByMemberId: l,
217
+ taskId: e.taskId
218
+ }), A(`已同意「${e.title}」。`), await W(1, !1);
219
+ } catch (e) {
220
+ O(H(e));
221
+ } finally {
222
+ V(!1);
223
+ }
224
+ }
225
+ }, [
226
+ l,
227
+ B,
228
+ W
229
+ ]), Z = v((e) => {
230
+ F(e), z("");
231
+ }, []), Q = v(() => {
232
+ F(null), z("");
233
+ }, []), he = v(async () => {
234
+ let e = N;
235
+ if (!(!e?.taskId || !l || !U || B)) {
236
+ V(!0), O(null), A(null);
237
+ try {
238
+ await E({
239
+ action: "REJECTED",
240
+ comment: U,
241
+ decidedByMemberId: l,
242
+ taskId: e.taskId
243
+ }), F(null), z(""), A(`已拒絕「${e.title}」。`), await W(1, !1);
244
+ } catch (e) {
245
+ O(H(e));
246
+ } finally {
247
+ V(!1);
248
+ }
249
+ }
250
+ }, [
251
+ l,
252
+ B,
253
+ W,
254
+ N,
255
+ U
256
+ ]), ge = v((e, t) => {
257
+ let n = t.id;
258
+ n === "approve" ? X(e) : n === "reject" ? Z(e) : n === "view" ? Y(e) : n === "read" && J(e.id);
259
+ }, [
260
+ X,
261
+ J,
262
+ Y,
263
+ Z
264
+ ]), _e = v((e, t) => {
265
+ t instanceof Element && t.closest("button") || Y(e);
266
+ }, [Y]), ve = v((e, t) => {
267
+ t.key !== "Enter" && t.key !== " " || t.target instanceof Element && t.target.closest("button") || (t.preventDefault(), Y(e));
268
+ }, [Y]), ye = x(() => u.filter((e) => j === "all" ? !0 : j === "read" ? e.status === "READ" : e.status !== "READ"), [j, u]), be = x(() => {
269
+ let e = /* @__PURE__ */ new Date(), t = R.reduce((e, t) => (e[t] = [], e), {
177
270
  earlier: [],
178
271
  past7Days: [],
179
272
  today: [],
180
273
  yesterday: []
181
274
  });
182
- return X.forEach((n) => {
183
- t[J(n.createdAt, e)].push(n);
184
- }), U.map((e) => [e, t[e]]).filter(([, e]) => e.length > 0);
185
- }, [X]), Q = u.length < f;
186
- return l ? /* @__PURE__ */ E(P, {
187
- bottomGhostActionDisabled: y || g,
188
- bottomGhostActionLoading: y,
275
+ return ye.forEach((n) => {
276
+ t[me(n.createdAt, e)].push(n);
277
+ }), R.map((e) => [e, t[e]]).filter(([, e]) => e.length > 0);
278
+ }, [ye]), $ = u.length < f;
279
+ return l ? /* @__PURE__ */ T(ne, { children: [/* @__PURE__ */ w(ae, {
280
+ bottomGhostActionDisabled: _ || h,
281
+ bottomGhostActionLoading: _,
189
282
  bottomGhostActionText: "全部標為已讀",
190
283
  bottomOnGhostActionClick: () => {
191
- R();
284
+ K();
192
285
  },
193
286
  bottomOnPrimaryActionClick: () => {
194
- B();
287
+ q();
195
288
  },
196
- bottomPrimaryActionDisabled: !Q || g,
197
- bottomPrimaryActionLoading: g && Q,
198
- bottomPrimaryActionText: Q ? "載入更多" : "已顯示全部",
199
- contentKey: `${M}:${u.length}`,
289
+ bottomPrimaryActionDisabled: !$ || h,
290
+ bottomPrimaryActionLoading: h && $,
291
+ bottomPrimaryActionText: $ ? "載入更多" : "已顯示全部",
292
+ contentKey: `${j}:${u.length}`,
200
293
  filterAreaAllRadioLabel: "全部",
201
- filterAreaOnRadioChange: L,
294
+ filterAreaOnRadioChange: G,
202
295
  filterAreaReadRadioLabel: "已讀",
203
296
  filterAreaShow: !0,
204
297
  filterAreaUnreadRadioLabel: "未讀",
205
- filterAreaValue: M,
298
+ filterAreaValue: j,
206
299
  headerTitle: "通知中心",
207
300
  isBottomDisplay: !0,
208
301
  isHeaderDisplay: !0,
209
302
  onClose: a,
210
303
  open: o,
211
304
  size: "medium",
212
- children: /* @__PURE__ */ D("div", {
305
+ children: /* @__PURE__ */ T("div", {
213
306
  role: "list",
214
307
  children: [
215
- T ? /* @__PURE__ */ E("p", {
308
+ C ? /* @__PURE__ */ w("p", {
216
309
  role: "alert",
217
310
  style: {
218
311
  color: "var(--mzn-color-text-error, #d92d20)",
219
312
  padding: "12px 16px"
220
313
  },
221
- children: T
314
+ children: C
315
+ }) : null,
316
+ k ? /* @__PURE__ */ w("p", {
317
+ role: "status",
318
+ style: {
319
+ color: "var(--mzn-color-text-success, #079455)",
320
+ padding: "12px 16px"
321
+ },
322
+ children: k
222
323
  }) : null,
223
- Z.length === 0 ? /* @__PURE__ */ E("p", {
324
+ be.length === 0 ? /* @__PURE__ */ w("p", {
224
325
  style: {
225
326
  color: "var(--mzn-color-text-secondary, #6b7280)",
226
327
  padding: "24px 16px",
227
328
  textAlign: "center"
228
329
  },
229
- children: g ? "載入中…" : "目前沒有通知"
330
+ children: h ? "載入中…" : "目前沒有通知"
230
331
  }) : null,
231
- Z.map(([e, t], n) => /* @__PURE__ */ E(v, { children: t.map((r, i) => /* @__PURE__ */ E(F, {
232
- appendTips: n === Z.length - 1 && i === t.length - 1 && !Q ? "已顯示全部通知" : void 0,
233
- cancelButtonText: r.status === "READ" ? void 0 : "標為已讀",
234
- description: r.body,
235
- onCancel: r.status === "READ" ? void 0 : () => {
236
- V(r.id);
237
- },
238
- onConfirm: r.instanceId ? () => {
239
- K(r);
240
- } : void 0,
241
- confirmButtonText: r.instanceId ? "查看案件" : void 0,
242
- prependTips: i === 0 ? W[e] : void 0,
243
- reference: r.id,
244
- severity: q(r.type),
245
- showBadge: r.status !== "READ",
246
- timeStamp: r.createdAt,
247
- title: r.title,
248
- type: "drawer"
249
- }, r.id)) }, e))
332
+ be.map(([e, t]) => /* @__PURE__ */ w(te, { children: t.map((t, n) => {
333
+ let r = t.instanceId !== null;
334
+ return /* @__PURE__ */ w("div", {
335
+ onClick: r ? (e) => {
336
+ _e(t, e.target);
337
+ } : void 0,
338
+ onKeyDown: r ? (e) => {
339
+ ve(t, e);
340
+ } : void 0,
341
+ role: r ? "button" : void 0,
342
+ style: r ? { cursor: "pointer" } : void 0,
343
+ tabIndex: r ? 0 : void 0,
344
+ children: /* @__PURE__ */ w(se, {
345
+ description: t.body,
346
+ onBadgeSelect: (e) => {
347
+ ge(t, e);
348
+ },
349
+ options: [...de(t)],
350
+ prependTips: n === 0 ? le[e] : void 0,
351
+ reference: t.id,
352
+ severity: pe(t),
353
+ showBadge: t.status !== "READ",
354
+ timeStamp: t.createdAt,
355
+ title: fe(t),
356
+ type: "drawer"
357
+ })
358
+ }, t.id);
359
+ }) }, e))
250
360
  ]
251
361
  })
252
- }) : null;
362
+ }), /* @__PURE__ */ w(oe, {
363
+ cancelText: "取消",
364
+ confirmButtonProps: {
365
+ disabled: !U,
366
+ variant: "destructive-primary"
367
+ },
368
+ confirmText: "送出拒絕",
369
+ loading: B,
370
+ modalStatusType: "error",
371
+ modalType: "standard",
372
+ onCancel: Q,
373
+ onClose: Q,
374
+ onConfirm: () => {
375
+ he();
376
+ },
377
+ open: N !== null,
378
+ showModalFooter: !0,
379
+ showModalHeader: !0,
380
+ size: "regular",
381
+ supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
382
+ title: "拒絕原因",
383
+ children: /* @__PURE__ */ w(ce, {
384
+ autoFocus: !0,
385
+ onChange: (e) => {
386
+ z(e.target.value);
387
+ },
388
+ placeholder: "請輸入拒絕原因",
389
+ rows: 4,
390
+ value: I
391
+ })
392
+ })] }) : null;
253
393
  }
254
- function q(e) {
394
+ function V(e) {
255
395
  return e === "SLA_OVERDUE" ? "error" : e === "SLA_WARNING" ? "warning" : e === "INSTANCE_COMPLETED" ? "success" : "info";
256
396
  }
257
- function J(e, t) {
397
+ function me(e, t) {
258
398
  let n = new Date(e);
259
399
  if (Number.isNaN(n.getTime())) return "earlier";
260
400
  let r = new Date(t.getFullYear(), t.getMonth(), t.getDate()), i = new Date(n.getFullYear(), n.getMonth(), n.getDate());
@@ -262,58 +402,58 @@ function J(e, t) {
262
402
  let a = new Date(r);
263
403
  return a.setDate(a.getDate() - 1), i.getTime() === a.getTime() ? "yesterday" : (t.getTime() - n.getTime()) / (1e3 * 60 * 60 * 24) <= 7 ? "past7Days" : "earlier";
264
404
  }
265
- function Y(e) {
405
+ function H(e) {
266
406
  return e instanceof Error ? e.message : "發生未知錯誤";
267
407
  }
268
408
  //#endregion
269
409
  //#region src/lib/providers.tsx
270
- function X({ children: e, locale: t = N.ZH_TW, publicPaths: n, loginPath: r }) {
271
- return /* @__PURE__ */ E(M, {
410
+ function U({ children: e, locale: t = A.ZH_TW, publicPaths: n, loginPath: r }) {
411
+ return /* @__PURE__ */ w(k, {
272
412
  locale: t,
273
- children: /* @__PURE__ */ E(i, {
413
+ children: /* @__PURE__ */ w(i, {
274
414
  publicPaths: n,
275
415
  loginPath: r,
276
- children: /* @__PURE__ */ E(V, { children: /* @__PURE__ */ D(R, { children: [e, /* @__PURE__ */ E(K, {})] }) })
416
+ children: /* @__PURE__ */ w(I, { children: /* @__PURE__ */ T(N, { children: [e, /* @__PURE__ */ w(B, {})] }) })
277
417
  })
278
418
  });
279
419
  }
280
420
  //#endregion
281
421
  //#region src/lib/use-bpm-logout.ts
282
- function Z() {
422
+ function W() {
283
423
  let { logout: e } = r();
284
424
  return e;
285
425
  }
286
426
  //#endregion
287
427
  //#region src/lib/use-bpm-member.ts
288
- function Q() {
428
+ function G() {
289
429
  let { member: e } = r();
290
430
  return e;
291
431
  }
292
- var $ = {
432
+ var K = {
293
433
  root: "bpm_root_jl5S-",
294
434
  badge: "bpm_badge_SIKJk"
295
435
  };
296
436
  //#endregion
297
437
  //#region src/components/bpm-notification-bell-button.tsx
298
- function ee({ label: e = "通知中心" } = {}) {
299
- let { open: t } = z(), { unreadCount: n } = H(), r = n > 0 ? `${e},${n} 則未讀` : e;
300
- return /* @__PURE__ */ D("span", {
301
- className: $.root,
302
- children: [/* @__PURE__ */ E(T, {
438
+ function q({ label: e = "通知中心" } = {}) {
439
+ let { open: t } = P(), { unreadCount: n } = L(), r = n > 0 ? `${e},${n} 則未讀` : e;
440
+ return /* @__PURE__ */ T("span", {
441
+ className: K.root,
442
+ children: [/* @__PURE__ */ w(C, {
303
443
  "aria-label": r,
304
- icon: I,
444
+ icon: j,
305
445
  onClick: () => {
306
446
  t();
307
447
  },
308
448
  title: e,
309
449
  type: "button"
310
- }), n > 0 ? /* @__PURE__ */ E("span", {
311
- className: $.badge,
450
+ }), n > 0 ? /* @__PURE__ */ w("span", {
451
+ className: K.badge,
312
452
  children: n > 99 ? "99+" : n
313
453
  }) : null]
314
454
  });
315
455
  }
316
456
  //#endregion
317
- export { h as ApprovalInstanceListPage, i as AuthProvider, g as BPMFormField, ee as BPMNotificationBellButton, c as BPMRoutesProvider, _ as DashboardPage, m as MemberPicker, K as NotificationDrawer, R as NotificationDrawerProvider, V as NotificationUnreadProvider, d as OrgUnitPicker, p as PositionPicker, X as Providers, n as RouterAdapterProvider, o as createDefaultBPMRoutes, e as defaultBrowserSearchParams, a as formatDateTime, u as readMemberOption, l as readOrgUnitOption, f as readPositionOption, r as useAuth, Z as useBPMLogout, Q as useBPMMember, s as useBPMRoutes, z as useNotificationDrawer, H as useNotificationUnread, t as useRouterAdapter };
457
+ export { m as ApprovalInstanceListPage, i as AuthProvider, h as BPMFormField, q as BPMNotificationBellButton, c as BPMRoutesProvider, g as DashboardPage, p as MemberPicker, B as NotificationDrawer, N as NotificationDrawerProvider, I as NotificationUnreadProvider, d as OrgUnitPicker, ee as PositionPicker, U as Providers, n as RouterAdapterProvider, o as createDefaultBPMRoutes, e as defaultBrowserSearchParams, a as formatDateTime, u as readMemberOption, l as readOrgUnitOption, f as readPositionOption, r as useAuth, W as useBPMLogout, G as useBPMMember, s as useBPMRoutes, P as useNotificationDrawer, L as useNotificationUnread, t as useRouterAdapter };
318
458
 
319
459
  //# sourceMappingURL=index.js.map