Skip to content

@camera.ui/sdk / storage / JsonBaseSchema

Interface: JsonBaseSchema<T> ​

Defined in: storage/index.ts:92

Base schema with callbacks, the full schema interface. Adds storage and callback options for dynamic behavior.

Example ​

typescript
// Persisted number with onSet hook for live re-config:
{ type: 'number', key: 'pollSec', title: 'Poll (seconds)', description: '',
  defaultValue: 30, minimum: 5, maximum: 300, step: 5, store: true,
  onSet: async (newValue, oldValue) => this.reschedule(newValue) }

// Action button (no value stored, just fires on click):
{ type: 'button', key: 'reset', title: 'Reset to defaults', description: '',
  color: 'danger', onSet: async () => this.resetDefaults() }

Extends ​

Extended by ​

Type Parameters ​

T ​

T extends string | string[] | number | number[] | boolean | boolean[] = any

Properties ​

condition? ​

optional condition?: SchemaCondition | SchemaCondition[]

Defined in: storage/index.ts:73

Condition for conditional field visibility. Array = all must be true (AND).

Inherited from ​

JsonBaseSchemaWithoutCallbacks.condition


defaultValue? ​

optional defaultValue?: T

Defined in: storage/index.ts:71

Default value when not set.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.defaultValue


description ​

description: string

Defined in: storage/index.ts:52

Field description/help text.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.description


group? ​

optional group?: string

Defined in: storage/index.ts:54

Optional group name for organizing fields.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.group


hidden? ​

optional hidden?: boolean

Defined in: storage/index.ts:63

Hide field from UI.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.hidden


key ​

key: string

Defined in: storage/index.ts:48

Unique field identifier.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.key


onGet? ​

optional onGet?: () => Promise<any>

Defined in: storage/index.ts:98

Callback to get computed value.

Returns ​

Promise<any>


onSet? ​

optional onSet?: (newValue, oldValue) => Promise<void>

Defined in: storage/index.ts:96

Callback after a write. setValue fires it whether or not the value changed; setConfig fires it only for keys that changed.

Parameters ​

newValue ​

any

oldValue ​

any

Returns ​

Promise<void>


placeholder? ​

optional placeholder?: string

Defined in: storage/index.ts:69

Placeholder text for empty fields.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.placeholder


readonly? ​

optional readonly?: boolean

Defined in: storage/index.ts:67

Make field read-only.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.readonly


required? ​

optional required?: boolean

Defined in: storage/index.ts:65

Mark field as required.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.required


store? ​

optional store?: boolean

Defined in: storage/index.ts:94

Whether to persist this field to storage.


title ​

title: string

Defined in: storage/index.ts:50

Display title.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.title


type ​

type: JsonSchemaType

Defined in: storage/index.ts:46

Field type.

Inherited from ​

JsonBaseSchemaWithoutCallbacks.type