@bagelink/vue 1.15.490 → 1.15.496

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.15.490",
4
+ "version": "1.15.496",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -563,12 +563,24 @@ class Schema<T extends Record<string, any> = Record<string, any>> implements Sch
563
563
  if (config.helpText) prop.description = config.helpText
564
564
  if (config.default !== undefined) prop.default = config.default
565
565
  if (config.options) {
566
- const enumValues = (config.options as any[]).map(o => getOptionValue(o) ?? o)
566
+ const options = config.options as any[]
567
+ const enumValues = options.map(o => getOptionValue(o) ?? o)
567
568
  if (field._type === 'multiselect') {
568
569
  prop.items = { type: 'string', enum: enumValues }
569
570
  } else {
570
571
  prop.enum = enumValues
571
572
  }
573
+ if (
574
+ (field._type === 'select' || field._type === 'multiselect' || field._type === 'radio')
575
+ && options.every(option =>
576
+ option
577
+ && typeof option === 'object'
578
+ && 'label' in option
579
+ && 'value' in option
580
+ )
581
+ ) {
582
+ prop['x-options'] = options
583
+ }
572
584
  }
573
585
 
574
586
  // Numeric constraints
@@ -620,6 +632,9 @@ class Schema<T extends Record<string, any> = Record<string, any>> implements Sch
620
632
  if (field._type === 'array') {
621
633
  if (config.allowAdd !== undefined) xUi.allowAdd = config.allowAdd
622
634
  if (config.allowDelete !== undefined) xUi.allowDelete = config.allowDelete
635
+ if (config.schema && typeof config.schema.toJSONSchema === 'function') {
636
+ prop.items = config.schema.toJSONSchema()
637
+ }
623
638
  }
624
639
 
625
640
  // Component hint (for custom components)
@@ -798,6 +813,8 @@ interface JSONSchemaProperty {
798
813
  'maxLength'?: number
799
814
  '$ref'?: string
800
815
  'items'?: JSONSchemaProperty
816
+ 'properties'?: Record<string, JSONSchemaProperty>
817
+ 'required'?: string[]
801
818
  'anyOf'?: JSONSchemaProperty[]
802
819
  'oneOf'?: JSONSchemaProperty[]
803
820
  'allOf'?: JSONSchemaProperty[]
@@ -1213,10 +1230,13 @@ function createFieldFromProperty(
1213
1230
  const arrayConfig: Record<string, any> = { ...config }
1214
1231
  if (xUi.allowAdd !== undefined) arrayConfig.allowAdd = xUi.allowAdd
1215
1232
  if (xUi.allowDelete !== undefined) arrayConfig.allowDelete = xUi.allowDelete
1233
+ const itemSchema = resolvedProp.items?.type === 'object'
1234
+ ? fromJSONSchema(resolvedProp.items as JSONSchemaObject, { loadOptionsSource })
1235
+ : undefined
1216
1236
  if (resolvedProp.items?.type) {
1217
1237
  arrayConfig.itemType = inferFieldType(resolvedProp.items)
1218
1238
  }
1219
- field = $.array(resolvedProp.title || key, undefined, arrayConfig)
1239
+ field = $.array(resolvedProp.title || key, itemSchema, arrayConfig)
1220
1240
  break
1221
1241
  }
1222
1242
  case 'display':