@bagelink/vue 1.15.371 → 1.15.375

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.371",
4
+ "version": "1.15.375",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -820,6 +820,30 @@ export type JSONSchemaOptionsSourceLoader = (
820
820
  query: string,
821
821
  ) => Promise<unknown>
822
822
 
823
+ export interface JSONSchemaOptionsSourceHttpClient {
824
+ get: (
825
+ endpoint: string,
826
+ config?: { params?: Record<string, string | number> },
827
+ ) => Promise<{ data: unknown }>
828
+ }
829
+
830
+ /** Create a same-origin x-options-source loader from the host's HTTP client. */
831
+ export function createJSONSchemaOptionsSourceLoader(
832
+ client: JSONSchemaOptionsSourceHttpClient,
833
+ ): JSONSchemaOptionsSourceLoader {
834
+ return async (source, query) => {
835
+ if (!source.endpoint.startsWith('/') || source.endpoint.startsWith('//')) {
836
+ throw new Error('Form option endpoints must be same-origin paths')
837
+ }
838
+ const params: Record<string, string | number> = {}
839
+ if (source.searchParam && query) params[source.searchParam] = query
840
+ if (source.limitParam && source.limit != null) {
841
+ params[source.limitParam] = source.limit
842
+ }
843
+ return (await client.get(source.endpoint, { params })).data
844
+ }
845
+ }
846
+
823
847
  function valueAtPath(value: unknown, path?: string): unknown {
824
848
  if (!path) return value
825
849
  return path.split('.').reduce<unknown>((current, key) => {
@@ -134,7 +134,7 @@ export interface JSONSchemaProperty {
134
134
  'x-textarea-autoheight'?: boolean
135
135
  'x-number-layout'?: 'default' | 'vertical' | 'horizontal'
136
136
  'x-number-spinner'?: boolean
137
- 'x-phone-only-countries'?: string
137
+ 'x-phone-only-countries'?: string | string[]
138
138
  'x-select-multiselect'?: boolean
139
139
  'x-file-multiple'?: boolean
140
140
  'x-file-height'?: number
@@ -244,7 +244,9 @@ export function schemaToFields(schema: JSONSchemaObject | undefined): FormField[
244
244
  textareaAutoHeight: prop['x-textarea-autoheight'],
245
245
  numberLayout: prop['x-number-layout'],
246
246
  numberSpinner: prop['x-number-spinner'] ?? true,
247
- phoneOnlyCountries: prop['x-phone-only-countries'],
247
+ phoneOnlyCountries: Array.isArray(prop['x-phone-only-countries'])
248
+ ? prop['x-phone-only-countries'].join(', ')
249
+ : prop['x-phone-only-countries'],
248
250
  selectMultiselect: prop['x-select-multiselect'],
249
251
  fileMultiple: prop['x-file-multiple'],
250
252
  fileHeight: prop['x-file-height'],