ballerina-core 1.0.190 → 1.0.191
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 +1 -1
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/state.ts +2 -1
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/template.tsx +10 -9
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/state.ts +2 -1
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/template.tsx +9 -4
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
DispatchOnChange,
|
|
9
9
|
ListType,
|
|
10
10
|
ValueCallbackWithOptionalFlags,
|
|
11
|
+
ValueUnit,
|
|
11
12
|
VoidCallbackWithOptionalFlags,
|
|
12
13
|
} from "../../../../../../../../main";
|
|
13
14
|
import { Unit } from "../../../../../../../fun/domains/unit/state";
|
|
@@ -21,7 +22,7 @@ export type ListAbstractRendererReadonlyContext<
|
|
|
21
22
|
ExtraContext,
|
|
22
23
|
> = CommonAbstractRendererReadonlyContext<
|
|
23
24
|
ListType<any>,
|
|
24
|
-
ValueTuple,
|
|
25
|
+
ValueTuple | ValueUnit,
|
|
25
26
|
CustomPresentationContext,
|
|
26
27
|
ExtraContext
|
|
27
28
|
>;
|
package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/template.tsx
CHANGED
|
@@ -16,10 +16,7 @@ import {
|
|
|
16
16
|
} from "../../../../../../../../main";
|
|
17
17
|
import { Template } from "../../../../../../../template/state";
|
|
18
18
|
import { ListMethods } from "../../../../deserializer/domains/specification/domains/forms/domains/renderer/domains/list/state";
|
|
19
|
-
import {
|
|
20
|
-
DispatchParsedType,
|
|
21
|
-
StringSerializedType,
|
|
22
|
-
} from "../../../../deserializer/domains/specification/domains/types/state";
|
|
19
|
+
import { DispatchParsedType } from "../../../../deserializer/domains/specification/domains/types/state";
|
|
23
20
|
import {
|
|
24
21
|
ListAbstractRendererForeignMutationsExpected,
|
|
25
22
|
ListAbstractRendererReadonlyContext,
|
|
@@ -63,8 +60,9 @@ export const ListAbstractRenderer = <
|
|
|
63
60
|
) => ({
|
|
64
61
|
disabled: _.disabled,
|
|
65
62
|
locked: _.locked,
|
|
66
|
-
value:
|
|
67
|
-
_.value
|
|
63
|
+
value: PredicateValue.Operations.IsUnit(_.value)
|
|
64
|
+
? _.value
|
|
65
|
+
: _.value.values.get(elementIndex) || GetDefaultElementValue(),
|
|
68
66
|
...(_.elementFormStates?.get(elementIndex) ||
|
|
69
67
|
GetDefaultElementState()),
|
|
70
68
|
bindings: _.bindings,
|
|
@@ -154,15 +152,18 @@ export const ListAbstractRenderer = <
|
|
|
154
152
|
>((props) => {
|
|
155
153
|
const domNodeId = props.context.domNodeAncestorPath + "[list]";
|
|
156
154
|
|
|
157
|
-
if (
|
|
155
|
+
if (
|
|
156
|
+
!PredicateValue.Operations.IsTuple(props.context.value) &&
|
|
157
|
+
!PredicateValue.Operations.IsUnit(props.context.value)
|
|
158
|
+
) {
|
|
158
159
|
console.error(
|
|
159
|
-
`Tuple value expected but got: ${JSON.stringify(
|
|
160
|
+
`Tuple or unit value expected but got: ${JSON.stringify(
|
|
160
161
|
props.context.value,
|
|
161
162
|
)}\n...When rendering \n...${domNodeId}`,
|
|
162
163
|
);
|
|
163
164
|
return (
|
|
164
165
|
<ErrorRenderer
|
|
165
|
-
message={`${domNodeId}: Tuple value expected for list but got ${JSON.stringify(
|
|
166
|
+
message={`${domNodeId}: Tuple or unit value expected for list but got ${JSON.stringify(
|
|
166
167
|
props.context.value,
|
|
167
168
|
)}`}
|
|
168
169
|
/>
|
package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/state.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
simpleUpdater,
|
|
7
7
|
Template,
|
|
8
8
|
Updater,
|
|
9
|
+
ValueUnit,
|
|
9
10
|
ValueRecord,
|
|
10
11
|
View,
|
|
11
12
|
DispatchOnChange,
|
|
@@ -23,7 +24,7 @@ export type RecordAbstractRendererReadonlyContext<
|
|
|
23
24
|
ExtraContext,
|
|
24
25
|
> = CommonAbstractRendererReadonlyContext<
|
|
25
26
|
RecordType<any>,
|
|
26
|
-
ValueRecord,
|
|
27
|
+
ValueRecord | ValueUnit,
|
|
27
28
|
CustomPresentationContext,
|
|
28
29
|
ExtraContext
|
|
29
30
|
>;
|
package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/template.tsx
CHANGED
|
@@ -93,7 +93,9 @@ export const RecordAbstractRenderer = <
|
|
|
93
93
|
> &
|
|
94
94
|
RecordAbstractRendererState,
|
|
95
95
|
) => ({
|
|
96
|
-
value: _.value
|
|
96
|
+
value: PredicateValue.Operations.IsUnit(_.value)
|
|
97
|
+
? _.value
|
|
98
|
+
: _.value.fields.get(fieldName)!,
|
|
97
99
|
type: _.type.fields.get(fieldName)!,
|
|
98
100
|
...(_.fieldStates?.get(fieldName) ||
|
|
99
101
|
FieldTemplates.get(fieldName)!.GetDefaultState()),
|
|
@@ -201,15 +203,18 @@ export const RecordAbstractRenderer = <
|
|
|
201
203
|
>((props) => {
|
|
202
204
|
const domNodeId = props.context.domNodeAncestorPath + "[record]";
|
|
203
205
|
|
|
204
|
-
if (
|
|
206
|
+
if (
|
|
207
|
+
!PredicateValue.Operations.IsRecord(props.context.value) &&
|
|
208
|
+
!PredicateValue.Operations.IsUnit(props.context.value)
|
|
209
|
+
) {
|
|
205
210
|
console.error(
|
|
206
|
-
`Record expected but got: ${JSON.stringify(
|
|
211
|
+
`Record or unit value expected but got: ${JSON.stringify(
|
|
207
212
|
props.context.value,
|
|
208
213
|
)}\n...When rendering \n...${domNodeId}`,
|
|
209
214
|
);
|
|
210
215
|
return (
|
|
211
216
|
<ErrorRenderer
|
|
212
|
-
message={`${domNodeId}: Record value expected but got ${JSON.stringify(
|
|
217
|
+
message={`${domNodeId}: Record or unit value expected but got ${JSON.stringify(
|
|
213
218
|
props.context.value,
|
|
214
219
|
)}`}
|
|
215
220
|
/>
|