@internal returns a list of DD elements, creating them on the fly by default unless option is to destroy or disable
(els: GridStackElement, opts?: DDOpts)
| 202 | |
| 203 | /** @internal returns a list of DD elements, creating them on the fly by default unless option is to destroy or disable */ |
| 204 | protected _getDDElements(els: GridStackElement, opts?: DDOpts): DDElement[] { |
| 205 | // don't force create if we're going to destroy it, unless it's a grid which is used as drop target for it's children |
| 206 | const create = (els as GridHTMLElement).gridstack || opts !== 'destroy' && opts !== 'disable'; |
| 207 | const hosts = Utils.getElements(els) as DDElementHost[]; |
| 208 | if (!hosts.length) return []; |
| 209 | const list = hosts.map(e => e.ddElement || (create ? DDElement.init(e) : null)).filter(d => d); // remove nulls |
| 210 | return list; |
| 211 | } |
| 212 | } |