@ram_28/kf-ai-sdk 2.0.16 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +1 -1
- package/dist/auth/authConfig.d.ts +1 -1
- package/dist/auth/types.d.ts +1 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.mjs +1 -1
- package/dist/components/hooks/useActivityForm/types.d.ts +4 -5
- package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -1
- package/dist/components/hooks/useActivityTable/types.d.ts +5 -4
- package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -1
- package/dist/components/hooks/useBDOTable/types.d.ts +20 -12
- package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +2 -2
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -1
- package/dist/{constants-ConHc1oS.js → constants-Cyi942Yr.js} +5 -5
- package/dist/constants-DEmYwKfC.cjs +1 -0
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +15 -16
- package/dist/table.types.d.ts +1 -1
- package/dist/table.types.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/workflow/Activity.d.ts +8 -5
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.mjs +461 -476
- package/docs/README.md +51 -0
- package/docs/bdo/README.md +161 -0
- package/docs/bdo/api_reference.md +281 -0
- package/docs/examples/bdo/create-product.md +69 -0
- package/docs/examples/bdo/edit-product-dialog.md +95 -0
- package/docs/examples/bdo/filtered-product-table.md +100 -0
- package/docs/examples/bdo/product-listing.md +73 -0
- package/docs/examples/bdo/supplier-dropdown.md +60 -0
- package/docs/examples/workflow/approve-leave-request.md +76 -0
- package/docs/examples/workflow/filtered-activity-table.md +101 -0
- package/docs/examples/workflow/my-pending-requests.md +90 -0
- package/docs/examples/workflow/start-new-workflow.md +47 -0
- package/docs/examples/workflow/submit-leave-request.md +72 -0
- package/docs/examples/workflow/workflow-progress.md +49 -0
- package/docs/useActivityForm/README.md +241 -0
- package/docs/useActivityForm/api_reference.md +279 -0
- package/docs/useActivityTable/README.md +263 -0
- package/docs/useActivityTable/api_reference.md +294 -0
- package/docs/useBDOForm/README.md +172 -0
- package/docs/useBDOForm/api_reference.md +244 -0
- package/docs/useBDOTable/README.md +242 -0
- package/docs/useBDOTable/api_reference.md +253 -0
- package/docs/useFilter/README.md +323 -0
- package/docs/useFilter/api_reference.md +228 -0
- package/docs/workflow/README.md +158 -0
- package/docs/workflow/api_reference.md +161 -0
- package/package.json +1 -1
- package/sdk/auth/authConfig.ts +1 -1
- package/sdk/auth/types.ts +1 -1
- package/sdk/components/hooks/useActivityForm/types.ts +4 -6
- package/sdk/components/hooks/useActivityForm/useActivityForm.ts +10 -73
- package/sdk/components/hooks/useActivityTable/types.ts +4 -5
- package/sdk/components/hooks/useActivityTable/useActivityTable.ts +10 -8
- package/sdk/components/hooks/useBDOTable/types.ts +20 -10
- package/sdk/components/hooks/useBDOTable/useBDOTable.ts +12 -8
- package/sdk/table.types.ts +2 -0
- package/sdk/types/constants.ts +1 -1
- package/sdk/workflow/Activity.ts +39 -7
- package/dist/constants-QX2RX-wu.cjs +0 -1
- package/docs/api.md +0 -95
- package/docs/bdo.md +0 -224
- package/docs/gaps.md +0 -360
- package/docs/useActivityForm.md +0 -393
- package/docs/useActivityTable.md +0 -418
- package/docs/useBDOForm.md +0 -376
- package/docs/useBDOTable.md +0 -284
- package/docs/useFilter.md +0 -188
- package/docs/workflow.md +0 -560
- /package/docs/{useAuth.md → useAuth/README.md} +0 -0
package/dist/workflow.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var oe = Object.defineProperty;
|
|
2
2
|
var ce = (o, t, e) => t in o ? oe(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
-
var
|
|
4
|
-
import { c as
|
|
5
|
-
import { B as ue, c as de, S as
|
|
6
|
-
import { useState as
|
|
7
|
-
import { v as
|
|
8
|
-
import { useQuery as
|
|
3
|
+
var V = (o, t, e) => ce(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { c as T, g as O, d as le } from "./client-_ayziI1d.js";
|
|
5
|
+
import { B as ue, c as de, S as W, F as ye, U as fe, R as he, T as ge, D as me, b as _e, a as we, N as Fe } from "./FileField-BWrSHNRq.js";
|
|
6
|
+
import { useState as q, useRef as X, useMemo as b, useEffect as ve, useCallback as z } from "react";
|
|
7
|
+
import { v as Te, u as Oe, b as Se, d as $e, e as be, f as Ce, a as pe } from "./shared-5a7UkED1.js";
|
|
8
|
+
import { useQuery as Pe } from "@tanstack/react-query";
|
|
9
9
|
import { v as Y, e as Z } from "./attachment-constants-C2UHWxmp.js";
|
|
10
|
-
import { t as
|
|
11
|
-
import { g as
|
|
10
|
+
import { t as ee, u as Ve } from "./useTable-DS0-WInw.js";
|
|
11
|
+
import { g as Ee } from "./metadata-Cc1mBcLS.js";
|
|
12
12
|
class xe {
|
|
13
13
|
constructor(t) {
|
|
14
|
-
|
|
14
|
+
V(this, "bp_id");
|
|
15
15
|
this.bp_id = t;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -19,10 +19,10 @@ class xe {
|
|
|
19
19
|
*/
|
|
20
20
|
async start() {
|
|
21
21
|
const t = await fetch(
|
|
22
|
-
`${
|
|
22
|
+
`${T()}/api/app/process/${this.bp_id}/start`,
|
|
23
23
|
{
|
|
24
24
|
method: "POST",
|
|
25
|
-
headers:
|
|
25
|
+
headers: O()
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
if (!t.ok)
|
|
@@ -37,10 +37,10 @@ class xe {
|
|
|
37
37
|
*/
|
|
38
38
|
async progress(t) {
|
|
39
39
|
const e = await fetch(
|
|
40
|
-
`${
|
|
40
|
+
`${T()}/api/app/process/${this.bp_id}/${t}/progress`,
|
|
41
41
|
{
|
|
42
42
|
method: "GET",
|
|
43
|
-
headers:
|
|
43
|
+
headers: O()
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
if (!e.ok)
|
|
@@ -55,147 +55,147 @@ class xe {
|
|
|
55
55
|
const e = `/api/app/process/${this.bp_id}/${t}`;
|
|
56
56
|
return {
|
|
57
57
|
// ── List-level ────────────────────────────────────────────
|
|
58
|
-
async inProgressList(
|
|
59
|
-
const
|
|
58
|
+
async inProgressList(s) {
|
|
59
|
+
const a = await fetch(`${T()}${e}/inprogress/list`, {
|
|
60
60
|
method: "POST",
|
|
61
|
-
headers:
|
|
62
|
-
body:
|
|
61
|
+
headers: O(),
|
|
62
|
+
body: s ? JSON.stringify(s) : void 0
|
|
63
63
|
});
|
|
64
|
-
if (!
|
|
65
|
-
throw new Error(`Failed to list in-progress activities: ${
|
|
66
|
-
return
|
|
64
|
+
if (!a.ok)
|
|
65
|
+
throw new Error(`Failed to list in-progress activities: ${a.statusText}`);
|
|
66
|
+
return a.json();
|
|
67
67
|
},
|
|
68
|
-
async completedList(
|
|
69
|
-
const
|
|
68
|
+
async completedList(s) {
|
|
69
|
+
const a = await fetch(`${T()}${e}/completed/list`, {
|
|
70
70
|
method: "POST",
|
|
71
|
-
headers:
|
|
72
|
-
body:
|
|
71
|
+
headers: O(),
|
|
72
|
+
body: s ? JSON.stringify(s) : void 0
|
|
73
73
|
});
|
|
74
|
-
if (!
|
|
75
|
-
throw new Error(`Failed to list completed activities: ${
|
|
76
|
-
return
|
|
74
|
+
if (!a.ok)
|
|
75
|
+
throw new Error(`Failed to list completed activities: ${a.statusText}`);
|
|
76
|
+
return a.json();
|
|
77
77
|
},
|
|
78
|
-
async inProgressCount(
|
|
79
|
-
var
|
|
80
|
-
const
|
|
78
|
+
async inProgressCount(s) {
|
|
79
|
+
var f, n;
|
|
80
|
+
const a = {
|
|
81
81
|
Type: "Metric",
|
|
82
82
|
GroupBy: [],
|
|
83
83
|
Metric: [{ Field: "_id", Type: "Count" }],
|
|
84
|
-
...(
|
|
85
|
-
},
|
|
84
|
+
...(s == null ? void 0 : s.Filter) && { Filter: s.Filter }
|
|
85
|
+
}, r = await fetch(`${T()}${e}/inprogress/metric`, {
|
|
86
86
|
method: "POST",
|
|
87
|
-
headers:
|
|
88
|
-
body: JSON.stringify(
|
|
87
|
+
headers: O(),
|
|
88
|
+
body: JSON.stringify(a)
|
|
89
89
|
});
|
|
90
|
-
if (!
|
|
91
|
-
throw new Error(`Failed to get in-progress count: ${
|
|
92
|
-
return { Count: ((
|
|
90
|
+
if (!r.ok)
|
|
91
|
+
throw new Error(`Failed to get in-progress count: ${r.statusText}`);
|
|
92
|
+
return { Count: ((n = (f = (await r.json()).Data) == null ? void 0 : f[0]) == null ? void 0 : n.count__id) ?? 0 };
|
|
93
93
|
},
|
|
94
|
-
async completedCount(
|
|
95
|
-
var
|
|
96
|
-
const
|
|
94
|
+
async completedCount(s) {
|
|
95
|
+
var f, n;
|
|
96
|
+
const a = {
|
|
97
97
|
Type: "Metric",
|
|
98
98
|
GroupBy: [],
|
|
99
99
|
Metric: [{ Field: "_id", Type: "Count" }],
|
|
100
|
-
...(
|
|
101
|
-
},
|
|
100
|
+
...(s == null ? void 0 : s.Filter) && { Filter: s.Filter }
|
|
101
|
+
}, r = await fetch(`${T()}${e}/completed/metric`, {
|
|
102
102
|
method: "POST",
|
|
103
|
-
headers:
|
|
104
|
-
body: JSON.stringify(
|
|
103
|
+
headers: O(),
|
|
104
|
+
body: JSON.stringify(a)
|
|
105
105
|
});
|
|
106
|
-
if (!
|
|
107
|
-
throw new Error(`Failed to get completed count: ${
|
|
108
|
-
return { Count: ((
|
|
106
|
+
if (!r.ok)
|
|
107
|
+
throw new Error(`Failed to get completed count: ${r.statusText}`);
|
|
108
|
+
return { Count: ((n = (f = (await r.json()).Data) == null ? void 0 : f[0]) == null ? void 0 : n.count__id) ?? 0 };
|
|
109
109
|
},
|
|
110
|
-
async inProgressMetric(
|
|
111
|
-
const
|
|
110
|
+
async inProgressMetric(s) {
|
|
111
|
+
const a = { Type: "Metric", ...s }, r = await fetch(`${T()}${e}/inprogress/metric`, {
|
|
112
112
|
method: "POST",
|
|
113
|
-
headers:
|
|
114
|
-
body: JSON.stringify(
|
|
113
|
+
headers: O(),
|
|
114
|
+
body: JSON.stringify(a)
|
|
115
115
|
});
|
|
116
|
-
if (!
|
|
117
|
-
throw new Error(`Failed to get in-progress metrics: ${
|
|
118
|
-
return
|
|
116
|
+
if (!r.ok)
|
|
117
|
+
throw new Error(`Failed to get in-progress metrics: ${r.statusText}`);
|
|
118
|
+
return r.json();
|
|
119
119
|
},
|
|
120
|
-
async completedMetric(
|
|
121
|
-
const
|
|
120
|
+
async completedMetric(s) {
|
|
121
|
+
const a = { Type: "Metric", ...s }, r = await fetch(`${T()}${e}/completed/metric`, {
|
|
122
122
|
method: "POST",
|
|
123
|
-
headers:
|
|
124
|
-
body: JSON.stringify(
|
|
123
|
+
headers: O(),
|
|
124
|
+
body: JSON.stringify(a)
|
|
125
125
|
});
|
|
126
|
-
if (!
|
|
127
|
-
throw new Error(`Failed to get completed metrics: ${
|
|
128
|
-
return
|
|
126
|
+
if (!r.ok)
|
|
127
|
+
throw new Error(`Failed to get completed metrics: ${r.statusText}`);
|
|
128
|
+
return r.json();
|
|
129
129
|
},
|
|
130
130
|
// ── Instance-level ────────────────────────────────────────
|
|
131
|
-
async read(
|
|
132
|
-
const
|
|
131
|
+
async read(s) {
|
|
132
|
+
const a = await fetch(`${T()}${e}/${s}/read`, {
|
|
133
133
|
method: "GET",
|
|
134
|
-
headers:
|
|
134
|
+
headers: O()
|
|
135
135
|
});
|
|
136
|
-
if (!
|
|
137
|
-
throw new Error(`Failed to read activity: ${
|
|
138
|
-
return (await
|
|
136
|
+
if (!a.ok)
|
|
137
|
+
throw new Error(`Failed to read activity: ${a.statusText}`);
|
|
138
|
+
return (await a.json()).Data;
|
|
139
139
|
},
|
|
140
|
-
async update(
|
|
141
|
-
const
|
|
140
|
+
async update(s, a) {
|
|
141
|
+
const r = await fetch(`${T()}${e}/${s}/update`, {
|
|
142
142
|
method: "POST",
|
|
143
|
-
headers:
|
|
144
|
-
body: JSON.stringify(
|
|
143
|
+
headers: O(),
|
|
144
|
+
body: JSON.stringify(a)
|
|
145
145
|
});
|
|
146
|
-
if (!
|
|
147
|
-
throw new Error(`Failed to update activity: ${
|
|
148
|
-
return
|
|
146
|
+
if (!r.ok)
|
|
147
|
+
throw new Error(`Failed to update activity: ${r.statusText}`);
|
|
148
|
+
return r.json();
|
|
149
149
|
},
|
|
150
|
-
async draftStart(
|
|
151
|
-
const
|
|
150
|
+
async draftStart(s, a) {
|
|
151
|
+
const r = await fetch(`${T()}${e}/${s}/draft`, {
|
|
152
152
|
method: "PATCH",
|
|
153
|
-
headers:
|
|
154
|
-
body: JSON.stringify(
|
|
153
|
+
headers: O(),
|
|
154
|
+
body: JSON.stringify(a)
|
|
155
155
|
});
|
|
156
|
-
if (!
|
|
157
|
-
throw new Error(`Failed to start draft: ${
|
|
158
|
-
return
|
|
156
|
+
if (!r.ok)
|
|
157
|
+
throw new Error(`Failed to start draft: ${r.statusText}`);
|
|
158
|
+
return r.json();
|
|
159
159
|
},
|
|
160
|
-
async draftEnd(
|
|
161
|
-
const
|
|
160
|
+
async draftEnd(s, a) {
|
|
161
|
+
const r = await fetch(`${T()}${e}/${s}/draft`, {
|
|
162
162
|
method: "POST",
|
|
163
|
-
headers:
|
|
164
|
-
body: JSON.stringify(
|
|
163
|
+
headers: O(),
|
|
164
|
+
body: JSON.stringify(a)
|
|
165
165
|
});
|
|
166
|
-
if (!
|
|
167
|
-
throw new Error(`Failed to end draft: ${
|
|
168
|
-
return
|
|
166
|
+
if (!r.ok)
|
|
167
|
+
throw new Error(`Failed to end draft: ${r.statusText}`);
|
|
168
|
+
return r.json();
|
|
169
169
|
},
|
|
170
|
-
async complete(
|
|
171
|
-
const
|
|
170
|
+
async complete(s) {
|
|
171
|
+
const a = await fetch(`${T()}${e}/${s}/done`, {
|
|
172
172
|
method: "POST",
|
|
173
|
-
headers:
|
|
173
|
+
headers: O()
|
|
174
174
|
});
|
|
175
|
-
if (!
|
|
176
|
-
throw new Error(`Failed to complete activity: ${
|
|
177
|
-
return
|
|
175
|
+
if (!a.ok)
|
|
176
|
+
throw new Error(`Failed to complete activity: ${a.statusText}`);
|
|
177
|
+
return a.json();
|
|
178
178
|
},
|
|
179
|
-
async progress(
|
|
180
|
-
const
|
|
179
|
+
async progress(s) {
|
|
180
|
+
const a = await fetch(`${T()}${e}/${s}/progress`, {
|
|
181
181
|
method: "GET",
|
|
182
|
-
headers:
|
|
182
|
+
headers: O()
|
|
183
183
|
});
|
|
184
|
-
if (!
|
|
185
|
-
throw new Error(`Failed to get activity progress: ${
|
|
186
|
-
return
|
|
184
|
+
if (!a.ok)
|
|
185
|
+
throw new Error(`Failed to get activity progress: ${a.statusText}`);
|
|
186
|
+
return a.json();
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
class
|
|
192
|
-
constructor(t, e,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this._ops = t, this._id = e, this._data = { ...
|
|
191
|
+
class De {
|
|
192
|
+
constructor(t, e, s, a) {
|
|
193
|
+
V(this, "_id");
|
|
194
|
+
V(this, "_data");
|
|
195
|
+
V(this, "_ops");
|
|
196
|
+
V(this, "_fields");
|
|
197
|
+
V(this, "_accessorCache", /* @__PURE__ */ new Map());
|
|
198
|
+
this._ops = t, this._id = e, this._data = { ...s }, this._fields = a;
|
|
199
199
|
}
|
|
200
200
|
// ============================================================
|
|
201
201
|
// BDO ITEM METHODS
|
|
@@ -211,9 +211,9 @@ class ke {
|
|
|
211
211
|
*/
|
|
212
212
|
validate() {
|
|
213
213
|
const t = [];
|
|
214
|
-
for (const [e,
|
|
215
|
-
const
|
|
216
|
-
|
|
214
|
+
for (const [e, s] of Object.entries(this._fields)) {
|
|
215
|
+
const a = this._data[e], r = s.validate(a);
|
|
216
|
+
r.valid || t.push(...r.errors);
|
|
217
217
|
}
|
|
218
218
|
return {
|
|
219
219
|
valid: t.length === 0,
|
|
@@ -254,51 +254,51 @@ class ke {
|
|
|
254
254
|
_getAccessor(t) {
|
|
255
255
|
if (this._accessorCache.has(t))
|
|
256
256
|
return this._accessorCache.get(t);
|
|
257
|
-
const e = this._fields[t],
|
|
257
|
+
const e = this._fields[t], s = (e == null ? void 0 : e.meta) ?? {
|
|
258
258
|
_id: t,
|
|
259
259
|
Name: t,
|
|
260
260
|
Type: "String"
|
|
261
|
-
},
|
|
262
|
-
let
|
|
263
|
-
return
|
|
261
|
+
}, a = (e == null ? void 0 : e.readOnly) ?? !1, r = () => e ? e.validate(this._data[t]) : { valid: !0, errors: [] };
|
|
262
|
+
let i;
|
|
263
|
+
return a ? i = {
|
|
264
264
|
label: (e == null ? void 0 : e.label) ?? t,
|
|
265
265
|
required: (e == null ? void 0 : e.required) ?? !1,
|
|
266
266
|
readOnly: !0,
|
|
267
267
|
defaultValue: e == null ? void 0 : e.defaultValue,
|
|
268
|
-
meta:
|
|
268
|
+
meta: s,
|
|
269
269
|
get: () => this._data[t],
|
|
270
|
-
validate:
|
|
271
|
-
} :
|
|
270
|
+
validate: r
|
|
271
|
+
} : i = {
|
|
272
272
|
label: (e == null ? void 0 : e.label) ?? t,
|
|
273
273
|
required: (e == null ? void 0 : e.required) ?? !1,
|
|
274
274
|
readOnly: !1,
|
|
275
275
|
defaultValue: e == null ? void 0 : e.defaultValue,
|
|
276
|
-
meta:
|
|
276
|
+
meta: s,
|
|
277
277
|
get: () => this._data[t],
|
|
278
|
-
set: (
|
|
279
|
-
this._data[t] =
|
|
278
|
+
set: (d) => {
|
|
279
|
+
this._data[t] = d;
|
|
280
280
|
},
|
|
281
|
-
validate:
|
|
282
|
-
}, this._accessorCache.set(t,
|
|
281
|
+
validate: r
|
|
282
|
+
}, this._accessorCache.set(t, i), i;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
const
|
|
285
|
+
function G(o, t, e, s) {
|
|
286
|
+
const a = new De(
|
|
287
287
|
o,
|
|
288
288
|
t,
|
|
289
289
|
e,
|
|
290
|
-
|
|
290
|
+
s
|
|
291
291
|
);
|
|
292
|
-
return new Proxy(
|
|
293
|
-
get(
|
|
294
|
-
return
|
|
292
|
+
return new Proxy(a, {
|
|
293
|
+
get(r, i, d) {
|
|
294
|
+
return i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_ops" || i === "_data" || i === "_fields" || i === "_accessorCache" || i === "_getAccessor" || typeof i == "symbol" ? Reflect.get(r, i, d) : i === "_id" ? r._id : r._getAccessor(i);
|
|
295
295
|
},
|
|
296
|
-
has(
|
|
297
|
-
return typeof
|
|
296
|
+
has(r, i) {
|
|
297
|
+
return typeof i == "symbol" ? !1 : i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_id" ? !0 : i in r._fields;
|
|
298
298
|
},
|
|
299
|
-
ownKeys(
|
|
299
|
+
ownKeys(r) {
|
|
300
300
|
return [
|
|
301
|
-
...Object.keys(
|
|
301
|
+
...Object.keys(r._fields),
|
|
302
302
|
"_id",
|
|
303
303
|
"validate",
|
|
304
304
|
"toJSON",
|
|
@@ -308,11 +308,11 @@ function Ne(o, t, e, a) {
|
|
|
308
308
|
"progress"
|
|
309
309
|
];
|
|
310
310
|
},
|
|
311
|
-
getOwnPropertyDescriptor(
|
|
312
|
-
if (typeof
|
|
311
|
+
getOwnPropertyDescriptor(r, i) {
|
|
312
|
+
if (typeof i != "symbol")
|
|
313
313
|
return {
|
|
314
314
|
configurable: !0,
|
|
315
|
-
enumerable:
|
|
315
|
+
enumerable: i !== "validate" && i !== "toJSON" && i !== "update" && i !== "save" && i !== "complete" && i !== "progress"
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
318
|
});
|
|
@@ -322,7 +322,7 @@ class Ge {
|
|
|
322
322
|
// ============================================================
|
|
323
323
|
// FIELD DISCOVERY (internal)
|
|
324
324
|
// ============================================================
|
|
325
|
-
|
|
325
|
+
V(this, "_fieldsCache", null);
|
|
326
326
|
}
|
|
327
327
|
// ============================================================
|
|
328
328
|
// ACTIVITY OPERATIONS (internal)
|
|
@@ -342,8 +342,8 @@ class Ge {
|
|
|
342
342
|
if (this._fieldsCache) return this._fieldsCache;
|
|
343
343
|
const t = {};
|
|
344
344
|
for (const e of Object.keys(this)) {
|
|
345
|
-
const
|
|
346
|
-
|
|
345
|
+
const s = this[e];
|
|
346
|
+
s instanceof ue && (t[e] = s);
|
|
347
347
|
}
|
|
348
348
|
return this._fieldsCache = t, t;
|
|
349
349
|
}
|
|
@@ -352,17 +352,23 @@ class Ge {
|
|
|
352
352
|
// ============================================================
|
|
353
353
|
/**
|
|
354
354
|
* List in-progress activity instances.
|
|
355
|
-
*
|
|
355
|
+
* Each row is wrapped in an ActivityInstance proxy with field accessors.
|
|
356
356
|
*/
|
|
357
357
|
async getInProgressList(t) {
|
|
358
|
-
|
|
358
|
+
const e = this._ops(), s = await e.inProgressList(t), a = this._discoverFields();
|
|
359
|
+
return s.Data.map(
|
|
360
|
+
(r) => G(e, r._id, r, a)
|
|
361
|
+
);
|
|
359
362
|
}
|
|
360
363
|
/**
|
|
361
364
|
* List completed activity instances.
|
|
362
|
-
*
|
|
365
|
+
* Each row is wrapped in an ActivityInstance proxy with field accessors.
|
|
363
366
|
*/
|
|
364
367
|
async getCompletedList(t) {
|
|
365
|
-
|
|
368
|
+
const e = this._ops(), s = await e.completedList(t), a = this._discoverFields();
|
|
369
|
+
return s.Data.map(
|
|
370
|
+
(r) => G(e, r._id, r, a)
|
|
371
|
+
);
|
|
366
372
|
}
|
|
367
373
|
/**
|
|
368
374
|
* Get count of in-progress activity instances.
|
|
@@ -399,12 +405,12 @@ class Ge {
|
|
|
399
405
|
* @returns ActivityInstance with typed field accessors
|
|
400
406
|
*/
|
|
401
407
|
async getInstance(t) {
|
|
402
|
-
const e = this._ops(),
|
|
403
|
-
return
|
|
408
|
+
const e = this._ops(), s = await e.read(t), a = this._discoverFields();
|
|
409
|
+
return G(
|
|
404
410
|
e,
|
|
405
411
|
t,
|
|
406
|
-
|
|
407
|
-
|
|
412
|
+
s,
|
|
413
|
+
a
|
|
408
414
|
);
|
|
409
415
|
}
|
|
410
416
|
// ============================================================
|
|
@@ -425,14 +431,14 @@ class Ge {
|
|
|
425
431
|
return this._ops();
|
|
426
432
|
}
|
|
427
433
|
}
|
|
428
|
-
function
|
|
429
|
-
var
|
|
430
|
-
const e = { _id: o, ...t },
|
|
431
|
-
if (
|
|
434
|
+
function te(o, t) {
|
|
435
|
+
var a;
|
|
436
|
+
const e = { _id: o, ...t }, s = t.Type;
|
|
437
|
+
if (s === "String" && ((a = t.Constraint) != null && a.Enum))
|
|
432
438
|
return new de(e);
|
|
433
|
-
switch (
|
|
439
|
+
switch (s) {
|
|
434
440
|
case "String":
|
|
435
|
-
return new
|
|
441
|
+
return new W(e);
|
|
436
442
|
case "Number":
|
|
437
443
|
return new Fe(e);
|
|
438
444
|
case "Boolean":
|
|
@@ -450,56 +456,56 @@ function ee(o, t) {
|
|
|
450
456
|
case "File":
|
|
451
457
|
return new ye(e);
|
|
452
458
|
default:
|
|
453
|
-
return new
|
|
459
|
+
return new W(e);
|
|
454
460
|
}
|
|
455
461
|
}
|
|
456
|
-
function
|
|
462
|
+
function Ne(o) {
|
|
457
463
|
const t = {};
|
|
458
|
-
for (const [e,
|
|
459
|
-
t[e] =
|
|
464
|
+
for (const [e, s] of Object.entries(o))
|
|
465
|
+
t[e] = te(e, s);
|
|
460
466
|
return t;
|
|
461
467
|
}
|
|
462
|
-
function
|
|
463
|
-
var
|
|
464
|
-
const
|
|
465
|
-
if (!(
|
|
466
|
-
const
|
|
467
|
-
for (const
|
|
468
|
-
if (
|
|
469
|
-
return
|
|
468
|
+
function ke(o, t, e) {
|
|
469
|
+
var r;
|
|
470
|
+
const s = t == null ? void 0 : t.BDOBlob;
|
|
471
|
+
if (!(s != null && s.Activity)) return null;
|
|
472
|
+
const a = o == null ? void 0 : o.Id;
|
|
473
|
+
for (const i of s.Activity)
|
|
474
|
+
if (i.Id !== a && (r = i.Input) != null && r[e])
|
|
475
|
+
return i.Input[e];
|
|
470
476
|
return null;
|
|
471
477
|
}
|
|
472
|
-
function
|
|
473
|
-
return async (t, e,
|
|
474
|
-
const
|
|
475
|
-
for (const
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
let
|
|
479
|
-
typeof
|
|
480
|
-
const l =
|
|
478
|
+
function Ie(o) {
|
|
479
|
+
return async (t, e, s) => {
|
|
480
|
+
const a = {}, r = "_getFields" in o ? o._getFields() : o, i = (s == null ? void 0 : s.names) ?? Object.keys(r);
|
|
481
|
+
for (const d of i) {
|
|
482
|
+
const f = r[d];
|
|
483
|
+
if (!f || f.readOnly) continue;
|
|
484
|
+
let n = t[d];
|
|
485
|
+
typeof n == "string" && f.meta.Type === "Number" && (n = n === "" ? void 0 : Number(n));
|
|
486
|
+
const l = f.validate(n);
|
|
481
487
|
if (!l.valid && l.errors.length > 0) {
|
|
482
|
-
|
|
488
|
+
a[d] = {
|
|
483
489
|
type: "validate",
|
|
484
|
-
message: l.errors[0] || `${
|
|
490
|
+
message: l.errors[0] || `${d} is invalid`
|
|
485
491
|
};
|
|
486
492
|
continue;
|
|
487
493
|
}
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
|
|
494
|
+
const _ = Te(
|
|
495
|
+
f,
|
|
496
|
+
n
|
|
491
497
|
);
|
|
492
|
-
!
|
|
498
|
+
!_.valid && _.errors.length > 0 && (a[d] = {
|
|
493
499
|
type: "constraint",
|
|
494
|
-
message:
|
|
500
|
+
message: _.errors[0]
|
|
495
501
|
});
|
|
496
502
|
}
|
|
497
|
-
return Object.keys(
|
|
503
|
+
return Object.keys(a).length === 0 ? { values: t, errors: {} } : { values: {}, errors: a };
|
|
498
504
|
};
|
|
499
505
|
}
|
|
500
|
-
function
|
|
501
|
-
const
|
|
502
|
-
function
|
|
506
|
+
function Ue(o, t, e) {
|
|
507
|
+
const s = o._getFields(), a = /* @__PURE__ */ new Map(), r = `/api/app/process/${o.meta.businessProcessId}/${o.meta.activityId}`, i = le(r);
|
|
508
|
+
function d() {
|
|
503
509
|
if (!e)
|
|
504
510
|
throw new Error(
|
|
505
511
|
"Cannot perform attachment operation: no activity instance ID"
|
|
@@ -509,53 +515,53 @@ function Ie(o, t, e) {
|
|
|
509
515
|
return new Proxy(
|
|
510
516
|
{},
|
|
511
517
|
{
|
|
512
|
-
get(
|
|
513
|
-
if (typeof
|
|
518
|
+
get(f, n) {
|
|
519
|
+
if (typeof n == "symbol")
|
|
514
520
|
return;
|
|
515
|
-
if (
|
|
521
|
+
if (n === "_id")
|
|
516
522
|
return e;
|
|
517
|
-
if (
|
|
523
|
+
if (n === "toJSON")
|
|
518
524
|
return () => t.getValues();
|
|
519
|
-
if (
|
|
525
|
+
if (n === "validate")
|
|
520
526
|
return () => t.trigger();
|
|
521
|
-
if (
|
|
522
|
-
return
|
|
523
|
-
const l =
|
|
524
|
-
_id:
|
|
525
|
-
Name:
|
|
527
|
+
if (a.has(n))
|
|
528
|
+
return a.get(n);
|
|
529
|
+
const l = s[n], _ = (l == null ? void 0 : l.meta) ?? {
|
|
530
|
+
_id: n,
|
|
531
|
+
Name: n,
|
|
526
532
|
Type: "String"
|
|
527
|
-
},
|
|
528
|
-
t.getValues(
|
|
529
|
-
) : { valid: !0, errors: [] },
|
|
530
|
-
const
|
|
531
|
-
return
|
|
533
|
+
}, I = (l == null ? void 0 : l.readOnly) ?? !1, U = () => l ? l.validate(
|
|
534
|
+
t.getValues(n)
|
|
535
|
+
) : { valid: !0, errors: [] }, j = (v) => {
|
|
536
|
+
const u = t.getValues(n);
|
|
537
|
+
return u ?? v;
|
|
532
538
|
};
|
|
533
|
-
if (!
|
|
534
|
-
const
|
|
535
|
-
const c = t.getValues(
|
|
536
|
-
return
|
|
537
|
-
},
|
|
538
|
-
label: (l == null ? void 0 : l.label) ??
|
|
539
|
+
if (!I) {
|
|
540
|
+
const v = () => {
|
|
541
|
+
const c = t.getValues(n);
|
|
542
|
+
return _.Type === "File" ? c ?? [] : c;
|
|
543
|
+
}, u = {
|
|
544
|
+
label: (l == null ? void 0 : l.label) ?? n,
|
|
539
545
|
required: (l == null ? void 0 : l.required) ?? !1,
|
|
540
546
|
readOnly: !1,
|
|
541
547
|
defaultValue: l == null ? void 0 : l.defaultValue,
|
|
542
|
-
meta:
|
|
543
|
-
get:
|
|
544
|
-
getOrDefault:
|
|
548
|
+
meta: _,
|
|
549
|
+
get: v,
|
|
550
|
+
getOrDefault: j,
|
|
545
551
|
set: (c) => {
|
|
546
|
-
t.setValue(
|
|
552
|
+
t.setValue(n, c, {
|
|
547
553
|
shouldDirty: !0,
|
|
548
554
|
shouldTouch: !0,
|
|
549
555
|
shouldValidate: !1
|
|
550
556
|
});
|
|
551
557
|
},
|
|
552
|
-
validate:
|
|
558
|
+
validate: U
|
|
553
559
|
};
|
|
554
|
-
return (
|
|
560
|
+
return (_.Type === "Image" || _.Type === "File") && (_.Type === "Image" ? (u.upload = async (c) => {
|
|
555
561
|
Y(c.name, "Image");
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
|
|
562
|
+
const g = d(), [h] = await i.getUploadUrl(
|
|
563
|
+
g,
|
|
564
|
+
n,
|
|
559
565
|
[
|
|
560
566
|
{
|
|
561
567
|
FileName: c.name,
|
|
@@ -564,144 +570,144 @@ function Ie(o, t, e) {
|
|
|
564
570
|
}
|
|
565
571
|
]
|
|
566
572
|
);
|
|
567
|
-
await fetch(
|
|
573
|
+
await fetch(h.UploadUrl.URL, {
|
|
568
574
|
method: "PUT",
|
|
569
|
-
headers: { "Content-Type":
|
|
575
|
+
headers: { "Content-Type": h.ContentType },
|
|
570
576
|
body: c
|
|
571
577
|
});
|
|
572
|
-
const
|
|
573
|
-
_id:
|
|
574
|
-
_name:
|
|
575
|
-
FileName:
|
|
576
|
-
FileExtension:
|
|
577
|
-
Size:
|
|
578
|
-
ContentType:
|
|
578
|
+
const m = {
|
|
579
|
+
_id: h._id,
|
|
580
|
+
_name: h._name,
|
|
581
|
+
FileName: h.FileName,
|
|
582
|
+
FileExtension: h.FileExtension,
|
|
583
|
+
Size: h.Size,
|
|
584
|
+
ContentType: h.ContentType
|
|
579
585
|
};
|
|
580
|
-
return t.setValue(
|
|
586
|
+
return t.setValue(n, m, {
|
|
581
587
|
shouldDirty: !0
|
|
582
|
-
}),
|
|
583
|
-
},
|
|
588
|
+
}), m;
|
|
589
|
+
}, u.deleteAttachment = async () => {
|
|
584
590
|
const c = t.getValues(
|
|
585
|
-
|
|
586
|
-
),
|
|
591
|
+
n
|
|
592
|
+
), g = d();
|
|
587
593
|
if (!(c != null && c._id))
|
|
588
|
-
throw new Error(`${
|
|
589
|
-
await
|
|
594
|
+
throw new Error(`${n} has no image to delete`);
|
|
595
|
+
await i.deleteAttachment(g, n, c._id), t.setValue(n, null, {
|
|
590
596
|
shouldDirty: !0
|
|
591
597
|
});
|
|
592
|
-
},
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
),
|
|
596
|
-
if (!(
|
|
597
|
-
throw new Error(`${
|
|
598
|
-
return
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
598
|
+
}, u.getDownloadUrl = async (c) => {
|
|
599
|
+
const g = t.getValues(
|
|
600
|
+
n
|
|
601
|
+
), h = d();
|
|
602
|
+
if (!(g != null && g._id))
|
|
603
|
+
throw new Error(`${n} has no image`);
|
|
604
|
+
return i.getDownloadUrl(
|
|
605
|
+
h,
|
|
606
|
+
n,
|
|
607
|
+
g._id,
|
|
602
608
|
c
|
|
603
609
|
);
|
|
604
|
-
}) : (
|
|
605
|
-
for (const
|
|
606
|
-
Y(
|
|
607
|
-
const
|
|
608
|
-
FileName:
|
|
609
|
-
Size:
|
|
610
|
-
FileExtension: Z(
|
|
611
|
-
})),
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
),
|
|
616
|
-
c.map(async (
|
|
610
|
+
}) : (u.upload = async (c) => {
|
|
611
|
+
for (const F of c)
|
|
612
|
+
Y(F.name, "File");
|
|
613
|
+
const g = d(), h = c.map((F) => ({
|
|
614
|
+
FileName: F.name,
|
|
615
|
+
Size: F.size,
|
|
616
|
+
FileExtension: Z(F.name)
|
|
617
|
+
})), m = await i.getUploadUrl(
|
|
618
|
+
g,
|
|
619
|
+
n,
|
|
620
|
+
h
|
|
621
|
+
), B = await Promise.all(
|
|
622
|
+
c.map(async (F, p) => (await fetch(m[p].UploadUrl.URL, {
|
|
617
623
|
method: "PUT",
|
|
618
624
|
headers: {
|
|
619
|
-
"Content-Type":
|
|
625
|
+
"Content-Type": m[p].ContentType
|
|
620
626
|
},
|
|
621
|
-
body:
|
|
627
|
+
body: F
|
|
622
628
|
}), {
|
|
623
|
-
_id:
|
|
624
|
-
_name:
|
|
625
|
-
FileName:
|
|
626
|
-
FileExtension:
|
|
627
|
-
Size:
|
|
628
|
-
ContentType:
|
|
629
|
+
_id: m[p]._id,
|
|
630
|
+
_name: m[p]._name,
|
|
631
|
+
FileName: m[p].FileName,
|
|
632
|
+
FileExtension: m[p].FileExtension,
|
|
633
|
+
Size: m[p].Size,
|
|
634
|
+
ContentType: m[p].ContentType
|
|
629
635
|
}))
|
|
630
|
-
),
|
|
636
|
+
), y = t.getValues(n) ?? [];
|
|
631
637
|
return t.setValue(
|
|
632
|
-
|
|
633
|
-
[...
|
|
638
|
+
n,
|
|
639
|
+
[...y, ...B],
|
|
634
640
|
{ shouldDirty: !0 }
|
|
635
|
-
),
|
|
636
|
-
},
|
|
637
|
-
const
|
|
638
|
-
await
|
|
639
|
-
|
|
640
|
-
|
|
641
|
+
), B;
|
|
642
|
+
}, u.deleteAttachment = async (c) => {
|
|
643
|
+
const g = t.getValues(n) ?? [], h = d();
|
|
644
|
+
await i.deleteAttachment(h, n, c), t.setValue(
|
|
645
|
+
n,
|
|
646
|
+
g.filter((m) => m._id !== c),
|
|
641
647
|
{ shouldDirty: !0 }
|
|
642
648
|
);
|
|
643
|
-
},
|
|
644
|
-
const
|
|
645
|
-
return
|
|
646
|
-
|
|
647
|
-
|
|
649
|
+
}, u.getDownloadUrl = async (c, g) => {
|
|
650
|
+
const h = d();
|
|
651
|
+
return i.getDownloadUrl(
|
|
652
|
+
h,
|
|
653
|
+
n,
|
|
648
654
|
c,
|
|
649
|
-
|
|
655
|
+
g
|
|
650
656
|
);
|
|
651
|
-
},
|
|
652
|
-
const
|
|
653
|
-
return
|
|
654
|
-
})),
|
|
657
|
+
}, u.getDownloadUrls = async (c) => {
|
|
658
|
+
const g = d();
|
|
659
|
+
return i.getDownloadUrls(g, n, c);
|
|
660
|
+
})), a.set(n, u), u;
|
|
655
661
|
}
|
|
656
|
-
const
|
|
657
|
-
const
|
|
658
|
-
return
|
|
659
|
-
},
|
|
660
|
-
label: (l == null ? void 0 : l.label) ??
|
|
662
|
+
const N = () => {
|
|
663
|
+
const v = t.getValues(n);
|
|
664
|
+
return _.Type === "File" ? v ?? [] : v;
|
|
665
|
+
}, $ = {
|
|
666
|
+
label: (l == null ? void 0 : l.label) ?? n,
|
|
661
667
|
required: (l == null ? void 0 : l.required) ?? !1,
|
|
662
668
|
readOnly: !0,
|
|
663
669
|
defaultValue: l == null ? void 0 : l.defaultValue,
|
|
664
|
-
meta:
|
|
665
|
-
get:
|
|
666
|
-
getOrDefault:
|
|
667
|
-
validate:
|
|
670
|
+
meta: _,
|
|
671
|
+
get: N,
|
|
672
|
+
getOrDefault: j,
|
|
673
|
+
validate: U
|
|
668
674
|
};
|
|
669
|
-
return (
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
), c =
|
|
673
|
-
if (!(
|
|
674
|
-
throw new Error(`${
|
|
675
|
-
return
|
|
675
|
+
return (_.Type === "Image" || _.Type === "File") && (_.Type === "Image" ? $.getDownloadUrl = async (v) => {
|
|
676
|
+
const u = t.getValues(
|
|
677
|
+
n
|
|
678
|
+
), c = d();
|
|
679
|
+
if (!(u != null && u._id))
|
|
680
|
+
throw new Error(`${n} has no image to download`);
|
|
681
|
+
return i.getDownloadUrl(
|
|
676
682
|
c,
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
683
|
+
n,
|
|
684
|
+
u._id,
|
|
685
|
+
v
|
|
680
686
|
);
|
|
681
|
-
} : (
|
|
682
|
-
const c =
|
|
683
|
-
return
|
|
687
|
+
} : ($.getDownloadUrl = async (v, u) => {
|
|
688
|
+
const c = d();
|
|
689
|
+
return i.getDownloadUrl(
|
|
684
690
|
c,
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
691
|
+
n,
|
|
692
|
+
v,
|
|
693
|
+
u
|
|
688
694
|
);
|
|
689
|
-
},
|
|
690
|
-
const
|
|
691
|
-
return
|
|
692
|
-
})),
|
|
695
|
+
}, $.getDownloadUrls = async (v) => {
|
|
696
|
+
const u = d();
|
|
697
|
+
return i.getDownloadUrls(u, n, v);
|
|
698
|
+
})), a.set(n, $), $;
|
|
693
699
|
},
|
|
694
|
-
has(
|
|
695
|
-
return typeof
|
|
700
|
+
has(f, n) {
|
|
701
|
+
return typeof n == "symbol" ? !1 : n === "_id" || n === "toJSON" || n === "validate" ? !0 : n in s;
|
|
696
702
|
},
|
|
697
|
-
ownKeys(
|
|
698
|
-
return [...Object.keys(
|
|
703
|
+
ownKeys(f) {
|
|
704
|
+
return [...Object.keys(s), "_id", "toJSON", "validate"];
|
|
699
705
|
},
|
|
700
|
-
getOwnPropertyDescriptor(
|
|
701
|
-
if (typeof
|
|
706
|
+
getOwnPropertyDescriptor(f, n) {
|
|
707
|
+
if (typeof n != "symbol")
|
|
702
708
|
return {
|
|
703
709
|
configurable: !0,
|
|
704
|
-
enumerable:
|
|
710
|
+
enumerable: n !== "toJSON" && n !== "validate"
|
|
705
711
|
};
|
|
706
712
|
}
|
|
707
713
|
}
|
|
@@ -710,55 +716,55 @@ function Ie(o, t, e) {
|
|
|
710
716
|
function Ke(o, t) {
|
|
711
717
|
const {
|
|
712
718
|
activity_instance_id: e,
|
|
713
|
-
defaultValues:
|
|
714
|
-
mode:
|
|
715
|
-
enabled:
|
|
716
|
-
} = t, [
|
|
719
|
+
defaultValues: s = {},
|
|
720
|
+
mode: a = "onBlur",
|
|
721
|
+
enabled: r = !0
|
|
722
|
+
} = t, [i, d] = q(!1), [f, n] = q(null), [l, _] = q(!1), [I, U] = q({}), j = X(!1), N = X(null), { data: $, isLoading: v } = Pe({
|
|
717
723
|
queryKey: ["bp-metadata", o.meta.businessProcessId],
|
|
718
|
-
queryFn: () =>
|
|
724
|
+
queryFn: () => Ee(o.meta.businessProcessId),
|
|
719
725
|
staleTime: 30 * 60 * 1e3
|
|
720
|
-
}),
|
|
721
|
-
const
|
|
722
|
-
return
|
|
723
|
-
(
|
|
726
|
+
}), u = b(() => {
|
|
727
|
+
const w = $ == null ? void 0 : $.BDOBlob;
|
|
728
|
+
return w != null && w.Activity ? w.Activity.find(
|
|
729
|
+
(C) => C.Id === o.meta.activityId
|
|
724
730
|
) ?? null : null;
|
|
725
|
-
}, [
|
|
731
|
+
}, [$, o.meta.activityId]), c = v, g = b(() => u != null && u.Input ? Ne(u.Input) : o._getFields(), [u, o]), h = b(
|
|
726
732
|
() => ({
|
|
727
|
-
...
|
|
733
|
+
...I,
|
|
728
734
|
// readonly fields from other activities
|
|
729
|
-
...
|
|
735
|
+
...g
|
|
730
736
|
// Input fields (editable + readonly)
|
|
731
737
|
}),
|
|
732
|
-
[
|
|
733
|
-
),
|
|
734
|
-
() => Object.keys(
|
|
735
|
-
[f]
|
|
736
|
-
), M = P(
|
|
737
|
-
() => Ue(h),
|
|
738
|
+
[I, g]
|
|
739
|
+
), m = b(
|
|
740
|
+
() => Object.keys(h).filter((w) => h[w].readOnly),
|
|
738
741
|
[h]
|
|
739
|
-
),
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
742
|
+
), B = b(
|
|
743
|
+
() => Ie(g),
|
|
744
|
+
[g]
|
|
745
|
+
), y = Oe({
|
|
746
|
+
mode: a,
|
|
747
|
+
defaultValues: s,
|
|
748
|
+
resolver: B
|
|
749
|
+
}), F = b(() => o._getOps(), [o]), p = b(
|
|
750
|
+
() => Ue(o, y, e),
|
|
751
|
+
[o, y, e]
|
|
746
752
|
);
|
|
747
|
-
|
|
748
|
-
if (!
|
|
749
|
-
let
|
|
753
|
+
ve(() => {
|
|
754
|
+
if (!r || c) return;
|
|
755
|
+
let w = !0;
|
|
750
756
|
return (async () => {
|
|
751
|
-
|
|
757
|
+
d(!0), n(null);
|
|
752
758
|
try {
|
|
753
|
-
const
|
|
754
|
-
if (!
|
|
755
|
-
if (
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
),
|
|
760
|
-
(
|
|
761
|
-
const
|
|
759
|
+
const S = await F.read(e);
|
|
760
|
+
if (!w) return;
|
|
761
|
+
if (S && typeof S == "object") {
|
|
762
|
+
const D = pe(
|
|
763
|
+
g,
|
|
764
|
+
S
|
|
765
|
+
), E = { ...s, ...D };
|
|
766
|
+
(N.current === null || S !== N.current) && (y.reset(E), N.current = S);
|
|
767
|
+
const L = /* @__PURE__ */ new Set([
|
|
762
768
|
"_id",
|
|
763
769
|
"BPInstanceId",
|
|
764
770
|
"Status",
|
|
@@ -770,162 +776,141 @@ function Ke(o, t) {
|
|
|
770
776
|
"_modified_by",
|
|
771
777
|
"_v",
|
|
772
778
|
"_m_v"
|
|
773
|
-
]),
|
|
774
|
-
for (const
|
|
775
|
-
if (!
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
779
|
+
]), k = {};
|
|
780
|
+
for (const P of Object.keys(S))
|
|
781
|
+
if (!g[P] && !L.has(P)) {
|
|
782
|
+
const J = ke(
|
|
783
|
+
u,
|
|
784
|
+
$,
|
|
785
|
+
P
|
|
780
786
|
);
|
|
781
|
-
|
|
782
|
-
...
|
|
787
|
+
J && (k[P] = te(P, {
|
|
788
|
+
...J,
|
|
783
789
|
ReadOnly: !0
|
|
784
790
|
}));
|
|
785
791
|
}
|
|
786
|
-
Object.keys(
|
|
792
|
+
Object.keys(k).length > 0 && U(k);
|
|
787
793
|
}
|
|
788
|
-
} catch (
|
|
789
|
-
if (!
|
|
790
|
-
console.error("Failed to read activity data:",
|
|
794
|
+
} catch (S) {
|
|
795
|
+
if (!w) return;
|
|
796
|
+
console.error("Failed to read activity data:", S), n(ee(S));
|
|
791
797
|
} finally {
|
|
792
|
-
|
|
798
|
+
w && d(!1);
|
|
793
799
|
}
|
|
794
800
|
})(), () => {
|
|
795
|
-
|
|
801
|
+
w = !1;
|
|
796
802
|
};
|
|
797
|
-
}, [
|
|
798
|
-
const
|
|
799
|
-
(
|
|
800
|
-
[
|
|
803
|
+
}, [r, c, F, e]);
|
|
804
|
+
const K = z(
|
|
805
|
+
(w, C) => F.update(e, {
|
|
806
|
+
[w]: C
|
|
801
807
|
}),
|
|
802
|
-
[
|
|
803
|
-
),
|
|
804
|
-
() => be({
|
|
805
|
-
apiFn: H,
|
|
806
|
-
allFields: f,
|
|
807
|
-
readonlyFieldNames: _,
|
|
808
|
-
rhf: u,
|
|
809
|
-
isComputingRef: A
|
|
810
|
-
}),
|
|
811
|
-
[H, f, _, u]
|
|
812
|
-
), q = n === "onChange" || n === "all", L = n === "onBlur" || n === "onTouched" || n === "all", te = P(
|
|
808
|
+
[F, e]
|
|
809
|
+
), R = b(
|
|
813
810
|
() => Se({
|
|
814
|
-
|
|
815
|
-
allFields:
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
811
|
+
apiFn: K,
|
|
812
|
+
allFields: h,
|
|
813
|
+
readonlyFieldNames: m,
|
|
814
|
+
rhf: y,
|
|
815
|
+
isComputingRef: j
|
|
819
816
|
}),
|
|
820
|
-
[
|
|
821
|
-
), se =
|
|
817
|
+
[K, h, m, y]
|
|
818
|
+
), A = a === "onChange" || a === "all", M = a === "onBlur" || a === "onTouched" || a === "all", se = b(
|
|
822
819
|
() => $e({
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
820
|
+
rhf: y,
|
|
821
|
+
allFields: h,
|
|
822
|
+
syncField: R,
|
|
823
|
+
syncOnBlur: M,
|
|
824
|
+
syncOnChange: A
|
|
827
825
|
}),
|
|
828
|
-
[
|
|
829
|
-
), ae =
|
|
830
|
-
(
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
e,
|
|
842
|
-
C
|
|
843
|
-
), await (g == null ? void 0 : g(F, x));
|
|
844
|
-
} catch (C) {
|
|
845
|
-
T == null || T(K(C), x);
|
|
846
|
-
} finally {
|
|
847
|
-
w(!1);
|
|
848
|
-
}
|
|
849
|
-
},
|
|
850
|
-
(F, x) => {
|
|
851
|
-
T == null || T(F, x);
|
|
852
|
-
}
|
|
853
|
-
),
|
|
854
|
-
[u, O, _, f, e]
|
|
855
|
-
), ne = G(
|
|
856
|
-
(g, T) => u.handleSubmit(
|
|
857
|
-
async (F, x) => {
|
|
858
|
-
w(!0);
|
|
826
|
+
[y, h, R, M, A]
|
|
827
|
+
), ae = b(
|
|
828
|
+
() => be({
|
|
829
|
+
control: y.control,
|
|
830
|
+
syncField: R,
|
|
831
|
+
syncOnBlur: M,
|
|
832
|
+
syncOnChange: A
|
|
833
|
+
}),
|
|
834
|
+
[y.control, R, M, A]
|
|
835
|
+
), ne = z(
|
|
836
|
+
(w, C) => y.handleSubmit(
|
|
837
|
+
async (S, D) => {
|
|
838
|
+
_(!0);
|
|
859
839
|
try {
|
|
860
|
-
const
|
|
861
|
-
for (const
|
|
862
|
-
if (
|
|
863
|
-
const
|
|
864
|
-
|
|
840
|
+
const E = {}, L = new Set(m), k = y.formState.dirtyFields, P = y.getValues();
|
|
841
|
+
for (const x of Object.keys(P)) {
|
|
842
|
+
if (L.has(x) || !k[x]) continue;
|
|
843
|
+
const H = P[x] !== void 0 ? P[x] : S[x], Q = h[x];
|
|
844
|
+
E[x] = Q ? Ce(Q, H) : H;
|
|
865
845
|
}
|
|
866
|
-
Object.keys(
|
|
846
|
+
Object.keys(E).length > 0 && await F.update(
|
|
867
847
|
e,
|
|
868
|
-
|
|
869
|
-
)
|
|
870
|
-
|
|
871
|
-
|
|
848
|
+
E
|
|
849
|
+
);
|
|
850
|
+
const J = await F.complete(e);
|
|
851
|
+
await (w == null ? void 0 : w(J, D));
|
|
852
|
+
} catch (E) {
|
|
853
|
+
C == null || C(ee(E), D);
|
|
872
854
|
} finally {
|
|
873
|
-
|
|
855
|
+
_(!1);
|
|
874
856
|
}
|
|
875
857
|
},
|
|
876
|
-
(
|
|
877
|
-
|
|
858
|
+
(S, D) => {
|
|
859
|
+
C == null || C(S, D);
|
|
878
860
|
}
|
|
879
861
|
),
|
|
880
|
-
[
|
|
881
|
-
), re =
|
|
882
|
-
|
|
883
|
-
}, [
|
|
862
|
+
[y, F, m, h, e]
|
|
863
|
+
), re = z(() => {
|
|
864
|
+
y.clearErrors();
|
|
865
|
+
}, [y]), ie = !!f;
|
|
884
866
|
return {
|
|
885
867
|
// Item proxy
|
|
886
|
-
item:
|
|
868
|
+
item: p,
|
|
887
869
|
// Activity reference
|
|
888
870
|
activity: o,
|
|
889
871
|
// Form methods
|
|
890
|
-
register:
|
|
891
|
-
handleSubmit:
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
control: se,
|
|
872
|
+
register: se,
|
|
873
|
+
handleSubmit: ne,
|
|
874
|
+
watch: y.watch,
|
|
875
|
+
setValue: y.setValue,
|
|
876
|
+
getValues: y.getValues,
|
|
877
|
+
reset: y.reset,
|
|
878
|
+
trigger: y.trigger,
|
|
879
|
+
control: ae,
|
|
899
880
|
// Flattened form state
|
|
900
|
-
errors:
|
|
901
|
-
isValid:
|
|
902
|
-
isDirty:
|
|
903
|
-
isSubmitting:
|
|
904
|
-
isSubmitSuccessful:
|
|
881
|
+
errors: y.formState.errors,
|
|
882
|
+
isValid: y.formState.isValid,
|
|
883
|
+
isDirty: y.formState.isDirty,
|
|
884
|
+
isSubmitting: y.formState.isSubmitting || l,
|
|
885
|
+
isSubmitSuccessful: y.formState.isSubmitSuccessful,
|
|
905
886
|
// Loading
|
|
906
|
-
isLoading:
|
|
887
|
+
isLoading: i || c,
|
|
907
888
|
isMetadataLoading: c,
|
|
908
|
-
loadError:
|
|
889
|
+
loadError: f,
|
|
909
890
|
hasError: ie,
|
|
910
891
|
// Metadata
|
|
911
|
-
bpMetadata:
|
|
892
|
+
bpMetadata: $ ?? null,
|
|
912
893
|
// Operations
|
|
913
894
|
clearErrors: re
|
|
914
895
|
};
|
|
915
896
|
}
|
|
916
897
|
function He(o) {
|
|
917
|
-
const { activity: t, status: e, ...
|
|
918
|
-
() => e === "inprogress" ?
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
898
|
+
const { activity: t, status: e, ...s } = o, { businessProcessId: a, activityId: r } = t.meta, i = b(
|
|
899
|
+
() => e === "inprogress" ? async (f) => ({
|
|
900
|
+
Data: await t.getInProgressList(f)
|
|
901
|
+
}) : async (f) => ({
|
|
902
|
+
Data: await t.getCompletedList(f)
|
|
903
|
+
}),
|
|
904
|
+
[t, e]
|
|
905
|
+
), d = b(
|
|
906
|
+
() => e === "inprogress" ? async (f) => ({ Count: await t.inProgressCount(f) }) : async (f) => ({ Count: await t.completedCount(f) }),
|
|
907
|
+
[t, e]
|
|
923
908
|
);
|
|
924
|
-
return
|
|
925
|
-
queryKey: ["activity-table",
|
|
926
|
-
listFn:
|
|
927
|
-
countFn:
|
|
928
|
-
...
|
|
909
|
+
return Ve({
|
|
910
|
+
queryKey: ["activity-table", a, r, e],
|
|
911
|
+
listFn: i,
|
|
912
|
+
countFn: d,
|
|
913
|
+
...s
|
|
929
914
|
});
|
|
930
915
|
}
|
|
931
916
|
const Qe = {
|
|
@@ -934,11 +919,11 @@ const Qe = {
|
|
|
934
919
|
};
|
|
935
920
|
export {
|
|
936
921
|
Ge as Activity,
|
|
937
|
-
|
|
922
|
+
De as ActivityInstance,
|
|
938
923
|
Qe as ActivityTableStatus,
|
|
939
924
|
xe as Workflow,
|
|
940
|
-
|
|
941
|
-
|
|
925
|
+
Ne as buildFieldsFromInput,
|
|
926
|
+
te as createFieldFromMeta,
|
|
942
927
|
Ke as useActivityForm,
|
|
943
928
|
He as useActivityTable
|
|
944
929
|
};
|