@bagelink/vue 1.15.151 → 1.15.154

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.151",
4
+ "version": "1.15.154",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -306,8 +306,8 @@ const tooltipStyle = computed(() => ({ left: `${tipX.value}px`, top: `${tipY.val
306
306
  v-for="(s, i) in segments" :key="i" class="bgl-funnel__tick p-05"
307
307
  :style="horizontal ? { flex: '1 1 0' } : { height: `${bandHeight}px` }"
308
308
  >
309
- <span class="bgl-funnel__name ellipsis-1 txt12 light" :title="s.label">{{ s.label }}</span>
310
- <span class="bgl-funnel__val txt24">{{ s.display }}</span>
309
+ <span class="bgl-funnel__name ellipsis-1 txt12 light opacity-6" :title="s.label">{{ s.label }}</span>
310
+ <span class="bgl-funnel__val txt24 bold">{{ s.display }}</span>
311
311
  </div>
312
312
  </div>
313
313
  </div>
@@ -121,6 +121,8 @@ watch(formData, (newVal) => {
121
121
  }, { deep: true })
122
122
 
123
123
  function shouldShowField(field: FieldBuilder): boolean {
124
+ // Hidden fields keep their value (submitted) but are never displayed.
125
+ if (field._hidden) return false
124
126
  if (field._condition == null) return true
125
127
  return evaluateQuery(field._condition, formData.value)
126
128
  }
@@ -197,6 +197,7 @@ const stepErrors = ref<Record<string, string>>({})
197
197
 
198
198
  // Check if a field should be validated (visible based on condition)
199
199
  function shouldValidateField(field: FieldBuilder): boolean {
200
+ if (field._hidden) return false
200
201
  if (field._condition == null) return true
201
202
  return evaluateCondition(field._condition, formData.value)
202
203
  }
@@ -93,6 +93,8 @@ export interface FieldBuilder<TValue = any> {
93
93
  _type: string
94
94
  _config: BaseFieldConfig & Record<string, any>
95
95
  _condition?: string
96
+ /** When true the field is never rendered but its value is still submitted. */
97
+ _hidden?: boolean
96
98
  _validations?: Array<(value: TValue) => true | string>
97
99
  _onUpdate?: (value: TValue, formData: Record<string, any>) => void
98
100
  _class?: string
@@ -101,6 +103,8 @@ export interface FieldBuilder<TValue = any> {
101
103
 
102
104
  // Chainable methods
103
105
  if: (condition: string) => FieldBuilder<TValue>
106
+ /** Mark the field as hidden — kept in form data / submitted but not displayed. */
107
+ hidden: (hidden?: boolean) => FieldBuilder<TValue>
104
108
  validate: (fn: (value: TValue) => true | string) => FieldBuilder<TValue>
105
109
  onUpdate: (fn: (value: TValue, formData: Record<string, any>) => void) => FieldBuilder<TValue>
106
110
  class: (className: string) => FieldBuilder<TValue>
@@ -148,6 +152,7 @@ class Field<TValue = any> implements FieldBuilder<TValue> {
148
152
  _type: string
149
153
  _config: BaseFieldConfig & Record<string, any>
150
154
  _condition?: string
155
+ _hidden?: boolean
151
156
  _validations?: Array<(value: TValue) => true | string>
152
157
  _onUpdate?: (value: TValue, formData: Record<string, any>) => void
153
158
  _class?: string
@@ -164,6 +169,11 @@ class Field<TValue = any> implements FieldBuilder<TValue> {
164
169
  return this
165
170
  }
166
171
 
172
+ hidden(hidden = true): this {
173
+ this._hidden = hidden
174
+ return this
175
+ }
176
+
167
177
  validate(fn: (value: TValue) => true | string): this {
168
178
  if (!this._validations) {
169
179
  this._validations = []
@@ -574,6 +584,9 @@ class Schema<T extends Record<string, any> = Record<string, any>> implements Sch
574
584
  // Conditional visibility
575
585
  if (field._condition) xUi.condition = field._condition
576
586
 
587
+ // Hidden (submitted but not displayed)
588
+ if (field._hidden) xUi.hidden = true
589
+
577
590
  // Array field options
578
591
  if (field._type === 'array') {
579
592
  if (config.allowAdd !== undefined) xUi.allowAdd = config.allowAdd
@@ -763,6 +776,7 @@ interface JSONSchemaProperty {
763
776
  cols?: number
764
777
  class?: string
765
778
  condition?: string
779
+ hidden?: boolean
766
780
  allowAdd?: boolean
767
781
  allowDelete?: boolean
768
782
  component?: string
@@ -1019,6 +1033,11 @@ function createFieldFromProperty(
1019
1033
  field.if(xUi.condition)
1020
1034
  }
1021
1035
 
1036
+ // Apply hidden
1037
+ if (xUi.hidden) {
1038
+ field.hidden()
1039
+ }
1040
+
1022
1041
  return field
1023
1042
  }
1024
1043
 
@@ -21,6 +21,7 @@ export type FormFieldType =
21
21
  | 'number' | 'date' | 'email' | 'phone' | 'url'
22
22
  | 'select' | 'radio' | 'checkbox' | 'toggle'
23
23
  | 'file' | 'signature' | 'range' | 'color' | 'json'
24
+ | 'hidden'
24
25
  | 'heading' | 'divider'
25
26
 
26
27
  export interface SelectOption {
@@ -55,6 +56,10 @@ export interface FormField {
55
56
  /** User-authored (non-grid) classes preserved alongside layout classes. */
56
57
  class?: string
57
58
  hideLabel?: boolean
59
+ /** SCIM 2.0 filter expression controlling conditional visibility. */
60
+ condition?: string
61
+ /** When true the field is never displayed but its value is still submitted. */
62
+ hidden?: boolean
58
63
  richTextVariant?: 'full' | 'basic' | 'simple'
59
64
  markdownShowFormatting?: boolean
60
65
  textareaRows?: number
@@ -99,6 +104,10 @@ export interface JSONSchemaProperty {
99
104
  /** UI extension object — layout classes + render hints (shared with form-flow). */
100
105
  'x-ui'?: {
101
106
  class?: string
107
+ /** SCIM 2.0 filter expression controlling conditional visibility. */
108
+ condition?: string
109
+ /** Field kept in form data / submitted but never displayed. */
110
+ hidden?: boolean
102
111
  [key: string]: any
103
112
  }
104
113
  'x-field-type'?: FormFieldType
@@ -145,6 +154,9 @@ export function defaultRowSpan(type: FormFieldType): number {
145
154
  return 1
146
155
  }
147
156
 
157
+ /** Field types that never render an input in the live form. */
158
+ export const NON_INPUT_TYPES: FormFieldType[] = ['heading', 'divider', 'hidden']
159
+
148
160
  export function inferFieldType(prop: JSONSchemaProperty): FormFieldType {
149
161
  if (prop.format) {
150
162
  switch (prop.format) {
@@ -204,6 +216,8 @@ export function schemaToFields(schema: JSONSchemaObject | undefined): FormField[
204
216
  mColSpan: classToMColSpan(uiClass) ?? 12,
205
217
  class: stripGridClasses(uiClass) || undefined,
206
218
  hideLabel: prop['x-hide-label'] ?? false,
219
+ condition: prop['x-ui']?.condition || undefined,
220
+ hidden: prop['x-ui']?.hidden || (type === 'hidden') || undefined,
207
221
  richTextVariant: prop['x-rich-text-variant'],
208
222
  markdownShowFormatting: prop['x-markdown-show-formatting'],
209
223
  textareaRows: prop['x-textarea-rows'],
@@ -266,6 +280,7 @@ export function fieldsToSchema(fields: FormField[]): JSONSchemaObject {
266
280
  case 'file':
267
281
  case 'signature':
268
282
  case 'color':
283
+ case 'hidden':
269
284
  prop.type = 'string'
270
285
  break
271
286
  case 'number':
@@ -332,6 +347,10 @@ export function fieldsToSchema(fields: FormField[]): JSONSchemaObject {
332
347
  })
333
348
  if (layoutClass) prop['x-ui'] = { ...prop['x-ui'], class: layoutClass }
334
349
 
350
+ // Conditional visibility + hidden — stored in x-ui (consumed by FormFlow)
351
+ if (field.condition) prop['x-ui'] = { ...prop['x-ui'], condition: field.condition }
352
+ if (field.hidden === true) prop['x-ui'] = { ...prop['x-ui'], hidden: true }
353
+
335
354
  // Boolean/enum x- extensions — only write when non-default
336
355
  if (field.hideLabel === true) prop['x-hide-label'] = true
337
356
  if (field.richTextVariant) prop['x-rich-text-variant'] = field.richTextVariant
@@ -412,6 +431,8 @@ export function validateFormData(fields: FormField[], data: Record<string, any>)
412
431
 
413
432
  for (const field of fields) {
414
433
  if (field.type === 'heading' || field.type === 'divider') continue
434
+ // Hidden fields are never shown, so they can't be user-corrected — skip.
435
+ if (field.type === 'hidden' || field.hidden === true) continue
415
436
 
416
437
  const value = data[field.key]
417
438