Ga naar hoofdinhoud

CnPropertyValueCell

The cell renderer used inside CnPropertiesTab for a single property's value. Picks an appropriate input/display widget from the schema (with optional explicit override) and emits committed values back to the parent.

Exposed publicly so consumers using a custom value-cell scoped slot on CnPropertiesTab can fall back to the default rendering for properties they don't want to handle themselves.

Wraps: NcTextField, NcTextArea, NcCheckboxRadioSwitch, NcDateTimePickerNative, NcSelect


Widgets

WidgetWhen auto-detectedNotes
textstring (default)NcTextField. The type attribute follows the string format — see the format table below.
numbertype: 'number' or 'integer'NcTextField (type="number" with min/max/step from schema). Emits parsed numbers (or null for empty).
booleantype: 'boolean'NcCheckboxRadioSwitch (always rendered as a switch — no row-click required to edit).
datetimetype: 'string' with format of date, time, or date-timeNcDateTimePickerNative.
textareatype: 'string' with format: 'text' or format: 'html'NcTextArea with configurable rows.
arraytype: 'array'NcTextField with comma-separated values. Emits an array on update (split(/ *, */g) + filter(Boolean)).
objecttype: 'object'CnJsonViewer (CodeMirror) editor for JSON. Emits the parsed object on commit; if the input is invalid JSON, the raw string is emitted unchanged so the user keeps their work and CnJsonViewer shows a parse error inline. Empty input emits null.
select(never auto-detected — must be set via widget prop)NcSelect with options. Emits raw IDs (single value or array, depending on selectMultiple).

String format → input type mapping

For the text widget the cell maps the schema's format to a sensible HTML5 input type:

format value(s)Input type
email, idn-emailemail
url, uri, uri-reference, iri, iri-reference, uri-template, accessUrl, shareUrl, downloadUrlurl
passwordpassword
telephonetel
color, color-hex, color-hex-alphacolor
date / time / date-time(handled by the datetime widget — not a plain text input)
anything else (hostname, ipv4, uuid, regex, bsn, kvk, semver, …)text

Use the widget prop to override the auto-detection — e.g. when a property's options come from a runtime collection (select) or when you want a textarea for a property whose schema doesn't carry format: 'text'.


Props

PropTypeDefaultDescription
propertyKeyStringrequiredThe schema property key.
schemaObjectnullFull JSON schema. Used to derive the active widget when widget is not set.
value*nullThe resolved current value (formData[key] ?? item[key]).
isEditableBooleantrueWhen false, the cell renders display-only.
isEditingBooleanfalseWhen true (and isEditable), the cell renders an input — except for boolean, which always renders the switch.
displayNameString''Human-readable label used as placeholder/aria-label.
editabilityWarningStringnullTooltip/title on the display element when not editable.
widgetStringnullExplicit widget override. One of text, number, boolean, datetime, textarea, array, select, object.
selectOptionsArraynullOptions for the select widget. Each entry may be a primitive or { id, label }.
selectMultipleBooleantrueWhether the select widget allows multiple values.
textareaRowsNumber4Row count for the textarea widget.
objectEditorHeightString'300px'CSS height passed to the object widget's CodeMirror editor.

Events

EventPayloadDescription
update:valuevalueThe new committed value. For array/select the payload is already an array of primitives; for number/integer it is parsed (or null).

Public methods

MethodDescription
focus()Focus the underlying input/textarea (no-op for widgets without a focusable element). Called by CnPropertiesTab when a row is selected.

Usage inside a custom value-cell slot

<CnPropertiesTab
:schema="schema"
:item="item"
:form-data="formData"
:selected-property="selectedProperty"
@update:selected-property="selectedProperty = $event"
@update:property-value="onPropertyValueUpdate">
<template #value-cell="{ propertyKey, resolvedValue, isEditing, isEditable, displayName, schemaProp, onUpdate }">
<!-- Render Toast UI for markdown fields, fall back to default cell otherwise -->
<MyMarkdownEditor
v-if="schemaProp && schemaProp.format === 'markdown' && isEditing"
:value="String(resolvedValue || '')"
@update:value="onUpdate" />
<CnPropertyValueCell
v-else
:property-key="propertyKey"
:schema="schema"
:value="resolvedValue"
:is-editable="isEditable"
:is-editing="isEditing"
:display-name="displayName"
@update:value="onUpdate" />
</template>
</CnPropertiesTab>