-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7975e19
commit fe39b1e
Showing
7 changed files
with
138 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
16 changes: 9 additions & 7 deletions
16
src/plugins/dropZone/index.ts → src/plugins/selections/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import type { VueDropZoneConfig } from "./vue/types"; | ||
|
||
export function dropZone(dzConfig: VueDropZoneConfig = {}) { | ||
export default function dropZone(dzConfig: VueDropZoneConfig = {}) { | ||
//console.log("init dropzone", parent, config, globals); | ||
// end-user scope | ||
console.log("dropZone plugin in index"); | ||
return () => { | ||
return { | ||
setup() {}, | ||
tearDown() {}, | ||
}; | ||
}; | ||
//return () => { | ||
// return { | ||
// setup() {}, | ||
// tearDown() {}, | ||
// }; | ||
//}; | ||
} | ||
|
||
//function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
//import type { DropZone } from "../../../types"; | ||
import type { VueDropZoneConfig, VueDropZone, VueElement } from "./types"; | ||
|
||
import { watch } from "vue"; | ||
|
||
import { isBrowser } from "../../../utils"; | ||
|
||
import { getEl } from "../../../vue/utils"; | ||
|
||
import initDropZone from "../index"; | ||
|
||
export function dropZone(dzConfig: VueDropZoneConfig = {}) { | ||
console.log("hello", dzConfig); | ||
//console.log("dropzone", setUpDropZone); | ||
|
||
if (!isBrowser || !dzConfig.dropZones?.length) return; | ||
|
||
const enabledDZs = []; | ||
|
||
console.log("dropZone plugin in index"); | ||
|
||
dzConfig.dropZones.forEach((dz: VueDropZone | VueElement) => { | ||
console.log("dz", dz); | ||
const validParent = getEl(dz.element); | ||
|
||
console.log("validParent", validParent); | ||
|
||
//return; | ||
|
||
if (validParent) { | ||
return initDropZone(validParent); | ||
} else { | ||
const stop = watch(dz, (newParent) => { | ||
if (!newParent) return; | ||
|
||
const validParent = getEl(newParent); | ||
|
||
if (!validParent) { | ||
console.warn("Invalid parent element", newParent); | ||
} else { | ||
initDropZone(validParent, dnd); | ||
} | ||
|
||
stop(); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
//setup({})(null, null, null); | ||
|
||
// parent html element | ||
|
||
//return (parent: HTMLElement) => { | ||
// return { | ||
// setup, | ||
// teardown | ||
// } | ||
//} | ||
|
||
//return { | ||
// setup, | ||
// tearDown, | ||
//}; | ||
|
||
//if (dzConfig.dropZones && isBrowser) { | ||
// const dropZones = dzConfig.dropZones; | ||
|
||
// for (const dz of dropZones) { | ||
// const el = getEl(dz.element); | ||
|
||
// if (el instanceof HTMLElement) { | ||
// enabledDZs.push(el); | ||
// } else { | ||
// const stop = watch(dz.element, (newEl) => { | ||
// if (newEl instanceof HTMLElement) { | ||
// stop(); | ||
|
||
// enabledDZs.push(newEl); | ||
|
||
// return setUpDropZone(dzConfig, parent, globals); | ||
// } else { | ||
// console.warn("Invalid dropzone element", newEl); | ||
// } | ||
// }); | ||
// } | ||
// } | ||
|
||
// delete dzConfig.dropZones; | ||
//} | ||
|
||
//dzConfig.validDropZones = enabledDZs; | ||
|
||
//return setUpDropZone(dzConfig, parent, globals); | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters