nucleus-core-ts 0.9.827 → 0.9.829

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.
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useId } from 'react';
4
- import { describeCron, parseCron } from '../../../../src/Services/Integrations/cron';
4
+ import { describeCron, parseCron } from '../../../../src/Shared/cron';
5
5
  import { integrationsPageTheme } from '../theme';
6
6
  import { Field, Notice } from './Primitives';
7
7
  /**
@@ -191,6 +191,95 @@ export function ReferenceCheckRows({ rows, targetFields, targets, disabled, onCh
191
191
  })
192
192
  ]
193
193
  }),
194
+ row.onMissing === 'create' ? /*#__PURE__*/ _jsxs("div", {
195
+ className: "mt-3 flex flex-col gap-2",
196
+ children: [
197
+ /*#__PURE__*/ _jsxs("div", {
198
+ className: "flex flex-wrap items-center justify-between gap-2",
199
+ children: [
200
+ /*#__PURE__*/ _jsx("span", {
201
+ className: theme.field.label,
202
+ children: "Also fill on the values it creates"
203
+ }),
204
+ /*#__PURE__*/ _jsx("button", {
205
+ className: theme.button.ghost,
206
+ disabled: disabled || !referenced,
207
+ onClick: ()=>patch(index, {
208
+ createValues: [
209
+ ...row.createValues ?? [],
210
+ {
211
+ column: '',
212
+ from: ''
213
+ }
214
+ ]
215
+ }),
216
+ type: "button",
217
+ children: "Add a column"
218
+ })
219
+ ]
220
+ }),
221
+ (row.createValues ?? []).length === 0 ? /*#__PURE__*/ _jsx("p", {
222
+ className: theme.field.hint,
223
+ children: `A new ${row.entity || 'row'} carries only the value itself. The record that needed it usually has the rest — its code, its parent — and those can be filled here.`
224
+ }) : null,
225
+ (row.createValues ?? []).map((pair, pairIndex)=>/*#__PURE__*/ _jsxs("div", {
226
+ className: "grid grid-cols-1 gap-2 sm:grid-cols-[1fr_1fr_auto]",
227
+ children: [
228
+ /*#__PURE__*/ _jsxs("select", {
229
+ className: theme.field.input,
230
+ disabled: disabled,
231
+ onChange: (event)=>patch(index, {
232
+ createValues: (row.createValues ?? []).with(pairIndex, {
233
+ ...pair,
234
+ column: event.target.value
235
+ })
236
+ }),
237
+ value: pair.column,
238
+ children: [
239
+ /*#__PURE__*/ _jsx("option", {
240
+ value: "",
241
+ children: "Column to fill…"
242
+ }),
243
+ (referenced?.fields ?? []).map((field)=>/*#__PURE__*/ _jsx("option", {
244
+ value: field,
245
+ children: field
246
+ }, field))
247
+ ]
248
+ }),
249
+ /*#__PURE__*/ _jsxs("select", {
250
+ className: theme.field.input,
251
+ disabled: disabled,
252
+ onChange: (event)=>patch(index, {
253
+ createValues: (row.createValues ?? []).with(pairIndex, {
254
+ ...pair,
255
+ from: event.target.value
256
+ })
257
+ }),
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
+ }),
270
+ /*#__PURE__*/ _jsx("button", {
271
+ className: theme.button.ghost,
272
+ disabled: disabled,
273
+ onClick: ()=>patch(index, {
274
+ createValues: (row.createValues ?? []).toSpliced(pairIndex, 1)
275
+ }),
276
+ type: "button",
277
+ children: "Remove"
278
+ })
279
+ ]
280
+ }, pairIndex))
281
+ ]
282
+ }) : null,
194
283
  /*#__PURE__*/ _jsxs("div", {
195
284
  className: "mt-2 flex items-center justify-between gap-3",
196
285
  children: [
@@ -111,6 +111,16 @@ export type ReferenceCheckValue = {
111
111
  /** Column in that entity to match against. */
112
112
  entityColumn: string;
113
113
  onMissing: 'create' | 'skipRecord' | 'ignore';
114
+ /**
115
+ * Other columns to fill when this run CREATES the missing value.
116
+ *
117
+ * A department created from nothing but its own name is a row somebody has to
118
+ * finish by hand — and the record that needed it usually carries the rest.
119
+ */
120
+ createValues?: {
121
+ column: string;
122
+ from: string;
123
+ }[];
114
124
  };
115
125
  /**
116
126
  * A login created alongside each imported record.