release: WRNexusJS 0.6.0
This commit is contained in:
@@ -1,26 +1,29 @@
|
||||
component Collapse {
|
||||
outputs {
|
||||
toggle(payload: { index: number; item: string | number | boolean | null | object; open: boolean; openIndexes: number[] })
|
||||
open(payload: { index: number; item: string | number | boolean | null | object })
|
||||
close(payload: { index: number; item: string | number | boolean | null | object })
|
||||
}
|
||||
|
||||
props {
|
||||
@event toggle = function
|
||||
@event open = function
|
||||
@event close = function
|
||||
size = "default"
|
||||
color = "primary"
|
||||
items = []
|
||||
multiple = false
|
||||
mode = "panel"
|
||||
initialOpenIndexes = []
|
||||
ariaLabel = "Collapsible content"
|
||||
class = ""
|
||||
size: string = "default"
|
||||
color: string = "primary"
|
||||
items: unknown[] = []
|
||||
multiple: boolean = false
|
||||
mode: string = "panel"
|
||||
initialOpenIndexes: unknown[] = []
|
||||
ariaLabel: string = "Collapsible content"
|
||||
class: string = ""
|
||||
}
|
||||
|
||||
state openIndexes = initialOpenIndexes
|
||||
|
||||
functions {
|
||||
function isOpen(index) {
|
||||
shared function isOpen(index) {
|
||||
return openIndexes.includes(index)
|
||||
}
|
||||
|
||||
function toggleItem(index, item, opening) {
|
||||
client function toggleItem(index, item, opening) {
|
||||
if (item.disabled) {
|
||||
return
|
||||
}
|
||||
@@ -31,12 +34,12 @@ component Collapse {
|
||||
} else {
|
||||
openIndexes = [index]
|
||||
}
|
||||
$emit("open", { index: index, item: item })
|
||||
output.open({ index: index, item: item })
|
||||
} else {
|
||||
openIndexes = openIndexes.filter((openIndex) => openIndex !== index)
|
||||
$emit("close", { index: index, item: item })
|
||||
output.close({ index: index, item: item })
|
||||
}
|
||||
$emit("toggle", {
|
||||
output.toggle({
|
||||
index: index,
|
||||
item: item,
|
||||
open: opening,
|
||||
|
||||
Reference in New Issue
Block a user