(mode, mods)
| 2320 | |
| 2321 | // MARK: prepare display |
| 2322 | display(mode, mods) { |
| 2323 | this.lastPayload = mods |
| 2324 | |
| 2325 | const lookupOp = mods.multiDestination ? `multi${this.flags.operation.slice(0, 1).toUpperCase()}${this.flags.operation.slice(1)}` : this.flags.operation |
| 2326 | |
| 2327 | this.infoData.clsShow() |
| 2328 | this.feedback.clsHide() |
| 2329 | MA.byIdHTML('fileOpCanvas-title', I18N.defer(this.l10n_title[lookupOp], false)) |
| 2330 | MA.byIdHTML('fileOpCanvas-info', I18N.defer(this.l10n_info[lookupOp], false)) |
| 2331 | MA.byIdHTML('fileOpCanvas-button', `${I18N.defer(this.l10n_button[lookupOp], false)} [${this.flags.count}]`) |
| 2332 | MA.byId('fileOpCanvas-zipImport').clsShow(mods.isZipImport) |
| 2333 | |
| 2334 | const isSingle = mode !== 'delete' && !mods.multiDestination |
| 2335 | |
| 2336 | const collectPick = MA.byId('fileOpCanvas-destination') |
| 2337 | collectPick.innerHTML = '' |
| 2338 | collectPick.clsHide(mode === 'delete') |
| 2339 | |
| 2340 | if ( mode !== 'delete' ) { |
| 2341 | for ( const [key, info] of window.state.mapCollectionFiles ) { |
| 2342 | if ( key === mods.originCollectKey ) { continue } |
| 2343 | const node = DATA.templateEngine('file_op_collect_option', { |
| 2344 | icon : DATA.makeFolderIcon( |
| 2345 | false, |
| 2346 | false, |
| 2347 | false, |
| 2348 | false, |
| 2349 | info.color |
| 2350 | ), |
| 2351 | name : info.name, |
| 2352 | tag : info.tag === null ? '' : `<br><span class="small fst-italic">${info.tag}</span>`, |
| 2353 | }) |
| 2354 | node.firstElementChild.addEventListener('click', () => { this.selectDestination(isSingle, key) }) |
| 2355 | node.firstElementChild.setAttribute('title', info.folder) |
| 2356 | this.buttonDest.set(key, node.querySelector('.collect-indicate')) |
| 2357 | collectPick.appendChild(node) |
| 2358 | } |
| 2359 | } |
| 2360 | |
| 2361 | this.overlay.show() |
| 2362 | |
| 2363 | // NOTE: FILE OPS |
| 2364 | // destinations : [thisCheck.value], |
| 2365 | // source_collectKey : sourceMod.collectKey, |
| 2366 | // source_modUUID : sourceMod.uuid, |
| 2367 | // source_rawPath : string (for drag-drop) |
| 2368 | // type : 'copy','move','delete' |
| 2369 | |
| 2370 | if ( this.flags.operation === 'import' ) { |
| 2371 | for ( const file of this.lastPayload.rawFileList ) { |
| 2372 | this.selectedMods[file] = { |
| 2373 | destinations : [], |
| 2374 | doAction : false, |
| 2375 | source_collectKey : null, |
| 2376 | source_modUUID : null, |
| 2377 | source_rawPath : file, |
| 2378 | type : this.lastPayload.isZipImport ? 'unzip' : 'copy', |
| 2379 | } |
no test coverage detected