Skip to content

PropertyList ​

PropertyList è un elenco controllato e senza stile per riempimenti, contorni ed effetti. Il discriminante propKey dà a slot e azioni i tipi esatti Fill, Stroke o Effect. Le modifiche all'editor e il comportamento di annullamento restano in useEditorPropertyList() o in un adattatore dell'applicazione.

Struttura ​

  • PropertyListRoot: elementi controllati, identità, stato misto ed eventi semantici
  • PropertyListItem: tipo esatto dell'elemento più data-hidden e data-dragging
  • PropertyListAdd: aggiunge un elemento tipizzato
  • PropertyListRemove: rimuove l'elemento con un dato indice
  • PropertyListVisibility: attiva o disattiva la visibilità dell'elemento con un dato indice ed espone aria-pressed
vue
<script setup lang="ts">
import { 
ref
} from 'vue'
import type { Fill } from '@pairdraw/scene-graph' import {
PropertyListItem
,
PropertyListRemove
,
PropertyListRoot
} from '@pairdraw/vue/primitives/PropertyList'
const
fills
=
ref
<Fill[]>([])
</script> <template> <
PropertyListRoot
prop-key
="fills"
:
items
="
fills
"
@
remove
="
fills
.
splice
(
$event
, 1)"
v-slot="{
items
}"
> <
PropertyListItem
v-for="(
_
,
index
) in
items
"
:
key
="
index
"
prop-key
="fills"
:
index
="
index
"
v-slot="{
item
}"
> <
span
>{{
item
?.type }}</
span
>
<
PropertyListRemove
prop-key
="fills"
:
index
="
index
">Remove</PropertyListRemove>
</PropertyListItem> </PropertyListRoot> </template>

La matrice condivisa degli stati interattivi è mostrata nella demo di PropertySection.

Adattatore per l'editor ​

I pannelli di Pairdraw usano useEditorPropertyList(propKey) per collegare gli eventi controllati alla selezione, agli aggiornamenti su più nodi, al raggruppamento delle operazioni di annullamento e al riordino. Chi usa l'SDK al di fuori di Pairdraw può fornire un proprio adattatore di stato senza un contesto dell'editor Pairdraw.

Riferimento API generato ​

PropertyListRoot

Generated from packages/vue/src/primitives/PropertyList/PropertyListRoot.vue

Props

PropDefaultType
propKey*
Discriminator that provides exact Fill, Stroke, or Effect types to slots and actions.
—K
items*
Controlled list items.
—PropertyListItemFor<K>[]
mixed
Marks values across the current selection as inconsistent.
falseboolean | undefined
disabled
Prevents item actions.
—boolean | undefined
getKey
Stable identity for keyed rows. Defaults to the item index.
—((item: PropertyListItemFor<K>, index: number) => PropertyListIdentity) | undefined
label
Optional accessible label exposed to consumers.
—string | undefined

Events

EventPayloadDescription
add[item: PropertyListItemFor<K>]
remove[index: number]
update[index: number, item: PropertyListItemFor<K>]
patch[index: number, changes: Partial<PropertyListItemFor<K>>]
toggleVisibility[index: number]
reorder[fromIndex: number, toIndex: number]

Slots

SlotPropsDescription
defaultPropertyListRootSlotProps<K>

PropertyListItem

Generated from packages/vue/src/primitives/PropertyList/PropertyListItem.vue

Props

PropDefaultType
propKey*—K
index*—number
draggingfalseboolean | undefined
disabled—boolean | undefined
as"div"string | Component | undefined
asChildfalseboolean | undefined

Events

EventPayloadDescription
update[index: number, item: PropertyListItemFor<K>]
patch[index: number, changes: Partial<PropertyListItemFor<K>>]
remove[index: number]
toggleVisibility[index: number]

Slots

SlotPropsDescription
defaultPropertyListItemSlotProps<K>

PropertyListAdd

Generated from packages/vue/src/primitives/PropertyList/PropertyListAdd.vue

Props

PropDefaultType
propKey*
Must match the nearest PropertyListRoot and preserves generic inference.
—K
as
Element or component rendered by this part.
"button"string | Component | undefined
asChild
Merge behavior into the single child element.
falseboolean | undefined
disabled
Prevent activation.
—boolean | undefined
item*—PropertyListItemFor<K>

Events

EventPayloadDescription
add[item: PropertyListItemFor<K>]

Slots

SlotPropsDescription
default{}

PropertyListRemove

Generated from packages/vue/src/primitives/PropertyList/PropertyListRemove.vue

Props

PropDefaultType
propKey*
Must match the nearest PropertyListRoot and preserves generic inference.
—K
as
Element or component rendered by this part.
"button"string | Component | undefined
asChild
Merge behavior into the single child element.
falseboolean | undefined
disabled
Prevent activation.
—boolean | undefined
index*—number

Events

EventPayloadDescription
remove[index: number]

Slots

SlotPropsDescription
default{}

PropertyListVisibility

Generated from packages/vue/src/primitives/PropertyList/PropertyListVisibility.vue

Props

PropDefaultType
propKey*
Must match the nearest PropertyListRoot and preserves generic inference.
—K
as
Element or component rendered by this part.
"button"string | Component | undefined
asChild
Merge behavior into the single child element.
falseboolean | undefined
disabled
Prevent activation.
—boolean | undefined
index*—number

Events

EventPayloadDescription
toggle[index: number]

Slots

SlotPropsDescription
default{ visible: boolean; }

Released under the MIT License.