ballerina-core 1.0.146 → 1.0.147
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
|
@@ -152,9 +152,7 @@ export type OneAbstractRendererView = View<
|
|
|
152
152
|
| {
|
|
153
153
|
kind: "initialized";
|
|
154
154
|
DetailsRenderer: Template<any, any, any, any>;
|
|
155
|
-
PreviewRenderer:
|
|
156
|
-
value: ValueRecord,
|
|
157
|
-
) => Template<any, any, any, any> | undefined;
|
|
155
|
+
PreviewRenderer?: (value: ValueRecord) => Template<any, any, any, any>;
|
|
158
156
|
}
|
|
159
157
|
| {
|
|
160
158
|
kind: "uninitialized";
|
package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.tsx
CHANGED
|
@@ -161,90 +161,94 @@ export const OneAbstractRenderer = (
|
|
|
161
161
|
},
|
|
162
162
|
}));
|
|
163
163
|
|
|
164
|
-
const embeddedPreviewRenderer =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
164
|
+
const embeddedPreviewRenderer = PreviewRenderer
|
|
165
|
+
? (value: ValueRecord) =>
|
|
166
|
+
PreviewRenderer.mapContext<
|
|
167
|
+
OneAbstractRendererReadonlyContext & OneAbstractRendererState
|
|
168
|
+
>((_) => {
|
|
169
|
+
const state = RecordAbstractRendererState.Default.zero();
|
|
170
|
+
return {
|
|
171
|
+
..._,
|
|
172
|
+
...state,
|
|
173
|
+
value,
|
|
174
|
+
disabled: _.disabled,
|
|
175
|
+
bindings: _.bindings,
|
|
176
|
+
extraContext: _.extraContext,
|
|
177
|
+
identifiers: {
|
|
178
|
+
withLauncher: _.identifiers.withLauncher.concat(`[preview]`),
|
|
179
|
+
withoutLauncher:
|
|
180
|
+
_.identifiers.withoutLauncher.concat(`[preview]`),
|
|
181
|
+
},
|
|
182
|
+
type: _.type.args,
|
|
183
|
+
};
|
|
184
|
+
})
|
|
185
|
+
.mapState(
|
|
186
|
+
OneAbstractRendererState.Updaters.Core.customFormState.children
|
|
187
|
+
.detailsState,
|
|
188
|
+
)
|
|
189
|
+
.mapForeignMutationsFromProps<{
|
|
190
|
+
onChange: DispatchOnChange<PredicateValue>;
|
|
191
|
+
}>((props) => ({
|
|
192
|
+
onChange: (
|
|
193
|
+
_: BasicUpdater<ValueRecord>,
|
|
194
|
+
nestedDelta: DispatchDelta,
|
|
195
|
+
) => {
|
|
196
|
+
props.setState(
|
|
197
|
+
OneAbstractRendererState.Updaters.Core.commonFormState.children
|
|
198
|
+
.modifiedByUser(replaceWith(true))
|
|
199
|
+
.then(
|
|
200
|
+
OneAbstractRendererState.Updaters.Core.customFormState.children.detailsState(
|
|
201
|
+
RecordAbstractRendererState.Updaters.Core.commonFormState(
|
|
202
|
+
DispatchCommonFormState.Updaters.modifiedByUser(
|
|
203
|
+
replaceWith(true),
|
|
204
|
+
),
|
|
205
|
+
),
|
|
202
206
|
),
|
|
203
|
-
),
|
|
204
|
-
),
|
|
205
|
-
)
|
|
206
|
-
.then((__) => {
|
|
207
|
-
if (
|
|
208
|
-
__.customFormState.selectedValue.sync.kind != "loaded" ||
|
|
209
|
-
__.customFormState.selectedValue.sync.value.kind ==
|
|
210
|
-
"errors" ||
|
|
211
|
-
!PredicateValue.Operations.IsRecord(
|
|
212
|
-
__.customFormState.selectedValue.sync.value.value,
|
|
213
207
|
)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
208
|
+
.then((__) => {
|
|
209
|
+
if (
|
|
210
|
+
__.customFormState.selectedValue.sync.kind != "loaded" ||
|
|
211
|
+
__.customFormState.selectedValue.sync.value.kind ==
|
|
212
|
+
"errors" ||
|
|
213
|
+
!PredicateValue.Operations.IsRecord(
|
|
214
|
+
__.customFormState.selectedValue.sync.value.value,
|
|
215
|
+
)
|
|
216
|
+
) {
|
|
217
|
+
return __;
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
...__,
|
|
221
|
+
customFormState: {
|
|
222
|
+
...__.customFormState,
|
|
223
|
+
selectedValue: {
|
|
224
|
+
...__.customFormState.selectedValue,
|
|
225
|
+
sync: {
|
|
226
|
+
...__.customFormState.selectedValue.sync,
|
|
227
|
+
value: {
|
|
228
|
+
...__.customFormState.selectedValue.sync.value,
|
|
229
|
+
value: _(
|
|
230
|
+
__.customFormState.selectedValue.sync.value
|
|
231
|
+
.value,
|
|
232
|
+
),
|
|
233
|
+
},
|
|
234
|
+
},
|
|
230
235
|
},
|
|
231
236
|
},
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
}),
|
|
236
|
-
);
|
|
237
|
+
};
|
|
238
|
+
}),
|
|
239
|
+
);
|
|
237
240
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
// TODO, must return the ID in the delta,
|
|
242
|
+
const delta: DispatchDelta = {
|
|
243
|
+
kind: "OptionValue",
|
|
244
|
+
value: nestedDelta,
|
|
245
|
+
isWholeEntityMutation: true,
|
|
246
|
+
};
|
|
244
247
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
props.foreignMutations.onChange(id, delta);
|
|
249
|
+
},
|
|
250
|
+
}))
|
|
251
|
+
: undefined;
|
|
248
252
|
|
|
249
253
|
return Template.Default<
|
|
250
254
|
OneAbstractRendererReadonlyContext,
|