nucleus-core-ts 0.9.835 → 0.9.837

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.
@@ -202,6 +202,7 @@ export function MappingEditor({ mapping, targets, targetsLoading, endpoints, fre
202
202
  referenceChecks: rows
203
203
  }),
204
204
  rows: draft.referenceChecks,
205
+ sourceFields: sourceFields,
205
206
  targetFields: targetFields,
206
207
  targets: targets
207
208
  }),
@@ -4,9 +4,18 @@ export type ReferenceCheckRowsProps = {
4
4
  rows: ReferenceCheckValue[];
5
5
  /** Columns of the entity being written into. */
6
6
  targetFields: string[];
7
+ /**
8
+ * Field names the source really sends.
9
+ *
10
+ * A value being created is usually described by fields the mapping had no
11
+ * reason to write onto the record — the source sends
12
+ * `{code, value}` and the record keeps only the value. The engine reads the
13
+ * SOURCE first, so this offers what it can actually reach.
14
+ */
15
+ sourceFields?: string[];
7
16
  /** Every entity an import may read or write, with its columns. */
8
17
  targets: MappingTarget[];
9
18
  disabled?: boolean;
10
19
  onChange: (rows: ReferenceCheckValue[]) => void;
11
20
  };
12
- export declare function ReferenceCheckRows({ rows, targetFields, targets, disabled, onChange, }: ReferenceCheckRowsProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function ReferenceCheckRows({ rows, targetFields, sourceFields, targets, disabled, onChange, }: ReferenceCheckRowsProps): import("react/jsx-runtime").JSX.Element;
@@ -36,8 +36,9 @@ const EMPTY = {
36
36
  entityColumn: '',
37
37
  onMissing: 'skipRecord'
38
38
  };
39
- export function ReferenceCheckRows({ rows, targetFields, targets, disabled, onChange }) {
39
+ export function ReferenceCheckRows({ rows, targetFields, sourceFields = [], targets, disabled, onChange }) {
40
40
  const uid = useId();
41
+ const fromListId = `${uid}-from-fields`;
41
42
  const patch = (index, next)=>{
42
43
  const current = rows[index];
43
44
  if (!current) return;
@@ -68,6 +69,15 @@ export function ReferenceCheckRows({ rows, targetFields, targets, disabled, onCh
68
69
  })
69
70
  ]
70
71
  }),
72
+ /*#__PURE__*/ _jsx("datalist", {
73
+ id: fromListId,
74
+ children: [
75
+ ...sourceFields,
76
+ ...targetFields
77
+ ].map((field)=>/*#__PURE__*/ _jsx("option", {
78
+ value: field
79
+ }, field))
80
+ }),
71
81
  rows.length === 0 ? /*#__PURE__*/ _jsx("p", {
72
82
  className: theme.list.empty,
73
83
  children: "Nothing is checked. A record whose department or location does not exist here yet will be written pointing at nothing."
@@ -246,26 +256,18 @@ export function ReferenceCheckRows({ rows, targetFields, targets, disabled, onCh
246
256
  }, field))
247
257
  ]
248
258
  }),
249
- /*#__PURE__*/ _jsxs("select", {
259
+ /*#__PURE__*/ _jsx("input", {
250
260
  className: theme.field.input,
251
261
  disabled: disabled,
262
+ list: fromListId,
252
263
  onChange: (event)=>patch(index, {
253
264
  createValues: (row.createValues ?? []).with(pairIndex, {
254
265
  ...pair,
255
266
  from: event.target.value
256
267
  })
257
268
  }),
258
- value: pair.from,
259
- children: [
260
- /*#__PURE__*/ _jsx("option", {
261
- value: "",
262
- children: "…from this record's"
263
- }),
264
- targetFields.map((field)=>/*#__PURE__*/ _jsx("option", {
265
- value: field,
266
- children: field
267
- }, field))
268
- ]
269
+ placeholder: "…from the source, e.g. type.code",
270
+ value: pair.from
269
271
  }),
270
272
  /*#__PURE__*/ _jsx("button", {
271
273
  className: theme.button.ghost,