@lingk/sync 2.0.15 → 2.0.17

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/main.js CHANGED
@@ -7106,7 +7106,7 @@ module.exports =
7106
7106
  /* 69 */
7107
7107
  /***/ function(module, exports, __webpack_require__) {
7108
7108
 
7109
- 'use strict';
7109
+ "use strict";
7110
7110
 
7111
7111
  Object.defineProperty(exports, "__esModule", {
7112
7112
  value: true
@@ -7149,13 +7149,15 @@ module.exports =
7149
7149
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
7150
7150
 
7151
7151
  function formatBytes(a, b) {
7152
- if (0 === a) return "0 Bytes";var c = 1024,
7152
+ if (0 === a) return "0 Bytes";
7153
+ var c = 1024,
7153
7154
  d = b || 2,
7154
7155
  e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
7155
- f = Math.floor(Math.log(a) / Math.log(c));return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
7156
+ f = Math.floor(Math.log(a) / Math.log(c));
7157
+ return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
7156
7158
  }
7157
7159
 
7158
- var extensionBlacklist = ['zip', 'tar', 'gz'];
7160
+ var extensionBlacklist = ["zip", "tar", "gz"];
7159
7161
 
7160
7162
  var FlatFile = function (_Component) {
7161
7163
  _inherits(FlatFile, _Component);
@@ -7171,7 +7173,7 @@ module.exports =
7171
7173
  try {
7172
7174
  json = JSON.parse(content);
7173
7175
  } catch (err) {
7174
- console.log('err when trying to parse json = ' + err);
7176
+ console.log("err when trying to parse json = " + err);
7175
7177
  }
7176
7178
  if (json) {
7177
7179
  var fields = [];
@@ -7190,7 +7192,7 @@ module.exports =
7190
7192
  });
7191
7193
  var meta = {
7192
7194
  name: file.name,
7193
- type: file.name.substr(0, file.name.lastIndexOf('.')).split(' ').join(''),
7195
+ type: file.name.substr(0, file.name.lastIndexOf(".")).split(" ").join(""),
7194
7196
  byteSize: file.size,
7195
7197
  properties: fields
7196
7198
  };
@@ -7199,13 +7201,13 @@ module.exports =
7199
7201
  };
7200
7202
 
7201
7203
  _this.parseJsonLines = function (content) {
7202
- var firstLine = content.substring(0, content.indexOf('\n'));
7203
- return '[' + firstLine + ']';
7204
+ var firstLine = content.substring(0, content.indexOf("\n"));
7205
+ return "[" + firstLine + "]";
7204
7206
  };
7205
7207
 
7206
7208
  _this.parseCSV = function (file, csv, isXLS) {
7207
7209
  if (isXLS && (!csv || csv === null)) {
7208
- var err = 'Remove empty sheets- ' + file.name;
7210
+ var err = "Remove empty sheets- " + file.name;
7209
7211
  alert(err);
7210
7212
  throw new Error(err);
7211
7213
  } else {
@@ -7216,7 +7218,7 @@ module.exports =
7216
7218
  complete: function complete(result) {
7217
7219
  resolve({
7218
7220
  name: file.name,
7219
- type: file.name.substr(0, file.name.lastIndexOf('.')).split(' ').join(''),
7221
+ type: file.name.substr(0, file.name.lastIndexOf(".")).split(" ").join(""),
7220
7222
  byteSize: file.size,
7221
7223
  properties: result.meta.fields.map(function (f) {
7222
7224
  return {
@@ -7242,13 +7244,12 @@ module.exports =
7242
7244
  var fileContents = [].concat(_toConsumableArray(_this.state.fileContents));
7243
7245
  var contentCounter = 0;
7244
7246
  fs.forEach(function (file) {
7245
- var extension = file.name.substr(file.name.lastIndexOf('.') + 1, file.name.length);
7247
+ var extension = file.name.substr(file.name.lastIndexOf(".") + 1, file.name.length);
7246
7248
  var blacklisted = extensionBlacklist.includes(extension);
7247
7249
  if (!blacklisted) {
7248
- var isXLS = extension === 'xlsx' || extension === 'xls';
7250
+ var isXLS = extension === "xlsx" || extension === "xls";
7249
7251
  var reader = new FileReader();
7250
7252
  reader.onload = function (e) {
7251
-
7252
7253
  // PARSE METADATA
7253
7254
  var data = e.target.result;
7254
7255
  var csv = null;
@@ -7259,9 +7260,9 @@ module.exports =
7259
7260
  for (var i = 0; i < length; i++) {
7260
7261
  binary += String.fromCharCode(bytes[i]);
7261
7262
  }*/
7262
- var workbook = _xlsx2.default.read(binary, { type: 'binary' });
7263
+ var workbook = _xlsx2.default.read(binary, { type: "binary" });
7263
7264
  var sheetNames = workbook.SheetNames.filter(function (sn) {
7264
- return sn !== 'Export Summary';
7265
+ return sn !== "Export Summary";
7265
7266
  });
7266
7267
  sheetNames.forEach(function (sn) {
7267
7268
  csv = _xlsx2.default.utils.sheet_to_csv(workbook.Sheets[sn]);
@@ -7278,7 +7279,7 @@ module.exports =
7278
7279
  }
7279
7280
  });
7280
7281
  });
7281
- } else if (extension === 'csv') {
7282
+ } else if (extension === "csv") {
7282
7283
  _this.parseCSV(file, csv, null).then(function (csvMeta) {
7283
7284
  meta = meta.concat(Object.assign({}, csvMeta, { fileType: extension }));
7284
7285
  counter += 1;
@@ -7287,9 +7288,9 @@ module.exports =
7287
7288
  _this.props.onDrop();
7288
7289
  }
7289
7290
  });
7290
- } else if (extension === 'json' || extension === 'jsonl') {
7291
+ } else if (extension === "json" || extension === "jsonl") {
7291
7292
  var d = data;
7292
- if (extension === 'jsonl') {
7293
+ if (extension === "jsonl") {
7293
7294
  d = _this.parseJsonLines(data);
7294
7295
  }
7295
7296
  var fileMeta = _this.parseJsonFile(d, file);
@@ -7298,13 +7299,13 @@ module.exports =
7298
7299
  counter += 1;
7299
7300
  if (counter === fs.length) {
7300
7301
  _this.setState({ meta: meta });
7301
- _this.props.onDrop();
7302
+ // this.props.onDrop();
7302
7303
  }
7303
7304
  }
7304
- } else if (extension === 'txt' || extension === 'xml') {
7305
+ } else if (extension === "txt" || extension === "xml" || extension === "hdr") {
7305
7306
  var csvMeta = {
7306
7307
  name: file.name,
7307
- type: file.name.substr(0, file.name.lastIndexOf('.')).split(' ').join(''),
7308
+ type: file.name.substr(0, file.name.lastIndexOf(".")).split(" ").join(""),
7308
7309
  byteSize: file.size
7309
7310
  };
7310
7311
  meta = meta.concat(Object.assign({}, csvMeta, { fileType: extension }));
@@ -7329,7 +7330,7 @@ module.exports =
7329
7330
  reader.readAsText(file);
7330
7331
  }
7331
7332
  } else {
7332
- _this.setState({ dropError: 'File type not accepted.' });
7333
+ _this.setState({ dropError: "File type not accepted." });
7333
7334
  setTimeout(function () {
7334
7335
  _this.setState({ dropError: null });
7335
7336
  }, 3500);
@@ -7338,7 +7339,7 @@ module.exports =
7338
7339
  };
7339
7340
 
7340
7341
  _this.onReject = function () {
7341
- _this.setState({ dropError: 'File is too big!' });
7342
+ _this.setState({ dropError: "File is too big!" });
7342
7343
  setTimeout(function () {
7343
7344
  _this.setState({ dropError: null });
7344
7345
  }, 3500);
@@ -7379,7 +7380,7 @@ module.exports =
7379
7380
  fileContents: [],
7380
7381
  uploading: false,
7381
7382
  dropError: null,
7382
- sortFileTableBy: 'uploadedTime', // name, byteSize, uploadedTime
7383
+ sortFileTableBy: "uploadedTime", // name, byteSize, uploadedTime
7383
7384
  isDeletingFile: null,
7384
7385
  deleteModalOpen: false
7385
7386
  };
@@ -7387,7 +7388,7 @@ module.exports =
7387
7388
  }
7388
7389
 
7389
7390
  _createClass(FlatFile, [{
7390
- key: 'render',
7391
+ key: "render",
7391
7392
  value: function render() {
7392
7393
  var _this2 = this;
7393
7394
 
@@ -7416,7 +7417,7 @@ module.exports =
7416
7417
  if (fileSchema && fileSchema.length) {
7417
7418
  fileSchema = fileSchema.sort(function (a, b) {
7418
7419
  var term = sortFileTableBy;
7419
- if (term === 'uploadedTime') {
7420
+ if (term === "uploadedTime") {
7420
7421
  return a[term] < b[term];
7421
7422
  }
7422
7423
  return a[term] > b[term];
@@ -7433,71 +7434,105 @@ module.exports =
7433
7434
  });
7434
7435
 
7435
7436
  return _react2.default.createElement(
7436
- 'div',
7437
+ "div",
7437
7438
  null,
7438
7439
  _react2.default.createElement(
7439
- 'div',
7440
- { style: { display: 'inline-block' } },
7440
+ "div",
7441
+ { style: { display: "inline-block" } },
7441
7442
  _react2.default.createElement(
7442
7443
  _reactDropzone2.default,
7443
- { onDropAccepted: this.onDrop, onDropRejected: this.onReject,
7444
- className: 'dropzone', maxSize: 1000000 * 1000 * 5 /*5 GB*/ },
7444
+ {
7445
+ onDropAccepted: this.onDrop,
7446
+ onDropRejected: this.onReject,
7447
+ className: "dropzone",
7448
+ maxSize: 1000000 * 1000 * 5 /*5 GB*/
7449
+ },
7445
7450
  !dropError ? _react2.default.createElement(
7446
- 'p',
7451
+ "p",
7447
7452
  null,
7448
- 'Drop one or more files here, or click to select files to upload.'
7453
+ "Drop one or more files here, or click to select files to upload."
7449
7454
  ) : _react2.default.createElement(
7450
- 'p',
7451
- { style: { color: '#c9302c', fontWeight: 'bold' } },
7455
+ "p",
7456
+ { style: { color: "#c9302c", fontWeight: "bold" } },
7452
7457
  dropError
7453
7458
  )
7454
7459
  )
7455
7460
  ),
7456
7461
  _react2.default.createElement(
7457
- 'div',
7458
- { style: { marginLeft: 30, display: 'inline-block', verticalAlign: 'top',
7459
- maxWidth: '60%' } },
7462
+ "div",
7463
+ {
7464
+ style: {
7465
+ marginLeft: 30,
7466
+ display: "inline-block",
7467
+ verticalAlign: "top",
7468
+ maxWidth: "60%"
7469
+ }
7470
+ },
7460
7471
  hasFile && _react2.default.createElement(
7461
- 'aside',
7472
+ "aside",
7462
7473
  null,
7463
7474
  _react2.default.createElement(
7464
- 'div',
7475
+ "div",
7465
7476
  null,
7466
7477
  _react2.default.createElement(
7467
- 'h3',
7468
- { style: { marginTop: 10, display: 'inline-block', verticalAlign: 'top' } },
7469
- 'Dropped files'
7478
+ "h3",
7479
+ {
7480
+ style: {
7481
+ marginTop: 10,
7482
+ display: "inline-block",
7483
+ verticalAlign: "top"
7484
+ }
7485
+ },
7486
+ "Dropped files"
7470
7487
  ),
7471
7488
  _react2.default.createElement(
7472
7489
  Button,
7473
7490
  {
7474
- type: 'brand',
7491
+ type: "brand",
7475
7492
  onClick: this.upload,
7476
- style: { marginTop: 4, marginLeft: 20, verticalAlign: 'top', height: 36 },
7477
- disabled: uploading },
7493
+ style: {
7494
+ marginTop: 4,
7495
+ marginLeft: 20,
7496
+ verticalAlign: "top",
7497
+ height: 36
7498
+ },
7499
+ disabled: uploading
7500
+ },
7478
7501
  _react2.default.createElement(
7479
- 'span',
7480
- { style: { display: 'inline-block', verticalAlign: 'top', marginTop: 3 } },
7481
- 'Upload'
7502
+ "span",
7503
+ {
7504
+ style: {
7505
+ display: "inline-block",
7506
+ verticalAlign: "top",
7507
+ marginTop: 3
7508
+ }
7509
+ },
7510
+ "Upload"
7482
7511
  ),
7483
- '\xA0\xA0',
7512
+ "\xA0\xA0",
7484
7513
  _react2.default.createElement(UploadIcon, null)
7485
7514
  ),
7486
7515
  uploading && _react2.default.createElement(
7487
- 'div',
7488
- { style: { paddingLeft: 12, paddingTop: 12, display: 'inline-block' } },
7516
+ "div",
7517
+ {
7518
+ style: {
7519
+ paddingLeft: 12,
7520
+ paddingTop: 12,
7521
+ display: "inline-block"
7522
+ }
7523
+ },
7489
7524
  _react2.default.createElement(Spinner, null)
7490
7525
  )
7491
7526
  ),
7492
7527
  _react2.default.createElement(
7493
- 'ul',
7528
+ "ul",
7494
7529
  { style: { padding: 0 } },
7495
7530
  droppedFiles.map(function (f, i) {
7496
7531
  return _react2.default.createElement(
7497
- 'li',
7498
- { key: i, style: { listStyle: 'none' } },
7532
+ "li",
7533
+ { key: i, style: { listStyle: "none" } },
7499
7534
  f.name,
7500
- ' - ',
7535
+ " - ",
7501
7536
  formatBytes(f.byteSize)
7502
7537
  );
7503
7538
  })
@@ -7505,68 +7540,77 @@ module.exports =
7505
7540
  )
7506
7541
  ),
7507
7542
  fileSchema && fileSchema.length > 0 && _react2.default.createElement(
7508
- 'div',
7509
- { style: {
7510
- marginTop: 20, width: '100%'
7511
- } },
7543
+ "div",
7544
+ {
7545
+ style: {
7546
+ marginTop: 20,
7547
+ width: "100%"
7548
+ }
7549
+ },
7512
7550
  _react2.default.createElement(
7513
- 'div',
7551
+ "div",
7514
7552
  { style: { marginBottom: 4 } },
7515
7553
  _react2.default.createElement(
7516
- 'strong',
7554
+ "strong",
7517
7555
  null,
7518
- fileSchema.length + ' file' + (fileSchema.length === 1 ? '' : 's')
7556
+ fileSchema.length + " file" + (fileSchema.length === 1 ? "" : "s")
7519
7557
  ),
7520
7558
  _react2.default.createElement(
7521
- 'strong',
7559
+ "strong",
7522
7560
  null,
7523
- ' uploaded'
7561
+ " uploaded"
7524
7562
  )
7525
7563
  ),
7526
7564
  _react2.default.createElement(
7527
7565
  _reactBootstrap.Table,
7528
- { bordered: true, condensed: true, className: 'file-manager-table' },
7566
+ { bordered: true, condensed: true, className: "file-manager-table" },
7529
7567
  _react2.default.createElement(
7530
- 'thead',
7568
+ "thead",
7531
7569
  null,
7532
7570
  _react2.default.createElement(
7533
- 'tr',
7571
+ "tr",
7534
7572
  null,
7535
7573
  _react2.default.createElement(
7536
- 'th',
7537
- { onClick: function onClick() {
7538
- return _this2.setState({ sortFileTableBy: 'name' });
7539
- } },
7540
- 'Name'
7574
+ "th",
7575
+ {
7576
+ onClick: function onClick() {
7577
+ return _this2.setState({ sortFileTableBy: "name" });
7578
+ }
7579
+ },
7580
+ "Name"
7541
7581
  ),
7542
7582
  _react2.default.createElement(
7543
- 'th',
7544
- { onClick: function onClick() {
7545
- return _this2.setState({ sortFileTableBy: 'byteSize' });
7546
- } },
7547
- 'Size'
7583
+ "th",
7584
+ {
7585
+ onClick: function onClick() {
7586
+ return _this2.setState({ sortFileTableBy: "byteSize" });
7587
+ }
7588
+ },
7589
+ "Size"
7548
7590
  ),
7549
7591
  _react2.default.createElement(
7550
- 'th',
7551
- { onClick: function onClick() {
7552
- return _this2.setState({ sortFileTableBy: 'uploadedTime' });
7553
- } },
7554
- 'Date uploaded'
7592
+ "th",
7593
+ {
7594
+ onClick: function onClick() {
7595
+ return _this2.setState({ sortFileTableBy: "uploadedTime" });
7596
+ }
7597
+ },
7598
+ "Date uploaded"
7555
7599
  )
7556
7600
  )
7557
7601
  ),
7558
7602
  _react2.default.createElement(
7559
- 'tbody',
7603
+ "tbody",
7560
7604
  null,
7561
7605
  fileSchema.map(function (file, i) {
7562
7606
  return _react2.default.createElement(
7563
- 'tr',
7607
+ "tr",
7564
7608
  { key: i },
7565
7609
  _react2.default.createElement(
7566
- 'td',
7610
+ "td",
7567
7611
  null,
7568
7612
  _react2.default.createElement(
7569
- 'a',
7613
+ "a",
7570
7614
  { onClick: function onClick(e) {
7571
7615
  return _this2.downloadFile(e, file);
7572
7616
  } },
@@ -7574,30 +7618,33 @@ module.exports =
7574
7618
  )
7575
7619
  ),
7576
7620
  _react2.default.createElement(
7577
- 'td',
7621
+ "td",
7578
7622
  null,
7579
7623
  _react2.default.createElement(
7580
- 'span',
7624
+ "span",
7581
7625
  null,
7582
7626
  formatBytes(file.byteSize)
7583
7627
  )
7584
7628
  ),
7585
7629
  _react2.default.createElement(
7586
- 'td',
7630
+ "td",
7587
7631
  null,
7588
- (0, _moment2.default)(file.uploadedTime).format('MMM Do, h:mm a')
7632
+ (0, _moment2.default)(file.uploadedTime).format("MMM Do, h:mm a")
7589
7633
  ),
7590
7634
  _react2.default.createElement(
7591
- 'td',
7635
+ "td",
7592
7636
  { style: { width: 24 } },
7593
7637
  !(isDeletingFile === file.name) && _react2.default.createElement(
7594
- 'svg',
7595
- { style: { width: 18, height: 18 },
7638
+ "svg",
7639
+ {
7640
+ style: { width: 18, height: 18 },
7596
7641
  onClick: function onClick() {
7597
7642
  return _this2.deleteFlatFile(file.name);
7598
7643
  },
7599
- className: 'delete-flat-file', viewBox: '0 0 60 60' },
7600
- _react2.default.createElement('path', { d: 'M 15.674663,15.572746 L 44.587629,44.485711 M 45.118838,15.420972 L 15.522889,45.016920' })
7644
+ className: "delete-flat-file",
7645
+ viewBox: "0 0 60 60"
7646
+ },
7647
+ _react2.default.createElement("path", { d: "M 15.674663,15.572746 L 44.587629,44.485711 M 45.118838,15.420972 L 15.522889,45.016920" })
7601
7648
  )
7602
7649
  )
7603
7650
  );
@@ -7607,22 +7654,26 @@ module.exports =
7607
7654
  ),
7608
7655
  _react2.default.createElement(
7609
7656
  Modal,
7610
- { opened: deleteModalOpenFile ? true : false,
7657
+ {
7658
+ opened: deleteModalOpenFile ? true : false,
7611
7659
  hideModal: this.closeDeleteModal,
7612
7660
  submitModal: this.actuallyDeleteFile,
7613
- title: 'Delete File', danger: true,
7614
- showCancel: true, submitLabel: 'Delete' },
7661
+ title: "Delete File",
7662
+ danger: true,
7663
+ showCancel: true,
7664
+ submitLabel: "Delete"
7665
+ },
7615
7666
  _react2.default.createElement(
7616
- 'div',
7617
- { style: { padding: 24, textAlign: 'center' } },
7618
- 'Are you sure you want to delete',
7667
+ "div",
7668
+ { style: { padding: 24, textAlign: "center" } },
7669
+ "Are you sure you want to delete",
7619
7670
  _react2.default.createElement(
7620
- 'strong',
7671
+ "strong",
7621
7672
  null,
7622
- ' ',
7673
+ " ",
7623
7674
  deleteModalOpenFile
7624
7675
  ),
7625
- '?'
7676
+ "?"
7626
7677
  )
7627
7678
  )
7628
7679
  );
@@ -7634,10 +7685,10 @@ module.exports =
7634
7685
 
7635
7686
  var UploadIcon = function UploadIcon() {
7636
7687
  return _react2.default.createElement(
7637
- 'svg',
7638
- { fill: '#FFF', height: '24', viewBox: '0 0 24 24', width: '24' },
7639
- _react2.default.createElement('path', { d: 'M0 0h24v24H0z', fill: 'none' }),
7640
- _react2.default.createElement('path', { d: 'M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z' })
7688
+ "svg",
7689
+ { fill: "#FFF", height: "24", viewBox: "0 0 24 24", width: "24" },
7690
+ _react2.default.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }),
7691
+ _react2.default.createElement("path", { d: "M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" })
7641
7692
  );
7642
7693
  };
7643
7694