@ram_28/kf-ai-sdk 2.0.10 → 2.0.12
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/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +67 -67
- package/dist/workflow/components/useActivityTable/index.d.ts +4 -0
- package/dist/workflow/components/useActivityTable/index.d.ts.map +1 -0
- package/dist/workflow/components/useActivityTable/types.d.ts +53 -0
- package/dist/workflow/components/useActivityTable/types.d.ts.map +1 -0
- package/dist/workflow/components/useActivityTable/useActivityTable.d.ts +4 -0
- package/dist/workflow/components/useActivityTable/useActivityTable.d.ts.map +1 -0
- package/dist/workflow/types.d.ts +2 -3
- package/dist/workflow/types.d.ts.map +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.d.ts +2 -0
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.mjs +274 -204
- package/dist/workflow.types.d.ts +1 -0
- package/dist/workflow.types.d.ts.map +1 -1
- package/docs/workflow.md +155 -10
- package/package.json +1 -1
- package/sdk/components/hooks/useForm/useForm.ts +2 -0
- package/sdk/workflow/components/useActivityTable/index.ts +8 -0
- package/sdk/workflow/components/useActivityTable/types.ts +67 -0
- package/sdk/workflow/components/useActivityTable/useActivityTable.ts +145 -0
- package/sdk/workflow/types.ts +2 -3
- package/sdk/workflow.ts +7 -0
- package/sdk/workflow.types.ts +7 -0
package/dist/workflow.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var H = (o, e, t) => e in o ?
|
|
3
|
-
var
|
|
4
|
-
import { c as
|
|
5
|
-
import { B as
|
|
6
|
-
import { useState as
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var H = (o, e, t) => e in o ? K(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var p = (o, e, t) => H(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { c as g, g as m } from "./client-CMERmrC-.js";
|
|
5
|
+
import { B as Q } from "./BaseField-B6da88U7.js";
|
|
6
|
+
import { useState as L, useRef as A, useMemo as P, useEffect as U, useCallback as C } from "react";
|
|
7
7
|
import { u as W } from "./index.esm-Cj63v5ny.js";
|
|
8
|
-
import { t as
|
|
8
|
+
import { t as x } from "./error-handling-CrhTtD88.js";
|
|
9
|
+
import { useQuery as M } from "@tanstack/react-query";
|
|
9
10
|
class z {
|
|
10
11
|
constructor(e) {
|
|
11
|
-
|
|
12
|
+
p(this, "bp_id");
|
|
12
13
|
this.bp_id = e;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
@@ -16,10 +17,10 @@ class z {
|
|
|
16
17
|
*/
|
|
17
18
|
async start() {
|
|
18
19
|
const e = await fetch(
|
|
19
|
-
`${
|
|
20
|
+
`${g()}/api/app/process/${this.bp_id}/start`,
|
|
20
21
|
{
|
|
21
22
|
method: "POST",
|
|
22
|
-
headers:
|
|
23
|
+
headers: m()
|
|
23
24
|
}
|
|
24
25
|
);
|
|
25
26
|
if (!e.ok)
|
|
@@ -34,10 +35,10 @@ class z {
|
|
|
34
35
|
*/
|
|
35
36
|
async progress(e) {
|
|
36
37
|
const t = await fetch(
|
|
37
|
-
`${
|
|
38
|
+
`${g()}/api/app/process/${this.bp_id}/${e}/progress`,
|
|
38
39
|
{
|
|
39
40
|
method: "GET",
|
|
40
|
-
headers:
|
|
41
|
+
headers: m()
|
|
41
42
|
}
|
|
42
43
|
);
|
|
43
44
|
if (!t.ok)
|
|
@@ -53,94 +54,94 @@ class z {
|
|
|
53
54
|
return {
|
|
54
55
|
// ── List-level ────────────────────────────────────────────
|
|
55
56
|
async inProgressList() {
|
|
56
|
-
const
|
|
57
|
+
const a = await fetch(`${g()}${t}/inprogress/list`, {
|
|
57
58
|
method: "GET",
|
|
58
|
-
headers:
|
|
59
|
+
headers: m()
|
|
59
60
|
});
|
|
60
|
-
if (!
|
|
61
|
-
throw new Error(`Failed to list in-progress activities: ${
|
|
62
|
-
return
|
|
61
|
+
if (!a.ok)
|
|
62
|
+
throw new Error(`Failed to list in-progress activities: ${a.statusText}`);
|
|
63
|
+
return a.json();
|
|
63
64
|
},
|
|
64
65
|
async completedList() {
|
|
65
|
-
const
|
|
66
|
+
const a = await fetch(`${g()}${t}/completed/list`, {
|
|
66
67
|
method: "GET",
|
|
67
|
-
headers:
|
|
68
|
+
headers: m()
|
|
68
69
|
});
|
|
69
|
-
if (!
|
|
70
|
-
throw new Error(`Failed to list completed activities: ${
|
|
71
|
-
return
|
|
70
|
+
if (!a.ok)
|
|
71
|
+
throw new Error(`Failed to list completed activities: ${a.statusText}`);
|
|
72
|
+
return a.json();
|
|
72
73
|
},
|
|
73
74
|
async inProgressMetric() {
|
|
74
|
-
const
|
|
75
|
+
const a = await fetch(`${g()}${t}/inprogress/metric`, {
|
|
75
76
|
method: "GET",
|
|
76
|
-
headers:
|
|
77
|
+
headers: m()
|
|
77
78
|
});
|
|
78
|
-
if (!
|
|
79
|
-
throw new Error(`Failed to get in-progress activity metrics: ${
|
|
80
|
-
return
|
|
79
|
+
if (!a.ok)
|
|
80
|
+
throw new Error(`Failed to get in-progress activity metrics: ${a.statusText}`);
|
|
81
|
+
return a.json();
|
|
81
82
|
},
|
|
82
83
|
async completedMetric() {
|
|
83
|
-
const
|
|
84
|
+
const a = await fetch(`${g()}${t}/completed/metric`, {
|
|
84
85
|
method: "GET",
|
|
85
|
-
headers:
|
|
86
|
+
headers: m()
|
|
86
87
|
});
|
|
87
|
-
if (!
|
|
88
|
-
throw new Error(`Failed to get completed activity metrics: ${
|
|
89
|
-
return
|
|
88
|
+
if (!a.ok)
|
|
89
|
+
throw new Error(`Failed to get completed activity metrics: ${a.statusText}`);
|
|
90
|
+
return a.json();
|
|
90
91
|
},
|
|
91
92
|
// ── Instance-level ────────────────────────────────────────
|
|
92
|
-
async read(
|
|
93
|
-
const s = await fetch(`${
|
|
93
|
+
async read(a) {
|
|
94
|
+
const s = await fetch(`${g()}${t}/${a}/read`, {
|
|
94
95
|
method: "GET",
|
|
95
|
-
headers:
|
|
96
|
+
headers: m()
|
|
96
97
|
});
|
|
97
98
|
if (!s.ok)
|
|
98
99
|
throw new Error(`Failed to read activity: ${s.statusText}`);
|
|
99
100
|
return (await s.json()).Data;
|
|
100
101
|
},
|
|
101
|
-
async update(
|
|
102
|
-
const
|
|
102
|
+
async update(a, s) {
|
|
103
|
+
const r = await fetch(`${g()}${t}/${a}/update`, {
|
|
103
104
|
method: "POST",
|
|
104
|
-
headers:
|
|
105
|
+
headers: m(),
|
|
105
106
|
body: JSON.stringify(s)
|
|
106
107
|
});
|
|
107
|
-
if (!
|
|
108
|
-
throw new Error(`Failed to update activity: ${
|
|
109
|
-
return
|
|
108
|
+
if (!r.ok)
|
|
109
|
+
throw new Error(`Failed to update activity: ${r.statusText}`);
|
|
110
|
+
return r.json();
|
|
110
111
|
},
|
|
111
|
-
async draftStart(
|
|
112
|
-
const
|
|
112
|
+
async draftStart(a, s) {
|
|
113
|
+
const r = await fetch(`${g()}${t}/${a}/draft`, {
|
|
113
114
|
method: "PATCH",
|
|
114
|
-
headers:
|
|
115
|
+
headers: m(),
|
|
115
116
|
body: JSON.stringify(s)
|
|
116
117
|
});
|
|
117
|
-
if (!
|
|
118
|
-
throw new Error(`Failed to start draft: ${
|
|
119
|
-
return
|
|
118
|
+
if (!r.ok)
|
|
119
|
+
throw new Error(`Failed to start draft: ${r.statusText}`);
|
|
120
|
+
return r.json();
|
|
120
121
|
},
|
|
121
|
-
async draftEnd(
|
|
122
|
-
const
|
|
122
|
+
async draftEnd(a, s) {
|
|
123
|
+
const r = await fetch(`${g()}${t}/${a}/draft`, {
|
|
123
124
|
method: "POST",
|
|
124
|
-
headers:
|
|
125
|
+
headers: m(),
|
|
125
126
|
body: JSON.stringify(s)
|
|
126
127
|
});
|
|
127
|
-
if (!
|
|
128
|
-
throw new Error(`Failed to end draft: ${
|
|
129
|
-
return
|
|
128
|
+
if (!r.ok)
|
|
129
|
+
throw new Error(`Failed to end draft: ${r.statusText}`);
|
|
130
|
+
return r.json();
|
|
130
131
|
},
|
|
131
|
-
async complete(
|
|
132
|
-
const s = await fetch(`${
|
|
132
|
+
async complete(a) {
|
|
133
|
+
const s = await fetch(`${g()}${t}/${a}/done`, {
|
|
133
134
|
method: "POST",
|
|
134
|
-
headers:
|
|
135
|
+
headers: m()
|
|
135
136
|
});
|
|
136
137
|
if (!s.ok)
|
|
137
138
|
throw new Error(`Failed to complete activity: ${s.statusText}`);
|
|
138
139
|
return s.json();
|
|
139
140
|
},
|
|
140
|
-
async progress(
|
|
141
|
-
const s = await fetch(`${
|
|
141
|
+
async progress(a) {
|
|
142
|
+
const s = await fetch(`${g()}${t}/${a}/progress`, {
|
|
142
143
|
method: "GET",
|
|
143
|
-
headers:
|
|
144
|
+
headers: m()
|
|
144
145
|
});
|
|
145
146
|
if (!s.ok)
|
|
146
147
|
throw new Error(`Failed to get activity progress: ${s.statusText}`);
|
|
@@ -149,14 +150,14 @@ class z {
|
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
class
|
|
153
|
-
constructor(e, t,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this._ops = e, this._id = t, this._data = { ...
|
|
153
|
+
class X {
|
|
154
|
+
constructor(e, t, a, s) {
|
|
155
|
+
p(this, "_id");
|
|
156
|
+
p(this, "_data");
|
|
157
|
+
p(this, "_ops");
|
|
158
|
+
p(this, "_fields");
|
|
159
|
+
p(this, "_accessorCache", /* @__PURE__ */ new Map());
|
|
160
|
+
this._ops = e, this._id = t, this._data = { ...a }, this._fields = s;
|
|
160
161
|
}
|
|
161
162
|
// ============================================================
|
|
162
163
|
// BDO ITEM METHODS
|
|
@@ -172,9 +173,9 @@ class Q {
|
|
|
172
173
|
*/
|
|
173
174
|
validate() {
|
|
174
175
|
const e = [];
|
|
175
|
-
for (const [t,
|
|
176
|
-
const s = this._data[t],
|
|
177
|
-
|
|
176
|
+
for (const [t, a] of Object.entries(this._fields)) {
|
|
177
|
+
const s = this._data[t], r = a.validate(s);
|
|
178
|
+
r.valid || e.push(...r.errors);
|
|
178
179
|
}
|
|
179
180
|
return {
|
|
180
181
|
valid: e.length === 0,
|
|
@@ -215,51 +216,51 @@ class Q {
|
|
|
215
216
|
_getAccessor(e) {
|
|
216
217
|
if (this._accessorCache.has(e))
|
|
217
218
|
return this._accessorCache.get(e);
|
|
218
|
-
const t = this._fields[e],
|
|
219
|
+
const t = this._fields[e], a = (t == null ? void 0 : t.meta) ?? {
|
|
219
220
|
_id: e,
|
|
220
221
|
Name: e,
|
|
221
222
|
Type: "String"
|
|
222
|
-
}, s = (t == null ? void 0 : t.readOnly) ?? !1,
|
|
223
|
+
}, s = (t == null ? void 0 : t.readOnly) ?? !1, r = () => t ? t.validate(this._data[e]) : { valid: !0, errors: [] };
|
|
223
224
|
let i;
|
|
224
225
|
return s ? i = {
|
|
225
226
|
label: (t == null ? void 0 : t.label) ?? e,
|
|
226
227
|
required: (t == null ? void 0 : t.required) ?? !1,
|
|
227
228
|
readOnly: !0,
|
|
228
229
|
defaultValue: t == null ? void 0 : t.defaultValue,
|
|
229
|
-
meta:
|
|
230
|
+
meta: a,
|
|
230
231
|
get: () => this._data[e],
|
|
231
|
-
validate:
|
|
232
|
+
validate: r
|
|
232
233
|
} : i = {
|
|
233
234
|
label: (t == null ? void 0 : t.label) ?? e,
|
|
234
235
|
required: (t == null ? void 0 : t.required) ?? !1,
|
|
235
236
|
readOnly: !1,
|
|
236
237
|
defaultValue: t == null ? void 0 : t.defaultValue,
|
|
237
|
-
meta:
|
|
238
|
+
meta: a,
|
|
238
239
|
get: () => this._data[e],
|
|
239
|
-
set: (
|
|
240
|
-
this._data[e] =
|
|
240
|
+
set: (d) => {
|
|
241
|
+
this._data[e] = d;
|
|
241
242
|
},
|
|
242
|
-
validate:
|
|
243
|
+
validate: r
|
|
243
244
|
}, this._accessorCache.set(e, i), i;
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
|
-
function
|
|
247
|
-
const s = new
|
|
247
|
+
function Y(o, e, t, a) {
|
|
248
|
+
const s = new X(
|
|
248
249
|
o,
|
|
249
250
|
e,
|
|
250
251
|
t,
|
|
251
|
-
|
|
252
|
+
a
|
|
252
253
|
);
|
|
253
254
|
return new Proxy(s, {
|
|
254
|
-
get(
|
|
255
|
-
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(
|
|
255
|
+
get(r, i, d) {
|
|
256
|
+
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);
|
|
256
257
|
},
|
|
257
|
-
has(
|
|
258
|
-
return typeof i == "symbol" ? !1 : i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_id" ? !0 : i in
|
|
258
|
+
has(r, i) {
|
|
259
|
+
return typeof i == "symbol" ? !1 : i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_id" ? !0 : i in r._fields;
|
|
259
260
|
},
|
|
260
|
-
ownKeys(
|
|
261
|
+
ownKeys(r) {
|
|
261
262
|
return [
|
|
262
|
-
...Object.keys(
|
|
263
|
+
...Object.keys(r._fields),
|
|
263
264
|
"_id",
|
|
264
265
|
"validate",
|
|
265
266
|
"toJSON",
|
|
@@ -269,7 +270,7 @@ function X(o, e, t, r) {
|
|
|
269
270
|
"progress"
|
|
270
271
|
];
|
|
271
272
|
},
|
|
272
|
-
getOwnPropertyDescriptor(
|
|
273
|
+
getOwnPropertyDescriptor(r, i) {
|
|
273
274
|
if (typeof i != "symbol")
|
|
274
275
|
return {
|
|
275
276
|
configurable: !0,
|
|
@@ -278,12 +279,12 @@ function X(o, e, t, r) {
|
|
|
278
279
|
}
|
|
279
280
|
});
|
|
280
281
|
}
|
|
281
|
-
class
|
|
282
|
+
class ut {
|
|
282
283
|
constructor() {
|
|
283
284
|
// ============================================================
|
|
284
285
|
// FIELD DISCOVERY (internal)
|
|
285
286
|
// ============================================================
|
|
286
|
-
|
|
287
|
+
p(this, "_fieldsCache", null);
|
|
287
288
|
}
|
|
288
289
|
// ============================================================
|
|
289
290
|
// ACTIVITY OPERATIONS (internal)
|
|
@@ -303,8 +304,8 @@ class ot {
|
|
|
303
304
|
if (this._fieldsCache) return this._fieldsCache;
|
|
304
305
|
const e = {};
|
|
305
306
|
for (const t of Object.keys(this)) {
|
|
306
|
-
const
|
|
307
|
-
|
|
307
|
+
const a = this[t];
|
|
308
|
+
a instanceof Q && (e[t] = a);
|
|
308
309
|
}
|
|
309
310
|
return this._fieldsCache = e, e;
|
|
310
311
|
}
|
|
@@ -344,11 +345,11 @@ class ot {
|
|
|
344
345
|
* @returns ActivityInstance with typed field accessors
|
|
345
346
|
*/
|
|
346
347
|
async getInstance(e) {
|
|
347
|
-
const t = this._ops(),
|
|
348
|
-
return
|
|
348
|
+
const t = this._ops(), a = await t.read(e), s = this._discoverFields();
|
|
349
|
+
return Y(
|
|
349
350
|
t,
|
|
350
351
|
e,
|
|
351
|
-
|
|
352
|
+
a,
|
|
352
353
|
s
|
|
353
354
|
);
|
|
354
355
|
}
|
|
@@ -370,72 +371,72 @@ class ot {
|
|
|
370
371
|
return this._ops();
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
|
-
function
|
|
374
|
-
return async (e, t,
|
|
375
|
-
const s = {},
|
|
376
|
-
for (const
|
|
377
|
-
const
|
|
378
|
-
if (!
|
|
379
|
-
const
|
|
380
|
-
|
|
374
|
+
function Z(o) {
|
|
375
|
+
return async (e, t, a) => {
|
|
376
|
+
const s = {}, r = o._getFields(), i = (a == null ? void 0 : a.names) ?? Object.keys(r);
|
|
377
|
+
for (const d of i) {
|
|
378
|
+
const _ = r[d];
|
|
379
|
+
if (!_ || _.readOnly) continue;
|
|
380
|
+
const V = e[d], w = _.validate(V);
|
|
381
|
+
!w.valid && w.errors.length > 0 && (s[d] = {
|
|
381
382
|
type: "validate",
|
|
382
|
-
message:
|
|
383
|
+
message: w.errors[0] || `${d} is invalid`
|
|
383
384
|
});
|
|
384
385
|
}
|
|
385
386
|
return Object.keys(s).length === 0 ? { values: e, errors: {} } : { values: {}, errors: s };
|
|
386
387
|
};
|
|
387
388
|
}
|
|
388
|
-
function
|
|
389
|
+
function tt(o, e) {
|
|
389
390
|
const t = o._getFields();
|
|
390
391
|
return new Proxy(
|
|
391
392
|
{},
|
|
392
393
|
{
|
|
393
|
-
get(
|
|
394
|
+
get(a, s) {
|
|
394
395
|
if (typeof s == "symbol")
|
|
395
396
|
return;
|
|
396
397
|
if (s === "toJSON")
|
|
397
398
|
return () => e.getValues();
|
|
398
399
|
if (s === "validate")
|
|
399
400
|
return () => e.trigger();
|
|
400
|
-
const
|
|
401
|
+
const r = t[s], i = (r == null ? void 0 : r.meta) ?? {
|
|
401
402
|
_id: s,
|
|
402
403
|
Name: s,
|
|
403
404
|
Type: "String"
|
|
404
|
-
},
|
|
405
|
-
return
|
|
406
|
-
label: (
|
|
407
|
-
required: (
|
|
405
|
+
}, d = (r == null ? void 0 : r.readOnly) ?? !1, _ = () => r ? r.validate(e.getValues(s)) : { valid: !0, errors: [] };
|
|
406
|
+
return d ? {
|
|
407
|
+
label: (r == null ? void 0 : r.label) ?? s,
|
|
408
|
+
required: (r == null ? void 0 : r.required) ?? !1,
|
|
408
409
|
readOnly: !0,
|
|
409
|
-
defaultValue:
|
|
410
|
+
defaultValue: r == null ? void 0 : r.defaultValue,
|
|
410
411
|
meta: i,
|
|
411
412
|
get: () => e.getValues(s),
|
|
412
|
-
getOrDefault: (
|
|
413
|
-
validate:
|
|
413
|
+
getOrDefault: (w) => e.getValues(s) ?? w,
|
|
414
|
+
validate: _
|
|
414
415
|
} : {
|
|
415
|
-
label: (
|
|
416
|
-
required: (
|
|
416
|
+
label: (r == null ? void 0 : r.label) ?? s,
|
|
417
|
+
required: (r == null ? void 0 : r.required) ?? !1,
|
|
417
418
|
readOnly: !1,
|
|
418
|
-
defaultValue:
|
|
419
|
+
defaultValue: r == null ? void 0 : r.defaultValue,
|
|
419
420
|
meta: i,
|
|
420
421
|
get: () => e.getValues(s),
|
|
421
|
-
getOrDefault: (
|
|
422
|
-
set: (
|
|
423
|
-
e.setValue(s,
|
|
422
|
+
getOrDefault: (v) => e.getValues(s) ?? v,
|
|
423
|
+
set: (v) => {
|
|
424
|
+
e.setValue(s, v, {
|
|
424
425
|
shouldDirty: !0,
|
|
425
426
|
shouldTouch: !0,
|
|
426
427
|
shouldValidate: !1
|
|
427
428
|
});
|
|
428
429
|
},
|
|
429
|
-
validate:
|
|
430
|
+
validate: _
|
|
430
431
|
};
|
|
431
432
|
},
|
|
432
|
-
has(
|
|
433
|
+
has(a, s) {
|
|
433
434
|
return typeof s == "symbol" ? !1 : s === "toJSON" || s === "validate" ? !0 : s in t;
|
|
434
435
|
},
|
|
435
|
-
ownKeys(
|
|
436
|
+
ownKeys(a) {
|
|
436
437
|
return [...Object.keys(t), "toJSON", "validate"];
|
|
437
438
|
},
|
|
438
|
-
getOwnPropertyDescriptor(
|
|
439
|
+
getOwnPropertyDescriptor(a, s) {
|
|
439
440
|
if (typeof s != "symbol")
|
|
440
441
|
return {
|
|
441
442
|
configurable: !0,
|
|
@@ -445,66 +446,66 @@ function Z(o, e) {
|
|
|
445
446
|
}
|
|
446
447
|
);
|
|
447
448
|
}
|
|
448
|
-
function
|
|
449
|
+
function dt(o, e) {
|
|
449
450
|
const {
|
|
450
451
|
activity_instance_id: t,
|
|
451
|
-
defaultValues:
|
|
452
|
+
defaultValues: a = {},
|
|
452
453
|
mode: s = "onBlur",
|
|
453
|
-
enabled:
|
|
454
|
-
} = e, [i,
|
|
454
|
+
enabled: r = !0
|
|
455
|
+
} = e, [i, d] = L(!1), [_, V] = L(null), [w, v] = L(!1), T = A(!1), E = A(null), j = P(
|
|
455
456
|
() => o._getFields(),
|
|
456
457
|
[o]
|
|
457
|
-
),
|
|
458
|
-
() => Object.keys(
|
|
459
|
-
(u) =>
|
|
458
|
+
), S = P(
|
|
459
|
+
() => Object.keys(j).filter(
|
|
460
|
+
(u) => j[u].readOnly
|
|
460
461
|
),
|
|
461
|
-
[
|
|
462
|
-
),
|
|
463
|
-
() =>
|
|
462
|
+
[j]
|
|
463
|
+
), N = P(
|
|
464
|
+
() => Z(o),
|
|
464
465
|
[o]
|
|
465
466
|
), n = W({
|
|
466
467
|
mode: s,
|
|
467
|
-
defaultValues:
|
|
468
|
-
resolver:
|
|
469
|
-
}),
|
|
470
|
-
() =>
|
|
468
|
+
defaultValues: a,
|
|
469
|
+
resolver: N
|
|
470
|
+
}), k = P(
|
|
471
|
+
() => tt(o, n),
|
|
471
472
|
[o, n]
|
|
472
|
-
),
|
|
473
|
+
), $ = P(
|
|
473
474
|
() => o._getOps(),
|
|
474
475
|
[o]
|
|
475
476
|
);
|
|
476
477
|
U(() => {
|
|
477
|
-
if (!
|
|
478
|
+
if (!r) return;
|
|
478
479
|
let u = !0;
|
|
479
480
|
return (async () => {
|
|
480
|
-
|
|
481
|
+
d(!0), V(null);
|
|
481
482
|
try {
|
|
482
|
-
const l = await
|
|
483
|
+
const l = await $.read(t);
|
|
483
484
|
if (!u) return;
|
|
484
|
-
l && typeof l == "object" && n.reset({ ...
|
|
485
|
+
l && typeof l == "object" && n.reset({ ...a, ...l });
|
|
485
486
|
} catch (l) {
|
|
486
487
|
if (!u) return;
|
|
487
|
-
console.error("Failed to read activity data:", l),
|
|
488
|
+
console.error("Failed to read activity data:", l), V(x(l));
|
|
488
489
|
} finally {
|
|
489
|
-
u &&
|
|
490
|
+
u && d(!1);
|
|
490
491
|
}
|
|
491
492
|
})(), () => {
|
|
492
493
|
u = !1;
|
|
493
494
|
};
|
|
494
|
-
}, [
|
|
495
|
-
const
|
|
495
|
+
}, [r, $, t]);
|
|
496
|
+
const f = C(
|
|
496
497
|
async (u) => {
|
|
497
|
-
|
|
498
|
-
if (!
|
|
499
|
-
|
|
498
|
+
S.length !== 0 && (T.current || (E.current && clearTimeout(E.current), E.current = setTimeout(async () => {
|
|
499
|
+
if (!T.current) {
|
|
500
|
+
T.current = !0;
|
|
500
501
|
try {
|
|
501
|
-
const c = n.getValues(), l = {},
|
|
502
|
-
Object.keys(c).forEach((
|
|
503
|
-
|
|
502
|
+
const c = n.getValues(), l = {}, h = new Set(S);
|
|
503
|
+
Object.keys(c).forEach((b) => {
|
|
504
|
+
h.has(b) || (l[b] = c[b]);
|
|
504
505
|
});
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
506
|
+
const y = await $.draftStart(t, l);
|
|
507
|
+
y && typeof y == "object" && Object.entries(y).forEach(([b, O]) => {
|
|
508
|
+
h.has(b) && n.getValues(b) !== O && n.setValue(b, O, {
|
|
508
509
|
shouldDirty: !1,
|
|
509
510
|
shouldValidate: !1
|
|
510
511
|
});
|
|
@@ -512,75 +513,75 @@ function ct(o, e) {
|
|
|
512
513
|
} catch (c) {
|
|
513
514
|
console.warn("Draft computation failed:", c);
|
|
514
515
|
} finally {
|
|
515
|
-
|
|
516
|
+
T.current = !1;
|
|
516
517
|
}
|
|
517
518
|
}
|
|
518
519
|
}, 300)));
|
|
519
520
|
},
|
|
520
|
-
[
|
|
521
|
-
),
|
|
521
|
+
[$, S, n]
|
|
522
|
+
), D = C(
|
|
522
523
|
(u, c) => {
|
|
523
|
-
const l =
|
|
524
|
-
|
|
525
|
-
let
|
|
526
|
-
s === "onBlur" || s === "onTouched" || s === "all" ?
|
|
527
|
-
},
|
|
524
|
+
const l = j[u], h = l ? l.readOnly : !1, y = c == null ? void 0 : c.onBlur, b = async (q) => {
|
|
525
|
+
y && await y(q);
|
|
526
|
+
let F = !0;
|
|
527
|
+
s === "onBlur" || s === "onTouched" || s === "all" ? F = await n.trigger(u) : F = !n.getFieldState(u, n.formState).error, F && await f(u);
|
|
528
|
+
}, O = n.register(u, {
|
|
528
529
|
...c,
|
|
529
|
-
onBlur:
|
|
530
|
-
...
|
|
530
|
+
onBlur: b,
|
|
531
|
+
...h ? { disabled: !0 } : {}
|
|
531
532
|
});
|
|
532
|
-
return
|
|
533
|
+
return h ? { ...O, disabled: !0 } : O;
|
|
533
534
|
},
|
|
534
|
-
[n,
|
|
535
|
-
),
|
|
535
|
+
[n, j, f, s]
|
|
536
|
+
), J = C(
|
|
536
537
|
(u, c) => n.handleSubmit(
|
|
537
|
-
async (l,
|
|
538
|
-
|
|
538
|
+
async (l, h) => {
|
|
539
|
+
v(!0);
|
|
539
540
|
try {
|
|
540
|
-
const
|
|
541
|
-
Object.keys(l).forEach((
|
|
542
|
-
!
|
|
543
|
-
}), await
|
|
544
|
-
} catch (
|
|
545
|
-
c == null || c(
|
|
541
|
+
const y = {}, b = new Set(S);
|
|
542
|
+
Object.keys(l).forEach((O) => {
|
|
543
|
+
!b.has(O) && l[O] !== void 0 && (y[O] = l[O]);
|
|
544
|
+
}), await $.update(t, y), await $.draftEnd(t, y), await (u == null ? void 0 : u(l, h));
|
|
545
|
+
} catch (y) {
|
|
546
|
+
c == null || c(x(y), h);
|
|
546
547
|
} finally {
|
|
547
|
-
|
|
548
|
+
v(!1);
|
|
548
549
|
}
|
|
549
550
|
},
|
|
550
|
-
(l,
|
|
551
|
-
c == null || c(l,
|
|
551
|
+
(l, h) => {
|
|
552
|
+
c == null || c(l, h);
|
|
552
553
|
}
|
|
553
554
|
),
|
|
554
|
-
[n,
|
|
555
|
-
),
|
|
555
|
+
[n, $, S]
|
|
556
|
+
), B = C(
|
|
556
557
|
(u, c) => n.handleSubmit(
|
|
557
|
-
async (l,
|
|
558
|
-
|
|
558
|
+
async (l, h) => {
|
|
559
|
+
v(!0);
|
|
559
560
|
try {
|
|
560
|
-
await
|
|
561
|
-
} catch (
|
|
562
|
-
c == null || c(
|
|
561
|
+
await $.complete(t), await (u == null ? void 0 : u(l, h));
|
|
562
|
+
} catch (y) {
|
|
563
|
+
c == null || c(x(y), h);
|
|
563
564
|
} finally {
|
|
564
|
-
|
|
565
|
+
v(!1);
|
|
565
566
|
}
|
|
566
567
|
},
|
|
567
|
-
(l,
|
|
568
|
-
c == null || c(l,
|
|
568
|
+
(l, h) => {
|
|
569
|
+
c == null || c(l, h);
|
|
569
570
|
}
|
|
570
571
|
),
|
|
571
|
-
[n,
|
|
572
|
-
),
|
|
572
|
+
[n, $]
|
|
573
|
+
), G = C(() => {
|
|
573
574
|
n.clearErrors();
|
|
574
|
-
}, [n]),
|
|
575
|
+
}, [n]), I = !!_;
|
|
575
576
|
return {
|
|
576
577
|
// Item proxy
|
|
577
|
-
item:
|
|
578
|
+
item: k,
|
|
578
579
|
// Activity reference
|
|
579
580
|
activity: o,
|
|
580
581
|
// Form methods
|
|
581
|
-
register:
|
|
582
|
-
handleSubmit:
|
|
583
|
-
handleComplete:
|
|
582
|
+
register: D,
|
|
583
|
+
handleSubmit: J,
|
|
584
|
+
handleComplete: B,
|
|
584
585
|
watch: n.watch,
|
|
585
586
|
setValue: n.setValue,
|
|
586
587
|
getValues: n.getValues,
|
|
@@ -591,19 +592,88 @@ function ct(o, e) {
|
|
|
591
592
|
errors: n.formState.errors,
|
|
592
593
|
isValid: n.formState.isValid,
|
|
593
594
|
isDirty: n.formState.isDirty,
|
|
594
|
-
isSubmitting: n.formState.isSubmitting ||
|
|
595
|
+
isSubmitting: n.formState.isSubmitting || w,
|
|
595
596
|
isSubmitSuccessful: n.formState.isSubmitSuccessful,
|
|
596
597
|
// Loading
|
|
597
598
|
isLoading: i,
|
|
598
|
-
loadError:
|
|
599
|
-
hasError:
|
|
599
|
+
loadError: _,
|
|
600
|
+
hasError: I,
|
|
600
601
|
// Operations
|
|
601
|
-
clearErrors:
|
|
602
|
+
clearErrors: G
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
const R = {
|
|
606
|
+
InProgress: "inprogress",
|
|
607
|
+
Completed: "completed"
|
|
608
|
+
};
|
|
609
|
+
function ft(o, e) {
|
|
610
|
+
const { status: t, onError: a, onSuccess: s } = e, { businessProcessId: r, activityId: i } = o.meta, {
|
|
611
|
+
data: d,
|
|
612
|
+
isLoading: _,
|
|
613
|
+
isFetching: V,
|
|
614
|
+
error: w,
|
|
615
|
+
refetch: v
|
|
616
|
+
} = M({
|
|
617
|
+
queryKey: ["activity-table", r, i, t],
|
|
618
|
+
queryFn: async () => {
|
|
619
|
+
try {
|
|
620
|
+
const f = t === R.InProgress ? await o.getInProgressList() : await o.getCompletedList();
|
|
621
|
+
return s && s(f.Data), f;
|
|
622
|
+
} catch (f) {
|
|
623
|
+
throw a && a(x(f)), f;
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
staleTime: 0,
|
|
627
|
+
gcTime: 30 * 1e3
|
|
628
|
+
}), {
|
|
629
|
+
data: T,
|
|
630
|
+
isLoading: E,
|
|
631
|
+
isFetching: j,
|
|
632
|
+
error: S,
|
|
633
|
+
refetch: N
|
|
634
|
+
} = M({
|
|
635
|
+
queryKey: [
|
|
636
|
+
"activity-table-count",
|
|
637
|
+
r,
|
|
638
|
+
i,
|
|
639
|
+
t
|
|
640
|
+
],
|
|
641
|
+
queryFn: async () => {
|
|
642
|
+
try {
|
|
643
|
+
return t === R.InProgress ? await o.inProgressMetrics() : await o.completedMetrics();
|
|
644
|
+
} catch (f) {
|
|
645
|
+
throw a && a(x(f)), f;
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
staleTime: 0,
|
|
649
|
+
gcTime: 30 * 1e3
|
|
650
|
+
}), n = P(
|
|
651
|
+
() => (d == null ? void 0 : d.Data) || [],
|
|
652
|
+
[d]
|
|
653
|
+
), k = P(
|
|
654
|
+
() => {
|
|
655
|
+
var f;
|
|
656
|
+
return ((f = T == null ? void 0 : T.Data[0]) == null ? void 0 : f.count__id) ?? 0;
|
|
657
|
+
},
|
|
658
|
+
[T]
|
|
659
|
+
), $ = C(async () => {
|
|
660
|
+
const [f] = await Promise.all([v(), N()]);
|
|
661
|
+
return f.data || { Data: [] };
|
|
662
|
+
}, [v, N]);
|
|
663
|
+
return {
|
|
664
|
+
rows: n,
|
|
665
|
+
totalItems: k,
|
|
666
|
+
isLoading: _ || E,
|
|
667
|
+
isFetching: V || j,
|
|
668
|
+
error: w ? x(w) : S ? x(S) : null,
|
|
669
|
+
refetch: $
|
|
602
670
|
};
|
|
603
671
|
}
|
|
604
672
|
export {
|
|
605
|
-
|
|
606
|
-
|
|
673
|
+
ut as Activity,
|
|
674
|
+
X as ActivityInstance,
|
|
675
|
+
R as ActivityTableStatus,
|
|
607
676
|
z as Workflow,
|
|
608
|
-
|
|
677
|
+
dt as useActivityForm,
|
|
678
|
+
ft as useActivityTable
|
|
609
679
|
};
|