Added the capability to upload CSV files
This commit is contained in:
parent
90b02eef79
commit
d1e736d7a7
19 changed files with 678 additions and 99 deletions
47
static/csv.js
Normal file
47
static/csv.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
function parse(text) {
|
||||
let state = 0;
|
||||
let idx = 0;
|
||||
let current = '';
|
||||
let curr_row = [];
|
||||
let rows = [];
|
||||
|
||||
while(idx < text.length) {
|
||||
switch (text[idx]) {
|
||||
case '\\':
|
||||
current += text[idx++];
|
||||
break;
|
||||
|
||||
case '"':
|
||||
if(current.length == 0) {
|
||||
while(text.length > idx && text[++idx] != '"')
|
||||
current += text[idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case ',':
|
||||
if (/^\d+(\.\d+)?$/.test(current)) {
|
||||
let asnum = parseFloat(current);
|
||||
curr_row.push(asnum);
|
||||
} else {
|
||||
curr_row.push(current);
|
||||
}
|
||||
current = '';
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
curr_row.push(current);
|
||||
current = '';
|
||||
rows.push(curr_row);
|
||||
curr_row = [];
|
||||
break;
|
||||
|
||||
default:
|
||||
current += text[idx];
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
export default parse;
|
||||
|
|
@ -544,6 +544,40 @@ video {
|
|||
--tw-backdrop-sepia: ;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.container {
|
||||
max-width: 640px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.container {
|
||||
max-width: 768px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.container {
|
||||
max-width: 1024px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
.container {
|
||||
max-width: 1280px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1536px) {
|
||||
.container {
|
||||
max-width: 1536px;
|
||||
}
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
|
|
@ -560,10 +594,6 @@ video {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
.flex-grow {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.grow {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
|
@ -572,6 +602,10 @@ video {
|
|||
flex-direction: column;
|
||||
}
|
||||
|
||||
.overflow-auto {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.border {
|
||||
border-width: 1px;
|
||||
}
|
||||
|
|
@ -581,10 +615,24 @@ video {
|
|||
background-color: rgb(214 211 209 / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.p-2 {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.p-4 {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.text-lg {
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.75rem;
|
||||
}
|
||||
|
||||
.hover\:bg-stone-200:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(231 229 228 / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.hover\:bg-stone-400:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(168 162 158 / var(--tw-bg-opacity));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue