@seedprotocol/mapping 0.6.1 → 0.6.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/CHANGELOG.md +11 -0
- package/README.md +22 -3
- package/dist/applyMapping.d.ts +4 -2
- package/dist/applyMapping.d.ts.map +1 -1
- package/dist/autoMap-Dh9SiWhT.js +631 -0
- package/dist/autoMap-Dh9SiWhT.js.map +1 -0
- package/dist/edgeMapping.d.ts +21 -0
- package/dist/edgeMapping.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -34
- package/dist/react/FieldMapper.d.ts +12 -2
- package/dist/react/FieldMapper.d.ts.map +1 -1
- package/dist/react/FieldMapperWires.d.ts.map +1 -1
- package/dist/react/PropertyRows.d.ts +4 -2
- package/dist/react/PropertyRows.d.ts.map +1 -1
- package/dist/react/SourceRows.d.ts +4 -2
- package/dist/react/SourceRows.d.ts.map +1 -1
- package/dist/react/fieldMapperCore.d.ts +3 -1
- package/dist/react/fieldMapperCore.d.ts.map +1 -1
- package/dist/react/fieldMapperSlots.d.ts +1 -1
- package/dist/react/fieldMapperSlots.d.ts.map +1 -1
- package/dist/react/fieldMapperTheme.d.ts +1 -1
- package/dist/react/fieldMapperTheme.d.ts.map +1 -1
- package/dist/react/fieldMapperTransforms.d.ts +7 -0
- package/dist/react/fieldMapperTransforms.d.ts.map +1 -0
- package/dist/react/fieldMapperTypes.d.ts +11 -1
- package/dist/react/fieldMapperTypes.d.ts.map +1 -1
- package/dist/react/useFieldMapper.d.ts.map +1 -1
- package/dist/react.d.ts +2 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +741 -658
- package/dist/react.js.map +1 -1
- package/dist/resolvedSources.d.ts.map +1 -1
- package/dist/types.d.ts +20 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { Fragment as
|
|
1
|
+
import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, c as l, f as u, g as d, i as f, k as p, l as m, n as h, r as g, s as _, t as v, u as y, x as b, y as x } from "./autoMap-Dh9SiWhT.js";
|
|
2
|
+
import { useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
3
|
+
import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
4
4
|
//#region src/react/fieldMapperControls.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */
|
|
5
|
+
function A({ className: e, value: t, onChange: n, children: r, disabled: i, "aria-label": a }) {
|
|
6
|
+
return /* @__PURE__ */ O("select", {
|
|
7
7
|
className: e,
|
|
8
8
|
"aria-label": a,
|
|
9
9
|
disabled: i,
|
|
@@ -12,8 +12,8 @@ function C({ className: e, value: t, onChange: n, children: r, disabled: i, "ari
|
|
|
12
12
|
children: r
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return /* @__PURE__ */
|
|
15
|
+
function j({ className: e, type: t = "button", onClick: n, children: r, disabled: i, "aria-label": a, "aria-pressed": o }) {
|
|
16
|
+
return /* @__PURE__ */ O("button", {
|
|
17
17
|
type: t,
|
|
18
18
|
className: e,
|
|
19
19
|
onClick: n,
|
|
@@ -23,15 +23,15 @@ function w({ className: e, type: t = "button", onClick: n, children: r, disabled
|
|
|
23
23
|
children: r
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return /* @__PURE__ */
|
|
26
|
+
function M({ className: e, children: t }) {
|
|
27
|
+
return /* @__PURE__ */ O("span", {
|
|
28
28
|
className: e,
|
|
29
29
|
children: t
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/react/fieldMapperSlots.ts
|
|
34
|
-
var
|
|
34
|
+
var N = {
|
|
35
35
|
root: "seed-field-mapper",
|
|
36
36
|
toolbar: "fm-toolbar",
|
|
37
37
|
filter: "fm-filter",
|
|
@@ -50,16 +50,17 @@ var E = {
|
|
|
50
50
|
addButton: "fm-btn",
|
|
51
51
|
inspector: "fm-inspector",
|
|
52
52
|
lookupEditor: "fm-lookups",
|
|
53
|
+
rowExpansion: "fm-row-expansion",
|
|
53
54
|
jsonPreview: "fm-preview"
|
|
54
55
|
};
|
|
55
|
-
function
|
|
56
|
+
function P(e, t, n) {
|
|
56
57
|
return [
|
|
57
|
-
|
|
58
|
+
N[e],
|
|
58
59
|
t?.[e],
|
|
59
60
|
n
|
|
60
61
|
].filter(Boolean).join(" ");
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function F(e, t, n) {
|
|
63
64
|
let r;
|
|
64
65
|
r = e?.preview === void 0 ? t !== !1 && "both" : e.preview;
|
|
65
66
|
let i;
|
|
@@ -71,85 +72,93 @@ function O(e, t, n) {
|
|
|
71
72
|
lookups: i
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
+
function I(e) {
|
|
75
76
|
return e === "row" || e === "both";
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function L(e) {
|
|
78
79
|
return e === "json" || e === "both";
|
|
79
80
|
}
|
|
80
81
|
//#endregion
|
|
81
82
|
//#region src/react/fieldMapperCore.ts
|
|
82
|
-
function
|
|
83
|
+
function R(e, t = 40) {
|
|
83
84
|
let n = e.replace(/\s+/g, " ").trim();
|
|
84
85
|
return n.length <= t ? n : `${n.slice(0, t)}…`;
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
let t = e.subtitle ? `${e.label} · ${e.subtitle}` : e.label, n =
|
|
87
|
+
function z(e) {
|
|
88
|
+
let t = e.subtitle ? `${e.label} · ${e.subtitle}` : e.label, n = R(e.value, 36);
|
|
88
89
|
return n ? `${t} · "${n}"` : t;
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function B(e) {
|
|
91
92
|
return e.filter((e) => e.kind !== "resolved");
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
94
|
+
function V(e) {
|
|
95
|
+
return B(e).map((e) => ({
|
|
95
96
|
value: e.id,
|
|
96
|
-
label:
|
|
97
|
+
label: z(e),
|
|
97
98
|
sample: e.value,
|
|
98
99
|
kind: e.kind
|
|
99
100
|
}));
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
+
function H(e) {
|
|
102
103
|
return e.map((e) => ({
|
|
103
104
|
value: e.name,
|
|
104
105
|
label: e.required ? `${e.name} *` : e.name,
|
|
105
106
|
dataType: e.dataType
|
|
106
107
|
}));
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
+
function U(e) {
|
|
109
110
|
if (e.kind === "full" || e.kind === "section") return !1;
|
|
110
111
|
let t = typeof e.meta?.url == "string" && e.meta.url.trim() ? e.meta.url.trim() : e.value;
|
|
111
|
-
return !t.trim().includes("<") &&
|
|
112
|
+
return !t.trim().includes("<") && b(t);
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
+
function W(e, t) {
|
|
114
115
|
if (!e || !t) return null;
|
|
115
|
-
if (
|
|
116
|
-
if (
|
|
116
|
+
if (a(t)) return "lookup";
|
|
117
|
+
if (U(e)) {
|
|
117
118
|
if (t.dataType === "Image" || t.dataType === "File") return "file";
|
|
118
119
|
if (t.dataType === "Html") return "extract";
|
|
119
120
|
}
|
|
120
121
|
return null;
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
+
function G(e, t, n) {
|
|
124
|
+
if (t === "derive") {
|
|
125
|
+
let e = n?.mapping?.derive?.from;
|
|
126
|
+
return e ? `‹derive from ${e}›` : "‹derive›";
|
|
127
|
+
}
|
|
128
|
+
if (t === "assemble") {
|
|
129
|
+
let e = n?.mapping?.assemble?.blocks;
|
|
130
|
+
return e?.length ? `‹assemble ${e.join(", ")}›` : "‹assemble›";
|
|
131
|
+
}
|
|
123
132
|
if (!e) return "";
|
|
124
|
-
if (t === "extract") return `‹extract HTML from ${
|
|
125
|
-
if (t === "file") return `‹file stored from ${
|
|
133
|
+
if (t === "extract") return `‹extract HTML from ${R(e.value, 48)}›`;
|
|
134
|
+
if (t === "file") return `‹file stored from ${R(e.value, 48)}›`;
|
|
126
135
|
if (t === "lookup") {
|
|
127
|
-
let t = e.value || e.label,
|
|
136
|
+
let t = e.value || e.label, a = n?.mapping ?? {
|
|
128
137
|
sourceId: e.id,
|
|
129
|
-
propertyName:
|
|
138
|
+
propertyName: n?.propertyName ?? n?.target?.name ?? "",
|
|
130
139
|
resolve: "lookup"
|
|
131
|
-
},
|
|
132
|
-
if (
|
|
133
|
-
let e =
|
|
134
|
-
return
|
|
140
|
+
}, o = r(a, t, n?.lookups);
|
|
141
|
+
if (o !== void 0) {
|
|
142
|
+
let e = n?.target ? i(o, n.target) : o;
|
|
143
|
+
return R(Array.isArray(e) ? e.join(", ") : String(e), 80);
|
|
135
144
|
}
|
|
136
|
-
return `‹lookup ref for "${
|
|
145
|
+
return `‹lookup ref for "${R(e.value, 48)}"›`;
|
|
137
146
|
}
|
|
138
|
-
if (
|
|
139
|
-
if (
|
|
140
|
-
let t = e.value || e.label,
|
|
141
|
-
if (typeof
|
|
142
|
-
if (typeof
|
|
147
|
+
if (n?.target && a(n.target)) return "";
|
|
148
|
+
if (n?.target) {
|
|
149
|
+
let t = e.value || e.label, r = u(t, n.target.dataType);
|
|
150
|
+
if (typeof r == "string") return R(r, 80);
|
|
151
|
+
if (typeof r == "number" || typeof r == "boolean") return String(r);
|
|
143
152
|
try {
|
|
144
|
-
return
|
|
153
|
+
return R(JSON.stringify(r), 80);
|
|
145
154
|
} catch {
|
|
146
|
-
return
|
|
155
|
+
return R(String(r), 80);
|
|
147
156
|
}
|
|
148
157
|
}
|
|
149
|
-
return
|
|
158
|
+
return R(e.value, 80);
|
|
150
159
|
}
|
|
151
|
-
function
|
|
152
|
-
let r =
|
|
160
|
+
function K(e, t, n) {
|
|
161
|
+
let r = y(e, t, n), i = t.filter((e) => e.resolve && e.resolve !== "lookup");
|
|
153
162
|
return i.length === 0 ? r : {
|
|
154
163
|
...r,
|
|
155
164
|
_pendingResolve: i.map((e) => ({
|
|
@@ -159,26 +168,26 @@ function z(e, t, n) {
|
|
|
159
168
|
}))
|
|
160
169
|
};
|
|
161
170
|
}
|
|
162
|
-
function
|
|
171
|
+
function q(e) {
|
|
163
172
|
if (e.conflict) return "conflict";
|
|
164
|
-
if (!e.mapping
|
|
173
|
+
if (!e.mapping || !c(e.mapping)) return "empty";
|
|
165
174
|
let t = e.mapping.resolve ?? null;
|
|
166
|
-
if (e.requiredResolve && t !== e.requiredResolve) return "needsResolve";
|
|
175
|
+
if (e.requiredResolve && t !== e.requiredResolve && (t !== "assemble" || e.requiredResolve !== "extract")) return "needsResolve";
|
|
167
176
|
if (t === "lookup") {
|
|
168
177
|
let t = e.sampleValue ?? "";
|
|
169
|
-
if (!t ||
|
|
178
|
+
if (!t || r(e.mapping, t, e.lookups) === void 0) return "needsLookup";
|
|
170
179
|
}
|
|
171
180
|
return "mapped";
|
|
172
181
|
}
|
|
173
|
-
function
|
|
174
|
-
let n = new Set(t.filter(
|
|
182
|
+
function J(e, t) {
|
|
183
|
+
let n = new Set(t.filter(c).map((e) => e.propertyName)), r = e.filter((e) => e.required && !n.has(e.name)).map((e) => e.name);
|
|
175
184
|
return {
|
|
176
185
|
mapped: n.size,
|
|
177
186
|
total: e.length,
|
|
178
187
|
missingRequired: r
|
|
179
188
|
};
|
|
180
189
|
}
|
|
181
|
-
function
|
|
190
|
+
function ee(e) {
|
|
182
191
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
|
|
183
192
|
for (let r of e) {
|
|
184
193
|
let e = r.propertyName;
|
|
@@ -188,13 +197,41 @@ function H(e) {
|
|
|
188
197
|
}
|
|
189
198
|
return n;
|
|
190
199
|
}
|
|
191
|
-
function
|
|
192
|
-
return e.resolve ? e.resolve === "lookup" ? e : p(e) : t &&
|
|
200
|
+
function Y(e, t) {
|
|
201
|
+
return e.resolve ? e.resolve === "lookup" ? e : p(e) : t && a(t) ? {
|
|
193
202
|
...p(e),
|
|
194
203
|
resolve: "lookup"
|
|
195
204
|
} : p(e);
|
|
196
205
|
}
|
|
197
|
-
function
|
|
206
|
+
function X(e, t, n, r, i) {
|
|
207
|
+
let a = t === "property" ? e.findIndex((e) => e.propertyName === n) : r.indexOf(n);
|
|
208
|
+
if (a < 0) return null;
|
|
209
|
+
let o = e[a];
|
|
210
|
+
if (!o || o.resolve !== "assemble") return null;
|
|
211
|
+
let s = [...e];
|
|
212
|
+
return s[a] = _(o, i), s;
|
|
213
|
+
}
|
|
214
|
+
function te(e, t, n, r, i) {
|
|
215
|
+
if (t === "property") {
|
|
216
|
+
let t = e.findIndex((e) => e.propertyName === n);
|
|
217
|
+
if (t >= 0) {
|
|
218
|
+
let n = [...e];
|
|
219
|
+
return n[t] = l(e[t], i), n;
|
|
220
|
+
}
|
|
221
|
+
return i ? Z(e, {
|
|
222
|
+
propertyName: n,
|
|
223
|
+
resolve: "derive",
|
|
224
|
+
derive: i
|
|
225
|
+
}) : null;
|
|
226
|
+
}
|
|
227
|
+
let a = r.indexOf(n);
|
|
228
|
+
if (a < 0) return null;
|
|
229
|
+
let o = e[a];
|
|
230
|
+
if (!o) return null;
|
|
231
|
+
let s = [...e];
|
|
232
|
+
return s[a] = l(o, i), s;
|
|
233
|
+
}
|
|
234
|
+
function ne(t, n, r, i, a) {
|
|
198
235
|
if (n === "property") {
|
|
199
236
|
let n = t.findIndex((e) => e.propertyName === r);
|
|
200
237
|
if (n < 0) return null;
|
|
@@ -210,75 +247,77 @@ function W(t, n, r, i, a) {
|
|
|
210
247
|
let c = [...t];
|
|
211
248
|
return c[o] = e(s, a), c;
|
|
212
249
|
}
|
|
213
|
-
function
|
|
250
|
+
function Z(e, t) {
|
|
214
251
|
let n = e.filter((e) => e.propertyName !== t.propertyName);
|
|
215
252
|
return n.push(t), n;
|
|
216
253
|
}
|
|
217
|
-
function
|
|
254
|
+
function re(e, t) {
|
|
218
255
|
if (t.length === 0) return null;
|
|
219
256
|
let n = !1, r = { ...e };
|
|
220
257
|
for (let e of t) e in r && (delete r[e], n = !0);
|
|
221
258
|
return n ? r : null;
|
|
222
259
|
}
|
|
223
|
-
function
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
let
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
260
|
+
function ie(e, t, n, r, i) {
|
|
261
|
+
let a = new Map(n.map((e) => [e.name, e])), o = d(r, i);
|
|
262
|
+
o = Y(o, a.get(i)), o.sourceId && !t.some((e) => e.id === o.sourceId) && !B(t).find((e) => e.id === o.sourceId) && t.some((e) => e.id === r);
|
|
263
|
+
let s = e.find((e) => e.propertyName === i);
|
|
264
|
+
o = m(o, s);
|
|
265
|
+
let c = Z(e, o), l = [];
|
|
266
|
+
return s?.resolve === "lookup" && o.resolve !== "lookup" && l.push(i), {
|
|
267
|
+
mappings: c,
|
|
268
|
+
clearedLookupProps: l
|
|
230
269
|
};
|
|
231
270
|
}
|
|
232
|
-
function
|
|
271
|
+
function ae(e, t) {
|
|
233
272
|
let n = s(t), r = [];
|
|
234
273
|
return {
|
|
235
274
|
mappings: e.filter((e) => {
|
|
236
275
|
let i;
|
|
237
|
-
return i = n ? e.sourceId
|
|
276
|
+
return i = n ? !(e.sourceId && e.sourceId === n.originId && e.resolve === n.resolve) : e.sourceId !== t, !i && e.resolve === "lookup" && r.push(e.propertyName), i;
|
|
238
277
|
}),
|
|
239
278
|
clearedLookupProps: r
|
|
240
279
|
};
|
|
241
280
|
}
|
|
242
|
-
function
|
|
243
|
-
let { targets: t, mappings:
|
|
244
|
-
for (let e of
|
|
281
|
+
function oe(e) {
|
|
282
|
+
let { targets: t, mappings: r, sources: i, lookups: a } = e, o = new Map(r.map((e) => [e.propertyName, e])), s = new Map(B(i).map((e) => [e.id, e]));
|
|
283
|
+
for (let e of i) s.has(e.id) || s.set(e.id, e);
|
|
245
284
|
return (e.visiblePropertyNames == null ? t : t.filter((t) => e.visiblePropertyNames.has(t.name))).map((e) => {
|
|
246
|
-
let t =
|
|
285
|
+
let t = o.get(e.name), r = t?.sourceId ? s.get(t.sourceId) : void 0, i = W(r, e), c = n(r), l = q({
|
|
247
286
|
mapping: t,
|
|
248
|
-
requiredResolve:
|
|
249
|
-
sampleValue:
|
|
250
|
-
lookups:
|
|
287
|
+
requiredResolve: i,
|
|
288
|
+
sampleValue: c,
|
|
289
|
+
lookups: a
|
|
251
290
|
});
|
|
252
291
|
return {
|
|
253
292
|
id: e.name,
|
|
254
293
|
target: e,
|
|
255
294
|
mapping: t,
|
|
256
|
-
source:
|
|
257
|
-
sampleValue:
|
|
258
|
-
preview:
|
|
295
|
+
source: r,
|
|
296
|
+
sampleValue: c,
|
|
297
|
+
preview: G(r, t?.resolve, {
|
|
259
298
|
target: e,
|
|
260
|
-
lookups:
|
|
299
|
+
lookups: a,
|
|
261
300
|
propertyName: e.name,
|
|
262
301
|
mapping: t
|
|
263
302
|
}),
|
|
264
|
-
requiredResolve:
|
|
265
|
-
state:
|
|
303
|
+
requiredResolve: i,
|
|
304
|
+
state: l
|
|
266
305
|
};
|
|
267
306
|
});
|
|
268
307
|
}
|
|
269
|
-
function
|
|
270
|
-
let { mappings: t, edgeIds:
|
|
308
|
+
function se(e) {
|
|
309
|
+
let { mappings: t, edgeIds: r, drafts: i, sources: a, targets: o, lookups: s } = e, l = new Map(a.map((e) => [e.id, e])), u = new Map(o.map((e) => [e.name, e])), d = [];
|
|
271
310
|
for (let e = 0; e < t.length; e++) {
|
|
272
|
-
let
|
|
273
|
-
|
|
311
|
+
let n = t[e], i = r[e] ?? `edge-${e}`;
|
|
312
|
+
d.push({
|
|
274
313
|
id: i,
|
|
275
|
-
propertyName:
|
|
276
|
-
mapping:
|
|
277
|
-
source:
|
|
278
|
-
target:
|
|
314
|
+
propertyName: n.propertyName,
|
|
315
|
+
mapping: n,
|
|
316
|
+
source: n.sourceId ? l.get(n.sourceId) : void 0,
|
|
317
|
+
target: u.get(n.propertyName)
|
|
279
318
|
});
|
|
280
319
|
}
|
|
281
|
-
for (let e of
|
|
320
|
+
for (let e of i) d.push({
|
|
282
321
|
id: e.id,
|
|
283
322
|
propertyName: e.propertyName,
|
|
284
323
|
mapping: e.sourceId && e.propertyName ? {
|
|
@@ -290,49 +329,49 @@ function te(e) {
|
|
|
290
329
|
propertyName: e.propertyName ?? "",
|
|
291
330
|
...e.resolve ? { resolve: e.resolve } : {}
|
|
292
331
|
} : void 0,
|
|
293
|
-
source: e.sourceId ?
|
|
294
|
-
target: e.propertyName ?
|
|
332
|
+
source: e.sourceId ? l.get(e.sourceId) : void 0,
|
|
333
|
+
target: e.propertyName ? u.get(e.propertyName) : void 0
|
|
295
334
|
});
|
|
296
|
-
let
|
|
335
|
+
let f = ee(d);
|
|
297
336
|
return {
|
|
298
|
-
rows:
|
|
299
|
-
let t =
|
|
300
|
-
mapping:
|
|
337
|
+
rows: d.map((e) => {
|
|
338
|
+
let t = W(e.source, e.target), r = (e.mapping && e.mapping.propertyName, e.mapping), i = n(e.source), a = r && c(r) ? r : void 0, o = q({
|
|
339
|
+
mapping: a,
|
|
301
340
|
requiredResolve: t,
|
|
302
|
-
conflict:
|
|
303
|
-
sampleValue:
|
|
304
|
-
lookups:
|
|
305
|
-
}),
|
|
341
|
+
conflict: f.has(e.id),
|
|
342
|
+
sampleValue: i,
|
|
343
|
+
lookups: s
|
|
344
|
+
}), l = a ? o : f.has(e.id) ? "conflict" : "empty";
|
|
306
345
|
return {
|
|
307
346
|
id: e.id,
|
|
308
347
|
target: e.target,
|
|
309
|
-
mapping:
|
|
348
|
+
mapping: a,
|
|
310
349
|
source: e.source,
|
|
311
|
-
sampleValue:
|
|
312
|
-
preview:
|
|
350
|
+
sampleValue: i,
|
|
351
|
+
preview: G(e.source, a?.resolve, {
|
|
313
352
|
target: e.target,
|
|
314
|
-
lookups:
|
|
315
|
-
propertyName:
|
|
316
|
-
mapping:
|
|
353
|
+
lookups: s,
|
|
354
|
+
propertyName: a?.propertyName,
|
|
355
|
+
mapping: a
|
|
317
356
|
}),
|
|
318
357
|
requiredResolve: t,
|
|
319
|
-
state:
|
|
358
|
+
state: l
|
|
320
359
|
};
|
|
321
360
|
}),
|
|
322
|
-
conflicts:
|
|
361
|
+
conflicts: f
|
|
323
362
|
};
|
|
324
363
|
}
|
|
325
|
-
function
|
|
364
|
+
function ce(e) {
|
|
326
365
|
return `${e}-${Math.random().toString(36).slice(2, 10)}`;
|
|
327
366
|
}
|
|
328
|
-
function
|
|
367
|
+
function le(e, t) {
|
|
329
368
|
if (e.length === t) return e;
|
|
330
369
|
if (e.length > t) return e.slice(0, t);
|
|
331
370
|
let n = [...e];
|
|
332
|
-
for (; n.length < t;) n.push(
|
|
371
|
+
for (; n.length < t;) n.push(ce("edge"));
|
|
333
372
|
return n;
|
|
334
373
|
}
|
|
335
|
-
function
|
|
374
|
+
function ue(e, t, n, r) {
|
|
336
375
|
if (n === "all") return null;
|
|
337
376
|
let i = new Set(t.map((e) => e.propertyName)), a = new Set(r);
|
|
338
377
|
for (let t of e) (i.has(t.name) || n === "requiredAndMapped" && t.required) && a.add(t.name);
|
|
@@ -340,64 +379,64 @@ function re(e, t, n, r) {
|
|
|
340
379
|
}
|
|
341
380
|
//#endregion
|
|
342
381
|
//#region src/react/LookupEditor.tsx
|
|
343
|
-
function
|
|
344
|
-
let
|
|
345
|
-
return
|
|
346
|
-
value:
|
|
347
|
-
ref:
|
|
348
|
-
}),
|
|
349
|
-
}
|
|
350
|
-
function
|
|
351
|
-
let s = n.find((t) => t.id === e.sourceId), c =
|
|
382
|
+
function de(e, t, n) {
|
|
383
|
+
let r = o(t), i = n.trim(), a = e.filter((e) => o(e.value) !== r);
|
|
384
|
+
return i && a.push({
|
|
385
|
+
value: r,
|
|
386
|
+
ref: i
|
|
387
|
+
}), a;
|
|
388
|
+
}
|
|
389
|
+
function fe({ mapping: e, sources: n, targetsByName: r, onLookupChange: i, compact: a }) {
|
|
390
|
+
let s = n.find((t) => t.id === e.sourceId), c = o(s?.value || s?.label || ""), l = t(e), u = new Set(l.map((e) => o(e.value)).filter(Boolean));
|
|
352
391
|
c && u.add(c);
|
|
353
|
-
let d = [...u], f = r.get(e.propertyName), p = new Map(l.map((e) => [
|
|
354
|
-
return /* @__PURE__ */
|
|
392
|
+
let d = [...u], f = r.get(e.propertyName), p = new Map(l.map((e) => [o(e.value), e.ref]));
|
|
393
|
+
return /* @__PURE__ */ k("div", {
|
|
355
394
|
className: "fm-lookup-block",
|
|
356
395
|
children: [
|
|
357
|
-
!
|
|
358
|
-
/* @__PURE__ */
|
|
396
|
+
!a && /* @__PURE__ */ k("h4", { children: [e.propertyName, f?.ref ? ` → ${f.ref}` : ""] }),
|
|
397
|
+
/* @__PURE__ */ O("div", {
|
|
359
398
|
className: "fm-lookup-hint",
|
|
360
399
|
children: "Map source strings to refs. Host owns Identity search/create."
|
|
361
400
|
}),
|
|
362
|
-
d.length === 0 ? /* @__PURE__ */
|
|
401
|
+
d.length === 0 ? /* @__PURE__ */ O("div", {
|
|
363
402
|
className: "fm-lookup-hint",
|
|
364
403
|
children: "No sample value yet — paste a source string key after connecting."
|
|
365
|
-
}) : d.map((t) => /* @__PURE__ */
|
|
404
|
+
}) : d.map((t) => /* @__PURE__ */ k("div", {
|
|
366
405
|
className: "fm-lookup-row",
|
|
367
|
-
children: [/* @__PURE__ */
|
|
406
|
+
children: [/* @__PURE__ */ O("div", {
|
|
368
407
|
className: "fm-lookup-key",
|
|
369
408
|
title: t,
|
|
370
409
|
children: t || "(empty)"
|
|
371
|
-
}), /* @__PURE__ */
|
|
410
|
+
}), /* @__PURE__ */ O("input", {
|
|
372
411
|
className: "fm-lookup-input",
|
|
373
412
|
type: "text",
|
|
374
413
|
placeholder: "ref",
|
|
375
414
|
value: p.get(t) ?? "",
|
|
376
|
-
onChange: (n) => i(e,
|
|
415
|
+
onChange: (n) => i(e, de(l, t, n.target.value)),
|
|
377
416
|
onClick: (e) => e.stopPropagation()
|
|
378
417
|
})]
|
|
379
418
|
}, t))
|
|
380
419
|
]
|
|
381
420
|
});
|
|
382
421
|
}
|
|
383
|
-
function
|
|
384
|
-
let s =
|
|
422
|
+
function Q({ mode: e, mappings: t, sources: n, targets: r, onLookupChange: i, classNames: a, className: o }) {
|
|
423
|
+
let s = w(() => t.filter((e) => e.resolve === "lookup"), [t]), c = w(() => {
|
|
385
424
|
let e = /* @__PURE__ */ new Map();
|
|
386
425
|
for (let t of r) e.set(t.name, t);
|
|
387
426
|
return e;
|
|
388
427
|
}, [r]);
|
|
389
428
|
if (s.length === 0) return null;
|
|
390
429
|
let l = [
|
|
391
|
-
|
|
430
|
+
P("lookupEditor", a),
|
|
392
431
|
e === "row" ? "fm-lookups--row" : null,
|
|
393
432
|
o
|
|
394
433
|
].filter(Boolean).join(" ");
|
|
395
|
-
return /* @__PURE__ */
|
|
434
|
+
return /* @__PURE__ */ k("div", {
|
|
396
435
|
className: l,
|
|
397
|
-
children: [e === "section" && /* @__PURE__ */
|
|
436
|
+
children: [e === "section" && /* @__PURE__ */ O("div", {
|
|
398
437
|
className: "fm-lookups-title",
|
|
399
438
|
children: "Relation lookups"
|
|
400
|
-
}), s.map((t) => /* @__PURE__ */
|
|
439
|
+
}), s.map((t) => /* @__PURE__ */ O(fe, {
|
|
401
440
|
mapping: t,
|
|
402
441
|
sources: n,
|
|
403
442
|
targetsByName: c,
|
|
@@ -408,21 +447,21 @@ function X({ mode: e, mappings: t, sources: n, targets: r, onLookupChange: i, cl
|
|
|
408
447
|
}
|
|
409
448
|
//#endregion
|
|
410
449
|
//#region src/react/fieldMapperTheme.ts
|
|
411
|
-
var
|
|
412
|
-
function
|
|
450
|
+
var pe = 8, me = "seed-field-mapper-theme";
|
|
451
|
+
function he(e) {
|
|
413
452
|
return e % 8;
|
|
414
453
|
}
|
|
415
|
-
function
|
|
454
|
+
function ge(e, t) {
|
|
416
455
|
if (t && t.length > 0) return t[e % t.length];
|
|
417
|
-
let n =
|
|
456
|
+
let n = he(e) + 1;
|
|
418
457
|
return `var(--fm-map-${n}, var(--map-${n}, currentColor))`;
|
|
419
458
|
}
|
|
420
|
-
function
|
|
459
|
+
function _e(e = "default") {
|
|
421
460
|
return e === "unstyled" ? "none" : e;
|
|
422
461
|
}
|
|
423
|
-
var
|
|
462
|
+
var ve = "\n --sfm-color-ground: #0f172a;\n --sfm-color-ink: #e2e8f0;\n --sfm-color-well: #1e293b;\n --sfm-color-line: #334155;\n --sfm-color-muted: #94a3b8;\n --sfm-color-faint: #64748b;\n --sfm-color-selection: #3b82f6;\n --sfm-color-warning: #fbbf24;\n --sfm-color-danger: #f87171;\n --sfm-color-highlight: #f59e0b;\n --sfm-map-1: #3b82f6;\n --sfm-map-2: #8b5cf6;\n --sfm-map-3: #ec4899;\n --sfm-map-4: #f59e0b;\n --sfm-map-5: #10b981;\n --sfm-map-6: #06b6d4;\n --sfm-map-7: #f97316;\n --sfm-map-8: #14b8a6;\n --fm-ground: var(--sfm-color-ground);\n --fm-ink: var(--sfm-color-ink);\n --fm-well: var(--sfm-color-well);\n --fm-line: var(--sfm-color-line);\n --fm-muted: var(--sfm-color-muted);\n --fm-faint: var(--sfm-color-faint);\n --fm-selection: var(--sfm-color-selection);\n --fm-highlight: var(--sfm-color-highlight);\n --fm-danger: var(--sfm-color-danger);\n --fm-warning: var(--sfm-color-warning);\n --fm-map-1: var(--sfm-map-1);\n --fm-map-2: var(--sfm-map-2);\n --fm-map-3: var(--sfm-map-3);\n --fm-map-4: var(--sfm-map-4);\n --fm-map-5: var(--sfm-map-5);\n --fm-map-6: var(--sfm-map-6);\n --fm-map-7: var(--sfm-map-7);\n --fm-map-8: var(--sfm-map-8);\n", ye = "\n.seed-field-mapper {\n\n --sfm-space-1: 4px;\n --sfm-space-2: 8px;\n --sfm-space-3: 12px;\n --sfm-space-4: 16px;\n --sfm-radius-sm: 4px;\n --sfm-radius-md: 8px;\n --sfm-radius-lg: 12px;\n --sfm-font-family: inherit;\n --sfm-font-mono: ui-monospace, monospace;\n --sfm-font-size-sm: 11px;\n --sfm-font-size-md: 13px;\n --sfm-control-height: 32px;\n --sfm-row-gap: var(--sfm-space-2);\n\n font-family: var(--sfm-font-family);\n border-radius: var(--sfm-radius-lg);\n padding: var(--sfm-space-4);\n}\n.seed-field-mapper * { box-sizing: border-box; }\n.seed-field-mapper .fm-toolbar {\n display: flex;\n gap: var(--sfm-space-2);\n align-items: center;\n margin-bottom: var(--sfm-space-3);\n flex-wrap: wrap;\n}\n.seed-field-mapper .fm-btn {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 6px var(--sfm-space-3);\n cursor: pointer;\n font-size: var(--sfm-font-size-md);\n min-height: var(--sfm-control-height);\n}\n.seed-field-mapper .fm-meta {\n font-size: 12px;\n margin-left: auto;\n}\n.seed-field-mapper .fm-banner {\n font-size: 12px;\n padding: var(--sfm-space-2) 10px;\n border-radius: var(--sfm-radius-md);\n margin-bottom: 10px;\n border: 1px solid;\n}\n.seed-field-mapper .fm-grid {\n position: relative;\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 48px;\n min-height: 240px;\n}\n.seed-field-mapper .fm-col-title {\n font-size: var(--sfm-font-size-sm);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-card {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n margin-bottom: var(--sfm-space-2);\n cursor: pointer;\n transition: border-color 0.15s, box-shadow 0.15s;\n}\n.seed-field-mapper .fm-label {\n font-weight: 600;\n font-size: var(--sfm-font-size-md);\n margin-bottom: var(--sfm-space-1);\n}\n.seed-field-mapper .fm-value {\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.seed-field-mapper .fm-kind {\n font-size: 10px;\n margin-left: 6px;\n}\n.seed-field-mapper .fm-prop-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-dtype {\n font-size: 10px;\n padding: 2px 6px;\n border-radius: var(--sfm-radius-sm);\n border: 1px solid;\n}\n.seed-field-mapper .fm-remove {\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 14px;\n padding: 0 var(--sfm-space-1);\n}\n.seed-field-mapper .fm-svg {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: visible;\n}\n.seed-field-mapper .fm-preview {\n margin-top: var(--sfm-space-3);\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: var(--sfm-space-3);\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: pre-wrap;\n max-height: 200px;\n overflow: auto;\n}\n.seed-field-mapper details.fm-preview {\n font-family: var(--sfm-font-family);\n white-space: normal;\n max-height: none;\n overflow: visible;\n padding: var(--sfm-space-2) var(--sfm-space-3);\n}\n.seed-field-mapper details.fm-preview > summary {\n cursor: pointer;\n font-size: var(--sfm-font-size-sm);\n list-style: disclosure-closed;\n}\n.seed-field-mapper details.fm-preview[open] > summary {\n list-style: disclosure-open;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-preview-body {\n margin: 0;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: pre-wrap;\n max-height: 200px;\n overflow: auto;\n}\n.seed-field-mapper .fm-lookups {\n margin-top: var(--sfm-space-4);\n border-top: 1px solid;\n padding-top: var(--sfm-space-3);\n}\n.seed-field-mapper .fm-row .fm-lookups,\n.seed-field-mapper .fm-lookups--row {\n margin-top: var(--sfm-space-2);\n border-top: none;\n padding-top: 0;\n}\n.seed-field-mapper .fm-row .fm-lookup-block {\n margin-bottom: 0;\n padding: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookups-title {\n font-size: var(--sfm-font-size-sm);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-block {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-block h4 {\n margin: 0 0 var(--sfm-space-2);\n font-size: var(--sfm-font-size-md);\n font-weight: 600;\n}\n.seed-field-mapper .fm-lookup-hint {\n font-size: var(--sfm-font-size-sm);\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-row {\n display: grid;\n grid-template-columns: 1fr 1.4fr;\n gap: var(--sfm-space-2);\n align-items: center;\n margin-bottom: 6px;\n}\n.seed-field-mapper .fm-lookup-key {\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.seed-field-mapper .fm-lookup-input {\n width: 100%;\n border: 1px solid;\n border-radius: 6px;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n padding: 6px var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-input:focus {\n outline: none;\n}\n.seed-field-mapper .fm-row-list {\n display: flex;\n flex-direction: column;\n gap: var(--sfm-row-gap);\n}\n.seed-field-mapper .fm-row {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n}\n.seed-field-mapper .fm-row-main {\n display: grid;\n grid-template-columns: minmax(100px, 140px) 1fr auto auto auto;\n gap: var(--sfm-space-2);\n align-items: center;\n}\n.seed-field-mapper .fm-row-main-source {\n grid-template-columns: 1fr auto auto 1fr auto auto;\n}\n.seed-field-mapper .fm-row-accessory {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n.seed-field-mapper .fm-row-accessory:empty {\n display: none;\n}\n.seed-field-mapper .fm-row-prop {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n}\n.seed-field-mapper .fm-row-prop-name {\n font-weight: 600;\n font-size: var(--sfm-font-size-md);\n}\n.seed-field-mapper .fm-row-preview {\n margin-top: 6px;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n}\n.seed-field-mapper .fm-row-expansion {\n margin-top: 8px;\n}\n.seed-field-mapper .fm-row-expansion:empty {\n display: none;\n}\n.seed-field-mapper .fm-row-flag {\n font-size: var(--sfm-font-size-sm);\n margin-top: var(--sfm-space-1);\n}\n.seed-field-mapper .fm-select {\n width: 100%;\n border: 1px solid;\n border-radius: 6px;\n font-size: 12px;\n padding: 6px var(--sfm-space-2);\n min-width: 0;\n min-height: var(--sfm-control-height);\n}\n.seed-field-mapper .fm-select:focus {\n outline: none;\n}\n.seed-field-mapper .fm-filter {\n display: flex;\n gap: 6px;\n margin-bottom: 10px;\n flex-wrap: wrap;\n}\n.seed-field-mapper .fm-inspector {\n margin-top: var(--sfm-space-3);\n border-top: 1px solid;\n padding-top: 10px;\n}\n.seed-field-mapper .fm-inspector summary {\n cursor: pointer;\n font-size: 12px;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-inspector-row {\n display: grid;\n grid-template-columns: 1fr 1.5fr auto;\n gap: var(--sfm-space-2);\n align-items: center;\n padding: 6px 0;\n border-bottom: 1px solid;\n font-size: 12px;\n}\n.seed-field-mapper .fm-into {\n font-size: var(--sfm-font-size-sm);\n}\n", be = `
|
|
424
463
|
.seed-field-mapper {
|
|
425
|
-
${
|
|
464
|
+
${ve}
|
|
426
465
|
color: var(--sfm-color-ink);
|
|
427
466
|
background: var(--sfm-color-ground);
|
|
428
467
|
}
|
|
@@ -557,66 +596,69 @@ ${le}
|
|
|
557
596
|
color: var(--sfm-color-faint);
|
|
558
597
|
}
|
|
559
598
|
`;
|
|
560
|
-
function
|
|
599
|
+
function xe(e) {
|
|
561
600
|
return `@layer seed-field-mapper {\n${e}\n}`;
|
|
562
601
|
}
|
|
563
|
-
function
|
|
564
|
-
return e === "none" ? "" :
|
|
602
|
+
function Se(e) {
|
|
603
|
+
return e === "none" ? "" : xe(e === "structural" ? ye : `${ye}\n${be}`);
|
|
565
604
|
}
|
|
566
|
-
var
|
|
567
|
-
function
|
|
605
|
+
var Ce = Se("default"), we = null;
|
|
606
|
+
function Te(e) {
|
|
568
607
|
if (typeof document > "u" || e === "none") return;
|
|
569
|
-
let t =
|
|
608
|
+
let t = Se(e), n = document.getElementById(me);
|
|
570
609
|
if (n) {
|
|
571
|
-
|
|
610
|
+
we !== e && (n.textContent = t, we = e);
|
|
572
611
|
return;
|
|
573
612
|
}
|
|
574
613
|
let r = document.createElement("style");
|
|
575
|
-
r.id =
|
|
614
|
+
r.id = me, r.textContent = t, document.head.appendChild(r), we = e;
|
|
576
615
|
}
|
|
577
|
-
function
|
|
578
|
-
if (
|
|
579
|
-
let e = document.getElementById(
|
|
616
|
+
function Ee() {
|
|
617
|
+
if (we = null, typeof document > "u") return;
|
|
618
|
+
let e = document.getElementById(me);
|
|
580
619
|
e && (typeof e.remove == "function" ? e.remove() : e.parentNode && e.parentNode.removeChild(e));
|
|
581
620
|
}
|
|
582
621
|
//#endregion
|
|
583
622
|
//#region src/react/FieldMapperWires.tsx
|
|
584
623
|
function $(e, t) {
|
|
624
|
+
if (!e.sourceId) return "";
|
|
585
625
|
if (!e.resolve) return e.sourceId;
|
|
586
|
-
let n =
|
|
626
|
+
let n = x(e.sourceId, e.resolve);
|
|
587
627
|
return t.some((e) => e.id === n) ? n : e.sourceId;
|
|
588
628
|
}
|
|
589
|
-
function
|
|
629
|
+
function De(e, t) {
|
|
590
630
|
let n = e.replace(/\s+/g, " ").trim();
|
|
591
631
|
return n.length <= t ? n : `${n.slice(0, t)}…`;
|
|
592
632
|
}
|
|
593
|
-
function
|
|
594
|
-
Select:
|
|
595
|
-
Button:
|
|
596
|
-
Pill:
|
|
633
|
+
function Oe({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i, renderLookup: a, connectionColors: o, slots: c, classNames: l, ui: u = {
|
|
634
|
+
Select: A,
|
|
635
|
+
Button: j,
|
|
636
|
+
Pill: M
|
|
597
637
|
} }) {
|
|
598
|
-
let d = u.Button, [f, p] =
|
|
638
|
+
let d = u.Button, [f, p] = E(null), [m, h] = E(null), [g, _] = E(null), [v, y] = E(!1), [b, x] = E({
|
|
599
639
|
width: 0,
|
|
600
640
|
height: 0
|
|
601
|
-
}), [
|
|
641
|
+
}), [N, F] = E([]), I = T(null), R = T({}), z = T({}), B = w(() => {
|
|
602
642
|
let e = /* @__PURE__ */ new Map();
|
|
603
643
|
return n.forEach((t, n) => {
|
|
604
644
|
e.set(t.propertyName, n);
|
|
605
645
|
}), e;
|
|
606
|
-
}, [n]),
|
|
646
|
+
}, [n]), V = w(() => {
|
|
607
647
|
let t = /* @__PURE__ */ new Map();
|
|
608
648
|
return n.forEach((n, r) => {
|
|
649
|
+
if (!n.sourceId) return;
|
|
609
650
|
let i = $(n, e);
|
|
610
651
|
for (let e of /* @__PURE__ */ new Set([n.sourceId, i])) {
|
|
611
652
|
let n = t.get(e) ?? [];
|
|
612
653
|
n.push(r), t.set(e, n);
|
|
613
654
|
}
|
|
614
655
|
}), t;
|
|
615
|
-
}, [n, e]),
|
|
616
|
-
if (!
|
|
617
|
-
let t =
|
|
656
|
+
}, [n, e]), H = S(() => {
|
|
657
|
+
if (!I.current) return [];
|
|
658
|
+
let t = I.current.getBoundingClientRect();
|
|
618
659
|
return n.map((n, r) => {
|
|
619
|
-
|
|
660
|
+
if (!n.sourceId) return null;
|
|
661
|
+
let i = $(n, e), a = R.current[i] ?? R.current[n.sourceId], s = z.current[n.propertyName];
|
|
620
662
|
if (!a || !s) return null;
|
|
621
663
|
let c = a.getBoundingClientRect(), l = s.getBoundingClientRect();
|
|
622
664
|
return {
|
|
@@ -624,7 +666,7 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
624
666
|
y1: c.top + c.height / 2 - t.top,
|
|
625
667
|
x2: l.left - t.left,
|
|
626
668
|
y2: l.top + l.height / 2 - t.top,
|
|
627
|
-
stroke:
|
|
669
|
+
stroke: ge(r, o),
|
|
628
670
|
mappingIndex: r,
|
|
629
671
|
mapping: n
|
|
630
672
|
};
|
|
@@ -634,16 +676,16 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
634
676
|
o,
|
|
635
677
|
e
|
|
636
678
|
]);
|
|
637
|
-
|
|
679
|
+
C(() => {
|
|
638
680
|
let e = () => {
|
|
639
|
-
if (
|
|
640
|
-
let e =
|
|
641
|
-
|
|
681
|
+
if (I.current) {
|
|
682
|
+
let e = I.current.getBoundingClientRect();
|
|
683
|
+
x({
|
|
642
684
|
width: e.width,
|
|
643
685
|
height: e.height
|
|
644
686
|
});
|
|
645
687
|
}
|
|
646
|
-
|
|
688
|
+
F(H());
|
|
647
689
|
};
|
|
648
690
|
e(), window.addEventListener("resize", e);
|
|
649
691
|
let t = setInterval(e, 200);
|
|
@@ -651,80 +693,80 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
651
693
|
window.removeEventListener("resize", e), clearInterval(t);
|
|
652
694
|
};
|
|
653
695
|
}, [
|
|
654
|
-
|
|
696
|
+
H,
|
|
655
697
|
n,
|
|
656
698
|
e,
|
|
657
699
|
t
|
|
658
700
|
]);
|
|
659
|
-
let
|
|
701
|
+
let U = (e) => {
|
|
660
702
|
p((t) => t === e ? null : e);
|
|
661
|
-
},
|
|
703
|
+
}, W = (e) => {
|
|
662
704
|
f && r.connect(f, e);
|
|
663
|
-
},
|
|
705
|
+
}, G = (e) => {
|
|
664
706
|
let t = s(e);
|
|
665
707
|
return t ? n.some((e) => e.sourceId === t.originId && e.resolve === t.resolve) : n.some((t) => t.sourceId === e);
|
|
666
|
-
}, q = (e) => n.find((t) => t.propertyName === e),
|
|
708
|
+
}, q = (e) => n.find((t) => t.propertyName === e), J = (t) => {
|
|
667
709
|
if (m) return t.propertyName === m;
|
|
668
|
-
if (
|
|
710
|
+
if (g) {
|
|
669
711
|
let n = $(t, e);
|
|
670
|
-
return t.sourceId ===
|
|
712
|
+
return t.sourceId === g || n === g;
|
|
671
713
|
}
|
|
672
714
|
return !1;
|
|
673
|
-
},
|
|
715
|
+
}, ee = m != null || g != null, Y = w(() => K(e, n, t), [
|
|
674
716
|
e,
|
|
675
717
|
n,
|
|
676
718
|
t
|
|
677
|
-
]), { coverage:
|
|
678
|
-
return /* @__PURE__ */
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
className:
|
|
681
|
-
children: [c.autoMap && /* @__PURE__ */
|
|
682
|
-
className:
|
|
719
|
+
]), { coverage: X } = r, te = L(c.preview);
|
|
720
|
+
return /* @__PURE__ */ k(D, { children: [
|
|
721
|
+
/* @__PURE__ */ k("div", {
|
|
722
|
+
className: P("toolbar", l),
|
|
723
|
+
children: [c.autoMap && /* @__PURE__ */ O(d, {
|
|
724
|
+
className: P("autoMapButton", l),
|
|
683
725
|
onClick: () => r.autoMap(),
|
|
684
726
|
children: "Auto-map"
|
|
685
|
-
}), /* @__PURE__ */
|
|
686
|
-
className:
|
|
727
|
+
}), /* @__PURE__ */ k("span", {
|
|
728
|
+
className: P("coverage", l),
|
|
687
729
|
children: [
|
|
688
|
-
|
|
730
|
+
X.mapped,
|
|
689
731
|
" / ",
|
|
690
|
-
|
|
732
|
+
X.total,
|
|
691
733
|
" mapped",
|
|
692
|
-
|
|
734
|
+
X.missingRequired.length > 0 ? ` · ${X.missingRequired.length} required missing` : "",
|
|
693
735
|
f ? " · click properties (source stays selected)" : " · click a source"
|
|
694
736
|
]
|
|
695
737
|
})]
|
|
696
738
|
}),
|
|
697
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ k("div", {
|
|
698
740
|
className: "fm-grid",
|
|
699
|
-
ref:
|
|
741
|
+
ref: I,
|
|
700
742
|
children: [
|
|
701
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ O("svg", {
|
|
702
744
|
className: "fm-svg",
|
|
703
|
-
width:
|
|
704
|
-
height:
|
|
705
|
-
children:
|
|
706
|
-
let t =
|
|
707
|
-
return /* @__PURE__ */
|
|
745
|
+
width: b.width,
|
|
746
|
+
height: b.height,
|
|
747
|
+
children: N.map((e) => {
|
|
748
|
+
let t = J(e.mapping), n = (e.x1 + e.x2) / 2;
|
|
749
|
+
return /* @__PURE__ */ O("path", {
|
|
708
750
|
className: "fm-connector",
|
|
709
751
|
"data-mapping-index": e.mappingIndex,
|
|
710
|
-
"data-pair":
|
|
752
|
+
"data-pair": he(e.mappingIndex),
|
|
711
753
|
d: `M ${e.x1} ${e.y1} C ${n} ${e.y1}, ${n} ${e.y2}, ${e.x2} ${e.y2}`,
|
|
712
754
|
stroke: e.stroke,
|
|
713
755
|
strokeWidth: t ? 3 : 2,
|
|
714
756
|
fill: "none",
|
|
715
|
-
opacity:
|
|
757
|
+
opacity: ee && !t ? .25 : .85
|
|
716
758
|
}, `${e.mapping.sourceId}-${e.mapping.propertyName}-${e.mapping.resolve ?? "copy"}`);
|
|
717
759
|
})
|
|
718
760
|
}),
|
|
719
|
-
/* @__PURE__ */
|
|
761
|
+
/* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
|
|
720
762
|
className: "fm-col-title",
|
|
721
763
|
children: "Sources"
|
|
722
764
|
}), e.map((t) => {
|
|
723
|
-
let i =
|
|
765
|
+
let i = G(t.id), a = f === t.id, o = V.get(t.id) ?? [], s = o[0], c = g === t.id || m != null && n.some((n) => {
|
|
724
766
|
let r = $(n, e);
|
|
725
767
|
return (n.sourceId === t.id || r === t.id) && n.propertyName === m;
|
|
726
768
|
});
|
|
727
|
-
return /* @__PURE__ */
|
|
769
|
+
return /* @__PURE__ */ k("div", {
|
|
728
770
|
ref: (e) => {
|
|
729
771
|
R.current[t.id] = e;
|
|
730
772
|
},
|
|
@@ -732,74 +774,74 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
732
774
|
"data-source-id": t.id,
|
|
733
775
|
...o.length > 0 ? {
|
|
734
776
|
"data-mapping-index": o.join(" "),
|
|
735
|
-
"data-pair": String(
|
|
777
|
+
"data-pair": String(he(s))
|
|
736
778
|
} : {},
|
|
737
|
-
onClick: () =>
|
|
738
|
-
onMouseEnter: () =>
|
|
739
|
-
onMouseLeave: () =>
|
|
740
|
-
children: [/* @__PURE__ */
|
|
779
|
+
onClick: () => U(t.id),
|
|
780
|
+
onMouseEnter: () => _(t.id),
|
|
781
|
+
onMouseLeave: () => _(null),
|
|
782
|
+
children: [/* @__PURE__ */ k("div", {
|
|
741
783
|
className: "fm-prop-row",
|
|
742
|
-
children: [/* @__PURE__ */
|
|
784
|
+
children: [/* @__PURE__ */ k("div", {
|
|
743
785
|
className: "fm-label",
|
|
744
786
|
children: [
|
|
745
787
|
t.label,
|
|
746
|
-
t.subtitle ? /* @__PURE__ */
|
|
788
|
+
t.subtitle ? /* @__PURE__ */ O("span", {
|
|
747
789
|
className: "fm-kind",
|
|
748
790
|
children: t.subtitle
|
|
749
791
|
}) : null,
|
|
750
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ O("span", {
|
|
751
793
|
className: "fm-kind",
|
|
752
794
|
children: t.kind
|
|
753
795
|
})
|
|
754
796
|
]
|
|
755
|
-
}), i && /* @__PURE__ */
|
|
756
|
-
className:
|
|
797
|
+
}), i && /* @__PURE__ */ O(d, {
|
|
798
|
+
className: P("removeButton", l),
|
|
757
799
|
"aria-label": "Remove all mappings for source",
|
|
758
800
|
onClick: (e) => {
|
|
759
801
|
e.stopPropagation(), r.removeBySource(t.id);
|
|
760
802
|
},
|
|
761
803
|
children: "×"
|
|
762
804
|
})]
|
|
763
|
-
}), /* @__PURE__ */
|
|
805
|
+
}), /* @__PURE__ */ O("div", {
|
|
764
806
|
className: "fm-value",
|
|
765
|
-
children:
|
|
807
|
+
children: De(t.value, 80)
|
|
766
808
|
})]
|
|
767
809
|
}, t.id);
|
|
768
810
|
})] }),
|
|
769
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
|
|
770
812
|
className: "fm-col-title",
|
|
771
813
|
children: "Model properties"
|
|
772
814
|
}), t.map((t) => {
|
|
773
|
-
let n = q(t.name), i =
|
|
774
|
-
return /* @__PURE__ */
|
|
815
|
+
let n = q(t.name), i = B.get(t.name), a = m === t.name || g != null && n != null && (n.sourceId === g || $(n, e) === g);
|
|
816
|
+
return /* @__PURE__ */ k("div", {
|
|
775
817
|
ref: (e) => {
|
|
776
|
-
|
|
818
|
+
z.current[t.name] = e;
|
|
777
819
|
},
|
|
778
820
|
className: `fm-card${n ? " mapped" : ""}${a ? " highlight" : ""}`,
|
|
779
821
|
"data-property-name": t.name,
|
|
780
822
|
...i == null ? {} : {
|
|
781
823
|
"data-mapping-index": String(i),
|
|
782
|
-
"data-pair": String(
|
|
824
|
+
"data-pair": String(he(i))
|
|
783
825
|
},
|
|
784
|
-
onClick: () =>
|
|
785
|
-
onMouseEnter: () =>
|
|
786
|
-
onMouseLeave: () =>
|
|
787
|
-
children: [/* @__PURE__ */
|
|
826
|
+
onClick: () => W(t.name),
|
|
827
|
+
onMouseEnter: () => h(t.name),
|
|
828
|
+
onMouseLeave: () => h(null),
|
|
829
|
+
children: [/* @__PURE__ */ k("div", {
|
|
788
830
|
className: "fm-prop-row",
|
|
789
|
-
children: [/* @__PURE__ */
|
|
831
|
+
children: [/* @__PURE__ */ O("div", {
|
|
790
832
|
className: "fm-label",
|
|
791
833
|
children: t.name
|
|
792
|
-
}), /* @__PURE__ */
|
|
834
|
+
}), /* @__PURE__ */ k("div", {
|
|
793
835
|
style: {
|
|
794
836
|
display: "flex",
|
|
795
837
|
alignItems: "center",
|
|
796
838
|
gap: 4
|
|
797
839
|
},
|
|
798
|
-
children: [/* @__PURE__ */
|
|
840
|
+
children: [/* @__PURE__ */ k("span", {
|
|
799
841
|
className: "fm-dtype",
|
|
800
842
|
children: [t.dataType, t.ref ? ` → ${t.ref}` : ""]
|
|
801
|
-
}), n && /* @__PURE__ */
|
|
802
|
-
className:
|
|
843
|
+
}), n && /* @__PURE__ */ O(d, {
|
|
844
|
+
className: P("removeButton", l),
|
|
803
845
|
"aria-label": "Remove mapping for property",
|
|
804
846
|
onClick: (e) => {
|
|
805
847
|
e.stopPropagation(), r.removeRow(t.name);
|
|
@@ -807,7 +849,7 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
807
849
|
children: "×"
|
|
808
850
|
})]
|
|
809
851
|
})]
|
|
810
|
-
}), n && /* @__PURE__ */
|
|
852
|
+
}), n && /* @__PURE__ */ k("div", {
|
|
811
853
|
className: "fm-value",
|
|
812
854
|
children: [
|
|
813
855
|
"← ",
|
|
@@ -819,15 +861,15 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
819
861
|
})] })
|
|
820
862
|
]
|
|
821
863
|
}),
|
|
822
|
-
c.lookups === "section" && a && r.rows.filter((e) => e.mapping?.resolve === "lookup").map((e) => /* @__PURE__ */
|
|
823
|
-
className:
|
|
864
|
+
c.lookups === "section" && a && r.rows.filter((e) => e.mapping?.resolve === "lookup").map((e) => /* @__PURE__ */ O("div", {
|
|
865
|
+
className: P("lookupEditor", l),
|
|
824
866
|
children: a({
|
|
825
867
|
...e,
|
|
826
868
|
sampleValue: e.sampleValue ?? "",
|
|
827
869
|
onLookupChange: (t) => r.setLookupEntries(e.id, t)
|
|
828
870
|
})
|
|
829
871
|
}, e.id)),
|
|
830
|
-
c.lookups === "section" && !a && i && /* @__PURE__ */
|
|
872
|
+
c.lookups === "section" && !a && i && /* @__PURE__ */ O(Q, {
|
|
831
873
|
mode: "section",
|
|
832
874
|
mappings: n,
|
|
833
875
|
sources: e,
|
|
@@ -838,96 +880,126 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
838
880
|
},
|
|
839
881
|
classNames: l
|
|
840
882
|
}),
|
|
841
|
-
|
|
842
|
-
className:
|
|
843
|
-
open:
|
|
844
|
-
onToggle: (e) =>
|
|
845
|
-
children: [/* @__PURE__ */
|
|
883
|
+
te && /* @__PURE__ */ k("details", {
|
|
884
|
+
className: P("jsonPreview", l),
|
|
885
|
+
open: v,
|
|
886
|
+
onToggle: (e) => y(e.target.open),
|
|
887
|
+
children: [/* @__PURE__ */ O("summary", { children: "Preview JSON" }), /* @__PURE__ */ O("pre", {
|
|
846
888
|
className: "fm-preview-body",
|
|
847
|
-
children: JSON.stringify(
|
|
889
|
+
children: JSON.stringify(Y, null, 2)
|
|
848
890
|
})]
|
|
849
891
|
})
|
|
850
892
|
] });
|
|
851
893
|
}
|
|
852
894
|
//#endregion
|
|
895
|
+
//#region src/react/fieldMapperTransforms.ts
|
|
896
|
+
function ke(e) {
|
|
897
|
+
let t = [
|
|
898
|
+
{
|
|
899
|
+
value: "",
|
|
900
|
+
label: "copy"
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
value: "extract",
|
|
904
|
+
label: "extract"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
value: "file",
|
|
908
|
+
label: "file"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
value: "lookup",
|
|
912
|
+
label: "lookup"
|
|
913
|
+
}
|
|
914
|
+
];
|
|
915
|
+
e.target?.dataType === "Html" && t.push({
|
|
916
|
+
value: "assemble",
|
|
917
|
+
label: "assemble"
|
|
918
|
+
});
|
|
919
|
+
let n = e.mapping?.resolve;
|
|
920
|
+
return n && !t.some((e) => e.value === n) && t.push({
|
|
921
|
+
value: n,
|
|
922
|
+
label: n
|
|
923
|
+
}), t;
|
|
924
|
+
}
|
|
925
|
+
function Ae(e, t) {
|
|
926
|
+
let n = ke(e);
|
|
927
|
+
return t ? t(e, n) : n;
|
|
928
|
+
}
|
|
929
|
+
function je(e, t) {
|
|
930
|
+
return e.mapping?.sourceId || e.mapping?.resolve === "derive" ? !0 : t.some((e) => e.value === "derive");
|
|
931
|
+
}
|
|
932
|
+
function Me(e) {
|
|
933
|
+
return !e.mapping?.sourceId && e.mapping?.resolve === "derive";
|
|
934
|
+
}
|
|
935
|
+
//#endregion
|
|
853
936
|
//#region src/react/PropertyRows.tsx
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
value: "extract",
|
|
861
|
-
label: "extract"
|
|
862
|
-
},
|
|
863
|
-
{
|
|
864
|
-
value: "file",
|
|
865
|
-
label: "file"
|
|
866
|
-
},
|
|
867
|
-
{
|
|
868
|
-
value: "lookup",
|
|
869
|
-
label: "lookup"
|
|
870
|
-
}
|
|
871
|
-
];
|
|
872
|
-
function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "requiredAndMapped", onLookupsChange: a, slots: o, classNames: s, ui: c = {
|
|
873
|
-
Select: C,
|
|
874
|
-
Button: w,
|
|
875
|
-
Pill: T
|
|
876
|
-
}, renderRowAccessory: l, renderLookup: u }) {
|
|
877
|
-
let d = c.Select, f = c.Button, p = c.Pill, [m, h] = y(i), [g, v] = y(() => /* @__PURE__ */ new Set()), [E, O] = y(!1), [M, P] = y(!1), [F, I] = y(null), [L, R] = y(!1), B = _(() => re(t, n, m, g), [
|
|
937
|
+
function Ne({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "requiredAndMapped", onLookupsChange: a, slots: o, classNames: s, ui: c = {
|
|
938
|
+
Select: A,
|
|
939
|
+
Button: j,
|
|
940
|
+
Pill: M
|
|
941
|
+
}, renderRowAccessory: l, renderLookup: u, renderRowExpansion: d, transformOptions: f }) {
|
|
942
|
+
let p = c.Select, m = c.Button, h = c.Pill, [g, _] = E(i), [v, y] = E(() => /* @__PURE__ */ new Set()), [b, x] = E(!1), [S, C] = E(!1), [T, N] = E(null), [F, z] = E(!1), V = w(() => ue(t, n, g, v), [
|
|
878
943
|
t,
|
|
879
944
|
n,
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
]),
|
|
945
|
+
g,
|
|
946
|
+
v
|
|
947
|
+
]), H = w(() => V == null ? r.rows : r.rows.filter((e) => V.has(e.id)), [r.rows, V]), U = w(() => {
|
|
883
948
|
let e = /* @__PURE__ */ new Map();
|
|
884
949
|
for (let t of n) {
|
|
950
|
+
if (!t.sourceId) continue;
|
|
885
951
|
let n = e.get(t.sourceId) ?? [];
|
|
886
952
|
n.push(t.propertyName), e.set(t.sourceId, n);
|
|
887
953
|
}
|
|
888
954
|
return e;
|
|
889
|
-
}, [n]),
|
|
955
|
+
}, [n]), W = w(() => K(e, n, t), [
|
|
890
956
|
e,
|
|
891
957
|
n,
|
|
892
958
|
t
|
|
893
|
-
]), { coverage:
|
|
894
|
-
r.addRow(e),
|
|
895
|
-
},
|
|
896
|
-
|
|
959
|
+
]), { coverage: G, sourceOptions: q, addableProperties: J } = r, ee = L(o.preview), Y = I(o.preview), X = o.lookups === "row" && (!!u || !!a), te = o.lookups === "section" && !u && !!a, ne = (e) => {
|
|
960
|
+
r.addRow(e), y((t) => new Set(t).add(e)), C(!1);
|
|
961
|
+
}, Z = (e) => {
|
|
962
|
+
r.removeRow(e), y((t) => {
|
|
963
|
+
if (!t.has(e)) return t;
|
|
964
|
+
let n = new Set(t);
|
|
965
|
+
return n.delete(e), n;
|
|
966
|
+
});
|
|
967
|
+
}, re = (e) => {
|
|
968
|
+
N(e), C(!0);
|
|
897
969
|
}, ie = (e) => {
|
|
898
|
-
|
|
970
|
+
ne(e), T && (r.setSource(e, T), N(null));
|
|
899
971
|
};
|
|
900
|
-
return /* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
className:
|
|
903
|
-
children: [o.autoMap && /* @__PURE__ */
|
|
904
|
-
className:
|
|
972
|
+
return /* @__PURE__ */ k(D, { children: [
|
|
973
|
+
/* @__PURE__ */ k("div", {
|
|
974
|
+
className: P("toolbar", s),
|
|
975
|
+
children: [o.autoMap && /* @__PURE__ */ O(m, {
|
|
976
|
+
className: P("autoMapButton", s),
|
|
905
977
|
onClick: () => r.autoMap(),
|
|
906
978
|
children: "Auto-map"
|
|
907
|
-
}), /* @__PURE__ */
|
|
908
|
-
className:
|
|
979
|
+
}), /* @__PURE__ */ k("span", {
|
|
980
|
+
className: P("coverage", s),
|
|
909
981
|
children: [
|
|
910
|
-
|
|
982
|
+
G.mapped,
|
|
911
983
|
" of ",
|
|
912
|
-
|
|
984
|
+
G.total,
|
|
913
985
|
" properties mapped",
|
|
914
|
-
|
|
986
|
+
G.missingRequired.length > 0 ? ` · ${G.missingRequired.length} required missing` : ""
|
|
915
987
|
]
|
|
916
988
|
})]
|
|
917
989
|
}),
|
|
918
|
-
o.filter && /* @__PURE__ */
|
|
919
|
-
className:
|
|
990
|
+
o.filter && /* @__PURE__ */ k("div", {
|
|
991
|
+
className: P("filter", s),
|
|
920
992
|
role: "group",
|
|
921
993
|
"aria-label": "Row filter",
|
|
922
|
-
children: [/* @__PURE__ */
|
|
994
|
+
children: [/* @__PURE__ */ O(m, {
|
|
923
995
|
className: "fm-btn",
|
|
924
|
-
"aria-pressed":
|
|
925
|
-
onClick: () =>
|
|
996
|
+
"aria-pressed": g === "requiredAndMapped",
|
|
997
|
+
onClick: () => _("requiredAndMapped"),
|
|
926
998
|
children: "Mapped + required"
|
|
927
|
-
}), /* @__PURE__ */
|
|
999
|
+
}), /* @__PURE__ */ k(m, {
|
|
928
1000
|
className: "fm-btn",
|
|
929
|
-
"aria-pressed":
|
|
930
|
-
onClick: () =>
|
|
1001
|
+
"aria-pressed": g === "all",
|
|
1002
|
+
onClick: () => _("all"),
|
|
931
1003
|
children: [
|
|
932
1004
|
"All ",
|
|
933
1005
|
t.length,
|
|
@@ -935,117 +1007,123 @@ function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "
|
|
|
935
1007
|
]
|
|
936
1008
|
})]
|
|
937
1009
|
}),
|
|
938
|
-
/* @__PURE__ */
|
|
939
|
-
className:
|
|
940
|
-
children:
|
|
941
|
-
let i = n.mapping?.resolve ?? "";
|
|
942
|
-
return /* @__PURE__ */
|
|
943
|
-
className:
|
|
1010
|
+
/* @__PURE__ */ O("div", {
|
|
1011
|
+
className: P("rowList", s),
|
|
1012
|
+
children: H.map((n) => {
|
|
1013
|
+
let i = n.mapping?.resolve ?? "", a = Ae(n, f), o = je(n, a);
|
|
1014
|
+
return /* @__PURE__ */ k("div", {
|
|
1015
|
+
className: P("row", s),
|
|
944
1016
|
"data-state": n.state,
|
|
945
1017
|
"data-property-name": n.id,
|
|
946
1018
|
"data-required": n.target?.required ? "true" : void 0,
|
|
947
1019
|
"data-resolve": n.mapping?.resolve,
|
|
948
1020
|
"data-source-kind": n.source?.kind,
|
|
949
1021
|
children: [
|
|
950
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ k("div", {
|
|
951
1023
|
className: "fm-row-main",
|
|
952
1024
|
children: [
|
|
953
|
-
/* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ k("div", {
|
|
954
1026
|
className: "fm-row-prop",
|
|
955
|
-
children: [/* @__PURE__ */
|
|
956
|
-
className:
|
|
1027
|
+
children: [/* @__PURE__ */ k("div", {
|
|
1028
|
+
className: P("propertyLabel", s),
|
|
957
1029
|
children: [n.target?.name, n.target?.required ? " *" : ""]
|
|
958
|
-
}), /* @__PURE__ */
|
|
959
|
-
className:
|
|
1030
|
+
}), /* @__PURE__ */ O(h, {
|
|
1031
|
+
className: P("dataType", s),
|
|
960
1032
|
children: n.target?.dataType
|
|
961
1033
|
})]
|
|
962
1034
|
}),
|
|
963
|
-
/* @__PURE__ */
|
|
964
|
-
className:
|
|
1035
|
+
/* @__PURE__ */ k(p, {
|
|
1036
|
+
className: P("sourceSelect", s),
|
|
965
1037
|
"aria-label": `Source for ${n.id}`,
|
|
966
1038
|
value: n.mapping?.sourceId ?? "",
|
|
967
1039
|
onChange: (e) => {
|
|
968
1040
|
r.setSource(n.id, e || null);
|
|
969
1041
|
},
|
|
970
|
-
children: [/* @__PURE__ */
|
|
1042
|
+
children: [/* @__PURE__ */ O("option", {
|
|
971
1043
|
value: "",
|
|
972
1044
|
children: "Choose a source field…"
|
|
973
|
-
}),
|
|
1045
|
+
}), q.map((e) => /* @__PURE__ */ O("option", {
|
|
974
1046
|
value: e.value,
|
|
975
1047
|
children: e.label
|
|
976
1048
|
}, e.value))]
|
|
977
1049
|
}),
|
|
978
|
-
|
|
979
|
-
className:
|
|
1050
|
+
o ? /* @__PURE__ */ O(p, {
|
|
1051
|
+
className: P("transformSelect", s),
|
|
980
1052
|
"aria-label": `Transform for ${n.id}`,
|
|
981
1053
|
value: i,
|
|
1054
|
+
disabled: Me(n),
|
|
982
1055
|
onChange: (e) => {
|
|
983
1056
|
r.setTransform(n.id, e || null);
|
|
984
1057
|
},
|
|
985
|
-
children:
|
|
1058
|
+
children: a.map((e) => /* @__PURE__ */ O("option", {
|
|
986
1059
|
value: e.value,
|
|
1060
|
+
disabled: e.disabled,
|
|
987
1061
|
children: e.label
|
|
988
1062
|
}, e.label))
|
|
989
|
-
}) : /* @__PURE__ */
|
|
990
|
-
className:
|
|
1063
|
+
}) : /* @__PURE__ */ O(h, {
|
|
1064
|
+
className: P("dataType", s),
|
|
991
1065
|
children: n.target?.dataType
|
|
992
1066
|
}),
|
|
993
|
-
/* @__PURE__ */
|
|
994
|
-
className:
|
|
1067
|
+
/* @__PURE__ */ O("div", {
|
|
1068
|
+
className: P("rowAccessory", s),
|
|
995
1069
|
children: l?.(n) ?? null
|
|
996
1070
|
}),
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
className:
|
|
1071
|
+
/* @__PURE__ */ O(m, {
|
|
1072
|
+
className: P("removeButton", s),
|
|
999
1073
|
"aria-label": `Remove mapping for ${n.id}`,
|
|
1000
|
-
onClick: () =>
|
|
1074
|
+
onClick: () => Z(n.id),
|
|
1001
1075
|
children: "×"
|
|
1002
1076
|
})
|
|
1003
1077
|
]
|
|
1004
1078
|
}),
|
|
1005
|
-
|
|
1006
|
-
className:
|
|
1079
|
+
Y && n.preview && /* @__PURE__ */ O("div", {
|
|
1080
|
+
className: P("preview", s),
|
|
1007
1081
|
children: n.preview
|
|
1008
1082
|
}),
|
|
1009
|
-
n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */
|
|
1010
|
-
className:
|
|
1083
|
+
n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */ k("div", {
|
|
1084
|
+
className: P("validation", s),
|
|
1011
1085
|
children: ["needs ", n.requiredResolve]
|
|
1012
1086
|
}),
|
|
1013
|
-
n.state === "needsLookup" && /* @__PURE__ */
|
|
1014
|
-
className:
|
|
1087
|
+
n.state === "needsLookup" && /* @__PURE__ */ O("div", {
|
|
1088
|
+
className: P("validation", s),
|
|
1015
1089
|
children: "needs lookup"
|
|
1016
1090
|
}),
|
|
1017
|
-
|
|
1018
|
-
className:
|
|
1091
|
+
X && n.mapping?.resolve === "lookup" && n.mapping && (u ? /* @__PURE__ */ O("div", {
|
|
1092
|
+
className: P("lookupEditor", s),
|
|
1019
1093
|
children: u({
|
|
1020
1094
|
...n,
|
|
1021
1095
|
sampleValue: n.sampleValue ?? "",
|
|
1022
1096
|
onLookupChange: (e) => r.setLookupEntries(n.id, e)
|
|
1023
1097
|
})
|
|
1024
|
-
}) : /* @__PURE__ */
|
|
1098
|
+
}) : /* @__PURE__ */ O(Q, {
|
|
1025
1099
|
mode: "row",
|
|
1026
1100
|
mappings: [n.mapping],
|
|
1027
1101
|
sources: e,
|
|
1028
1102
|
targets: t,
|
|
1029
1103
|
onLookupChange: (e, t) => r.setLookupEntries(n.id, t),
|
|
1030
1104
|
classNames: s
|
|
1031
|
-
}))
|
|
1105
|
+
})),
|
|
1106
|
+
/* @__PURE__ */ O("div", {
|
|
1107
|
+
className: P("rowExpansion", s),
|
|
1108
|
+
children: d?.(n) ?? null
|
|
1109
|
+
})
|
|
1032
1110
|
]
|
|
1033
1111
|
}, n.id);
|
|
1034
1112
|
})
|
|
1035
1113
|
}),
|
|
1036
|
-
/* @__PURE__ */
|
|
1114
|
+
/* @__PURE__ */ O("div", {
|
|
1037
1115
|
style: { marginTop: 10 },
|
|
1038
|
-
children:
|
|
1039
|
-
className:
|
|
1116
|
+
children: S ? /* @__PURE__ */ k(p, {
|
|
1117
|
+
className: P("sourceSelect", s),
|
|
1040
1118
|
"aria-label": "Add property mapping",
|
|
1041
1119
|
value: "",
|
|
1042
1120
|
onChange: (e) => {
|
|
1043
1121
|
e && ie(e);
|
|
1044
1122
|
},
|
|
1045
|
-
children: [/* @__PURE__ */
|
|
1123
|
+
children: [/* @__PURE__ */ O("option", {
|
|
1046
1124
|
value: "",
|
|
1047
1125
|
children: "Choose a property…"
|
|
1048
|
-
}),
|
|
1126
|
+
}), J.map((e) => /* @__PURE__ */ k("option", {
|
|
1049
1127
|
value: e.name,
|
|
1050
1128
|
children: [
|
|
1051
1129
|
e.name,
|
|
@@ -1055,51 +1133,51 @@ function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "
|
|
|
1055
1133
|
")"
|
|
1056
1134
|
]
|
|
1057
1135
|
}, e.name))]
|
|
1058
|
-
}) : /* @__PURE__ */
|
|
1059
|
-
className:
|
|
1060
|
-
onClick: () =>
|
|
1061
|
-
disabled:
|
|
1136
|
+
}) : /* @__PURE__ */ O(m, {
|
|
1137
|
+
className: P("addButton", s),
|
|
1138
|
+
onClick: () => C(!0),
|
|
1139
|
+
disabled: J.length === 0,
|
|
1062
1140
|
children: "+ Add mapping"
|
|
1063
1141
|
})
|
|
1064
1142
|
}),
|
|
1065
|
-
o.inspector && /* @__PURE__ */
|
|
1066
|
-
className:
|
|
1067
|
-
open:
|
|
1068
|
-
onToggle: (e) =>
|
|
1069
|
-
children: [/* @__PURE__ */
|
|
1143
|
+
o.inspector && /* @__PURE__ */ k("details", {
|
|
1144
|
+
className: P("inspector", s),
|
|
1145
|
+
open: b,
|
|
1146
|
+
onToggle: (e) => x(e.target.open),
|
|
1147
|
+
children: [/* @__PURE__ */ k("summary", { children: [
|
|
1070
1148
|
"Source fields (",
|
|
1071
|
-
|
|
1149
|
+
B(e).length,
|
|
1072
1150
|
")"
|
|
1073
|
-
] }),
|
|
1074
|
-
let t =
|
|
1075
|
-
return /* @__PURE__ */
|
|
1151
|
+
] }), B(e).map((e) => {
|
|
1152
|
+
let t = U.get(e.id) ?? [];
|
|
1153
|
+
return /* @__PURE__ */ k("div", {
|
|
1076
1154
|
className: "fm-inspector-row",
|
|
1077
1155
|
children: [
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
e.subtitle ? /* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ k("div", { children: [
|
|
1157
|
+
/* @__PURE__ */ O("strong", { children: e.label }),
|
|
1158
|
+
e.subtitle ? /* @__PURE__ */ O("div", {
|
|
1081
1159
|
className: "fm-value",
|
|
1082
1160
|
children: e.subtitle
|
|
1083
1161
|
}) : null,
|
|
1084
|
-
/* @__PURE__ */
|
|
1162
|
+
/* @__PURE__ */ O("div", {
|
|
1085
1163
|
className: "fm-value",
|
|
1086
|
-
children:
|
|
1164
|
+
children: R(e.value, 60)
|
|
1087
1165
|
})
|
|
1088
1166
|
] }),
|
|
1089
|
-
/* @__PURE__ */
|
|
1167
|
+
/* @__PURE__ */ O("div", {
|
|
1090
1168
|
className: "fm-value",
|
|
1091
1169
|
children: t.length > 0 ? `→ ${t.join(", ")}` : "unused"
|
|
1092
1170
|
}),
|
|
1093
|
-
/* @__PURE__ */
|
|
1171
|
+
/* @__PURE__ */ O(m, {
|
|
1094
1172
|
className: "fm-btn",
|
|
1095
|
-
onClick: () =>
|
|
1173
|
+
onClick: () => re(e.id),
|
|
1096
1174
|
children: "Map this"
|
|
1097
1175
|
})
|
|
1098
1176
|
]
|
|
1099
1177
|
}, e.id);
|
|
1100
1178
|
})]
|
|
1101
1179
|
}),
|
|
1102
|
-
te && /* @__PURE__ */
|
|
1180
|
+
te && /* @__PURE__ */ O(Q, {
|
|
1103
1181
|
mode: "section",
|
|
1104
1182
|
mappings: n,
|
|
1105
1183
|
sources: e,
|
|
@@ -1110,198 +1188,186 @@ function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "
|
|
|
1110
1188
|
},
|
|
1111
1189
|
classNames: s
|
|
1112
1190
|
}),
|
|
1113
|
-
|
|
1114
|
-
className:
|
|
1115
|
-
open:
|
|
1116
|
-
onToggle: (e) =>
|
|
1117
|
-
children: [/* @__PURE__ */
|
|
1191
|
+
ee && /* @__PURE__ */ k("details", {
|
|
1192
|
+
className: P("jsonPreview", s),
|
|
1193
|
+
open: F,
|
|
1194
|
+
onToggle: (e) => z(e.target.open),
|
|
1195
|
+
children: [/* @__PURE__ */ O("summary", { children: "Preview JSON" }), /* @__PURE__ */ O("pre", {
|
|
1118
1196
|
className: "fm-preview-body",
|
|
1119
|
-
children: JSON.stringify(
|
|
1197
|
+
children: JSON.stringify(W, null, 2)
|
|
1120
1198
|
})]
|
|
1121
1199
|
})
|
|
1122
1200
|
] });
|
|
1123
1201
|
}
|
|
1124
1202
|
//#endregion
|
|
1125
1203
|
//#region src/react/SourceRows.tsx
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
{
|
|
1132
|
-
value: "extract",
|
|
1133
|
-
label: "extract"
|
|
1134
|
-
},
|
|
1135
|
-
{
|
|
1136
|
-
value: "file",
|
|
1137
|
-
label: "file"
|
|
1138
|
-
},
|
|
1139
|
-
{
|
|
1140
|
-
value: "lookup",
|
|
1141
|
-
label: "lookup"
|
|
1142
|
-
}
|
|
1143
|
-
];
|
|
1144
|
-
function Ce({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i, slots: a, classNames: o, ui: s = {
|
|
1145
|
-
Select: C,
|
|
1146
|
-
Button: w,
|
|
1147
|
-
Pill: T
|
|
1148
|
-
}, renderRowAccessory: c, renderLookup: l }) {
|
|
1149
|
-
let u = s.Select, d = s.Button, [f, p] = y(!1), { rows: m, sourceOptions: h, propertyOptions: g, coverage: v, conflicts: E, setSource: O, setProperty: j, setTransform: M, addRow: N, removeRow: P, autoMap: F } = r, I = _(() => z(e, n, t), [
|
|
1204
|
+
function Pe({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i, slots: a, classNames: o, ui: s = {
|
|
1205
|
+
Select: A,
|
|
1206
|
+
Button: j,
|
|
1207
|
+
Pill: M
|
|
1208
|
+
}, renderRowAccessory: c, renderLookup: l, renderRowExpansion: u, transformOptions: d }) {
|
|
1209
|
+
let f = s.Select, p = s.Button, [m, h] = E(!1), { rows: g, sourceOptions: _, propertyOptions: v, coverage: y, conflicts: b, setSource: x, setProperty: S, setTransform: C, addRow: T, removeRow: N, autoMap: F } = r, R = w(() => K(e, n, t), [
|
|
1150
1210
|
e,
|
|
1151
1211
|
n,
|
|
1152
1212
|
t
|
|
1153
|
-
]),
|
|
1154
|
-
return /* @__PURE__ */
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
className:
|
|
1157
|
-
children: [a.autoMap && /* @__PURE__ */
|
|
1158
|
-
className:
|
|
1213
|
+
]), z = L(a.preview), B = I(a.preview), V = a.lookups === "row" && (!!l || !!i), H = a.lookups === "section" && !l && !!i;
|
|
1214
|
+
return /* @__PURE__ */ k(D, { children: [
|
|
1215
|
+
/* @__PURE__ */ k("div", {
|
|
1216
|
+
className: P("toolbar", o),
|
|
1217
|
+
children: [a.autoMap && /* @__PURE__ */ O(p, {
|
|
1218
|
+
className: P("autoMapButton", o),
|
|
1159
1219
|
onClick: () => F(),
|
|
1160
1220
|
children: "Auto-map"
|
|
1161
|
-
}), /* @__PURE__ */
|
|
1162
|
-
className:
|
|
1221
|
+
}), /* @__PURE__ */ k("span", {
|
|
1222
|
+
className: P("coverage", o),
|
|
1163
1223
|
children: [
|
|
1164
|
-
|
|
1224
|
+
y.mapped,
|
|
1165
1225
|
" of ",
|
|
1166
|
-
|
|
1226
|
+
y.total,
|
|
1167
1227
|
" mapped",
|
|
1168
|
-
|
|
1228
|
+
y.missingRequired.length > 0 ? ` · ${y.missingRequired.length} required missing: ${y.missingRequired.join(", ")}` : ""
|
|
1169
1229
|
]
|
|
1170
1230
|
})]
|
|
1171
1231
|
}),
|
|
1172
|
-
|
|
1232
|
+
b.size > 0 && /* @__PURE__ */ k("div", {
|
|
1173
1233
|
className: "fm-banner fm-banner-danger",
|
|
1174
1234
|
role: "alert",
|
|
1175
1235
|
children: [
|
|
1176
|
-
|
|
1236
|
+
b.size,
|
|
1177
1237
|
" row",
|
|
1178
|
-
|
|
1238
|
+
b.size === 1 ? "" : "s",
|
|
1179
1239
|
" claim the same property — each property can only have one source."
|
|
1180
1240
|
]
|
|
1181
1241
|
}),
|
|
1182
|
-
|
|
1242
|
+
y.missingRequired.length > 0 && /* @__PURE__ */ k("div", {
|
|
1183
1243
|
className: "fm-banner fm-banner-warn",
|
|
1184
1244
|
role: "status",
|
|
1185
|
-
children: ["Required missing: ",
|
|
1245
|
+
children: ["Required missing: ", y.missingRequired.join(", ")]
|
|
1186
1246
|
}),
|
|
1187
|
-
/* @__PURE__ */
|
|
1188
|
-
className:
|
|
1189
|
-
children:
|
|
1190
|
-
let i = n.mapping?.resolve ?? "", a = n.source?.id ?? n.mapping?.sourceId ?? "", s = n.target?.name ?? n.mapping?.propertyName ?? "";
|
|
1191
|
-
return /* @__PURE__ */
|
|
1192
|
-
className:
|
|
1247
|
+
/* @__PURE__ */ O("div", {
|
|
1248
|
+
className: P("rowList", o),
|
|
1249
|
+
children: g.map((n) => {
|
|
1250
|
+
let i = n.mapping?.resolve ?? "", a = n.source?.id ?? n.mapping?.sourceId ?? "", s = n.target?.name ?? n.mapping?.propertyName ?? "", m = Ae(n, d), h = je(n, m);
|
|
1251
|
+
return /* @__PURE__ */ k("div", {
|
|
1252
|
+
className: P("row", o),
|
|
1193
1253
|
"data-state": n.state,
|
|
1194
1254
|
"data-property-name": s || void 0,
|
|
1195
1255
|
"data-required": n.target?.required ? "true" : void 0,
|
|
1196
1256
|
"data-resolve": n.mapping?.resolve,
|
|
1197
1257
|
"data-source-kind": n.source?.kind,
|
|
1198
1258
|
children: [
|
|
1199
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ k("div", {
|
|
1200
1260
|
className: "fm-row-main fm-row-main-source",
|
|
1201
1261
|
children: [
|
|
1202
|
-
/* @__PURE__ */
|
|
1203
|
-
className:
|
|
1262
|
+
/* @__PURE__ */ k(f, {
|
|
1263
|
+
className: P("sourceSelect", o),
|
|
1204
1264
|
"aria-label": "Source field",
|
|
1205
1265
|
value: a,
|
|
1206
1266
|
onChange: (e) => {
|
|
1207
|
-
|
|
1267
|
+
x(n.id, e || null);
|
|
1208
1268
|
},
|
|
1209
|
-
children: [/* @__PURE__ */
|
|
1269
|
+
children: [/* @__PURE__ */ O("option", {
|
|
1210
1270
|
value: "",
|
|
1211
1271
|
children: "Choose a source field…"
|
|
1212
|
-
}),
|
|
1272
|
+
}), _.map((e) => /* @__PURE__ */ O("option", {
|
|
1213
1273
|
value: e.value,
|
|
1214
1274
|
children: e.label
|
|
1215
1275
|
}, e.value))]
|
|
1216
1276
|
}),
|
|
1217
|
-
|
|
1218
|
-
className:
|
|
1277
|
+
h ? /* @__PURE__ */ O(f, {
|
|
1278
|
+
className: P("transformSelect", o),
|
|
1219
1279
|
"aria-label": "Transform",
|
|
1220
1280
|
value: i,
|
|
1281
|
+
disabled: Me(n),
|
|
1221
1282
|
onChange: (e) => {
|
|
1222
|
-
|
|
1283
|
+
C(n.id, e || null);
|
|
1223
1284
|
},
|
|
1224
|
-
children:
|
|
1285
|
+
children: m.map((e) => /* @__PURE__ */ O("option", {
|
|
1225
1286
|
value: e.value,
|
|
1287
|
+
disabled: e.disabled,
|
|
1226
1288
|
children: e.label
|
|
1227
1289
|
}, e.label))
|
|
1228
|
-
}) : /* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1290
|
+
}) : /* @__PURE__ */ O("span", { className: "fm-into" }),
|
|
1291
|
+
/* @__PURE__ */ O("span", {
|
|
1230
1292
|
className: "fm-into",
|
|
1231
1293
|
children: "into"
|
|
1232
1294
|
}),
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
className:
|
|
1295
|
+
/* @__PURE__ */ k(f, {
|
|
1296
|
+
className: P("sourceSelect", o),
|
|
1235
1297
|
"aria-label": "Target property",
|
|
1236
1298
|
value: s,
|
|
1237
1299
|
onChange: (e) => {
|
|
1238
|
-
e &&
|
|
1300
|
+
e && S(n.id, e);
|
|
1239
1301
|
},
|
|
1240
|
-
children: [/* @__PURE__ */
|
|
1302
|
+
children: [/* @__PURE__ */ O("option", {
|
|
1241
1303
|
value: "",
|
|
1242
1304
|
children: "Choose a property…"
|
|
1243
|
-
}),
|
|
1305
|
+
}), v.map((e) => /* @__PURE__ */ O("option", {
|
|
1244
1306
|
value: e.value,
|
|
1245
1307
|
children: e.label
|
|
1246
1308
|
}, e.value))]
|
|
1247
1309
|
}),
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
className:
|
|
1310
|
+
/* @__PURE__ */ O("div", {
|
|
1311
|
+
className: P("rowAccessory", o),
|
|
1250
1312
|
children: c?.(n) ?? null
|
|
1251
1313
|
}),
|
|
1252
|
-
/* @__PURE__ */
|
|
1253
|
-
className:
|
|
1314
|
+
/* @__PURE__ */ O(p, {
|
|
1315
|
+
className: P("removeButton", o),
|
|
1254
1316
|
"aria-label": "Remove row",
|
|
1255
|
-
onClick: () =>
|
|
1317
|
+
onClick: () => N(n.id),
|
|
1256
1318
|
children: "×"
|
|
1257
1319
|
})
|
|
1258
1320
|
]
|
|
1259
1321
|
}),
|
|
1260
|
-
|
|
1261
|
-
className:
|
|
1322
|
+
B && n.preview && /* @__PURE__ */ O("div", {
|
|
1323
|
+
className: P("preview", o),
|
|
1262
1324
|
children: n.preview
|
|
1263
1325
|
}),
|
|
1264
|
-
n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */
|
|
1265
|
-
className:
|
|
1326
|
+
n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */ k("div", {
|
|
1327
|
+
className: P("validation", o),
|
|
1266
1328
|
children: ["needs ", n.requiredResolve]
|
|
1267
1329
|
}),
|
|
1268
|
-
n.state === "needsLookup" && /* @__PURE__ */
|
|
1269
|
-
className:
|
|
1330
|
+
n.state === "needsLookup" && /* @__PURE__ */ O("div", {
|
|
1331
|
+
className: P("validation", o),
|
|
1270
1332
|
children: "needs lookup"
|
|
1271
1333
|
}),
|
|
1272
|
-
n.state === "conflict" && /* @__PURE__ */
|
|
1273
|
-
className:
|
|
1334
|
+
n.state === "conflict" && /* @__PURE__ */ O("div", {
|
|
1335
|
+
className: P("validation", o),
|
|
1274
1336
|
style: { color: "var(--fm-danger)" },
|
|
1275
1337
|
children: "property already mapped by another row"
|
|
1276
1338
|
}),
|
|
1277
|
-
|
|
1278
|
-
className:
|
|
1339
|
+
V && n.mapping?.resolve === "lookup" && n.mapping && (l ? /* @__PURE__ */ O("div", {
|
|
1340
|
+
className: P("lookupEditor", o),
|
|
1279
1341
|
children: l({
|
|
1280
1342
|
...n,
|
|
1281
1343
|
sampleValue: n.sampleValue ?? "",
|
|
1282
1344
|
onLookupChange: (e) => r.setLookupEntries(n.id, e)
|
|
1283
1345
|
})
|
|
1284
|
-
}) : /* @__PURE__ */
|
|
1346
|
+
}) : /* @__PURE__ */ O(Q, {
|
|
1285
1347
|
mode: "row",
|
|
1286
1348
|
mappings: [n.mapping],
|
|
1287
1349
|
sources: e,
|
|
1288
1350
|
targets: t,
|
|
1289
1351
|
onLookupChange: (e, t) => r.setLookupEntries(n.id, t),
|
|
1290
1352
|
classNames: o
|
|
1291
|
-
}))
|
|
1353
|
+
})),
|
|
1354
|
+
/* @__PURE__ */ O("div", {
|
|
1355
|
+
className: P("rowExpansion", o),
|
|
1356
|
+
children: u?.(n) ?? null
|
|
1357
|
+
})
|
|
1292
1358
|
]
|
|
1293
1359
|
}, n.id);
|
|
1294
1360
|
})
|
|
1295
1361
|
}),
|
|
1296
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ O("div", {
|
|
1297
1363
|
style: { marginTop: 10 },
|
|
1298
|
-
children: /* @__PURE__ */
|
|
1299
|
-
className:
|
|
1300
|
-
onClick: () =>
|
|
1364
|
+
children: /* @__PURE__ */ O(p, {
|
|
1365
|
+
className: P("addButton", o),
|
|
1366
|
+
onClick: () => T(),
|
|
1301
1367
|
children: "+ Add mapping"
|
|
1302
1368
|
})
|
|
1303
1369
|
}),
|
|
1304
|
-
|
|
1370
|
+
H && /* @__PURE__ */ O(Q, {
|
|
1305
1371
|
mode: "section",
|
|
1306
1372
|
mappings: n,
|
|
1307
1373
|
sources: e,
|
|
@@ -1312,31 +1378,35 @@ function Ce({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
|
|
|
1312
1378
|
},
|
|
1313
1379
|
classNames: o
|
|
1314
1380
|
}),
|
|
1315
|
-
|
|
1316
|
-
className:
|
|
1317
|
-
open:
|
|
1318
|
-
onToggle: (e) =>
|
|
1319
|
-
children: [/* @__PURE__ */
|
|
1381
|
+
z && /* @__PURE__ */ k("details", {
|
|
1382
|
+
className: P("jsonPreview", o),
|
|
1383
|
+
open: m,
|
|
1384
|
+
onToggle: (e) => h(e.target.open),
|
|
1385
|
+
children: [/* @__PURE__ */ O("summary", { children: "Preview JSON" }), /* @__PURE__ */ O("pre", {
|
|
1320
1386
|
className: "fm-preview-body",
|
|
1321
|
-
children: JSON.stringify(
|
|
1387
|
+
children: JSON.stringify(R, null, 2)
|
|
1322
1388
|
})]
|
|
1323
1389
|
})
|
|
1324
1390
|
] });
|
|
1325
1391
|
}
|
|
1326
1392
|
//#endregion
|
|
1327
1393
|
//#region src/react/useFieldMapper.ts
|
|
1328
|
-
function
|
|
1329
|
-
let [c, l] =
|
|
1330
|
-
|
|
1331
|
-
let
|
|
1394
|
+
function Fe({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {}, onLookupsChange: a, rowKey: o = "property", onAutoMap: s }) {
|
|
1395
|
+
let [c, l] = E(() => /* @__PURE__ */ new Set()), [u, d] = E([]), p = T(n), _ = T(n);
|
|
1396
|
+
_.current !== n && (_.current = n, p.current = n);
|
|
1397
|
+
let y = T([]);
|
|
1398
|
+
y.current = le(y.current, p.current.length);
|
|
1399
|
+
let b = y.current, x = S((e) => {
|
|
1400
|
+
p.current = e, y.current = le(y.current, e.length), r(e);
|
|
1401
|
+
}, [r]), C = S((e) => {
|
|
1332
1402
|
if (!a || e.length === 0) return;
|
|
1333
|
-
let t =
|
|
1403
|
+
let t = re(i, e);
|
|
1334
1404
|
t && a(t);
|
|
1335
|
-
}, [i, a]),
|
|
1405
|
+
}, [i, a]), D = w(() => V(e), [e]), O = w(() => H(t), [t]), k = w(() => J(t, n), [t, n]), A = w(() => new Set(n.map((e) => e.propertyName)), [n]), j = w(() => t.filter((e) => !A.has(e.name) && !c.has(e.name)), [
|
|
1336
1406
|
t,
|
|
1337
|
-
|
|
1407
|
+
A,
|
|
1338
1408
|
c
|
|
1339
|
-
]),
|
|
1409
|
+
]), M = w(() => oe({
|
|
1340
1410
|
targets: t,
|
|
1341
1411
|
mappings: n,
|
|
1342
1412
|
sources: e,
|
|
@@ -1346,274 +1416,283 @@ function we({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {},
|
|
|
1346
1416
|
n,
|
|
1347
1417
|
e,
|
|
1348
1418
|
i
|
|
1349
|
-
]),
|
|
1419
|
+
]), N = w(() => se({
|
|
1350
1420
|
mappings: n,
|
|
1351
|
-
edgeIds:
|
|
1421
|
+
edgeIds: b,
|
|
1352
1422
|
drafts: u,
|
|
1353
1423
|
sources: e,
|
|
1354
1424
|
targets: t,
|
|
1355
1425
|
lookups: i
|
|
1356
1426
|
}), [
|
|
1357
1427
|
n,
|
|
1358
|
-
|
|
1428
|
+
b,
|
|
1359
1429
|
u,
|
|
1360
1430
|
e,
|
|
1361
1431
|
t,
|
|
1362
1432
|
i
|
|
1363
|
-
]),
|
|
1364
|
-
let
|
|
1365
|
-
|
|
1433
|
+
]), P = o === "property" ? M : N.rows, F = o === "property" ? /* @__PURE__ */ new Set() : N.conflicts, I = S((n, r) => {
|
|
1434
|
+
let i = ie(p.current, e, t, n, r);
|
|
1435
|
+
x(i.mappings), C(i.clearedLookupProps);
|
|
1366
1436
|
}, [
|
|
1367
|
-
n,
|
|
1368
1437
|
e,
|
|
1369
1438
|
t,
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
]),
|
|
1373
|
-
let t =
|
|
1374
|
-
|
|
1375
|
-
}, [
|
|
1376
|
-
n,
|
|
1377
|
-
|
|
1378
|
-
b
|
|
1379
|
-
]), M = h(() => {
|
|
1380
|
-
r(s ? s() : d(e, t)), f([]), l(/* @__PURE__ */ new Set());
|
|
1439
|
+
x,
|
|
1440
|
+
C
|
|
1441
|
+
]), L = S((e) => {
|
|
1442
|
+
let t = ae(p.current, e);
|
|
1443
|
+
x(t.mappings), C(t.clearedLookupProps);
|
|
1444
|
+
}, [x, C]), R = S(() => {
|
|
1445
|
+
let n = s ? s() : v(e, t);
|
|
1446
|
+
x(n), d([]), l(/* @__PURE__ */ new Set());
|
|
1381
1447
|
}, [
|
|
1382
1448
|
s,
|
|
1383
1449
|
e,
|
|
1384
1450
|
t,
|
|
1385
|
-
|
|
1386
|
-
]),
|
|
1451
|
+
x
|
|
1452
|
+
]), z = S((n, r) => {
|
|
1453
|
+
let i = p.current;
|
|
1387
1454
|
if (o === "property") {
|
|
1388
|
-
if (!
|
|
1389
|
-
let e =
|
|
1390
|
-
|
|
1455
|
+
if (!r) {
|
|
1456
|
+
let e = i.find((e) => e.propertyName === n);
|
|
1457
|
+
if (e && f(e)) {
|
|
1458
|
+
x(Z(i, g(e))), e.resolve === "lookup" && C([n]);
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
x(i.filter((e) => e.propertyName !== n)), e?.resolve === "lookup" && C([n]);
|
|
1391
1462
|
return;
|
|
1392
1463
|
}
|
|
1393
|
-
let
|
|
1394
|
-
if (!
|
|
1395
|
-
let e =
|
|
1464
|
+
let a = ie(i, e, t, r, n), o = t.find((e) => e.name === n), s = B(e).find((e) => e.id === r), c = a.mappings.find((e) => e.propertyName === n);
|
|
1465
|
+
if (!c.resolve) {
|
|
1466
|
+
let e = W(s, o);
|
|
1396
1467
|
if (e) {
|
|
1397
|
-
|
|
1398
|
-
...
|
|
1468
|
+
c = {
|
|
1469
|
+
...c,
|
|
1399
1470
|
resolve: e
|
|
1400
|
-
},
|
|
1471
|
+
}, x(Z(a.mappings, c)), C(a.clearedLookupProps);
|
|
1401
1472
|
return;
|
|
1402
1473
|
}
|
|
1403
1474
|
}
|
|
1404
|
-
|
|
1475
|
+
x(a.mappings), C(a.clearedLookupProps);
|
|
1405
1476
|
return;
|
|
1406
1477
|
}
|
|
1407
|
-
let
|
|
1408
|
-
if (
|
|
1409
|
-
if (!
|
|
1410
|
-
let e =
|
|
1411
|
-
|
|
1478
|
+
let a = y.current.indexOf(n);
|
|
1479
|
+
if (a >= 0) {
|
|
1480
|
+
if (!r) {
|
|
1481
|
+
let e = i[a];
|
|
1482
|
+
if (e && f(e)) {
|
|
1483
|
+
let t = [...i];
|
|
1484
|
+
t[a] = g(e), x(t), e.resolve === "lookup" && C([e.propertyName]);
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
let t = i.filter((e, t) => t !== a);
|
|
1488
|
+
x(t), e?.resolve === "lookup" && C([e.propertyName]);
|
|
1412
1489
|
return;
|
|
1413
1490
|
}
|
|
1414
|
-
let
|
|
1415
|
-
sourceId:
|
|
1416
|
-
propertyName:
|
|
1491
|
+
let n = i[a], o = t.find((e) => e.name === n.propertyName), s = {
|
|
1492
|
+
sourceId: r,
|
|
1493
|
+
propertyName: n.propertyName
|
|
1417
1494
|
};
|
|
1418
|
-
if (
|
|
1419
|
-
let t =
|
|
1420
|
-
t && (
|
|
1421
|
-
...
|
|
1495
|
+
if (s = Y(s, o), s = m(s, n), !s.resolve) {
|
|
1496
|
+
let t = W(B(e).find((e) => e.id === r), o);
|
|
1497
|
+
t && (s = {
|
|
1498
|
+
...s,
|
|
1422
1499
|
resolve: t
|
|
1423
1500
|
});
|
|
1424
1501
|
}
|
|
1425
|
-
let
|
|
1426
|
-
|
|
1502
|
+
let c = [...i];
|
|
1503
|
+
c[a] = s, x(c), n.resolve === "lookup" && s.resolve !== "lookup" && C([n.propertyName]);
|
|
1427
1504
|
return;
|
|
1428
1505
|
}
|
|
1429
|
-
|
|
1430
|
-
let
|
|
1431
|
-
if (
|
|
1432
|
-
if (!
|
|
1433
|
-
id:
|
|
1434
|
-
propertyName:
|
|
1506
|
+
d((i) => {
|
|
1507
|
+
let a = i.map((i) => {
|
|
1508
|
+
if (i.id !== n) return i;
|
|
1509
|
+
if (!r) return {
|
|
1510
|
+
id: i.id,
|
|
1511
|
+
propertyName: i.propertyName
|
|
1435
1512
|
};
|
|
1436
|
-
let
|
|
1437
|
-
sourceId:
|
|
1438
|
-
propertyName:
|
|
1439
|
-
},
|
|
1513
|
+
let a = i.propertyName ? t.find((e) => e.name === i.propertyName) : void 0, o = W(B(e).find((e) => e.id === r), a), s = a && Y({
|
|
1514
|
+
sourceId: r,
|
|
1515
|
+
propertyName: i.propertyName ?? ""
|
|
1516
|
+
}, a).resolve || o || void 0;
|
|
1440
1517
|
return {
|
|
1441
|
-
id:
|
|
1442
|
-
sourceId:
|
|
1443
|
-
propertyName:
|
|
1518
|
+
id: i.id,
|
|
1519
|
+
sourceId: r,
|
|
1520
|
+
propertyName: i.propertyName,
|
|
1444
1521
|
resolve: s
|
|
1445
1522
|
};
|
|
1446
|
-
}),
|
|
1447
|
-
return
|
|
1448
|
-
sourceId: e.sourceId,
|
|
1523
|
+
}), o = a.filter((e) => e.propertyName && (e.sourceId || e.resolve === "derive")), s = a.filter((e) => !e.propertyName || !e.sourceId && e.resolve !== "derive");
|
|
1524
|
+
return o.length > 0 ? (x([...p.current, ...o.map((e) => ({
|
|
1525
|
+
...e.sourceId ? { sourceId: e.sourceId } : {},
|
|
1449
1526
|
propertyName: e.propertyName,
|
|
1450
1527
|
...e.resolve ? { resolve: e.resolve } : {}
|
|
1451
|
-
}))]),
|
|
1528
|
+
}))]), s) : a;
|
|
1452
1529
|
});
|
|
1453
1530
|
}, [
|
|
1454
1531
|
o,
|
|
1455
|
-
n,
|
|
1456
1532
|
e,
|
|
1457
1533
|
t,
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
]), R = h((i, a) => {
|
|
1534
|
+
x,
|
|
1535
|
+
C
|
|
1536
|
+
]), U = S((n, r) => {
|
|
1462
1537
|
if (o === "property") return;
|
|
1463
|
-
let
|
|
1464
|
-
if (
|
|
1465
|
-
let
|
|
1466
|
-
sourceId:
|
|
1467
|
-
propertyName:
|
|
1538
|
+
let i = p.current, a = y.current.indexOf(n);
|
|
1539
|
+
if (a >= 0) {
|
|
1540
|
+
let n = i[a], o = t.find((e) => e.name === r), s = B(e).find((e) => e.id === n.sourceId), c = {
|
|
1541
|
+
...n.sourceId ? { sourceId: n.sourceId } : {},
|
|
1542
|
+
propertyName: r
|
|
1468
1543
|
};
|
|
1469
|
-
if (
|
|
1470
|
-
let e =
|
|
1471
|
-
e && (
|
|
1472
|
-
...
|
|
1544
|
+
if (c = Y(c, o), c = m(c, n), !c.resolve) {
|
|
1545
|
+
let e = W(s, o);
|
|
1546
|
+
e && (c = {
|
|
1547
|
+
...c,
|
|
1473
1548
|
resolve: e
|
|
1474
1549
|
});
|
|
1475
1550
|
}
|
|
1476
|
-
let
|
|
1477
|
-
|
|
1551
|
+
let l = [...i];
|
|
1552
|
+
l[a] = c, x(l), n.resolve === "lookup" && c.resolve !== "lookup" && C([n.propertyName]), n.propertyName !== r && n.resolve === "lookup" && c.resolve === "lookup" && C([n.propertyName]);
|
|
1478
1553
|
return;
|
|
1479
1554
|
}
|
|
1480
|
-
|
|
1481
|
-
let
|
|
1482
|
-
if (
|
|
1483
|
-
let
|
|
1484
|
-
|
|
1485
|
-
sourceId:
|
|
1486
|
-
propertyName:
|
|
1487
|
-
},
|
|
1555
|
+
d((i) => {
|
|
1556
|
+
let a = i.map((i) => {
|
|
1557
|
+
if (i.id !== n) return i;
|
|
1558
|
+
let a = t.find((e) => e.name === r), o = i.sourceId ? B(e).find((e) => e.id === i.sourceId) : void 0, s = i.resolve;
|
|
1559
|
+
i.sourceId && a && (s = Y({
|
|
1560
|
+
sourceId: i.sourceId,
|
|
1561
|
+
propertyName: r
|
|
1562
|
+
}, a).resolve ?? W(o, a) ?? void 0);
|
|
1488
1563
|
let c = {
|
|
1489
|
-
id:
|
|
1490
|
-
sourceId:
|
|
1491
|
-
propertyName:
|
|
1564
|
+
id: i.id,
|
|
1565
|
+
sourceId: i.sourceId,
|
|
1566
|
+
propertyName: r,
|
|
1492
1567
|
resolve: s
|
|
1493
1568
|
};
|
|
1494
1569
|
return c.sourceId && c.propertyName, c;
|
|
1495
|
-
}),
|
|
1496
|
-
if (
|
|
1497
|
-
let e =
|
|
1498
|
-
sourceId: e.sourceId,
|
|
1570
|
+
}), o = a.filter((e) => e.propertyName && (e.sourceId || e.resolve === "derive")), s = a.filter((e) => !e.propertyName || !e.sourceId && e.resolve !== "derive");
|
|
1571
|
+
if (o.length > 0) {
|
|
1572
|
+
let e = o.map((e) => ({
|
|
1573
|
+
...e.sourceId ? { sourceId: e.sourceId } : {},
|
|
1499
1574
|
propertyName: e.propertyName,
|
|
1500
1575
|
...e.resolve ? { resolve: e.resolve } : {}
|
|
1501
1576
|
}));
|
|
1502
|
-
return
|
|
1577
|
+
return x([...p.current, ...e]), s;
|
|
1503
1578
|
}
|
|
1504
|
-
return
|
|
1579
|
+
return a;
|
|
1505
1580
|
});
|
|
1506
1581
|
}, [
|
|
1507
1582
|
o,
|
|
1508
|
-
g,
|
|
1509
|
-
n,
|
|
1510
1583
|
t,
|
|
1511
1584
|
e,
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
]),
|
|
1515
|
-
let
|
|
1516
|
-
if (!
|
|
1517
|
-
let
|
|
1518
|
-
if (!
|
|
1519
|
-
let
|
|
1520
|
-
Object.keys(
|
|
1585
|
+
x,
|
|
1586
|
+
C
|
|
1587
|
+
]), G = S((e, t) => {
|
|
1588
|
+
let n = ne(p.current, o, e, y.current, t);
|
|
1589
|
+
if (!n || (x(n), !a)) return;
|
|
1590
|
+
let r = o === "property" ? n.find((t) => t.propertyName === e) : n[y.current.indexOf(e)];
|
|
1591
|
+
if (!r) return;
|
|
1592
|
+
let s = Object.fromEntries((r.lookup?.entries ?? []).map((e) => [e.value, e.ref])), c = { ...i };
|
|
1593
|
+
Object.keys(s).length === 0 ? delete c[r.propertyName] : c[r.propertyName] = s, a(c);
|
|
1521
1594
|
}, [
|
|
1522
|
-
n,
|
|
1523
1595
|
o,
|
|
1524
|
-
|
|
1525
|
-
r,
|
|
1596
|
+
x,
|
|
1526
1597
|
a,
|
|
1527
1598
|
i
|
|
1528
|
-
])
|
|
1599
|
+
]), K = S((e, t) => {
|
|
1600
|
+
let n = X(p.current, o, e, y.current, t);
|
|
1601
|
+
n && x(n);
|
|
1602
|
+
}, [o, x]), q = S((e, t) => {
|
|
1603
|
+
let n = te(p.current, o, e, y.current, t);
|
|
1604
|
+
n && x(n);
|
|
1605
|
+
}, [o, x]);
|
|
1529
1606
|
return {
|
|
1530
|
-
rows:
|
|
1531
|
-
sourceOptions:
|
|
1532
|
-
propertyOptions:
|
|
1533
|
-
addableProperties:
|
|
1534
|
-
coverage:
|
|
1535
|
-
conflicts:
|
|
1536
|
-
setSource:
|
|
1537
|
-
setProperty:
|
|
1538
|
-
setTransform:
|
|
1539
|
-
let
|
|
1540
|
-
...e,
|
|
1541
|
-
resolve: t
|
|
1542
|
-
} : p({
|
|
1543
|
-
sourceId: e.sourceId,
|
|
1544
|
-
propertyName: e.propertyName,
|
|
1545
|
-
resolve: t
|
|
1546
|
-
}) : {
|
|
1547
|
-
sourceId: e.sourceId,
|
|
1548
|
-
propertyName: e.propertyName
|
|
1549
|
-
};
|
|
1607
|
+
rows: P,
|
|
1608
|
+
sourceOptions: D,
|
|
1609
|
+
propertyOptions: O,
|
|
1610
|
+
addableProperties: j,
|
|
1611
|
+
coverage: k,
|
|
1612
|
+
conflicts: F,
|
|
1613
|
+
setSource: z,
|
|
1614
|
+
setProperty: U,
|
|
1615
|
+
setTransform: S((e, t) => {
|
|
1616
|
+
let n = p.current;
|
|
1550
1617
|
if (o === "property") {
|
|
1551
|
-
let
|
|
1552
|
-
if (!
|
|
1553
|
-
|
|
1618
|
+
let r = n.find((t) => t.propertyName === e);
|
|
1619
|
+
if (!r) {
|
|
1620
|
+
t === "derive" && x(Z(n, {
|
|
1621
|
+
propertyName: e,
|
|
1622
|
+
resolve: "derive"
|
|
1623
|
+
}));
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
x(Z(n, h(r, t))), r.resolve === "lookup" && t !== "lookup" && C([e]);
|
|
1554
1627
|
return;
|
|
1555
1628
|
}
|
|
1556
|
-
let
|
|
1557
|
-
if (
|
|
1558
|
-
let e = n[
|
|
1559
|
-
|
|
1629
|
+
let r = y.current.indexOf(e);
|
|
1630
|
+
if (r >= 0) {
|
|
1631
|
+
let e = n[r], i = [...n];
|
|
1632
|
+
i[r] = h(e, t), x(i), e.resolve === "lookup" && t !== "lookup" && C([e.propertyName]);
|
|
1560
1633
|
return;
|
|
1561
1634
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1635
|
+
d((n) => {
|
|
1636
|
+
let r = n.map((n) => n.id === e ? {
|
|
1637
|
+
...n,
|
|
1638
|
+
resolve: t ?? void 0
|
|
1639
|
+
} : n), i = r.filter((e) => e.propertyName && (e.sourceId || e.resolve === "derive")), a = r.filter((e) => !e.propertyName || !e.sourceId && e.resolve !== "derive");
|
|
1640
|
+
return i.length > 0 ? (x([...p.current, ...i.map((e) => ({
|
|
1641
|
+
...e.sourceId ? { sourceId: e.sourceId } : {},
|
|
1642
|
+
propertyName: e.propertyName,
|
|
1643
|
+
...e.resolve ? { resolve: e.resolve } : {}
|
|
1644
|
+
}))]), a) : r;
|
|
1645
|
+
});
|
|
1566
1646
|
}, [
|
|
1567
1647
|
o,
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
r,
|
|
1571
|
-
b
|
|
1648
|
+
x,
|
|
1649
|
+
C
|
|
1572
1650
|
]),
|
|
1573
|
-
setLookupEntries:
|
|
1574
|
-
|
|
1651
|
+
setLookupEntries: G,
|
|
1652
|
+
setAssembleBlocks: K,
|
|
1653
|
+
setDerive: q,
|
|
1654
|
+
addRow: S((e) => {
|
|
1575
1655
|
if (o === "property") {
|
|
1576
1656
|
e && l((t) => new Set(t).add(e));
|
|
1577
1657
|
return;
|
|
1578
1658
|
}
|
|
1579
|
-
|
|
1580
|
-
id:
|
|
1659
|
+
d((t) => [...t, {
|
|
1660
|
+
id: ce("draft"),
|
|
1581
1661
|
...e ? { propertyName: e } : {}
|
|
1582
1662
|
}]);
|
|
1583
1663
|
}, [o]),
|
|
1584
|
-
removeRow:
|
|
1664
|
+
removeRow: S((e) => {
|
|
1665
|
+
let t = p.current;
|
|
1585
1666
|
if (o === "property") {
|
|
1586
|
-
let
|
|
1587
|
-
|
|
1667
|
+
let n = t.find((t) => t.propertyName === e);
|
|
1668
|
+
x(t.filter((t) => t.propertyName !== e)), n?.resolve === "lookup" && C([e]), l((t) => {
|
|
1588
1669
|
if (!t.has(e)) return t;
|
|
1589
1670
|
let n = new Set(t);
|
|
1590
1671
|
return n.delete(e), n;
|
|
1591
1672
|
});
|
|
1592
1673
|
return;
|
|
1593
1674
|
}
|
|
1594
|
-
let
|
|
1595
|
-
if (
|
|
1596
|
-
let e = n
|
|
1597
|
-
|
|
1675
|
+
let n = y.current.indexOf(e);
|
|
1676
|
+
if (n >= 0) {
|
|
1677
|
+
let e = t[n];
|
|
1678
|
+
x(t.filter((e, t) => t !== n)), e?.resolve === "lookup" && C([e.propertyName]);
|
|
1598
1679
|
return;
|
|
1599
1680
|
}
|
|
1600
|
-
|
|
1681
|
+
d((t) => t.filter((t) => t.id !== e));
|
|
1601
1682
|
}, [
|
|
1602
1683
|
o,
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
r,
|
|
1606
|
-
b
|
|
1684
|
+
x,
|
|
1685
|
+
C
|
|
1607
1686
|
]),
|
|
1608
|
-
autoMap:
|
|
1609
|
-
connect:
|
|
1610
|
-
removeBySource:
|
|
1687
|
+
autoMap: R,
|
|
1688
|
+
connect: I,
|
|
1689
|
+
removeBySource: L
|
|
1611
1690
|
};
|
|
1612
1691
|
}
|
|
1613
1692
|
//#endregion
|
|
1614
1693
|
//#region src/react/FieldMapper.tsx
|
|
1615
|
-
function
|
|
1616
|
-
let
|
|
1694
|
+
function Ie({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {}, onLookupsChange: a, onAutoMap: o, className: s, theme: c = "default", connectionColors: l, showPreview: u, layout: d = "rows", rowKey: f = "property", defaultRows: p = "requiredAndMapped", classNames: m, components: h, slots: g, renderRowAccessory: _, renderLookup: v, renderRowExpansion: y, transformOptions: b }) {
|
|
1695
|
+
let x = Fe({
|
|
1617
1696
|
sources: e,
|
|
1618
1697
|
targets: t,
|
|
1619
1698
|
mappings: n,
|
|
@@ -1622,69 +1701,73 @@ function Te({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {},
|
|
|
1622
1701
|
onLookupsChange: a,
|
|
1623
1702
|
rowKey: d === "rows" ? f : "property",
|
|
1624
1703
|
onAutoMap: o
|
|
1625
|
-
}),
|
|
1626
|
-
|
|
1704
|
+
}), S = _e(c), T = w(() => F(g, u, { layout: d }), [
|
|
1705
|
+
g,
|
|
1627
1706
|
u,
|
|
1628
1707
|
d
|
|
1629
|
-
]),
|
|
1630
|
-
Select: h?.Select ??
|
|
1631
|
-
Button: h?.Button ??
|
|
1632
|
-
Pill: h?.Pill ??
|
|
1708
|
+
]), E = w(() => ({
|
|
1709
|
+
Select: h?.Select ?? A,
|
|
1710
|
+
Button: h?.Button ?? j,
|
|
1711
|
+
Pill: h?.Pill ?? M
|
|
1633
1712
|
}), [h]);
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
}, [
|
|
1637
|
-
let
|
|
1638
|
-
|
|
1713
|
+
C(() => {
|
|
1714
|
+
Te(S);
|
|
1715
|
+
}, [S]);
|
|
1716
|
+
let D = P("root", m, [
|
|
1717
|
+
S === "none" || c === "unstyled" || c === "none" ? "seed-field-mapper--unstyled" : null,
|
|
1639
1718
|
d === "rows" ? "seed-field-mapper--rows" : "seed-field-mapper--wires",
|
|
1640
1719
|
s
|
|
1641
1720
|
].filter(Boolean).join(" ") || null);
|
|
1642
|
-
return /* @__PURE__ */
|
|
1643
|
-
className:
|
|
1644
|
-
"data-theme":
|
|
1721
|
+
return /* @__PURE__ */ O("div", {
|
|
1722
|
+
className: D,
|
|
1723
|
+
"data-theme": S,
|
|
1645
1724
|
"data-layout": d,
|
|
1646
1725
|
"data-row-key": d === "rows" ? f : void 0,
|
|
1647
|
-
children: d === "wires" ? /* @__PURE__ */
|
|
1726
|
+
children: d === "wires" ? /* @__PURE__ */ O(Oe, {
|
|
1648
1727
|
sources: e,
|
|
1649
1728
|
targets: t,
|
|
1650
1729
|
mappings: n,
|
|
1651
|
-
mapper:
|
|
1730
|
+
mapper: x,
|
|
1652
1731
|
lookups: i,
|
|
1653
1732
|
onLookupsChange: a,
|
|
1654
|
-
renderLookup:
|
|
1733
|
+
renderLookup: v,
|
|
1655
1734
|
connectionColors: l,
|
|
1656
|
-
slots:
|
|
1735
|
+
slots: T,
|
|
1657
1736
|
classNames: m,
|
|
1658
|
-
ui:
|
|
1659
|
-
}) : f === "source" ? /* @__PURE__ */
|
|
1737
|
+
ui: E
|
|
1738
|
+
}) : f === "source" ? /* @__PURE__ */ O(Pe, {
|
|
1660
1739
|
sources: e,
|
|
1661
1740
|
targets: t,
|
|
1662
1741
|
mappings: n,
|
|
1663
|
-
mapper:
|
|
1742
|
+
mapper: x,
|
|
1664
1743
|
lookups: i,
|
|
1665
1744
|
onLookupsChange: a,
|
|
1666
|
-
slots:
|
|
1745
|
+
slots: T,
|
|
1667
1746
|
classNames: m,
|
|
1668
|
-
ui:
|
|
1669
|
-
renderRowAccessory:
|
|
1670
|
-
renderLookup:
|
|
1671
|
-
|
|
1747
|
+
ui: E,
|
|
1748
|
+
renderRowAccessory: _,
|
|
1749
|
+
renderLookup: v,
|
|
1750
|
+
renderRowExpansion: y,
|
|
1751
|
+
transformOptions: b
|
|
1752
|
+
}) : /* @__PURE__ */ O(Ne, {
|
|
1672
1753
|
sources: e,
|
|
1673
1754
|
targets: t,
|
|
1674
1755
|
mappings: n,
|
|
1675
|
-
mapper:
|
|
1756
|
+
mapper: x,
|
|
1676
1757
|
defaultRows: p,
|
|
1677
1758
|
lookups: i,
|
|
1678
1759
|
onLookupsChange: a,
|
|
1679
|
-
slots:
|
|
1760
|
+
slots: T,
|
|
1680
1761
|
classNames: m,
|
|
1681
|
-
ui:
|
|
1682
|
-
renderRowAccessory:
|
|
1683
|
-
renderLookup:
|
|
1762
|
+
ui: E,
|
|
1763
|
+
renderRowAccessory: _,
|
|
1764
|
+
renderLookup: v,
|
|
1765
|
+
renderRowExpansion: y,
|
|
1766
|
+
transformOptions: b
|
|
1684
1767
|
})
|
|
1685
1768
|
});
|
|
1686
1769
|
}
|
|
1687
1770
|
//#endregion
|
|
1688
|
-
export {
|
|
1771
|
+
export { Ce as DEFAULT_THEME_CSS, pe as FIELD_MAPPER_PAIR_SLOTS, Ie as FieldMapper, be as PAINT_THEME_CSS, N as SLOT_BASE_CLASS, ye as STRUCTURAL_THEME_CSS, me as THEME_STYLE_ID, oe as buildPropertyModeRows, V as buildSourceOptions, K as buildSyncPreviewBag, Se as buildThemeCss, J as computeCoverage, W as computeRequiredResolve, ie as connectSourceToProperty, ge as connectionStrokeForIndex, ke as defaultTransformOptions, Te as ensureThemeInjected, ue as filterPropertyNames, ee as findConflicts, Me as isTransformSelectDisabled, G as previewForEdge, Ee as resetThemeInjectionForTests, F as resolveSlots, _e as resolveTheme, Ae as resolveTransformOptions, L as showJsonPreview, I as showRowPreview, je as showTransformSelect, P as slotClass, Fe as useFieldMapper, xe as wrapInThemeLayer };
|
|
1689
1772
|
|
|
1690
1773
|
//# sourceMappingURL=react.js.map
|