forked from btargac/excel-parser-processor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to xslx and some modernization
- Loading branch information
Showing
9 changed files
with
425 additions
and
772 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { dialog } from 'electron'; | ||
|
||
export const showOpenDialog = (browserWindow, defaultPath, cb) => { | ||
dialog.showOpenDialog(browserWindow, { | ||
buttonLabel: "Choose", | ||
defaultPath, | ||
title: "Choose an output folder", | ||
properties: ['openDirectory', 'createDirectory'] | ||
}).then(({ canceled, filePaths }) => { | ||
export const showOpenDialog = async (browserWindow, data, cb) => { | ||
try { | ||
const { canceled, filePaths } = await dialog.showOpenDialog(browserWindow, { | ||
buttonLabel: "Choose", | ||
defaultPath: data.path, | ||
title: "Choose an output folder", | ||
properties: ['openDirectory', 'createDirectory'] | ||
}); | ||
|
||
if( !canceled && filePaths?.length) { | ||
cb(defaultPath, filePaths[0], browserWindow); | ||
cb(data.file, filePaths[0], browserWindow); | ||
} | ||
}).catch(err => { | ||
} catch (err) { | ||
console.log(err); | ||
}) | ||
} | ||
}; |
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 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,7 +1,15 @@ | ||
const extensionRegex = /\.([a-zA-Z0-9]+)$/ig | ||
const trailingDotRegex = /\.$/g | ||
|
||
const trimTrailingDot = name => { | ||
const hasTrailingDot = trailingDotRegex.test(name); | ||
|
||
return hasTrailingDot ? name.replace(trailingDotRegex, '') : name; | ||
} | ||
|
||
export default (name, extension) => { | ||
const hasExtension = name.match(extensionRegex); | ||
name = trimTrailingDot(name); | ||
|
||
return hasExtension ? name: `${name}.${extension}`; | ||
} |
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