@lingk/sync 1.1.14 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/credentialSections.js +48 -26
- package/build/credentialSections.js.map +1 -1
- package/build/css/main.css +4 -0
- package/build/lightning.js.map +1 -1
- package/build/lightningStyles.js.map +1 -1
- package/build/lingk.js.map +1 -1
- package/build/lingkStyles.js.map +1 -1
- package/build/loadData.js.map +1 -1
- package/build/main.js +50 -27
- package/build/main.js.map +1 -1
- package/build/metadataDropdown.js.map +1 -1
- package/build/metadataFunctions.js.map +1 -1
- package/build/reducer.js.map +1 -1
- package/build/saveData.js.map +1 -1
- package/package.json +1 -1
|
@@ -3648,7 +3648,7 @@ module.exports =
|
|
|
3648
3648
|
f = Math.floor(Math.log(a) / Math.log(c));return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
|
|
3649
3649
|
}
|
|
3650
3650
|
|
|
3651
|
-
var extensionBlacklist = ['
|
|
3651
|
+
var extensionBlacklist = ['jsonl', 'xml', 'zip', 'tar', 'gz'];
|
|
3652
3652
|
|
|
3653
3653
|
var FlatFile = function (_Component) {
|
|
3654
3654
|
_inherits(FlatFile, _Component);
|
|
@@ -3740,30 +3740,34 @@ module.exports =
|
|
|
3740
3740
|
var reader = new FileReader();
|
|
3741
3741
|
reader.onload = function (e) {
|
|
3742
3742
|
|
|
3743
|
+
// PARSE METADATA
|
|
3743
3744
|
var data = e.target.result;
|
|
3744
3745
|
var csv = null;
|
|
3745
3746
|
if (isXLS) {
|
|
3746
|
-
var i;
|
|
3747
|
-
|
|
3748
3747
|
(function () {
|
|
3749
|
-
var
|
|
3750
|
-
var
|
|
3751
|
-
|
|
3748
|
+
var sheetCounter = 0;
|
|
3749
|
+
var binary = data;
|
|
3750
|
+
/*const bytes = new Uint8Array(data)
|
|
3751
|
+
for (var i = 0; i < length; i++) {
|
|
3752
3752
|
binary += String.fromCharCode(bytes[i]);
|
|
3753
|
-
}
|
|
3753
|
+
}*/
|
|
3754
3754
|
var workbook = _xlsx2.default.read(binary, { type: 'binary' });
|
|
3755
|
-
workbook.SheetNames.
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3755
|
+
var sheetNames = workbook.SheetNames.filter(function (sn) {
|
|
3756
|
+
return sn !== 'Export Summary';
|
|
3757
|
+
});
|
|
3758
|
+
sheetNames.forEach(function (sn) {
|
|
3759
|
+
csv = _xlsx2.default.utils.sheet_to_csv(workbook.Sheets[sn]);
|
|
3760
|
+
_this.parseCSV(file, csv).then(function (xlsMeta) {
|
|
3761
|
+
meta = meta.concat(Object.assign({}, xlsMeta, {
|
|
3762
|
+
sheetName: sn
|
|
3763
|
+
}));
|
|
3764
|
+
sheetCounter += 1;
|
|
3765
|
+
counter += 1;
|
|
3766
|
+
if (counter >= fs.length && sheetCounter === sheetNames.length) {
|
|
3767
|
+
_this.setState({ meta: meta });
|
|
3768
|
+
_this.props.onDrop();
|
|
3769
|
+
}
|
|
3770
|
+
});
|
|
3767
3771
|
});
|
|
3768
3772
|
})();
|
|
3769
3773
|
} else if (extension === 'csv') {
|
|
@@ -3787,7 +3791,8 @@ module.exports =
|
|
|
3787
3791
|
}
|
|
3788
3792
|
}
|
|
3789
3793
|
|
|
3790
|
-
|
|
3794
|
+
// ADD TO CONTENTS, TO UPLOAD
|
|
3795
|
+
fileContents = fileContents.concat(file);
|
|
3791
3796
|
contentCounter += 1;
|
|
3792
3797
|
if (contentCounter === fs.length) {
|
|
3793
3798
|
_this.setState({ fileContents: fileContents });
|
|
@@ -3795,7 +3800,7 @@ module.exports =
|
|
|
3795
3800
|
}; // end file reader on load callback
|
|
3796
3801
|
|
|
3797
3802
|
if (isXLS) {
|
|
3798
|
-
reader.
|
|
3803
|
+
reader.readAsBinaryString(file); // read as array buffer???
|
|
3799
3804
|
} else {
|
|
3800
3805
|
reader.readAsText(file);
|
|
3801
3806
|
}
|
|
@@ -3858,15 +3863,32 @@ module.exports =
|
|
|
3858
3863
|
var hasFile = meta && meta.length > 0;
|
|
3859
3864
|
|
|
3860
3865
|
var fileSchema = [];
|
|
3861
|
-
|
|
3862
|
-
|
|
3866
|
+
var fileSchemaNames = [];
|
|
3867
|
+
this.props.fileSchema && this.props.fileSchema.forEach(function (f) {
|
|
3868
|
+
if (!fileSchemaNames.includes(f.name)) {
|
|
3869
|
+
fileSchema.push(f);
|
|
3870
|
+
fileSchemaNames.push(f.name);
|
|
3871
|
+
}
|
|
3872
|
+
});
|
|
3873
|
+
if (fileSchema && fileSchema.length) {
|
|
3863
3874
|
fileSchema = fileSchema.sort(function (a, b) {
|
|
3864
3875
|
var term = sortFileTableBy;
|
|
3865
|
-
if (term === 'uploadedTime') {
|
|
3876
|
+
if (term === 'uploadedTime') {
|
|
3877
|
+
return a[term] < b[term];
|
|
3878
|
+
}
|
|
3866
3879
|
return a[term] > b[term];
|
|
3867
3880
|
});
|
|
3868
3881
|
}
|
|
3869
3882
|
|
|
3883
|
+
var droppedFiles = [];
|
|
3884
|
+
var droppedFileNames = [];
|
|
3885
|
+
meta && meta.forEach(function (f) {
|
|
3886
|
+
if (!droppedFileNames.includes(f.name)) {
|
|
3887
|
+
droppedFiles.push(f);
|
|
3888
|
+
droppedFileNames.push(f.name);
|
|
3889
|
+
}
|
|
3890
|
+
});
|
|
3891
|
+
|
|
3870
3892
|
return _react2.default.createElement(
|
|
3871
3893
|
'div',
|
|
3872
3894
|
null,
|
|
@@ -3880,7 +3902,7 @@ module.exports =
|
|
|
3880
3902
|
!dropError ? _react2.default.createElement(
|
|
3881
3903
|
'p',
|
|
3882
3904
|
null,
|
|
3883
|
-
'Drop one or more
|
|
3905
|
+
'Drop one or more files here, or click to select files to upload.'
|
|
3884
3906
|
) : _react2.default.createElement(
|
|
3885
3907
|
'p',
|
|
3886
3908
|
{ style: { color: '#c9302c', fontWeight: 'bold' } },
|
|
@@ -3927,7 +3949,7 @@ module.exports =
|
|
|
3927
3949
|
_react2.default.createElement(
|
|
3928
3950
|
'ul',
|
|
3929
3951
|
{ style: { padding: 0 } },
|
|
3930
|
-
|
|
3952
|
+
droppedFiles.map(function (f, i) {
|
|
3931
3953
|
return _react2.default.createElement(
|
|
3932
3954
|
'li',
|
|
3933
3955
|
{ key: i, style: { listStyle: 'none' } },
|