Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

streaksheet

Package Overview
Dependencies
Maintainers
4
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streaksheet - npm Package Compare versions

Comparing version 0.7.38 to 0.7.39

2

build/src/copyEncodingDecoding.d.ts

@@ -10,3 +10,3 @@ export declare function getDefaultCopyStringsEncoding(values: Array<Array<{

internal?: string;
external?: string;
external: string;
}>>;
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,8 +11,14 @@ value: true

var _papaparse = _interopRequireDefault(require("papaparse"));
var _useCopyPaste = require("./useCopyPaste");
var COMMON_COL_DELIMITERS = [',', '|', '\t', '\n', '\r'];
function getDefaultCopyStringsEncoding(values) {
var _rawExternal$;
var columnDelimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _useCopyPaste.DEFAULT_COPY_COLUMN_DELIMITER;
var rowDelimiter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _useCopyPaste.DEFAULT_COPY_ROW_DELIMITER;
var internal = JSON.stringify(values.map(function (row) {
var rawInternal = values.map(function (row) {
return row.map(function (_ref) {

@@ -20,9 +28,21 @@ var internal = _ref.internal;

});
}));
var external = values.map(function (row) {
});
var rawExternal = values.map(function (row) {
return row.map(function (_ref2) {
var external = _ref2.external;
return external;
}).join(columnDelimiter);
}).join(rowDelimiter);
});
});
var internal = JSON.stringify(rawInternal); // Don't wrap the cell in quotes only if it is a single cell with no delimiter characters in it
var useQuotes = rawExternal.length === 1 && ((_rawExternal$ = rawExternal[0]) === null || _rawExternal$ === void 0 ? void 0 : _rawExternal$.length) === 1 && ![].concat(COMMON_COL_DELIMITERS, [columnDelimiter]).some(function (delimiter) {
return rawExternal[0][0].includes(delimiter);
});
var external = _papaparse["default"].unparse(rawExternal, {
quotes: !useQuotes,
delimiter: columnDelimiter,
newline: rowDelimiter
});
return {

@@ -35,3 +55,3 @@ internal: internal,

function getDefaultPasteStringsDecoding(internalText, externalText) {
var _parsedInternal$0$len, _parsedInternal, _parsedInternal$;
var _parsed$data$0$length;

@@ -48,29 +68,38 @@ var columnDelimiter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _useCopyPaste.DEFAULT_COPY_COLUMN_DELIMITER;

var parsedExternal = externalText.split(rowDelimiter).map(function (row) {
return row.split(columnDelimiter);
var parsed = _papaparse["default"].parse(externalText, {
delimiter: columnDelimiter,
newline: rowDelimiter
});
if (!Array.isArray(parsedInternal)) {
throw new Error('failed to parse internal clipboard');
if (parsed.errors.length) {
throw new Error('PapaParse errors: ' + JSON.stringify(parsed.errors));
}
var ret = [];
var rowCount = Math.max(parsedExternal.length, parsedInternal.length);
var colCount = Math.max(parsedExternal[0].length, (_parsedInternal$0$len = (_parsedInternal = parsedInternal) === null || _parsedInternal === void 0 ? void 0 : (_parsedInternal$ = _parsedInternal[0]) === null || _parsedInternal$ === void 0 ? void 0 : _parsedInternal$.length) !== null && _parsedInternal$0$len !== void 0 ? _parsedInternal$0$len : 0);
var parsedExternal = parsed.data;
var height = parsed.data.length;
var width = (_parsed$data$0$length = parsed.data[0].length) !== null && _parsed$data$0$length !== void 0 ? _parsed$data$0$length : 0;
for (var i = 0; i < rowCount; i++) {
var internalRow = parsedInternal[i];
var externalRow = parsedExternal[i];
ret.push([]);
if (height < 1) {
throw new Error('No values found');
}
for (var j = 0; j < colCount; j++) {
ret[i].push({
internal: internalRow === null || internalRow === void 0 ? void 0 : internalRow[j],
external: externalRow === null || externalRow === void 0 ? void 0 : externalRow[j]
});
}
var isRectangular = parsed.data.every(function (row) {
return row.length === width;
});
if (!isRectangular) {
parsedExternal = [[externalText]];
}
return ret;
return parsedExternal.map(function (externalRow, i) {
return externalRow.map(function (external, j) {
var _parsedInternal$i;
return {
external: external,
internal: (_parsedInternal$i = parsedInternal[i]) === null || _parsedInternal$i === void 0 ? void 0 : _parsedInternal$i[j]
};
});
});
}
//# sourceMappingURL=copyEncodingDecoding.js.map

@@ -93,7 +93,9 @@ "use strict";

onFocus: function onFocus(e) {
var _selectableElement$cu;
var target = e.target;
e.persist();
console.log(e.target);
(_selectableElement$cu = selectableElement.current) === null || _selectableElement$cu === void 0 ? void 0 : _selectableElement$cu.select();
if (target === selectableElement.current) {
var _selectableElement$cu;
(_selectableElement$cu = selectableElement.current) === null || _selectableElement$cu === void 0 ? void 0 : _selectableElement$cu.select();
}
},

@@ -105,4 +107,2 @@ onDoubleClick: handleGridDoubleClick,

onMouseUp: handleGridMouseUp,
onCopy: handleCopy,
onPaste: handlePaste,
ref: ref,

@@ -127,2 +127,4 @@ style: _objectSpread(_objectSpread({}, props.style), {}, {

ref: selectableElement,
onCopy: handleCopy,
onPaste: handlePaste,
style: {

@@ -129,0 +131,0 @@ userSelect: 'text',

@@ -52,3 +52,3 @@ /// <reference types="react" />

internal?: string;
external?: string;
external: string;
}>>): boolean;

@@ -63,3 +63,3 @@ columnDelimiter?: string;

internal?: string;
external?: string;
external: string;
}>>;

@@ -66,0 +66,0 @@ }

{
"name": "streaksheet",
"version": "0.7.38",
"version": "0.7.39",
"author": "Chris Cowan <agentme49@gmail.com>",

@@ -57,5 +57,7 @@ "license": "MIT",

"@babel/runtime": "^7.8.4",
"@types/papaparse": "^5.2.4",
"immer": "^7.0.9",
"immutability-helper": "^3.1.1",
"lodash": "^4.17.15",
"papaparse": "^5.3.0",
"react-virtualized-auto-sizer": "^1.0.2",

@@ -62,0 +64,0 @@ "react-window": "^1.8.5"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc