| 146 | >(); |
| 147 | |
| 148 | export class Sortable<T extends Data = Data> { |
| 149 | public draggable: Draggable<T>; |
| 150 | public droppable: Droppable<T>; |
| 151 | |
| 152 | @reactive |
| 153 | public accessor index: number; |
| 154 | |
| 155 | #previousGroup: UniqueIdentifier | undefined; |
| 156 | |
| 157 | #previousIndex: number; |
| 158 | |
| 159 | get initialIndex() { |
| 160 | return store.get(this.manager, this.id)?.initialIndex ?? this.index; |
| 161 | } |
| 162 | |
| 163 | get initialGroup() { |
| 164 | return store.get(this.manager, this.id)?.initialGroup ?? this.group; |
| 165 | } |
| 166 | |
| 167 | @reactive |
| 168 | public accessor group: UniqueIdentifier | undefined; |
| 169 | |
| 170 | transition: SortableTransition | null; |
| 171 | |
| 172 | constructor( |
| 173 | { |
| 174 | effects: inputEffects = () => [], |
| 175 | disabled, |
| 176 | group, |
| 177 | index, |
| 178 | sensors, |
| 179 | type, |
| 180 | transition = defaultSortableTransition, |
| 181 | plugins: pluginsInput, |
| 182 | ...input |
| 183 | }: SortableInput<T>, |
| 184 | manager: DragDropManager<any, any> | undefined |
| 185 | ) { |
| 186 | const plugins = resolveCustomizable(pluginsInput, defaultPlugins); |
| 187 | const disabledState = normalizeDisabled(disabled); |
| 188 | |
| 189 | this.droppable = new SortableDroppable<T>( |
| 190 | {...input, disabled: disabledState.droppable}, |
| 191 | manager, |
| 192 | this |
| 193 | ); |
| 194 | this.draggable = new SortableDraggable<T>( |
| 195 | { |
| 196 | ...input, |
| 197 | disabled: disabledState.draggable, |
| 198 | plugins, |
| 199 | effects: () => [ |
| 200 | () => { |
| 201 | const status = this.manager?.dragOperation.status; |
| 202 | |
| 203 | if ( |
| 204 | status?.initializing && |
| 205 | this.id === this.manager?.dragOperation.source?.id |
nothing calls this directly
no test coverage detected