ballerina-core 1.0.216 → 1.0.218
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/built-ins/state.ts +8 -1
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_debouncer.ts +1 -1
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeStream.ts +1 -1
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/builder.ts +1 -1
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/state.ts +9 -5
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.tsx +19 -12
package/package.json
CHANGED
|
@@ -1821,7 +1821,14 @@ export const dispatchToAPIRawValue =
|
|
|
1821
1821
|
types,
|
|
1822
1822
|
converters,
|
|
1823
1823
|
injectedPrimitives,
|
|
1824
|
-
)(raw.fields, formState)
|
|
1824
|
+
)(raw.fields, formState).Then((value) =>
|
|
1825
|
+
ValueOrErrors.Default.return(
|
|
1826
|
+
converters["union"].toAPIRawValue([
|
|
1827
|
+
{ caseName, fields: value },
|
|
1828
|
+
formState?.commonFormState?.modifiedByUser ?? false,
|
|
1829
|
+
]),
|
|
1830
|
+
),
|
|
1831
|
+
);
|
|
1825
1832
|
}
|
|
1826
1833
|
|
|
1827
1834
|
if (t.kind == "singleSelection") {
|
|
@@ -15,7 +15,7 @@ export const debouncer = <
|
|
|
15
15
|
DebouncerCo<CustomPresentationContext, ExtraContext>().Repeat(
|
|
16
16
|
DebouncerCo<CustomPresentationContext, ExtraContext>().Seq([
|
|
17
17
|
Debounce<
|
|
18
|
-
Value<Map<string, string
|
|
18
|
+
Value<[Map<string, string>, boolean]>,
|
|
19
19
|
{ onDebounce: SimpleCallback<void> }
|
|
20
20
|
>(
|
|
21
21
|
DebouncedCo.GetState()
|
|
@@ -32,7 +32,7 @@ export const initializeStream = <
|
|
|
32
32
|
100,
|
|
33
33
|
// safe because we check for undefined in the runFilter
|
|
34
34
|
current.customFormState.getChunkWithParams!(maybeId.value)(
|
|
35
|
-
current.customFormState.streamParams.value,
|
|
35
|
+
current.customFormState.streamParams.value[0],
|
|
36
36
|
),
|
|
37
37
|
),
|
|
38
38
|
),
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
RecordAbstractRendererState,
|
|
21
21
|
ValueUnit,
|
|
22
22
|
MapRepo,
|
|
23
|
-
BasicFun2,
|
|
24
23
|
Value,
|
|
25
24
|
ValueCallbackWithOptionalFlags,
|
|
26
25
|
VoidCallbackWithOptionalFlags,
|
|
@@ -31,6 +30,7 @@ import {
|
|
|
31
30
|
BaseFlags,
|
|
32
31
|
Sum,
|
|
33
32
|
PredicateValue,
|
|
33
|
+
replaceWith,
|
|
34
34
|
} from "../../../../../../../../main";
|
|
35
35
|
import { Debounced } from "../../../../../../../debounced/state";
|
|
36
36
|
|
|
@@ -52,7 +52,7 @@ export type OneAbstractRendererState = CommonAbstractRendererState & {
|
|
|
52
52
|
customFormState: {
|
|
53
53
|
detailsState: RecordAbstractRendererState;
|
|
54
54
|
previewStates: Map<string, RecordAbstractRendererState>;
|
|
55
|
-
streamParams: Debounced<Value<Map<string, string
|
|
55
|
+
streamParams: Debounced<Value<[Map<string, string>, boolean]>>;
|
|
56
56
|
status: "open" | "closed";
|
|
57
57
|
stream: Sum<ValueInfiniteStreamState, "not initialized">;
|
|
58
58
|
getChunkWithParams:
|
|
@@ -77,7 +77,7 @@ export const OneAbstractRendererState = {
|
|
|
77
77
|
customFormState: {
|
|
78
78
|
detailsState: RecordAbstractRendererState.Default.zero(),
|
|
79
79
|
previewStates: Map(),
|
|
80
|
-
streamParams: Debounced.Default(Value.Default(Map())),
|
|
80
|
+
streamParams: Debounced.Default(Value.Default([Map(), false])),
|
|
81
81
|
status: "closed",
|
|
82
82
|
getChunkWithParams: getChunk,
|
|
83
83
|
stream: Sum.Default.right("not initialized"),
|
|
@@ -112,10 +112,14 @@ export const OneAbstractRendererState = {
|
|
|
112
112
|
streamParam: (
|
|
113
113
|
key: string,
|
|
114
114
|
_: BasicUpdater<string>,
|
|
115
|
+
shouldReload: boolean,
|
|
115
116
|
): Updater<OneAbstractRendererState> =>
|
|
116
117
|
OneAbstractRendererState.Updaters.Core.customFormState.children.streamParams(
|
|
117
118
|
Debounced.Updaters.Template.value(
|
|
118
|
-
Value.Updaters.value(
|
|
119
|
+
Value.Updaters.value((__) => [
|
|
120
|
+
MapRepo.Updaters.upsert(key, () => "", _)(__[0]),
|
|
121
|
+
shouldReload,
|
|
122
|
+
]),
|
|
119
123
|
),
|
|
120
124
|
),
|
|
121
125
|
},
|
|
@@ -182,7 +186,7 @@ export type OneAbstractRendererViewForeignMutationsExpected<Flags = BaseFlags> =
|
|
|
182
186
|
{
|
|
183
187
|
onChange: DispatchOnChange<ValueOption | ValueUnit, Flags>;
|
|
184
188
|
toggleOpen: SimpleCallback<void>;
|
|
185
|
-
setStreamParam:
|
|
189
|
+
setStreamParam: (key: string, value: string, shouldReload: boolean) => void;
|
|
186
190
|
select: ValueCallbackWithOptionalFlags<ValueRecord, Flags>;
|
|
187
191
|
create: ValueCallbackWithOptionalFlags<ValueRecord, Flags>;
|
|
188
192
|
delete?: VoidCallbackWithOptionalFlags<Flags>;
|
package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.tsx
CHANGED
|
@@ -338,11 +338,16 @@ export const OneAbstractRenderer = <
|
|
|
338
338
|
: id,
|
|
339
339
|
),
|
|
340
340
|
),
|
|
341
|
-
setStreamParam: (
|
|
341
|
+
setStreamParam: (
|
|
342
|
+
key: string,
|
|
343
|
+
value: string,
|
|
344
|
+
shouldReload: boolean,
|
|
345
|
+
) =>
|
|
342
346
|
props.setState(
|
|
343
347
|
OneAbstractRendererState.Updaters.Template.streamParam(
|
|
344
348
|
key,
|
|
345
|
-
replaceWith(
|
|
349
|
+
replaceWith(value),
|
|
350
|
+
shouldReload,
|
|
346
351
|
).then(
|
|
347
352
|
OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
|
|
348
353
|
Sum.Updaters.left(
|
|
@@ -457,18 +462,20 @@ export const OneAbstractRenderer = <
|
|
|
457
462
|
return {
|
|
458
463
|
...props.context,
|
|
459
464
|
onDebounce: () => {
|
|
460
|
-
props.
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
465
|
+
if (props.context.customFormState.streamParams.value[1]) {
|
|
466
|
+
props.setState(
|
|
467
|
+
OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
|
|
468
|
+
Sum.Updaters.left(
|
|
469
|
+
ValueInfiniteStreamState.Updaters.Template.reload(
|
|
470
|
+
// safe because we check for undefined in the runFilter
|
|
471
|
+
props.context.customFormState.getChunkWithParams!(
|
|
472
|
+
maybeId.value,
|
|
473
|
+
)(props.context.customFormState.streamParams.value[0]),
|
|
474
|
+
),
|
|
468
475
|
),
|
|
469
476
|
),
|
|
470
|
-
)
|
|
471
|
-
|
|
477
|
+
);
|
|
478
|
+
}
|
|
472
479
|
},
|
|
473
480
|
};
|
|
474
481
|
}),
|