ballerina-core 1.0.21 → 1.0.23
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
|
@@ -66,7 +66,7 @@ export const builtInsFromFieldViews = (fieldViews: any, fieldTypeConverters: Api
|
|
|
66
66
|
"generics": Map([
|
|
67
67
|
["SingleSelection", { apiConverters: fieldTypeConverters["SingleSelection"], defaultValue: CollectionSelection().Default.right("no selection") }] as [string, GenericBuiltIn],
|
|
68
68
|
["Multiselection", { apiConverters: fieldTypeConverters["SingleSelection"], defaultValue: Map() }] as [string, GenericBuiltIn],
|
|
69
|
-
["List", { apiConverters: fieldTypeConverters["SingleSelection"], defaultValue:
|
|
69
|
+
["List", { apiConverters: fieldTypeConverters["SingleSelection"], defaultValue: List() }] as [string, GenericBuiltIn]
|
|
70
70
|
]),
|
|
71
71
|
"renderers": {
|
|
72
72
|
"boolean": Set(),
|
|
@@ -187,7 +187,6 @@ export const ParseForm = (
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
if (typeof formConfig[fieldName] == "string") {
|
|
190
|
-
debugger
|
|
191
190
|
const err = formConfig[fieldName]
|
|
192
191
|
console.error(`error processing field ${fieldName}`, err)
|
|
193
192
|
formConfig[fieldName] = (props: any) => <>Error: field {fieldName} with {viewName} could not be instantiated</>
|
|
@@ -274,7 +273,7 @@ export type EntityApis = {
|
|
|
274
273
|
export type EnumName = string
|
|
275
274
|
|
|
276
275
|
|
|
277
|
-
export type EnumOptionsSources = BasicFun<EnumName, BasicFun<Unit,Promise<Array<[CollectionReference, BoolExpr<Unit>]>>>>
|
|
276
|
+
export type EnumOptionsSources = BasicFun<EnumName, BasicFun<Unit, Promise<Array<[CollectionReference, BoolExpr<Unit>]>>>>
|
|
278
277
|
export const parseForms =
|
|
279
278
|
<LeafPredicates,>(
|
|
280
279
|
builtIns: BuiltIns,
|
|
@@ -299,7 +298,9 @@ export const parseForms =
|
|
|
299
298
|
}
|
|
300
299
|
let parsedForms: ParsedForms = Map()
|
|
301
300
|
const traverse = (formDef: FormDef) => {
|
|
302
|
-
if (formProcessingOrder.has(formDef.name))
|
|
301
|
+
if (formProcessingOrder.has(formDef.name)) {
|
|
302
|
+
return
|
|
303
|
+
}
|
|
303
304
|
if (seen.has(formDef.name)) {
|
|
304
305
|
errors.push(`aborting: cycle detected when parsing forms: ${JSON.stringify(formProcessingOrder.reverse().toArray())} -> ${formDef.name}`)
|
|
305
306
|
return
|
|
@@ -311,10 +312,22 @@ export const parseForms =
|
|
|
311
312
|
if (fieldType?.kind == "lookup") {
|
|
312
313
|
traverse(formsConfig.forms.get(field.renderer)!)
|
|
313
314
|
}
|
|
315
|
+
try {
|
|
316
|
+
if (fieldType?.kind == "application" && fieldType?.value == "List" && fieldType?.args.length == 1 && field.elementRenderer != undefined) {
|
|
317
|
+
if (formsConfig.forms.has(field.elementRenderer))
|
|
318
|
+
traverse(formsConfig.forms.get(field.elementRenderer)!)
|
|
319
|
+
}
|
|
320
|
+
} catch (error) {
|
|
321
|
+
errors.push(`unhandled error: ${JSON.stringify(error)} -> ${formDef.name}`)
|
|
322
|
+
}
|
|
314
323
|
})
|
|
315
324
|
formProcessingOrder = formProcessingOrder.add(formDef.name)
|
|
316
325
|
}
|
|
317
|
-
formsConfig.forms.
|
|
326
|
+
const allForms = formsConfig.forms.valueSeq().toArray()
|
|
327
|
+
allForms.forEach(form => {
|
|
328
|
+
seen = seen.clear()
|
|
329
|
+
traverse(form)
|
|
330
|
+
})
|
|
318
331
|
|
|
319
332
|
formProcessingOrder.forEach(formName => {
|
|
320
333
|
const formConfig = formsConfig.forms.get(formName)!
|
|
@@ -366,13 +379,13 @@ export const parseForms =
|
|
|
366
379
|
const form = parsedForm.form
|
|
367
380
|
const initialState = parsedForm.initialFormState
|
|
368
381
|
const api = {
|
|
369
|
-
get: (id:string) => entityApis.get(launcher.api)(id).then((raw: any) => {
|
|
382
|
+
get: (id: string) => entityApis.get(launcher.api)(id).then((raw: any) => {
|
|
370
383
|
// alert(JSON.stringify(raw))
|
|
371
384
|
// alert(JSON.stringify(parsedForm.formDef.type))
|
|
372
385
|
const parsed = fromAPIRawValue({ kind: "lookup", name: parsedForm.formDef.type }, formsConfig.types, builtIns, apiConverters)(raw)
|
|
373
386
|
return parsed
|
|
374
387
|
}),
|
|
375
|
-
update: (value:any) => entityApis.update(launcher.api)(toAPIRawValue({ kind: "lookup", name: parsedForm.formDef.type }, formsConfig.types, builtIns, apiConverters)(value))
|
|
388
|
+
update: (value: any) => entityApis.update(launcher.api)(toAPIRawValue({ kind: "lookup", name: parsedForm.formDef.type }, formsConfig.types, builtIns, apiConverters)(value))
|
|
376
389
|
}
|
|
377
390
|
parsedLaunchers.edit = parsedLaunchers.edit.set(
|
|
378
391
|
launcherName,
|
|
@@ -393,7 +406,7 @@ export const parseForms =
|
|
|
393
406
|
const form = parsedForm.form
|
|
394
407
|
const initialState = parsedForm.initialFormState
|
|
395
408
|
const api = {
|
|
396
|
-
create: (value:any) => {
|
|
409
|
+
create: (value: any) => {
|
|
397
410
|
// alert(`type = ${JSON.stringify(parsedForm.formDef.type)}`)
|
|
398
411
|
// alert(`value = ${JSON.stringify(value)}`)
|
|
399
412
|
const raw = toAPIRawValue({ kind: "lookup", name: parsedForm.formDef.type }, formsConfig.types, builtIns, apiConverters)(value)
|