dnd

package
v0.0.0-...-e4b31ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lists

func Lists(config *Config) gas.DynamicComponent

Lists return dnd-lists component

Types

type Config

type Config struct {
	This DndListsParent // link to Compoent storing arrays

	Group     string
	FieldName string

	Events EventsHandlers

	Tag     string
	ItemTag string

	GroupClass       string
	PreviewClass     string // class for the dragging item preview
	PlaceholderClass string // class for the dragging item placeholder
}

Config dnd-lists config

type DndListsParent

type DndListsParent interface {
	DndListSet(listName string, arr []interface{})
	DndListGet(listName string) []interface{}
	DndListUpdate()
}

type EnteredEvent

type EnteredEvent struct {
	Index     int
	FieldName string

	Body gas.Object
}

type EventsHandlers

type EventsHandlers struct {
	Started func(event StartedEvent) (bool, error)
	Entered func(event EnteredEvent) (bool, error)
	Leaved  func(event LeavedEvent) error
	Ended   func(event StandardEvent) error
	Added   func(event StandardEvent) error
	Updated func(event StandardEvent) error
	Removed func(event RemovedEvent) error
	Moved   func(event StandardEvent) error
}

EventHandlers struct for unit all event handlers. see events.md

Event types:

| Name | Timing | Structure | |-----------|----------------------------------------------------|-----------------| | started | Element is chosen by user (return true for block) | StartedEvent | | entered | on dragenter (return true for block entering) | EnteredEvent | | leaved | on dragleave | LeavedEvent | | ended | Element dragging ended | StandardEvent | | added | Element is dropped into the list from another list | StandardEvent | | updated | When dragging element changes position | StandardEvent | | removed | Element is removed from the list into another list | RemovedEvent | | moved | When you move an item in the list or between lists | StandardEvent |

type LeavedEvent

type LeavedEvent struct {
	Body gas.Object
}

type RemovedEvent

type RemovedEvent struct {
	OldIndex int

	Body gas.Object
}

type StandardEvent

type StandardEvent struct {
	OldIndex int
	NewIndex int

	Body gas.Object
}

type StartedEvent

type StartedEvent struct {
	Index int

	Body gas.Object
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL