ballerina-core 1.0.208 → 1.0.209
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/package.json
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
Value,
|
|
30
30
|
SumNType,
|
|
31
31
|
ValueSumN,
|
|
32
|
+
ValueUnit,
|
|
32
33
|
} from "../../../../../../../../main";
|
|
33
34
|
import { Template, View } from "../../../../../../../template/state";
|
|
34
35
|
|
|
@@ -48,7 +49,10 @@ export type TableAbstractRendererReadonlyContext<
|
|
|
48
49
|
highlightedFilters: Array<string>;
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
export type TableAbstractRendererSelectedDetailRow =
|
|
52
|
+
export type TableAbstractRendererSelectedDetailRow =
|
|
53
|
+
| string
|
|
54
|
+
| undefined
|
|
55
|
+
| ValueUnit;
|
|
52
56
|
|
|
53
57
|
export type TableAbstractRendererState = CommonAbstractRendererState & {
|
|
54
58
|
customFormState: {
|
package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/table/template.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
Updater,
|
|
37
37
|
SumNType,
|
|
38
38
|
DispatchTableApiSource,
|
|
39
|
+
ValueUnit,
|
|
39
40
|
} from "../../../../../../../../main";
|
|
40
41
|
import { Template } from "../../../../../../../template/state";
|
|
41
42
|
import {
|
|
@@ -310,7 +311,21 @@ export const TableAbstractRenderer = <
|
|
|
310
311
|
return undefined;
|
|
311
312
|
}
|
|
312
313
|
|
|
313
|
-
|
|
314
|
+
if (
|
|
315
|
+
!PredicateValue.Operations.IsString(selectedDetailRow) &&
|
|
316
|
+
!PredicateValue.Operations.IsUnit(selectedDetailRow)
|
|
317
|
+
) {
|
|
318
|
+
console.error(
|
|
319
|
+
`Selected detail row is not a string or unit\n
|
|
320
|
+
...When rendering table field\n
|
|
321
|
+
...${_.domNodeAncestorPath}`,
|
|
322
|
+
);
|
|
323
|
+
return undefined;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const value = PredicateValue.Operations.IsUnit(selectedDetailRow)
|
|
327
|
+
? ValueUnit.Default()
|
|
328
|
+
: _.value.data.get(selectedDetailRow);
|
|
314
329
|
|
|
315
330
|
if (value == undefined) {
|
|
316
331
|
console.error(
|
|
@@ -321,9 +336,10 @@ export const TableAbstractRenderer = <
|
|
|
321
336
|
return undefined;
|
|
322
337
|
}
|
|
323
338
|
|
|
324
|
-
const rowState =
|
|
325
|
-
_.customFormState.rowStates.get(selectedDetailRow) ??
|
|
326
|
-
|
|
339
|
+
const rowState = PredicateValue.Operations.IsString(selectedDetailRow)
|
|
340
|
+
? (_.customFormState.rowStates.get(selectedDetailRow) ??
|
|
341
|
+
RecordAbstractRendererState.Default.fieldState(Map()))
|
|
342
|
+
: RecordAbstractRendererState.Default.fieldState(Map());
|
|
327
343
|
|
|
328
344
|
return {
|
|
329
345
|
value,
|
|
@@ -353,7 +369,9 @@ export const TableAbstractRenderer = <
|
|
|
353
369
|
);
|
|
354
370
|
return id;
|
|
355
371
|
}
|
|
356
|
-
|
|
372
|
+
if (!PredicateValue.Operations.IsString(selectedDetailRow)) {
|
|
373
|
+
return id;
|
|
374
|
+
}
|
|
357
375
|
return TableAbstractRendererState.Updaters.Core.customFormState.children.rowStates(
|
|
358
376
|
MapRepo.Updaters.upsert(
|
|
359
377
|
selectedDetailRow,
|
|
@@ -380,43 +398,48 @@ export const TableAbstractRenderer = <
|
|
|
380
398
|
return id;
|
|
381
399
|
}
|
|
382
400
|
|
|
383
|
-
if (
|
|
401
|
+
if (
|
|
402
|
+
!PredicateValue.Operations.IsString(selectedDetailRow) &&
|
|
403
|
+
!PredicateValue.Operations.IsUnit(selectedDetailRow)
|
|
404
|
+
) {
|
|
384
405
|
console.error(
|
|
385
|
-
`
|
|
406
|
+
`Selected detail row is not a string or unit\n
|
|
386
407
|
...When rendering table field\n
|
|
387
408
|
...${props.context.domNodeAncestorPath}`,
|
|
388
409
|
);
|
|
389
410
|
return id;
|
|
390
411
|
}
|
|
391
412
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
413
|
+
if (PredicateValue.Operations.IsString(selectedDetailRow)) {
|
|
414
|
+
props.setState(
|
|
415
|
+
TableAbstractRendererState.Updaters.Core.commonFormState.children.modifiedByUser(
|
|
416
|
+
replaceWith(true),
|
|
417
|
+
),
|
|
418
|
+
);
|
|
397
419
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
const delta: DispatchDelta<Flags> = {
|
|
421
|
+
kind: "TableValue",
|
|
422
|
+
id: selectedDetailRow,
|
|
423
|
+
nestedDelta: nestedDelta,
|
|
424
|
+
flags,
|
|
425
|
+
sourceAncestorLookupTypeNames:
|
|
426
|
+
nestedDelta.sourceAncestorLookupTypeNames,
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
const updater =
|
|
430
|
+
nestedUpdater.kind == "l"
|
|
431
|
+
? nestedUpdater
|
|
432
|
+
: Option.Default.some(
|
|
433
|
+
ValueTable.Updaters.data(
|
|
434
|
+
MapRepo.Updaters.update(
|
|
435
|
+
selectedDetailRow,
|
|
436
|
+
nestedUpdater.value,
|
|
437
|
+
),
|
|
415
438
|
),
|
|
416
|
-
)
|
|
417
|
-
);
|
|
439
|
+
);
|
|
418
440
|
|
|
419
|
-
|
|
441
|
+
props.foreignMutations.onChange(updater, delta);
|
|
442
|
+
}
|
|
420
443
|
},
|
|
421
444
|
}))
|
|
422
445
|
: undefined;
|
|
@@ -575,6 +598,17 @@ export const TableAbstractRenderer = <
|
|
|
575
598
|
return <></>;
|
|
576
599
|
}
|
|
577
600
|
|
|
601
|
+
// Detail row may have been deleted from outside the table
|
|
602
|
+
const isSelectedDetailRowValid =
|
|
603
|
+
props.context.customFormState.selectedDetailRow != undefined &&
|
|
604
|
+
!PredicateValue.Operations.IsUnit(
|
|
605
|
+
props.context.customFormState.selectedDetailRow,
|
|
606
|
+
) &&
|
|
607
|
+
props.context.value.data.size > 0 &&
|
|
608
|
+
props.context.value.data.has(
|
|
609
|
+
props.context.customFormState.selectedDetailRow,
|
|
610
|
+
);
|
|
611
|
+
|
|
578
612
|
return (
|
|
579
613
|
<>
|
|
580
614
|
<IdProvider domNodeId={domNodeId}>
|
|
@@ -582,6 +616,12 @@ export const TableAbstractRenderer = <
|
|
|
582
616
|
{...props}
|
|
583
617
|
context={{
|
|
584
618
|
...props.context,
|
|
619
|
+
customFormState: {
|
|
620
|
+
...props.context.customFormState,
|
|
621
|
+
selectedDetailRow: isSelectedDetailRowValid
|
|
622
|
+
? props.context.customFormState.selectedDetailRow
|
|
623
|
+
: undefined,
|
|
624
|
+
},
|
|
585
625
|
domNodeId,
|
|
586
626
|
tableHeaders: validVisibleColumns,
|
|
587
627
|
columnLabels: ColumnLabels,
|