@fluig-kit/ecm 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fluig-kit-ecm.es.js +343 -602
- package/dist/fluig-kit-ecm.umd.js +4 -10
- package/package.json +7 -2
package/dist/fluig-kit-ecm.es.js
CHANGED
|
@@ -1,530 +1,272 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
function Ie() {
|
|
11
|
-
if (ne) return j;
|
|
12
|
-
ne = 1;
|
|
13
|
-
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
14
|
-
function n(o, i, s) {
|
|
15
|
-
var u = null;
|
|
16
|
-
if (s !== void 0 && (u = "" + s), i.key !== void 0 && (u = "" + i.key), "key" in i) {
|
|
17
|
-
s = {};
|
|
18
|
-
for (var l in i)
|
|
19
|
-
l !== "key" && (s[l] = i[l]);
|
|
20
|
-
} else s = i;
|
|
21
|
-
return i = s.ref, {
|
|
22
|
-
$$typeof: e,
|
|
23
|
-
type: o,
|
|
24
|
-
key: u,
|
|
25
|
-
ref: i !== void 0 ? i : null,
|
|
26
|
-
props: s
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return j.Fragment = r, j.jsx = n, j.jsxs = n, j;
|
|
30
|
-
}
|
|
31
|
-
var N = {};
|
|
32
|
-
var oe;
|
|
33
|
-
function Fe() {
|
|
34
|
-
return oe || (oe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
35
|
-
function e(t) {
|
|
36
|
-
if (t == null) return null;
|
|
37
|
-
if (typeof t == "function")
|
|
38
|
-
return t.$$typeof === ye ? null : t.displayName || t.name || null;
|
|
39
|
-
if (typeof t == "string") return t;
|
|
40
|
-
switch (t) {
|
|
41
|
-
case E:
|
|
42
|
-
return "Fragment";
|
|
43
|
-
case W:
|
|
44
|
-
return "Profiler";
|
|
45
|
-
case _:
|
|
46
|
-
return "StrictMode";
|
|
47
|
-
case B:
|
|
48
|
-
return "Suspense";
|
|
49
|
-
case I:
|
|
50
|
-
return "SuspenseList";
|
|
51
|
-
case D:
|
|
52
|
-
return "Activity";
|
|
53
|
-
}
|
|
54
|
-
if (typeof t == "object")
|
|
55
|
-
switch (typeof t.tag == "number" && console.error(
|
|
56
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
57
|
-
), t.$$typeof) {
|
|
58
|
-
case p:
|
|
59
|
-
return "Portal";
|
|
60
|
-
case k:
|
|
61
|
-
return t.displayName || "Context";
|
|
62
|
-
case S:
|
|
63
|
-
return (t._context.displayName || "Context") + ".Consumer";
|
|
64
|
-
case O:
|
|
65
|
-
var d = t.render;
|
|
66
|
-
return t = t.displayName, t || (t = d.displayName || d.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
67
|
-
case V:
|
|
68
|
-
return d = t.displayName || null, d !== null ? d : e(t.type) || "Memo";
|
|
69
|
-
case F:
|
|
70
|
-
d = t._payload, t = t._init;
|
|
71
|
-
try {
|
|
72
|
-
return e(t(d));
|
|
73
|
-
} catch {
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
function r(t) {
|
|
79
|
-
return "" + t;
|
|
80
|
-
}
|
|
81
|
-
function n(t) {
|
|
82
|
-
try {
|
|
83
|
-
r(t);
|
|
84
|
-
var d = !1;
|
|
85
|
-
} catch {
|
|
86
|
-
d = !0;
|
|
87
|
-
}
|
|
88
|
-
if (d) {
|
|
89
|
-
d = console;
|
|
90
|
-
var y = d.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
91
|
-
return y.call(
|
|
92
|
-
d,
|
|
93
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
94
|
-
w
|
|
95
|
-
), r(t);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function o(t) {
|
|
99
|
-
if (t === E) return "<>";
|
|
100
|
-
if (typeof t == "object" && t !== null && t.$$typeof === F)
|
|
101
|
-
return "<...>";
|
|
102
|
-
try {
|
|
103
|
-
var d = e(t);
|
|
104
|
-
return d ? "<" + d + ">" : "<...>";
|
|
105
|
-
} catch {
|
|
106
|
-
return "<...>";
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function i() {
|
|
110
|
-
var t = z.A;
|
|
111
|
-
return t === null ? null : t.getOwner();
|
|
112
|
-
}
|
|
113
|
-
function s() {
|
|
114
|
-
return Error("react-stack-top-frame");
|
|
115
|
-
}
|
|
116
|
-
function u(t) {
|
|
117
|
-
if (Z.call(t, "key")) {
|
|
118
|
-
var d = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
119
|
-
if (d && d.isReactWarning) return !1;
|
|
120
|
-
}
|
|
121
|
-
return t.key !== void 0;
|
|
122
|
-
}
|
|
123
|
-
function l(t, d) {
|
|
124
|
-
function y() {
|
|
125
|
-
Q || (Q = !0, console.error(
|
|
126
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
127
|
-
d
|
|
128
|
-
));
|
|
129
|
-
}
|
|
130
|
-
y.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
131
|
-
get: y,
|
|
132
|
-
configurable: !0
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function c() {
|
|
136
|
-
var t = e(this.type);
|
|
137
|
-
return K[t] || (K[t] = !0, console.error(
|
|
138
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
139
|
-
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
140
|
-
}
|
|
141
|
-
function a(t, d, y, w, L, J) {
|
|
142
|
-
var b = y.ref;
|
|
143
|
-
return t = {
|
|
144
|
-
$$typeof: g,
|
|
145
|
-
type: t,
|
|
146
|
-
key: d,
|
|
147
|
-
props: y,
|
|
148
|
-
_owner: w
|
|
149
|
-
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(t, "ref", {
|
|
150
|
-
enumerable: !1,
|
|
151
|
-
get: c
|
|
152
|
-
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
153
|
-
configurable: !1,
|
|
154
|
-
enumerable: !1,
|
|
155
|
-
writable: !0,
|
|
156
|
-
value: 0
|
|
157
|
-
}), Object.defineProperty(t, "_debugInfo", {
|
|
158
|
-
configurable: !1,
|
|
159
|
-
enumerable: !1,
|
|
160
|
-
writable: !0,
|
|
161
|
-
value: null
|
|
162
|
-
}), Object.defineProperty(t, "_debugStack", {
|
|
163
|
-
configurable: !1,
|
|
164
|
-
enumerable: !1,
|
|
165
|
-
writable: !0,
|
|
166
|
-
value: L
|
|
167
|
-
}), Object.defineProperty(t, "_debugTask", {
|
|
168
|
-
configurable: !1,
|
|
169
|
-
enumerable: !1,
|
|
170
|
-
writable: !0,
|
|
171
|
-
value: J
|
|
172
|
-
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
173
|
-
}
|
|
174
|
-
function v(t, d, y, w, L, J) {
|
|
175
|
-
var b = d.children;
|
|
176
|
-
if (b !== void 0)
|
|
177
|
-
if (w)
|
|
178
|
-
if (he(b)) {
|
|
179
|
-
for (w = 0; w < b.length; w++)
|
|
180
|
-
m(b[w]);
|
|
181
|
-
Object.freeze && Object.freeze(b);
|
|
182
|
-
} else
|
|
183
|
-
console.error(
|
|
184
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
185
|
-
);
|
|
186
|
-
else m(b);
|
|
187
|
-
if (Z.call(d, "key")) {
|
|
188
|
-
b = e(t);
|
|
189
|
-
var P = Object.keys(d).filter(function(ge) {
|
|
190
|
-
return ge !== "key";
|
|
191
|
-
});
|
|
192
|
-
w = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", re[b + w] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
193
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
194
|
-
let props = %s;
|
|
195
|
-
<%s {...props} />
|
|
196
|
-
React keys must be passed directly to JSX without using spread:
|
|
197
|
-
let props = %s;
|
|
198
|
-
<%s key={someKey} {...props} />`,
|
|
199
|
-
w,
|
|
200
|
-
b,
|
|
201
|
-
P,
|
|
202
|
-
b
|
|
203
|
-
), re[b + w] = !0);
|
|
204
|
-
}
|
|
205
|
-
if (b = null, y !== void 0 && (n(y), b = "" + y), u(d) && (n(d.key), b = "" + d.key), "key" in d) {
|
|
206
|
-
y = {};
|
|
207
|
-
for (var H in d)
|
|
208
|
-
H !== "key" && (y[H] = d[H]);
|
|
209
|
-
} else y = d;
|
|
210
|
-
return b && l(
|
|
211
|
-
y,
|
|
212
|
-
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
213
|
-
), a(
|
|
214
|
-
t,
|
|
215
|
-
b,
|
|
216
|
-
y,
|
|
217
|
-
i(),
|
|
218
|
-
L,
|
|
219
|
-
J
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
function m(t) {
|
|
223
|
-
h(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === F && (t._payload.status === "fulfilled" ? h(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
224
|
-
}
|
|
225
|
-
function h(t) {
|
|
226
|
-
return typeof t == "object" && t !== null && t.$$typeof === g;
|
|
227
|
-
}
|
|
228
|
-
var f = we, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), p = /* @__PURE__ */ Symbol.for("react.portal"), E = /* @__PURE__ */ Symbol.for("react.fragment"), _ = /* @__PURE__ */ Symbol.for("react.strict_mode"), W = /* @__PURE__ */ Symbol.for("react.profiler"), S = /* @__PURE__ */ Symbol.for("react.consumer"), k = /* @__PURE__ */ Symbol.for("react.context"), O = /* @__PURE__ */ Symbol.for("react.forward_ref"), B = /* @__PURE__ */ Symbol.for("react.suspense"), I = /* @__PURE__ */ Symbol.for("react.suspense_list"), V = /* @__PURE__ */ Symbol.for("react.memo"), F = /* @__PURE__ */ Symbol.for("react.lazy"), D = /* @__PURE__ */ Symbol.for("react.activity"), ye = /* @__PURE__ */ Symbol.for("react.client.reference"), z = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Z = Object.prototype.hasOwnProperty, he = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
229
|
-
return null;
|
|
230
|
-
};
|
|
231
|
-
f = {
|
|
232
|
-
react_stack_bottom_frame: function(t) {
|
|
233
|
-
return t();
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
var Q, K = {}, ee = f.react_stack_bottom_frame.bind(
|
|
237
|
-
f,
|
|
238
|
-
s
|
|
239
|
-
)(), te = G(o(s)), re = {};
|
|
240
|
-
N.Fragment = E, N.jsx = function(t, d, y) {
|
|
241
|
-
var w = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
242
|
-
return v(
|
|
243
|
-
t,
|
|
244
|
-
d,
|
|
245
|
-
y,
|
|
246
|
-
!1,
|
|
247
|
-
w ? Error("react-stack-top-frame") : ee,
|
|
248
|
-
w ? G(o(t)) : te
|
|
249
|
-
);
|
|
250
|
-
}, N.jsxs = function(t, d, y) {
|
|
251
|
-
var w = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
252
|
-
return v(
|
|
253
|
-
t,
|
|
254
|
-
d,
|
|
255
|
-
y,
|
|
256
|
-
!0,
|
|
257
|
-
w ? Error("react-stack-top-frame") : ee,
|
|
258
|
-
w ? G(o(t)) : te
|
|
259
|
-
);
|
|
260
|
-
};
|
|
261
|
-
})()), N;
|
|
262
|
-
}
|
|
263
|
-
var ie;
|
|
264
|
-
function Pe() {
|
|
265
|
-
return ie || (ie = 1, process.env.NODE_ENV === "production" ? M.exports = Ie() : M.exports = Fe()), M.exports;
|
|
266
|
-
}
|
|
267
|
-
var A = Pe(), Ce = function(e, r) {
|
|
1
|
+
import { jsx as g, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as C, useState as O, useMemo as w, useCallback as E, useContext as x, useEffect as A, useRef as H } from "react";
|
|
3
|
+
import { appendErrors as Z, useWatch as K, useForm as J, FormProvider as Q, useFormContext as q } from "react-hook-form";
|
|
4
|
+
import { validateFieldsNatively as X, toNestErrors as ee } from "@hookform/resolvers";
|
|
5
|
+
import { z as te } from "zod";
|
|
6
|
+
import { parentProxy as T, DebugLogger as b, createFluigClient as ne } from "@fluig-kit/core";
|
|
7
|
+
import { DebugLogger as Ye, createFluigClient as Be, parentProxy as We } from "@fluig-kit/core";
|
|
8
|
+
import F from "chalk";
|
|
9
|
+
var re = function(e, t) {
|
|
268
10
|
for (var n = {}; e.length; ) {
|
|
269
|
-
var
|
|
270
|
-
if (!n[
|
|
271
|
-
var
|
|
272
|
-
n[
|
|
273
|
-
} else n[
|
|
274
|
-
if ("unionErrors" in
|
|
275
|
-
return
|
|
276
|
-
return e.push(
|
|
11
|
+
var r = e[0], i = r.code, s = r.message, c = r.path.join(".");
|
|
12
|
+
if (!n[c]) if ("unionErrors" in r) {
|
|
13
|
+
var a = r.unionErrors[0].errors[0];
|
|
14
|
+
n[c] = { message: a.message, type: a.code };
|
|
15
|
+
} else n[c] = { message: s, type: i };
|
|
16
|
+
if ("unionErrors" in r && r.unionErrors.forEach(function(f) {
|
|
17
|
+
return f.errors.forEach(function(d) {
|
|
18
|
+
return e.push(d);
|
|
277
19
|
});
|
|
278
|
-
}),
|
|
279
|
-
var
|
|
280
|
-
n[
|
|
20
|
+
}), t) {
|
|
21
|
+
var l = n[c].types, o = l && l[r.code];
|
|
22
|
+
n[c] = Z(c, t, n, i, o ? [].concat(o, r.message) : r.message);
|
|
281
23
|
}
|
|
282
24
|
e.shift();
|
|
283
25
|
}
|
|
284
26
|
return n;
|
|
285
|
-
},
|
|
286
|
-
return n === void 0 && (n = {}), function(
|
|
27
|
+
}, oe = function(e, t, n) {
|
|
28
|
+
return n === void 0 && (n = {}), function(r, i, s) {
|
|
287
29
|
try {
|
|
288
|
-
return Promise.resolve((function(
|
|
30
|
+
return Promise.resolve((function(c, a) {
|
|
289
31
|
try {
|
|
290
|
-
var
|
|
291
|
-
return s.shouldUseNativeValidation &&
|
|
32
|
+
var l = Promise.resolve(e[n.mode === "sync" ? "parse" : "parseAsync"](r, t)).then(function(o) {
|
|
33
|
+
return s.shouldUseNativeValidation && X({}, s), { errors: {}, values: n.raw ? r : o };
|
|
292
34
|
});
|
|
293
|
-
} catch (
|
|
294
|
-
return
|
|
35
|
+
} catch (o) {
|
|
36
|
+
return a(o);
|
|
295
37
|
}
|
|
296
|
-
return
|
|
297
|
-
})(0, function(
|
|
298
|
-
if ((function(
|
|
299
|
-
return Array.isArray(
|
|
300
|
-
})(
|
|
301
|
-
throw
|
|
38
|
+
return l && l.then ? l.then(void 0, a) : l;
|
|
39
|
+
})(0, function(c) {
|
|
40
|
+
if ((function(a) {
|
|
41
|
+
return Array.isArray(a?.errors);
|
|
42
|
+
})(c)) return { values: {}, errors: ee(re(c.errors, !s.shouldUseNativeValidation && s.criteriaMode === "all"), s) };
|
|
43
|
+
throw c;
|
|
302
44
|
}));
|
|
303
|
-
} catch (
|
|
304
|
-
return Promise.reject(
|
|
45
|
+
} catch (c) {
|
|
46
|
+
return Promise.reject(c);
|
|
305
47
|
}
|
|
306
48
|
};
|
|
307
49
|
};
|
|
308
|
-
const
|
|
50
|
+
const j = C(
|
|
309
51
|
null
|
|
310
52
|
);
|
|
311
|
-
function
|
|
53
|
+
function Te({
|
|
312
54
|
children: e,
|
|
313
|
-
baseSchema:
|
|
55
|
+
baseSchema: t
|
|
314
56
|
}) {
|
|
315
|
-
const [n,
|
|
316
|
-
|
|
317
|
-
}, []),
|
|
318
|
-
|
|
319
|
-
}, []),
|
|
57
|
+
const [n, r] = O([]), i = w(() => t ?? te.object({}), [t]), s = E((o, f) => {
|
|
58
|
+
r((d) => d.some((y) => y.id === o) ? d : [...d, { id: o, schema: f }]);
|
|
59
|
+
}, []), c = E((o) => {
|
|
60
|
+
r((f) => f.some((d) => d.id === o) ? f.filter((d) => d.id !== o) : f);
|
|
61
|
+
}, []), a = w(() => n.length ? n.map((o) => o.schema).reduce((o, f) => o.and(f), i) : i, [n, i]), l = w(
|
|
320
62
|
() => ({
|
|
321
63
|
registerSchema: s,
|
|
322
|
-
unregisterSchema:
|
|
323
|
-
mergedSchema:
|
|
64
|
+
unregisterSchema: c,
|
|
65
|
+
mergedSchema: a
|
|
324
66
|
}),
|
|
325
|
-
[s,
|
|
67
|
+
[s, c, a]
|
|
326
68
|
);
|
|
327
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ g(j.Provider, { value: l, children: e });
|
|
328
70
|
}
|
|
329
|
-
function
|
|
330
|
-
const e =
|
|
71
|
+
function M() {
|
|
72
|
+
const e = x(j);
|
|
331
73
|
if (!e)
|
|
332
74
|
throw new Error(
|
|
333
75
|
"useSchemaRegistry deve ser usado dentro de <SchemaRegistryProvider>"
|
|
334
76
|
);
|
|
335
77
|
return e;
|
|
336
78
|
}
|
|
337
|
-
function
|
|
79
|
+
function _(e) {
|
|
338
80
|
return typeof e == "number" ? e : isNaN(Number(e)) ? null : Number(e);
|
|
339
81
|
}
|
|
340
|
-
function
|
|
82
|
+
function U(e, t, n) {
|
|
341
83
|
if (!e) return !0;
|
|
342
|
-
const
|
|
84
|
+
const r = Array.isArray(t) ? t[0] : t, i = e.field ?? r, s = n?.[i];
|
|
343
85
|
return e.hasValue !== void 0 ? e.hasValue ? s != null && s !== "" : s == null || s === "" : e.equals !== void 0 ? s === e.equals : e.notEquals !== void 0 ? s !== e.notEquals : !0;
|
|
344
86
|
}
|
|
345
|
-
function
|
|
346
|
-
const s = new Set(e),
|
|
347
|
-
return n?.forEach((
|
|
348
|
-
if (
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
87
|
+
function ie(e, t, n, r, i) {
|
|
88
|
+
const s = new Set(e), c = new Set(t);
|
|
89
|
+
return n?.forEach((a) => {
|
|
90
|
+
if (a.from !== void 0) {
|
|
91
|
+
const o = Array.isArray(a.from) ? a.from : [a.from];
|
|
92
|
+
if (r === null || !o.includes(r)) return;
|
|
351
93
|
}
|
|
352
|
-
if (!
|
|
353
|
-
const
|
|
354
|
-
switch (
|
|
94
|
+
if (!U(a.when, a.target, i)) return;
|
|
95
|
+
const l = Array.isArray(a.target) ? a.target : [a.target];
|
|
96
|
+
switch (a.type) {
|
|
355
97
|
case "readonly":
|
|
356
|
-
|
|
357
|
-
|
|
98
|
+
l.forEach((o) => {
|
|
99
|
+
c.add(o), s.delete(o);
|
|
358
100
|
});
|
|
359
101
|
break;
|
|
360
102
|
case "active":
|
|
361
|
-
|
|
362
|
-
s.add(
|
|
103
|
+
l.forEach((o) => {
|
|
104
|
+
s.add(o), c.delete(o);
|
|
363
105
|
});
|
|
364
106
|
break;
|
|
365
107
|
case "hidden":
|
|
366
|
-
|
|
367
|
-
s.delete(
|
|
108
|
+
l.forEach((o) => {
|
|
109
|
+
s.delete(o), c.delete(o);
|
|
368
110
|
});
|
|
369
111
|
break;
|
|
370
112
|
}
|
|
371
|
-
}), { active: Array.from(s), readonly: Array.from(
|
|
113
|
+
}), { active: Array.from(s), readonly: Array.from(c) };
|
|
372
114
|
}
|
|
373
|
-
function
|
|
374
|
-
const i = new Set(e.active), s = new Set(e.readonly),
|
|
375
|
-
return
|
|
376
|
-
if (
|
|
377
|
-
const
|
|
378
|
-
if (n === null || !
|
|
115
|
+
function ae(e, t, n, r) {
|
|
116
|
+
const i = new Set(e.active), s = new Set(e.readonly), c = new Set(e.hidden ?? []);
|
|
117
|
+
return t?.forEach((a) => {
|
|
118
|
+
if (a.from !== void 0) {
|
|
119
|
+
const o = Array.isArray(a.from) ? a.from : [a.from];
|
|
120
|
+
if (n === null || !o.includes(n)) return;
|
|
379
121
|
}
|
|
380
|
-
if (!
|
|
381
|
-
const
|
|
382
|
-
switch (
|
|
122
|
+
if (!U(a.when, a.target, r)) return;
|
|
123
|
+
const l = Array.isArray(a.target) ? a.target : [a.target];
|
|
124
|
+
switch (a.type) {
|
|
383
125
|
case "hidden":
|
|
384
|
-
|
|
385
|
-
|
|
126
|
+
l.forEach((o) => {
|
|
127
|
+
c.add(o), i.delete(o), s.delete(o);
|
|
386
128
|
});
|
|
387
129
|
break;
|
|
388
130
|
case "active":
|
|
389
|
-
|
|
390
|
-
i.add(
|
|
131
|
+
l.forEach((o) => {
|
|
132
|
+
i.add(o), s.delete(o), c.delete(o);
|
|
391
133
|
});
|
|
392
134
|
break;
|
|
393
135
|
case "readonly":
|
|
394
|
-
|
|
395
|
-
s.add(
|
|
136
|
+
l.forEach((o) => {
|
|
137
|
+
s.add(o), i.delete(o), c.delete(o);
|
|
396
138
|
});
|
|
397
139
|
break;
|
|
398
140
|
}
|
|
399
141
|
}), {
|
|
400
142
|
active: Array.from(i),
|
|
401
143
|
readonly: Array.from(s),
|
|
402
|
-
hidden: Array.from(
|
|
144
|
+
hidden: Array.from(c)
|
|
403
145
|
};
|
|
404
146
|
}
|
|
405
|
-
function
|
|
406
|
-
if (!e?.length) return
|
|
407
|
-
const n = new Map(
|
|
147
|
+
function se(e, t) {
|
|
148
|
+
if (!e?.length) return t;
|
|
149
|
+
const n = new Map(t.map((i) => [i.name, i])), r = [];
|
|
408
150
|
return e.forEach((i) => {
|
|
409
|
-
n.has(i) && (
|
|
410
|
-
}), n.forEach((i) =>
|
|
151
|
+
n.has(i) && (r.push(n.get(i)), n.delete(i));
|
|
152
|
+
}), n.forEach((i) => r.push(i)), r;
|
|
411
153
|
}
|
|
412
|
-
function
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
i.target && (Array.isArray(i.target) ? i.target : [i.target]).forEach((
|
|
154
|
+
function ce(e) {
|
|
155
|
+
const t = /* @__PURE__ */ new Set(), n = (r = []) => {
|
|
156
|
+
r.forEach((i) => {
|
|
157
|
+
i.target && (Array.isArray(i.target) ? i.target : [i.target]).forEach((c) => t.add(c)), i.when?.field && t.add(i.when.field);
|
|
416
158
|
});
|
|
417
159
|
};
|
|
418
|
-
return n(e?.fields?.rules), n(e?.sections?.rules), Array.from(
|
|
160
|
+
return n(e?.fields?.rules), n(e?.sections?.rules), Array.from(t);
|
|
419
161
|
}
|
|
420
|
-
function
|
|
162
|
+
function le({
|
|
421
163
|
activityId: e,
|
|
422
|
-
previousActivityId:
|
|
164
|
+
previousActivityId: t,
|
|
423
165
|
control: n,
|
|
424
|
-
workflowStructure:
|
|
166
|
+
workflowStructure: r,
|
|
425
167
|
sectionsRegistry: i
|
|
426
168
|
}) {
|
|
427
|
-
const { registerSchema: s, unregisterSchema:
|
|
169
|
+
const { registerSchema: s, unregisterSchema: c } = M(), a = _(e), l = _(t), o = a !== null ? r[a] : null, f = w(() => ce(o), [a, o]), d = K({
|
|
428
170
|
control: n,
|
|
429
|
-
name:
|
|
171
|
+
name: f,
|
|
430
172
|
defaultValue: {}
|
|
431
|
-
}),
|
|
432
|
-
const
|
|
433
|
-
return
|
|
434
|
-
|
|
435
|
-
}),
|
|
436
|
-
}, [
|
|
437
|
-
if (!
|
|
173
|
+
}), y = w(() => {
|
|
174
|
+
const v = {};
|
|
175
|
+
return f.forEach((m, p) => {
|
|
176
|
+
v[m] = Array.isArray(d) ? d[p] : d;
|
|
177
|
+
}), v;
|
|
178
|
+
}, [d, f]), u = w(() => {
|
|
179
|
+
if (!o)
|
|
438
180
|
return {
|
|
439
181
|
sections: [],
|
|
440
182
|
fields: { active: [], readonly: [], hidden: [] }
|
|
441
183
|
};
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
184
|
+
const v = ie(
|
|
185
|
+
o.sections.active,
|
|
186
|
+
o.sections.readonly,
|
|
187
|
+
o.sections.rules,
|
|
188
|
+
l,
|
|
189
|
+
y
|
|
448
190
|
);
|
|
449
|
-
let
|
|
450
|
-
...
|
|
451
|
-
name:
|
|
191
|
+
let m = [
|
|
192
|
+
...v.readonly.map((S) => ({
|
|
193
|
+
name: S,
|
|
452
194
|
mode: "readonly"
|
|
453
195
|
})),
|
|
454
|
-
...
|
|
455
|
-
name:
|
|
196
|
+
...v.active.map((S) => ({
|
|
197
|
+
name: S,
|
|
456
198
|
mode: "active"
|
|
457
199
|
}))
|
|
458
200
|
];
|
|
459
|
-
|
|
460
|
-
const
|
|
201
|
+
m = se(o.sections.order, m);
|
|
202
|
+
const p = ae(
|
|
461
203
|
{
|
|
462
|
-
active:
|
|
463
|
-
readonly:
|
|
464
|
-
hidden:
|
|
204
|
+
active: o.fields.active,
|
|
205
|
+
readonly: o.fields.readonly,
|
|
206
|
+
hidden: o.fields.hidden
|
|
465
207
|
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
208
|
+
o.fields.rules,
|
|
209
|
+
l,
|
|
210
|
+
y
|
|
469
211
|
);
|
|
470
|
-
return { sections:
|
|
471
|
-
}, [
|
|
472
|
-
return
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
}), Object.keys(i ?? {}).filter((
|
|
478
|
-
}, [
|
|
212
|
+
return { sections: m, fields: p };
|
|
213
|
+
}, [o, l, y, i]);
|
|
214
|
+
return A(() => {
|
|
215
|
+
const v = u.sections.filter((m) => m.mode === "active").map((m) => m.name);
|
|
216
|
+
v.forEach((m) => {
|
|
217
|
+
const p = i?.[m]?.schema;
|
|
218
|
+
p && s(m, p);
|
|
219
|
+
}), Object.keys(i ?? {}).filter((m) => !v.includes(m)).forEach(c);
|
|
220
|
+
}, [u.sections, i, s, c]), u;
|
|
479
221
|
}
|
|
480
|
-
function
|
|
222
|
+
function ue() {
|
|
481
223
|
if (typeof document > "u") return {};
|
|
482
224
|
const e = {};
|
|
483
|
-
return document.querySelectorAll("input[type='radio'][name]").forEach((
|
|
484
|
-
const n =
|
|
485
|
-
|
|
486
|
-
}), document.querySelectorAll("input[name], textarea[name], select[name]").forEach((
|
|
487
|
-
const n =
|
|
488
|
-
if (!
|
|
225
|
+
return document.querySelectorAll("input[type='radio'][name]").forEach((t) => {
|
|
226
|
+
const n = t, r = n.getAttribute("name");
|
|
227
|
+
r && n.checked && (e[r] = n.value);
|
|
228
|
+
}), document.querySelectorAll("input[name], textarea[name], select[name]").forEach((t) => {
|
|
229
|
+
const n = t, r = n.getAttribute("name");
|
|
230
|
+
if (!r || e[r] !== void 0) return;
|
|
489
231
|
const i = n.getAttribute("value") ?? n.value ?? n.textContent ?? "";
|
|
490
|
-
e[
|
|
491
|
-
}), document.querySelectorAll("span[name]").forEach((
|
|
492
|
-
const n =
|
|
493
|
-
if (
|
|
232
|
+
e[r] = String(i).trim();
|
|
233
|
+
}), document.querySelectorAll("span[name]").forEach((t) => {
|
|
234
|
+
const n = t, r = n.getAttribute("name");
|
|
235
|
+
if (r) {
|
|
494
236
|
const i = n.textContent?.trim() ?? "";
|
|
495
|
-
i !== "" && (e[
|
|
237
|
+
i !== "" && (e[r] = i);
|
|
496
238
|
}
|
|
497
239
|
}), e;
|
|
498
240
|
}
|
|
499
|
-
const
|
|
500
|
-
if (
|
|
501
|
-
const
|
|
502
|
-
if (!
|
|
503
|
-
const n =
|
|
504
|
-
return n === !0 || !!
|
|
241
|
+
const Y = () => typeof window > "u" ? null : new URLSearchParams(window.location.search).get("edit"), de = () => typeof window > "u" || !window.top ? null : window.top.ECM?.workflowView ? "process" : "document", fe = () => {
|
|
242
|
+
if (de() === "process") {
|
|
243
|
+
const t = window.top?.ECM?.workflowView;
|
|
244
|
+
if (!t) return !1;
|
|
245
|
+
const n = t.newRequest ?? t.isNewRequest, r = t.colleagueLogin;
|
|
246
|
+
return n === !0 || !!r && r.trim() !== "";
|
|
505
247
|
}
|
|
506
|
-
return
|
|
507
|
-
},
|
|
508
|
-
function
|
|
248
|
+
return Y() === null;
|
|
249
|
+
}, me = () => Y() === "true", B = C(null);
|
|
250
|
+
function ke({
|
|
509
251
|
children: e,
|
|
510
|
-
devConfig:
|
|
252
|
+
devConfig: t
|
|
511
253
|
}) {
|
|
512
|
-
const [n,
|
|
513
|
-
return
|
|
254
|
+
const [n, r] = O(null), i = w(() => ue() ?? {}, []);
|
|
255
|
+
return A(() => {
|
|
514
256
|
let s = !0;
|
|
515
257
|
return (async () => {
|
|
516
|
-
const
|
|
517
|
-
let
|
|
258
|
+
const a = typeof window < "u" && window.location.hostname === "localhost", l = typeof window < "u" && window.self !== window.top;
|
|
259
|
+
let o = null;
|
|
518
260
|
try {
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
} catch (
|
|
522
|
-
console.warn("[FluigRuntime] Falha ao detectar atividade:",
|
|
261
|
+
const u = await T.top.ECM.workflowView.sequence;
|
|
262
|
+
u != null && (o = Number(u), t?.showDebugLogs && console.log("[FluigRuntime] Atividade:", o));
|
|
263
|
+
} catch (u) {
|
|
264
|
+
console.warn("[FluigRuntime] Falha ao detectar atividade:", u);
|
|
523
265
|
}
|
|
524
|
-
const
|
|
525
|
-
isView:
|
|
526
|
-
isReadOnly:
|
|
527
|
-
activityId:
|
|
266
|
+
const f = !a && l && !(fe() || me()), d = {
|
|
267
|
+
isView: f,
|
|
268
|
+
isReadOnly: f,
|
|
269
|
+
activityId: o,
|
|
528
270
|
// Usa o valor real detectado
|
|
529
271
|
previousActivityId: null,
|
|
530
272
|
prefilledValues: i,
|
|
@@ -532,46 +274,46 @@ function st({
|
|
|
532
274
|
showDebugLogs: !1,
|
|
533
275
|
isDev: !1
|
|
534
276
|
};
|
|
535
|
-
let
|
|
536
|
-
if (
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
...
|
|
540
|
-
...
|
|
541
|
-
isView:
|
|
542
|
-
isReadOnly:
|
|
277
|
+
let y = d;
|
|
278
|
+
if (t?.enabled) {
|
|
279
|
+
const u = t.isView ?? d.isView;
|
|
280
|
+
y = {
|
|
281
|
+
...d,
|
|
282
|
+
...t,
|
|
283
|
+
isView: u,
|
|
284
|
+
isReadOnly: u,
|
|
543
285
|
isDev: !0,
|
|
544
286
|
// Se devConfig tiver activityId definido explicitamente, usa ele.
|
|
545
287
|
// Se não, mantém o detectado (permite usar devConfig só para logs, por exemplo)
|
|
546
|
-
activityId:
|
|
288
|
+
activityId: t.activityId !== void 0 ? t.activityId : o
|
|
547
289
|
};
|
|
548
290
|
}
|
|
549
|
-
typeof window < "u" && (window.__FLUIG_DEBUG_ENABLED__ =
|
|
550
|
-
"Detected Activity":
|
|
551
|
-
"Final Activity":
|
|
552
|
-
"Dev Mode":
|
|
553
|
-
}),
|
|
291
|
+
typeof window < "u" && (window.__FLUIG_DEBUG_ENABLED__ = y.showDebugLogs), y.showDebugLogs && s && (b.header("Runtime Initialized"), b.table("State", {
|
|
292
|
+
"Detected Activity": o,
|
|
293
|
+
"Final Activity": y.activityId,
|
|
294
|
+
"Dev Mode": y.isDev
|
|
295
|
+
}), b.end()), s && r(y);
|
|
554
296
|
})(), () => {
|
|
555
297
|
s = !1;
|
|
556
298
|
};
|
|
557
|
-
}, [
|
|
299
|
+
}, [t, i]), n ? /* @__PURE__ */ g(B.Provider, { value: n, children: e }) : null;
|
|
558
300
|
}
|
|
559
|
-
function
|
|
560
|
-
const e =
|
|
301
|
+
function R() {
|
|
302
|
+
const e = x(B);
|
|
561
303
|
if (!e)
|
|
562
304
|
throw new Error(
|
|
563
305
|
"useFluigRuntime deve ser usado dentro de <FluigRuntimeProvider>"
|
|
564
306
|
);
|
|
565
307
|
return e;
|
|
566
308
|
}
|
|
567
|
-
function
|
|
568
|
-
const { activityId:
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}, [
|
|
309
|
+
function ve(e) {
|
|
310
|
+
const { activityId: t, previousActivityId: n } = R();
|
|
311
|
+
A(() => {
|
|
312
|
+
t != null && e.setValue("CURRENTACTIVITYID", t), n != null && e.setValue("LASTACTIVITYID", n);
|
|
313
|
+
}, [t, n, e]), A(() => {
|
|
572
314
|
if (typeof window > "u") return;
|
|
573
|
-
const
|
|
574
|
-
if (!
|
|
315
|
+
const r = window.top?.document.getElementById("send-process-button") || window.parent?.document.getElementById("workflow-actions-send") || document.getElementById("send-process-button");
|
|
316
|
+
if (!r) {
|
|
575
317
|
console.warn("[FluigWorkflowReact] Botão de envio do Fluig não encontrado. A validação automática pode falhar.");
|
|
576
318
|
return;
|
|
577
319
|
}
|
|
@@ -579,9 +321,9 @@ function $e(e) {
|
|
|
579
321
|
() => {
|
|
580
322
|
window.beforeSendValidate = () => !0;
|
|
581
323
|
try {
|
|
582
|
-
|
|
324
|
+
r.dispatchEvent(new MouseEvent("click", { view: window, bubbles: !0, cancelable: !0 }));
|
|
583
325
|
} catch {
|
|
584
|
-
|
|
326
|
+
r.click();
|
|
585
327
|
}
|
|
586
328
|
},
|
|
587
329
|
(i) => {
|
|
@@ -595,220 +337,220 @@ function $e(e) {
|
|
|
595
337
|
};
|
|
596
338
|
}, [e]);
|
|
597
339
|
}
|
|
598
|
-
const
|
|
340
|
+
const ye = ({
|
|
599
341
|
workflowStructure: e,
|
|
600
|
-
sectionsRegistry:
|
|
342
|
+
sectionsRegistry: t,
|
|
601
343
|
className: n
|
|
602
344
|
}) => {
|
|
603
|
-
const { control:
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}, [
|
|
607
|
-
const { sections:
|
|
608
|
-
control:
|
|
609
|
-
activityId:
|
|
610
|
-
previousActivityId:
|
|
345
|
+
const { control: r, handleSubmit: i, register: s, setValue: c, getValues: a } = q(), l = R(), o = H(!1);
|
|
346
|
+
A(() => {
|
|
347
|
+
o.current || (l.activityId != null && c("CURRENTACTIVITYID", l.activityId), l.previousActivityId != null && c("LASTACTIVITYID", l.previousActivityId), o.current = !0);
|
|
348
|
+
}, [l, c]);
|
|
349
|
+
const { sections: f, fields: d } = le({
|
|
350
|
+
control: r,
|
|
351
|
+
activityId: l.activityId,
|
|
352
|
+
previousActivityId: l.previousActivityId,
|
|
611
353
|
workflowStructure: e,
|
|
612
|
-
sectionsRegistry:
|
|
613
|
-
})
|
|
614
|
-
|
|
615
|
-
};
|
|
616
|
-
return /* @__PURE__ */ A.jsxs(
|
|
354
|
+
sectionsRegistry: t
|
|
355
|
+
});
|
|
356
|
+
return /* @__PURE__ */ N(
|
|
617
357
|
"form",
|
|
618
358
|
{
|
|
619
359
|
id: "fluig-react-form",
|
|
620
360
|
className: n,
|
|
621
|
-
onSubmit: i(
|
|
361
|
+
onSubmit: i((u) => {
|
|
362
|
+
console.log("✅ [FluigWorkflowForm] Dados válidos:", u);
|
|
363
|
+
}),
|
|
622
364
|
noValidate: !0,
|
|
623
365
|
children: [
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ N("div", { className: "hidden", style: { display: "none" }, children: [
|
|
367
|
+
/* @__PURE__ */ g("input", { type: "hidden", ...s("CURRENTACTIVITYID") }),
|
|
368
|
+
/* @__PURE__ */ g("input", { type: "hidden", ...s("LASTACTIVITYID") })
|
|
627
369
|
] }),
|
|
628
|
-
|
|
370
|
+
f.length === 0 && l.activityId !== null && /* @__PURE__ */ N("p", { children: [
|
|
629
371
|
"Não foi possível encontrar a atividade: ",
|
|
630
|
-
String(
|
|
372
|
+
String(l.activityId)
|
|
631
373
|
] }),
|
|
632
|
-
|
|
633
|
-
if (
|
|
634
|
-
const
|
|
635
|
-
if (!
|
|
636
|
-
const
|
|
637
|
-
return /* @__PURE__ */
|
|
638
|
-
|
|
374
|
+
f.map(({ name: u, mode: v }) => {
|
|
375
|
+
if (v === "hidden") return null;
|
|
376
|
+
const m = t[u];
|
|
377
|
+
if (!m) return null;
|
|
378
|
+
const p = m.Component;
|
|
379
|
+
return /* @__PURE__ */ g(
|
|
380
|
+
p,
|
|
639
381
|
{
|
|
640
|
-
id:
|
|
641
|
-
fields:
|
|
642
|
-
readOnly:
|
|
382
|
+
id: u,
|
|
383
|
+
fields: d,
|
|
384
|
+
readOnly: v === "readonly"
|
|
643
385
|
},
|
|
644
|
-
|
|
386
|
+
u
|
|
645
387
|
);
|
|
646
388
|
}),
|
|
647
|
-
|
|
389
|
+
l.isDev && l.showDebugSubmit && /* @__PURE__ */ g("div", { style: { width: "100%", padding: "16px", paddingTop: "0" }, children: /* @__PURE__ */ g("button", { type: "submit", className: "btn btn-primary btn-lg btn-block", children: "Submit (Debug)" }) })
|
|
648
390
|
]
|
|
649
391
|
}
|
|
650
392
|
);
|
|
651
|
-
},
|
|
652
|
-
const { mergedSchema:
|
|
653
|
-
resolver:
|
|
393
|
+
}, Le = (e) => {
|
|
394
|
+
const { mergedSchema: t } = M(), n = R(), r = J({
|
|
395
|
+
resolver: t ? oe(t) : void 0,
|
|
654
396
|
defaultValues: n.prefilledValues,
|
|
655
397
|
mode: "onBlur"
|
|
656
398
|
});
|
|
657
|
-
return
|
|
658
|
-
n.showDebugLogs && (
|
|
399
|
+
return ve(r), A(() => {
|
|
400
|
+
n.showDebugLogs && (b.header("Form Initialized"), b.table(
|
|
659
401
|
"Prefilled Values (DOM Capture)",
|
|
660
402
|
n.prefilledValues
|
|
661
|
-
),
|
|
662
|
-
}, [n.showDebugLogs, n.prefilledValues,
|
|
403
|
+
), b.info("RHF Current Values", r.getValues()), b.end());
|
|
404
|
+
}, [n.showDebugLogs, n.prefilledValues, r]), /* @__PURE__ */ g(Q, { ...r, children: /* @__PURE__ */ g(ye, { ...e }) });
|
|
663
405
|
};
|
|
664
|
-
async function
|
|
406
|
+
async function he(e) {
|
|
665
407
|
if (!e)
|
|
666
408
|
return console.warn("[setFluigNextActivity] Nenhuma atividade informada."), !1;
|
|
667
|
-
const { wfView:
|
|
668
|
-
if (!
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
return i ? (
|
|
409
|
+
const { wfView: t, wkfView: n } = await ge();
|
|
410
|
+
if (!t || !n) return !1;
|
|
411
|
+
pe(t);
|
|
412
|
+
const r = Number(e), i = we(t, r);
|
|
413
|
+
return i ? (be(t, n, i, r), console.log(`[setFluigNextActivity] Próxima atividade definida: ${r}`), !0) : (console.warn(`[setFluigNextActivity] Estado ${r} não encontrado nas próximas atividades disponíveis.`), console.log("Estados disponíveis:", t.availableStatesCOPY || t.availableStates), !1);
|
|
672
414
|
}
|
|
673
|
-
async function
|
|
674
|
-
const e = await
|
|
675
|
-
return !e || !
|
|
415
|
+
async function ge() {
|
|
416
|
+
const e = await T.top.ECM.workflowView, t = await T.top.ECM_WKFView;
|
|
417
|
+
return !e || !t ? (console.warn("[setFluigNextActivity] Contexto Fluig inválido ou não carregado."), {}) : { wfView: e, wkfView: t };
|
|
676
418
|
}
|
|
677
|
-
function
|
|
419
|
+
function pe(e) {
|
|
678
420
|
e.availableStatesCOPY || (e.availableStatesCOPY = e.availableStates);
|
|
679
421
|
}
|
|
680
|
-
function
|
|
681
|
-
return (e.availableStatesCOPY || e.availableStates)?.find((
|
|
422
|
+
function we(e, t) {
|
|
423
|
+
return (e.availableStatesCOPY || e.availableStates)?.find((r) => r.sequence === t);
|
|
682
424
|
}
|
|
683
|
-
function
|
|
684
|
-
e.availableUsers.users = [], e.availableStates = [n],
|
|
425
|
+
function be(e, t, n, r) {
|
|
426
|
+
e.availableUsers.users = [], e.availableStates = [n], t.selectActivity = () => r;
|
|
685
427
|
}
|
|
686
|
-
const
|
|
687
|
-
function
|
|
688
|
-
const e =
|
|
428
|
+
const W = C(null);
|
|
429
|
+
function Pe() {
|
|
430
|
+
const e = x(W);
|
|
689
431
|
if (!e)
|
|
690
432
|
throw new Error(
|
|
691
433
|
"useSection deve ser usado dentro de um componente <Section>"
|
|
692
434
|
);
|
|
693
435
|
return e;
|
|
694
436
|
}
|
|
695
|
-
function
|
|
437
|
+
function _e({
|
|
696
438
|
id: e,
|
|
697
|
-
className:
|
|
439
|
+
className: t,
|
|
698
440
|
schema: n,
|
|
699
|
-
children:
|
|
441
|
+
children: r,
|
|
700
442
|
form: i,
|
|
701
443
|
prefilledValues: s,
|
|
702
|
-
readOnly:
|
|
703
|
-
fields:
|
|
704
|
-
hidden:
|
|
444
|
+
readOnly: c,
|
|
445
|
+
fields: a = {},
|
|
446
|
+
hidden: l = !1
|
|
705
447
|
}) {
|
|
706
|
-
const { isView:
|
|
707
|
-
if (!
|
|
448
|
+
const { isView: o, activityId: f } = R(), d = f, y = q(), u = i || y;
|
|
449
|
+
if (!u)
|
|
708
450
|
return console.error(
|
|
709
451
|
`[FluigWorkflowReact] Section "${e}" não encontrou o 'form'.`
|
|
710
452
|
), null;
|
|
711
|
-
if (
|
|
712
|
-
const
|
|
713
|
-
(
|
|
714
|
-
[
|
|
715
|
-
),
|
|
716
|
-
(
|
|
717
|
-
[
|
|
718
|
-
),
|
|
719
|
-
(
|
|
720
|
-
[
|
|
721
|
-
),
|
|
722
|
-
(
|
|
723
|
-
if (!
|
|
724
|
-
const
|
|
725
|
-
|
|
453
|
+
if (l) return null;
|
|
454
|
+
const v = E(
|
|
455
|
+
(h) => a.hidden?.includes(h) ? "hidden" : a.readonly?.includes(h) ? "readonly" : a.active?.includes(h) ? "active" : c ? "readonly" : "active",
|
|
456
|
+
[a, c]
|
|
457
|
+
), m = E(
|
|
458
|
+
(h) => v(h) === "hidden",
|
|
459
|
+
[v]
|
|
460
|
+
), p = E(
|
|
461
|
+
(h) => v(h) === "readonly",
|
|
462
|
+
[v]
|
|
463
|
+
), S = E(
|
|
464
|
+
(h) => {
|
|
465
|
+
if (!h) return;
|
|
466
|
+
const I = u.getValues("CURRENTACTIVITYID");
|
|
467
|
+
u.setValue("LASTACTIVITYID", I), u.setValue("CURRENTACTIVITYID", d), he(Number(h));
|
|
726
468
|
},
|
|
727
|
-
[
|
|
469
|
+
[u, d]
|
|
728
470
|
);
|
|
729
|
-
|
|
730
|
-
if (!
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
let
|
|
734
|
-
for (;
|
|
735
|
-
|
|
736
|
-
const
|
|
737
|
-
if (
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}),
|
|
471
|
+
A(() => {
|
|
472
|
+
if (!o || !s || !n || !u) return;
|
|
473
|
+
const h = u.getValues(), I = n.shape;
|
|
474
|
+
I && Object.entries(I).forEach(([k, z]) => {
|
|
475
|
+
let V = z;
|
|
476
|
+
for (; V?._def?.schema; )
|
|
477
|
+
V = V._def.schema;
|
|
478
|
+
const D = V?._def?.fluig;
|
|
479
|
+
if (D?.type !== "options" || !Array.isArray(D.values) || h[k] !== void 0) return;
|
|
480
|
+
const L = {};
|
|
481
|
+
D.values.forEach((P) => {
|
|
482
|
+
L[P] = s[P] === "on";
|
|
483
|
+
}), u.setValue(k, L, {
|
|
742
484
|
shouldDirty: !1,
|
|
743
485
|
shouldValidate: !1
|
|
744
486
|
});
|
|
745
487
|
});
|
|
746
|
-
}, [
|
|
747
|
-
const
|
|
488
|
+
}, [o, s, n, u]);
|
|
489
|
+
const G = w(
|
|
748
490
|
() => ({
|
|
749
491
|
id: e,
|
|
750
|
-
form:
|
|
751
|
-
isHidden:
|
|
752
|
-
isReadOnly:
|
|
753
|
-
isView:
|
|
754
|
-
next:
|
|
755
|
-
wf_activity_id:
|
|
492
|
+
form: u,
|
|
493
|
+
isHidden: m,
|
|
494
|
+
isReadOnly: p,
|
|
495
|
+
isView: o,
|
|
496
|
+
next: S,
|
|
497
|
+
wf_activity_id: d
|
|
756
498
|
}),
|
|
757
|
-
[e,
|
|
499
|
+
[e, u, m, p, o, S, d]
|
|
758
500
|
);
|
|
759
|
-
return /* @__PURE__ */
|
|
501
|
+
return /* @__PURE__ */ g(W.Provider, { value: G, children: /* @__PURE__ */ g("section", { id: e, className: [e, t].filter(Boolean).join(" "), children: r }) });
|
|
760
502
|
}
|
|
761
|
-
const
|
|
762
|
-
function
|
|
763
|
-
const n =
|
|
764
|
-
return /* @__PURE__ */
|
|
503
|
+
const $ = C(null);
|
|
504
|
+
function Oe({ children: e, config: t }) {
|
|
505
|
+
const n = w(() => ne(t), [t]);
|
|
506
|
+
return /* @__PURE__ */ g($.Provider, { value: n, children: e });
|
|
765
507
|
}
|
|
766
|
-
function
|
|
767
|
-
const e =
|
|
508
|
+
function qe() {
|
|
509
|
+
const e = x($);
|
|
768
510
|
if (!e)
|
|
769
511
|
throw new Error(
|
|
770
512
|
"useFluigApi deve ser usado dentro de um <FluigApiProvider>"
|
|
771
513
|
);
|
|
772
514
|
return e;
|
|
773
515
|
}
|
|
774
|
-
function
|
|
516
|
+
function Ae(e) {
|
|
775
517
|
return e._def?.schema ?? e;
|
|
776
518
|
}
|
|
777
|
-
function
|
|
778
|
-
let
|
|
779
|
-
if (
|
|
780
|
-
const n =
|
|
781
|
-
if (n !== e && (
|
|
782
|
-
return
|
|
783
|
-
const
|
|
784
|
-
return (
|
|
519
|
+
function Se(e) {
|
|
520
|
+
let t = e._def?.fluig;
|
|
521
|
+
if (t?.values) return t.values;
|
|
522
|
+
const n = Ae(e);
|
|
523
|
+
if (n !== e && (t = n._def?.fluig, t?.values))
|
|
524
|
+
return t.values;
|
|
525
|
+
const r = n._def;
|
|
526
|
+
return (r?.meta ?? r?.metadata)?.fluig?.values ?? null;
|
|
785
527
|
}
|
|
786
|
-
function
|
|
528
|
+
function Ee(e) {
|
|
787
529
|
return e?._def?.typeName !== "ZodObject" ? [] : Object.entries(e.shape);
|
|
788
530
|
}
|
|
789
|
-
function
|
|
790
|
-
const
|
|
791
|
-
return (Array.isArray(e) ? e : Object.values(e).map((
|
|
792
|
-
let i =
|
|
531
|
+
function Ie(e) {
|
|
532
|
+
const t = /* @__PURE__ */ new Set();
|
|
533
|
+
return (Array.isArray(e) ? e : Object.values(e).map((r) => r.schema).filter(Boolean)).forEach((r) => {
|
|
534
|
+
let i = r;
|
|
793
535
|
for (; i._def?.schema; )
|
|
794
536
|
i = i._def.schema;
|
|
795
|
-
i._def?.typeName === "ZodObject" &&
|
|
796
|
-
|
|
797
|
-
const
|
|
798
|
-
|
|
537
|
+
i._def?.typeName === "ZodObject" && Ee(i).forEach(([s, c]) => {
|
|
538
|
+
t.add(s);
|
|
539
|
+
const a = Se(c);
|
|
540
|
+
a?.length && a.forEach((l) => t.add(l));
|
|
799
541
|
});
|
|
800
|
-
}), Array.from(
|
|
542
|
+
}), Array.from(t);
|
|
801
543
|
}
|
|
802
|
-
function
|
|
803
|
-
const
|
|
804
|
-
(
|
|
544
|
+
function je(e) {
|
|
545
|
+
const t = Ie(e), n = t.map(
|
|
546
|
+
(r) => `<input type="hidden" name="${r}" />`
|
|
805
547
|
).join(`
|
|
806
548
|
`);
|
|
807
|
-
return console.log(
|
|
549
|
+
return console.log(F.blue.bold(`
|
|
808
550
|
=== Inputs gerados (Build Script) ===
|
|
809
|
-
`)),
|
|
810
|
-
console.log(`${
|
|
811
|
-
}), console.log(
|
|
551
|
+
`)), t.forEach((r, i) => {
|
|
552
|
+
console.log(`${F.yellow(i + 1 + ".")} ${F.green(r)}`);
|
|
553
|
+
}), console.log(F.blue.bold(`
|
|
812
554
|
=====================================
|
|
813
555
|
`)), `<!DOCTYPE html>
|
|
814
556
|
<html lang="pt-br">
|
|
@@ -818,7 +560,6 @@ function mt(e) {
|
|
|
818
560
|
<title>Workflow Fluig</title>
|
|
819
561
|
|
|
820
562
|
<link rel="stylesheet" href="/portal/style-guide/css/fluig-style-guide.min.css">
|
|
821
|
-
|
|
822
563
|
<link rel="stylesheet" crossorigin href="./main.css">
|
|
823
564
|
</head>
|
|
824
565
|
<body>
|
|
@@ -833,17 +574,17 @@ function mt(e) {
|
|
|
833
574
|
</html>`;
|
|
834
575
|
}
|
|
835
576
|
export {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
577
|
+
Ye as DebugLogger,
|
|
578
|
+
Oe as FluigApiProvider,
|
|
579
|
+
ke as FluigRuntimeProvider,
|
|
580
|
+
Le as FluigWorkflowForm,
|
|
581
|
+
Te as SchemaRegistryProvider,
|
|
582
|
+
_e as Section,
|
|
583
|
+
Be as createFluigClient,
|
|
584
|
+
je as generateHtmlTemplate,
|
|
585
|
+
We as parentProxy,
|
|
586
|
+
qe as useFluigApi,
|
|
587
|
+
R as useFluigRuntime,
|
|
588
|
+
M as useSchemaRegistry,
|
|
589
|
+
Pe as useSection
|
|
849
590
|
};
|