@octaviaflow/core 3.1.0-beta.85 → 3.1.0-beta.86
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/chunk-5ISJ5NI3.js +2765 -0
- package/dist/chunk-5ISJ5NI3.js.map +1 -0
- package/dist/chunk-AMSH2ALP.js +5701 -0
- package/dist/chunk-AMSH2ALP.js.map +1 -0
- package/dist/chunk-XXT7FTMZ.js +1646 -0
- package/dist/chunk-XXT7FTMZ.js.map +1 -0
- package/dist/components/DataMapper/DataMapper.d.ts +33 -0
- package/dist/components/DataMapper/DataMapper.d.ts.map +1 -1
- package/dist/index.cjs +469 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +605 -340
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12986,22 +12986,92 @@ var TYPE_CLASSES = {
|
|
|
12986
12986
|
function pathOf(f) {
|
|
12987
12987
|
return f.path ?? f.key;
|
|
12988
12988
|
}
|
|
12989
|
-
function flatten(fields, expanded, depth = 0,
|
|
12989
|
+
function flatten(fields, expanded, depth = 0, parentKey = null, ancestors = []) {
|
|
12990
12990
|
const out = [];
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12991
|
+
fields.forEach((f, i) => {
|
|
12992
|
+
const isGroup = isGroupField(f);
|
|
12993
|
+
const isOpen = expanded.has(f.key);
|
|
12994
|
+
const insertAt = isGroup && isOpen ? { parentKey: f.key, index: 0, depth: depth + 1 } : { parentKey, index: i + 1, depth };
|
|
12995
|
+
out.push({
|
|
12996
|
+
field: f,
|
|
12997
|
+
depth,
|
|
12998
|
+
insertAt,
|
|
12999
|
+
// Deepest first, so one step left is one level out. When the gap is
|
|
13000
|
+
// already inside a group, this level's own "after me" point is the
|
|
13001
|
+
// first alternative.
|
|
13002
|
+
insertAlternatives: [
|
|
13003
|
+
...isGroup && isOpen ? [{ parentKey, index: i + 1, depth }] : [],
|
|
13004
|
+
...[...ancestors].reverse()
|
|
13005
|
+
]
|
|
13006
|
+
});
|
|
13007
|
+
if (isGroup && isOpen) {
|
|
13008
|
+
out.push(
|
|
13009
|
+
...flatten(f.children ?? [], expanded, depth + 1, f.key, [
|
|
13010
|
+
...ancestors,
|
|
13011
|
+
{ parentKey, index: i + 1, depth }
|
|
13012
|
+
])
|
|
13013
|
+
);
|
|
12995
13014
|
}
|
|
12996
|
-
}
|
|
13015
|
+
});
|
|
12997
13016
|
return out;
|
|
12998
13017
|
}
|
|
13018
|
+
function flattenFields(fields, expanded) {
|
|
13019
|
+
return flatten(fields, expanded);
|
|
13020
|
+
}
|
|
12999
13021
|
function collectAll(fields) {
|
|
13000
13022
|
return fields.flatMap((f) => [f, ...f.children ? collectAll(f.children) : []]);
|
|
13001
13023
|
}
|
|
13024
|
+
function isGroupField(f) {
|
|
13025
|
+
if (f.children && f.children.length > 0) return true;
|
|
13026
|
+
const t = String(f.type ?? "").toLowerCase();
|
|
13027
|
+
return !!f.custom && (f.isArray === true || t === "array" || t === "object");
|
|
13028
|
+
}
|
|
13029
|
+
function isArrayField(f) {
|
|
13030
|
+
return f.isArray === true || String(f.type ?? "").toLowerCase() === "array";
|
|
13031
|
+
}
|
|
13002
13032
|
function collectGroupKeys(fields) {
|
|
13003
13033
|
return collectAll(fields).filter((f) => !!f.children && f.children.length > 0).map((f) => f.key);
|
|
13004
13034
|
}
|
|
13035
|
+
var DEFAULT_ADD_FIELD_TYPES = [
|
|
13036
|
+
"string",
|
|
13037
|
+
"number",
|
|
13038
|
+
"boolean",
|
|
13039
|
+
"datetime",
|
|
13040
|
+
"object",
|
|
13041
|
+
"array"
|
|
13042
|
+
];
|
|
13043
|
+
function insertField(fields, parentKey, index, field) {
|
|
13044
|
+
if (parentKey === null) {
|
|
13045
|
+
const next = [...fields];
|
|
13046
|
+
next.splice(index, 0, field);
|
|
13047
|
+
return next;
|
|
13048
|
+
}
|
|
13049
|
+
return fields.map((f) => {
|
|
13050
|
+
if (f.key === parentKey) {
|
|
13051
|
+
const kids = [...f.children ?? []];
|
|
13052
|
+
kids.splice(index, 0, field);
|
|
13053
|
+
return { ...f, children: kids };
|
|
13054
|
+
}
|
|
13055
|
+
if (f.children && f.children.length > 0) {
|
|
13056
|
+
return { ...f, children: insertField(f.children, parentKey, index, field) };
|
|
13057
|
+
}
|
|
13058
|
+
return f;
|
|
13059
|
+
});
|
|
13060
|
+
}
|
|
13061
|
+
function removeField(fields, key) {
|
|
13062
|
+
return fields.filter((f) => f.key !== key).map(
|
|
13063
|
+
(f) => f.children && f.children.length > 0 ? { ...f, children: removeField(f.children, key) } : f
|
|
13064
|
+
);
|
|
13065
|
+
}
|
|
13066
|
+
function makeFieldKey(fields, parentKey, name) {
|
|
13067
|
+
const slug = name.trim().replace(/\s+/g, "_");
|
|
13068
|
+
const base = parentKey ? `${parentKey}.${slug}` : slug;
|
|
13069
|
+
const taken = new Set(collectAll(fields).map((f) => f.key));
|
|
13070
|
+
if (!taken.has(base)) return base;
|
|
13071
|
+
let n = 2;
|
|
13072
|
+
while (taken.has(`${base}_${n}`)) n += 1;
|
|
13073
|
+
return `${base}_${n}`;
|
|
13074
|
+
}
|
|
13005
13075
|
var TOKEN_RE = /\{\{([^}]+)\}\}/g;
|
|
13006
13076
|
var FN_RE = /\b([a-zA-Z_][a-zA-Z0-9_]*)\(/g;
|
|
13007
13077
|
function fieldToken(path) {
|
|
@@ -13318,6 +13388,9 @@ var DataMapper = (0, import_react76.forwardRef)(
|
|
|
13318
13388
|
onClose,
|
|
13319
13389
|
defaultSidebarOpen = true,
|
|
13320
13390
|
defaultGroupsExpanded = true,
|
|
13391
|
+
allowAddFields = false,
|
|
13392
|
+
onTargetFieldsChange,
|
|
13393
|
+
addFieldTypes = DEFAULT_ADD_FIELD_TYPES,
|
|
13321
13394
|
className,
|
|
13322
13395
|
...rest
|
|
13323
13396
|
}, forwardedRef) {
|
|
@@ -13330,6 +13403,68 @@ var DataMapper = (0, import_react76.forwardRef)(
|
|
|
13330
13403
|
const appliedGroupKeysRef = (0, import_react76.useRef)(
|
|
13331
13404
|
new Set(defaultGroupsExpanded ? collectGroupKeys(targetFields) : [])
|
|
13332
13405
|
);
|
|
13406
|
+
const [addingAt, setAddingAt] = (0, import_react76.useState)(null);
|
|
13407
|
+
const [newFieldName, setNewFieldName] = (0, import_react76.useState)("");
|
|
13408
|
+
const [hoverDepth, setHoverDepth] = (0, import_react76.useState)({});
|
|
13409
|
+
const [newFieldType, setNewFieldType] = (0, import_react76.useState)(addFieldTypes[0] ?? "string");
|
|
13410
|
+
const canAddFields = allowAddFields && typeof onTargetFieldsChange === "function";
|
|
13411
|
+
const commitAddField = (0, import_react76.useCallback)(() => {
|
|
13412
|
+
const raw = newFieldName.trim();
|
|
13413
|
+
if (!raw || !onTargetFieldsChange || !addingAt) return;
|
|
13414
|
+
const { parentKey, index } = addingAt;
|
|
13415
|
+
const parsed = raw.split(".").map((p) => p.trim()).filter(Boolean).map((p) => {
|
|
13416
|
+
const isArr = p.endsWith("[]");
|
|
13417
|
+
return { name: isArr ? p.slice(0, -2).trim() : p, isArray: isArr };
|
|
13418
|
+
}).filter((p) => p.name.length > 0);
|
|
13419
|
+
if (parsed.length === 0) return;
|
|
13420
|
+
const last = parsed[parsed.length - 1];
|
|
13421
|
+
const leafType = last.isArray ? "array" : newFieldType;
|
|
13422
|
+
const leafIsGroup = leafType === "object" || leafType === "array";
|
|
13423
|
+
const baseKey = makeFieldKey(targetFields, parentKey, parsed[0].name);
|
|
13424
|
+
const prefixOf = (depth) => [baseKey, ...parsed.slice(1, depth + 1).map((p) => p.name)].join(".");
|
|
13425
|
+
let node = {
|
|
13426
|
+
key: prefixOf(parsed.length - 1),
|
|
13427
|
+
label: last.name,
|
|
13428
|
+
type: leafType,
|
|
13429
|
+
custom: true,
|
|
13430
|
+
// A group with no children renders as a leaf and could never be added
|
|
13431
|
+
// to; seed it so it is immediately expandable.
|
|
13432
|
+
...leafIsGroup ? { children: [], isArray: leafType === "array" } : {}
|
|
13433
|
+
};
|
|
13434
|
+
const opened = leafIsGroup ? [node.key] : [];
|
|
13435
|
+
for (let i = parsed.length - 2; i >= 0; i--) {
|
|
13436
|
+
const key = prefixOf(i);
|
|
13437
|
+
const seg = parsed[i];
|
|
13438
|
+
node = {
|
|
13439
|
+
key,
|
|
13440
|
+
label: seg.name,
|
|
13441
|
+
// Intermediate levels are objects unless explicitly marked `[]`.
|
|
13442
|
+
type: seg.isArray ? "array" : "object",
|
|
13443
|
+
custom: true,
|
|
13444
|
+
...seg.isArray ? { isArray: true } : {},
|
|
13445
|
+
children: [node]
|
|
13446
|
+
};
|
|
13447
|
+
opened.push(key);
|
|
13448
|
+
}
|
|
13449
|
+
onTargetFieldsChange(insertField(targetFields, parentKey, index, node));
|
|
13450
|
+
setNewFieldName("");
|
|
13451
|
+
setAddingAt(null);
|
|
13452
|
+
if (opened.length > 0) {
|
|
13453
|
+
setExpandedTargets((prev) => {
|
|
13454
|
+
const next = new Set(prev);
|
|
13455
|
+
opened.forEach((k) => next.add(k));
|
|
13456
|
+
return next;
|
|
13457
|
+
});
|
|
13458
|
+
}
|
|
13459
|
+
}, [newFieldName, newFieldType, addingAt, targetFields, onTargetFieldsChange]);
|
|
13460
|
+
const commitRemoveField = (0, import_react76.useCallback)(
|
|
13461
|
+
(key) => {
|
|
13462
|
+
if (!onTargetFieldsChange) return;
|
|
13463
|
+
onTargetFieldsChange(removeField(targetFields, key));
|
|
13464
|
+
onChange(mappings.filter((m) => m.target !== key && !m.target.startsWith(`${key}.`)));
|
|
13465
|
+
},
|
|
13466
|
+
[targetFields, onTargetFieldsChange, mappings, onChange]
|
|
13467
|
+
);
|
|
13333
13468
|
const [targetSearch, setTargetSearch] = (0, import_react76.useState)("");
|
|
13334
13469
|
const [sourceSearch, setSourceSearch] = (0, import_react76.useState)("");
|
|
13335
13470
|
const [display, setDisplay] = (0, import_react76.useState)(defaultDisplay);
|
|
@@ -13485,13 +13620,119 @@ var DataMapper = (0, import_react76.forwardRef)(
|
|
|
13485
13620
|
e.dataTransfer.setData("application/x-ods-mapper", JSON.stringify({ snippet }));
|
|
13486
13621
|
e.dataTransfer.setData("text/plain", snippet);
|
|
13487
13622
|
};
|
|
13623
|
+
const renderGap = (at, key, alternatives = []) => {
|
|
13624
|
+
const hovered = hoverDepth[key];
|
|
13625
|
+
const choices = [at, ...alternatives];
|
|
13626
|
+
const active = choices[Math.min(hovered ?? 0, choices.length - 1)] ?? at;
|
|
13627
|
+
const isOpen = addingAt?.parentKey === active.parentKey && addingAt?.index === active.index;
|
|
13628
|
+
if (isOpen) {
|
|
13629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13630
|
+
"div",
|
|
13631
|
+
{
|
|
13632
|
+
className: "ods-data-mapper__add-form",
|
|
13633
|
+
style: { paddingLeft: 12 + active.depth * 16 },
|
|
13634
|
+
onKeyDown: (e) => {
|
|
13635
|
+
if (e.key === "Enter") {
|
|
13636
|
+
e.preventDefault();
|
|
13637
|
+
commitAddField();
|
|
13638
|
+
}
|
|
13639
|
+
if (e.key === "Escape") {
|
|
13640
|
+
e.preventDefault();
|
|
13641
|
+
setAddingAt(null);
|
|
13642
|
+
setNewFieldName("");
|
|
13643
|
+
}
|
|
13644
|
+
},
|
|
13645
|
+
children: [
|
|
13646
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__add-name", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13647
|
+
Input,
|
|
13648
|
+
{
|
|
13649
|
+
size: "sm",
|
|
13650
|
+
autoFocus: true,
|
|
13651
|
+
value: newFieldName,
|
|
13652
|
+
placeholder: "Name \xB7 Address.City to nest \xB7 Lines[].Amount for a list",
|
|
13653
|
+
"aria-label": "New field name",
|
|
13654
|
+
onChange: (e) => setNewFieldName(e.target.value)
|
|
13655
|
+
}
|
|
13656
|
+
) }),
|
|
13657
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__add-type", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13658
|
+
Select,
|
|
13659
|
+
{
|
|
13660
|
+
size: "sm",
|
|
13661
|
+
options: addFieldTypes.map((t) => ({ value: t, label: t })),
|
|
13662
|
+
value: newFieldType,
|
|
13663
|
+
"aria-label": "New field type",
|
|
13664
|
+
onChange: setNewFieldType
|
|
13665
|
+
}
|
|
13666
|
+
) }),
|
|
13667
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Button, { size: "sm", disabled: !newFieldName.trim(), onClick: commitAddField, children: "Add" }),
|
|
13668
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13669
|
+
Button,
|
|
13670
|
+
{
|
|
13671
|
+
size: "sm",
|
|
13672
|
+
variant: "ghost",
|
|
13673
|
+
onClick: () => {
|
|
13674
|
+
setAddingAt(null);
|
|
13675
|
+
setNewFieldName("");
|
|
13676
|
+
},
|
|
13677
|
+
children: "Cancel"
|
|
13678
|
+
}
|
|
13679
|
+
)
|
|
13680
|
+
]
|
|
13681
|
+
},
|
|
13682
|
+
key
|
|
13683
|
+
);
|
|
13684
|
+
}
|
|
13685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13686
|
+
"button",
|
|
13687
|
+
{
|
|
13688
|
+
type: "button",
|
|
13689
|
+
className: "ods-data-mapper__gap",
|
|
13690
|
+
"aria-label": choices.length > 1 ? "Add a field here \u2014 move left to add it to an outer level" : "Add a field here",
|
|
13691
|
+
onMouseMove: (e) => {
|
|
13692
|
+
if (choices.length < 2) return;
|
|
13693
|
+
const x = e.clientX - e.currentTarget.getBoundingClientRect().left;
|
|
13694
|
+
const stepsOut = Math.round(Math.max(0, 12 + at.depth * 16 - x) / 16);
|
|
13695
|
+
const next = Math.min(stepsOut, choices.length - 1);
|
|
13696
|
+
setHoverDepth((prev) => prev[key] === next ? prev : { ...prev, [key]: next });
|
|
13697
|
+
},
|
|
13698
|
+
onMouseLeave: () => setHoverDepth((prev) => {
|
|
13699
|
+
if (prev[key] === void 0) return prev;
|
|
13700
|
+
const next = { ...prev };
|
|
13701
|
+
delete next[key];
|
|
13702
|
+
return next;
|
|
13703
|
+
}),
|
|
13704
|
+
onClick: () => {
|
|
13705
|
+
setAddingAt(active);
|
|
13706
|
+
setNewFieldName("");
|
|
13707
|
+
},
|
|
13708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13709
|
+
"span",
|
|
13710
|
+
{
|
|
13711
|
+
className: "ods-data-mapper__gap-line",
|
|
13712
|
+
style: { left: 12 + active.depth * 16 },
|
|
13713
|
+
"aria-hidden": "true",
|
|
13714
|
+
children: [
|
|
13715
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__gap-rule" }),
|
|
13716
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ods-data-mapper__gap-label", children: [
|
|
13717
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__gap-plus", children: "+" }),
|
|
13718
|
+
"Add field"
|
|
13719
|
+
] }),
|
|
13720
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__gap-rule" })
|
|
13721
|
+
]
|
|
13722
|
+
}
|
|
13723
|
+
)
|
|
13724
|
+
},
|
|
13725
|
+
key
|
|
13726
|
+
);
|
|
13727
|
+
};
|
|
13488
13728
|
const rows = (0, import_react76.useMemo)(
|
|
13489
13729
|
() => flatten(targetFields, expandedTargets),
|
|
13490
13730
|
[targetFields, expandedTargets]
|
|
13491
13731
|
);
|
|
13492
13732
|
const filteredRows = (0, import_react76.useMemo)(() => {
|
|
13493
13733
|
const q2 = targetSearch.trim().toLowerCase();
|
|
13494
|
-
return rows.filter((
|
|
13734
|
+
return rows.filter((row) => {
|
|
13735
|
+
const { field } = row;
|
|
13495
13736
|
if (q2) {
|
|
13496
13737
|
const hay = `${field.label} ${field.apiName ?? ""} ${field.key}`.toLowerCase();
|
|
13497
13738
|
if (!hay.includes(q2)) return false;
|
|
@@ -13510,7 +13751,7 @@ var DataMapper = (0, import_react76.forwardRef)(
|
|
|
13510
13751
|
return all.filter((f) => f.required && !mappings.some((m) => m.target === f.key)).length;
|
|
13511
13752
|
}, [targetFields, mappings]);
|
|
13512
13753
|
const sourceRows = (0, import_react76.useMemo)(() => {
|
|
13513
|
-
const flat =
|
|
13754
|
+
const flat = flattenFields(sourceFields, expandedSource);
|
|
13514
13755
|
const q2 = sourceSearch.trim().toLowerCase();
|
|
13515
13756
|
if (!q2) return flat;
|
|
13516
13757
|
return flat.filter(
|
|
@@ -13716,218 +13957,241 @@ var DataMapper = (0, import_react76.forwardRef)(
|
|
|
13716
13957
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ods-data-mapper__grid-head-cell", children: "Target field" }),
|
|
13717
13958
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ods-data-mapper__grid-head-cell", children: "Expression" })
|
|
13718
13959
|
] }),
|
|
13719
|
-
|
|
13960
|
+
canAddFields && !targetSearch.trim() && display === "all" && renderGap({ parentKey: null, index: 0, depth: 0 }, "gap-top"),
|
|
13961
|
+
filteredRows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ods-data-mapper__empty", children: targetSearch ? "No matching target fields" : "No target fields" }) : filteredRows.map((row) => {
|
|
13962
|
+
const { field, depth } = row;
|
|
13720
13963
|
const isSelected = selectedTarget === field.key;
|
|
13721
|
-
const hasChildren =
|
|
13964
|
+
const hasChildren = isGroupField(field);
|
|
13965
|
+
const isInert = hasChildren;
|
|
13722
13966
|
const isExpanded = expandedTargets.has(field.key);
|
|
13723
13967
|
const expr = expressionFor(field.key);
|
|
13724
13968
|
const isMapped = !!expr;
|
|
13725
13969
|
const mappedChildren = hasChildren ? mappedDescendantCount(field) : 0;
|
|
13726
13970
|
const groupHasHiddenMappings = hasChildren && !isExpanded && mappedChildren > 0;
|
|
13727
|
-
|
|
13728
|
-
|
|
13729
|
-
|
|
13730
|
-
|
|
13731
|
-
|
|
13732
|
-
|
|
13733
|
-
|
|
13734
|
-
|
|
13735
|
-
|
|
13736
|
-
|
|
13737
|
-
|
|
13738
|
-
onDragEnter: (e) => {
|
|
13739
|
-
if (hasChildren) return;
|
|
13740
|
-
e.preventDefault();
|
|
13741
|
-
setDropTarget((prev) => prev === field.key ? prev : field.key);
|
|
13742
|
-
},
|
|
13743
|
-
onDragOver: (e) => {
|
|
13744
|
-
if (hasChildren) return;
|
|
13745
|
-
e.preventDefault();
|
|
13746
|
-
e.dataTransfer.dropEffect = "copy";
|
|
13747
|
-
if (dropTarget !== field.key) setDropTarget(field.key);
|
|
13748
|
-
},
|
|
13749
|
-
onDragLeave: (e) => {
|
|
13750
|
-
if (hasChildren) return;
|
|
13751
|
-
const next = e.relatedTarget;
|
|
13752
|
-
if (next && e.currentTarget.contains(next)) return;
|
|
13753
|
-
setDropTarget((prev) => prev === field.key ? null : prev);
|
|
13754
|
-
},
|
|
13755
|
-
onDrop: (e) => {
|
|
13756
|
-
if (hasChildren) return;
|
|
13757
|
-
e.preventDefault();
|
|
13758
|
-
const snippet = readDragSnippet(e);
|
|
13759
|
-
setDropTarget(null);
|
|
13760
|
-
if (snippet) dropOntoTarget(field.key, snippet);
|
|
13761
|
-
},
|
|
13762
|
-
children: [
|
|
13763
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13764
|
-
"div",
|
|
13765
|
-
{
|
|
13766
|
-
className: "ods-data-mapper__cell ods-data-mapper__cell--target",
|
|
13767
|
-
onClick: () => !hasChildren && setSelectedTarget(field.key),
|
|
13768
|
-
children: [
|
|
13769
|
-
depth > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__guides", "aria-hidden": "true", children: Array.from({ length: depth }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13770
|
-
"span",
|
|
13771
|
-
{
|
|
13772
|
-
className: cn(
|
|
13773
|
-
"ods-data-mapper__guide",
|
|
13774
|
-
i === depth - 1 && "ods-data-mapper__guide--last"
|
|
13775
|
-
)
|
|
13776
|
-
},
|
|
13777
|
-
i
|
|
13778
|
-
)) }),
|
|
13779
|
-
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13780
|
-
"button",
|
|
13781
|
-
{
|
|
13782
|
-
type: "button",
|
|
13783
|
-
className: cn(
|
|
13784
|
-
"ods-data-mapper__caret",
|
|
13785
|
-
isExpanded && "ods-data-mapper__caret--open"
|
|
13786
|
-
),
|
|
13787
|
-
onClick: (e) => {
|
|
13788
|
-
e.stopPropagation();
|
|
13789
|
-
handleToggleTarget(field.key);
|
|
13790
|
-
},
|
|
13791
|
-
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
13792
|
-
"aria-expanded": isExpanded,
|
|
13793
|
-
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronDownIcon6, {}) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronRightIcon3, {})
|
|
13794
|
-
}
|
|
13795
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__caret-spacer" }),
|
|
13796
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ods-data-mapper__field-meta", children: [
|
|
13797
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ods-data-mapper__field-label", children: [
|
|
13798
|
-
field.label,
|
|
13799
|
-
field.required && // Asterisk is decorative; the required state is
|
|
13800
|
-
// communicated to AT via the visually-hidden text
|
|
13801
|
-
// below — keeping `aria-label` on a plain <span>
|
|
13802
|
-
// would trigger axe's aria-prohibited-attr rule.
|
|
13803
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
13804
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13805
|
-
"span",
|
|
13806
|
-
{
|
|
13807
|
-
className: "ods-data-mapper__field-req",
|
|
13808
|
-
"aria-hidden": "true",
|
|
13809
|
-
children: "*"
|
|
13810
|
-
}
|
|
13811
|
-
),
|
|
13812
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13813
|
-
"span",
|
|
13814
|
-
{
|
|
13815
|
-
style: {
|
|
13816
|
-
position: "absolute",
|
|
13817
|
-
width: 1,
|
|
13818
|
-
height: 1,
|
|
13819
|
-
padding: 0,
|
|
13820
|
-
margin: -1,
|
|
13821
|
-
overflow: "hidden",
|
|
13822
|
-
clip: "rect(0,0,0,0)",
|
|
13823
|
-
whiteSpace: "nowrap",
|
|
13824
|
-
border: 0
|
|
13825
|
-
},
|
|
13826
|
-
children: [
|
|
13827
|
-
" ",
|
|
13828
|
-
"(required)"
|
|
13829
|
-
]
|
|
13830
|
-
}
|
|
13831
|
-
)
|
|
13832
|
-
] })
|
|
13833
|
-
] }),
|
|
13834
|
-
field.apiName && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__field-api", children: field.apiName })
|
|
13835
|
-
] }),
|
|
13836
|
-
renderTypePill(field.type),
|
|
13837
|
-
(field.isArray || field.type === "array" || isArrayItem) && hasChildren && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13838
|
-
"label",
|
|
13839
|
-
{
|
|
13840
|
-
className: "ods-data-mapper__foreach",
|
|
13841
|
-
onClick: (e) => e.stopPropagation(),
|
|
13842
|
-
children: [
|
|
13843
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("input", { type: "checkbox", defaultChecked: true, "aria-label": "For each record" }),
|
|
13844
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: "For each record" })
|
|
13845
|
-
]
|
|
13846
|
-
}
|
|
13847
|
-
)
|
|
13848
|
-
]
|
|
13849
|
-
}
|
|
13971
|
+
const showGaps = canAddFields && !targetSearch.trim() && display === "all";
|
|
13972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react76.Fragment, { children: [
|
|
13973
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13974
|
+
"div",
|
|
13975
|
+
{
|
|
13976
|
+
className: cn(
|
|
13977
|
+
"ods-data-mapper__row",
|
|
13978
|
+
isSelected && "ods-data-mapper__row--selected",
|
|
13979
|
+
isMapped && "ods-data-mapper__row--mapped",
|
|
13980
|
+
groupHasHiddenMappings && "ods-data-mapper__row--group-mapped",
|
|
13981
|
+
dropTarget === field.key && "ods-data-mapper__row--drop-target"
|
|
13850
13982
|
),
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
|
|
13893
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13983
|
+
"data-target-key": field.key,
|
|
13984
|
+
onDragEnter: (e) => {
|
|
13985
|
+
if (isInert) return;
|
|
13986
|
+
e.preventDefault();
|
|
13987
|
+
setDropTarget((prev) => prev === field.key ? prev : field.key);
|
|
13988
|
+
},
|
|
13989
|
+
onDragOver: (e) => {
|
|
13990
|
+
if (isInert) return;
|
|
13991
|
+
e.preventDefault();
|
|
13992
|
+
e.dataTransfer.dropEffect = "copy";
|
|
13993
|
+
if (dropTarget !== field.key) setDropTarget(field.key);
|
|
13994
|
+
},
|
|
13995
|
+
onDragLeave: (e) => {
|
|
13996
|
+
if (isInert) return;
|
|
13997
|
+
const next = e.relatedTarget;
|
|
13998
|
+
if (next && e.currentTarget.contains(next)) return;
|
|
13999
|
+
setDropTarget((prev) => prev === field.key ? null : prev);
|
|
14000
|
+
},
|
|
14001
|
+
onDrop: (e) => {
|
|
14002
|
+
if (isInert) return;
|
|
14003
|
+
e.preventDefault();
|
|
14004
|
+
const snippet = readDragSnippet(e);
|
|
14005
|
+
setDropTarget(null);
|
|
14006
|
+
if (snippet) dropOntoTarget(field.key, snippet);
|
|
14007
|
+
},
|
|
14008
|
+
children: [
|
|
14009
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
14010
|
+
"div",
|
|
14011
|
+
{
|
|
14012
|
+
className: "ods-data-mapper__cell ods-data-mapper__cell--target",
|
|
14013
|
+
onClick: () => !isInert && setSelectedTarget(field.key),
|
|
14014
|
+
children: [
|
|
14015
|
+
depth > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__guides", "aria-hidden": "true", children: Array.from({ length: depth }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14016
|
+
"span",
|
|
14017
|
+
{
|
|
14018
|
+
className: cn(
|
|
14019
|
+
"ods-data-mapper__guide",
|
|
14020
|
+
i === depth - 1 && "ods-data-mapper__guide--last"
|
|
14021
|
+
)
|
|
14022
|
+
},
|
|
14023
|
+
i
|
|
14024
|
+
)) }),
|
|
14025
|
+
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13894
14026
|
"button",
|
|
13895
14027
|
{
|
|
13896
14028
|
type: "button",
|
|
13897
|
-
className:
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
14029
|
+
className: cn(
|
|
14030
|
+
"ods-data-mapper__caret",
|
|
14031
|
+
isExpanded && "ods-data-mapper__caret--open"
|
|
14032
|
+
),
|
|
14033
|
+
onClick: (e) => {
|
|
14034
|
+
e.stopPropagation();
|
|
14035
|
+
handleToggleTarget(field.key);
|
|
13901
14036
|
},
|
|
13902
|
-
"aria-label": "
|
|
13903
|
-
|
|
13904
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14037
|
+
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
14038
|
+
"aria-expanded": isExpanded,
|
|
14039
|
+
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronDownIcon6, {}) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronRightIcon3, {})
|
|
13905
14040
|
}
|
|
13906
|
-
),
|
|
13907
|
-
|
|
13908
|
-
"
|
|
14041
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__caret-spacer" }),
|
|
14042
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ods-data-mapper__field-meta", children: [
|
|
14043
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ods-data-mapper__field-label", children: [
|
|
14044
|
+
field.label,
|
|
14045
|
+
field.required && // Asterisk is decorative; the required state is
|
|
14046
|
+
// communicated to AT via the visually-hidden text
|
|
14047
|
+
// below — keeping `aria-label` on a plain <span>
|
|
14048
|
+
// would trigger axe's aria-prohibited-attr rule.
|
|
14049
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
14050
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14051
|
+
"span",
|
|
14052
|
+
{
|
|
14053
|
+
className: "ods-data-mapper__field-req",
|
|
14054
|
+
"aria-hidden": "true",
|
|
14055
|
+
children: "*"
|
|
14056
|
+
}
|
|
14057
|
+
),
|
|
14058
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
14059
|
+
"span",
|
|
14060
|
+
{
|
|
14061
|
+
style: {
|
|
14062
|
+
position: "absolute",
|
|
14063
|
+
width: 1,
|
|
14064
|
+
height: 1,
|
|
14065
|
+
padding: 0,
|
|
14066
|
+
margin: -1,
|
|
14067
|
+
overflow: "hidden",
|
|
14068
|
+
clip: "rect(0,0,0,0)",
|
|
14069
|
+
whiteSpace: "nowrap",
|
|
14070
|
+
border: 0
|
|
14071
|
+
},
|
|
14072
|
+
children: [
|
|
14073
|
+
" ",
|
|
14074
|
+
"(required)"
|
|
14075
|
+
]
|
|
14076
|
+
}
|
|
14077
|
+
)
|
|
14078
|
+
] })
|
|
14079
|
+
] }),
|
|
14080
|
+
field.apiName && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__field-api", children: field.apiName })
|
|
14081
|
+
] }),
|
|
14082
|
+
field.custom && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
14083
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__field-custom", children: "custom" }),
|
|
14084
|
+
canAddFields && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14085
|
+
"button",
|
|
14086
|
+
{
|
|
14087
|
+
type: "button",
|
|
14088
|
+
className: "ods-data-mapper__field-remove",
|
|
14089
|
+
"aria-label": `Remove ${field.label}`,
|
|
14090
|
+
title: `Remove ${field.label}`,
|
|
14091
|
+
onClick: (e) => {
|
|
14092
|
+
e.stopPropagation();
|
|
14093
|
+
commitRemoveField(field.key);
|
|
14094
|
+
},
|
|
14095
|
+
children: "\xD7"
|
|
14096
|
+
}
|
|
14097
|
+
)
|
|
14098
|
+
] }),
|
|
14099
|
+
renderTypePill(field.type),
|
|
14100
|
+
isArrayField(field) && hasChildren && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
14101
|
+
"label",
|
|
13909
14102
|
{
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
14103
|
+
className: "ods-data-mapper__foreach",
|
|
14104
|
+
onClick: (e) => e.stopPropagation(),
|
|
14105
|
+
children: [
|
|
14106
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("input", { type: "checkbox", defaultChecked: true, "aria-label": "For each record" }),
|
|
14107
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: "For each record" })
|
|
14108
|
+
]
|
|
13916
14109
|
}
|
|
13917
14110
|
)
|
|
13918
|
-
]
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
14111
|
+
]
|
|
14112
|
+
}
|
|
14113
|
+
),
|
|
14114
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14115
|
+
"div",
|
|
14116
|
+
{
|
|
14117
|
+
className: cn(
|
|
14118
|
+
"ods-data-mapper__cell",
|
|
14119
|
+
"ods-data-mapper__cell--expr",
|
|
14120
|
+
isSelected && "ods-data-mapper__cell--expr-editing"
|
|
14121
|
+
),
|
|
14122
|
+
onClick: () => !isInert && setSelectedTarget(field.key),
|
|
14123
|
+
children: isInert ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ods-data-mapper__expr-group", children: [
|
|
14124
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ods-data-mapper__expr-group-count", children: [
|
|
14125
|
+
"Group \xB7 ",
|
|
14126
|
+
field.children?.length ?? 0,
|
|
14127
|
+
" sub-field",
|
|
14128
|
+
field.children?.length === 1 ? "" : "s"
|
|
14129
|
+
] }),
|
|
14130
|
+
mappedChildren > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
14131
|
+
"span",
|
|
14132
|
+
{
|
|
14133
|
+
className: "ods-data-mapper__expr-group-badge",
|
|
14134
|
+
title: `${mappedChildren} of ${field.children?.length ?? 0} sub-fields mapped`,
|
|
14135
|
+
children: [
|
|
14136
|
+
mappedChildren,
|
|
14137
|
+
" mapped"
|
|
14138
|
+
]
|
|
14139
|
+
}
|
|
14140
|
+
)
|
|
14141
|
+
] }) : isSelected ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ods-data-mapper__editor", onClick: (e) => e.stopPropagation(), children: [
|
|
14142
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14143
|
+
ExpressionEditor,
|
|
14144
|
+
{
|
|
14145
|
+
editorRef,
|
|
14146
|
+
value: expr,
|
|
14147
|
+
sourceFields,
|
|
14148
|
+
variables,
|
|
14149
|
+
onChange: (v) => setExpression(field.key, v),
|
|
14150
|
+
onEscape: () => setSelectedTarget(null),
|
|
14151
|
+
onDropSnippet: (snippet) => dropOntoTarget(field.key, snippet),
|
|
14152
|
+
readDragSnippet
|
|
14153
|
+
}
|
|
14154
|
+
),
|
|
14155
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ods-data-mapper__editor-actions", children: [
|
|
14156
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14157
|
+
"button",
|
|
14158
|
+
{
|
|
14159
|
+
type: "button",
|
|
14160
|
+
className: "ods-data-mapper__editor-fx",
|
|
14161
|
+
onClick: () => {
|
|
14162
|
+
setSidebarOpen(true);
|
|
14163
|
+
setSidebarTab("functions");
|
|
14164
|
+
},
|
|
14165
|
+
"aria-label": "Insert function",
|
|
14166
|
+
title: "Functions",
|
|
14167
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FxIcon, {})
|
|
14168
|
+
}
|
|
14169
|
+
),
|
|
14170
|
+
expr && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
14171
|
+
"button",
|
|
14172
|
+
{
|
|
14173
|
+
type: "button",
|
|
14174
|
+
className: "ods-data-mapper__editor-clear",
|
|
14175
|
+
onClick: () => setExpression(field.key, ""),
|
|
14176
|
+
"aria-label": "Clear expression",
|
|
14177
|
+
title: "Clear",
|
|
14178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TrashIcon, {})
|
|
14179
|
+
}
|
|
14180
|
+
)
|
|
14181
|
+
] })
|
|
14182
|
+
] }) : isMapped ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__expr-render", title: expr, children: renderExpressionSegments(
|
|
14183
|
+
expr,
|
|
14184
|
+
sourceFields,
|
|
14185
|
+
variables,
|
|
14186
|
+
(tokenIndex) => removeTokenAt(field.key, tokenIndex)
|
|
14187
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ods-data-mapper__expr-empty", children: dropTarget === field.key ? "Drop to map" : "Drag a field here or click to edit" })
|
|
14188
|
+
}
|
|
14189
|
+
)
|
|
14190
|
+
]
|
|
14191
|
+
}
|
|
14192
|
+
),
|
|
14193
|
+
showGaps && renderGap(row.insertAt, `gap-${field.key}`, row.insertAlternatives)
|
|
14194
|
+
] }, field.key);
|
|
13931
14195
|
})
|
|
13932
14196
|
] }),
|
|
13933
14197
|
sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("aside", { className: "ods-data-mapper__sidebar", "aria-label": "Data Stream", children: [
|