streaksheet
Advanced tools
Comparing version 0.8.9 to 0.8.10
@@ -72,2 +72,8 @@ "use strict"; | ||
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -634,3 +640,3 @@ | ||
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() { | ||
var selectedRowData, selectedRows, selectedIndices, _loop, _i, _Object$entries, getContinuousRegions, regions, regionRequests, _loop2, _i2, _Object$entries2, regionData; | ||
var selectedRowData, selectedRows, selectedSections, selectedIndices, _loop, _i, _Object$entries, sectionRequests, _iterator, _step, _loop3, getContinuousRegions, regions, regionRequests, _loop2, _i2, _Object$entries2, sectionData, regionData; | ||
@@ -668,3 +674,3 @@ return _regenerator["default"].wrap(function _callee$(_context) { | ||
selectedRowData = []; | ||
selectedRows = selectedRowsManager.selectedRows; | ||
selectedRows = selectedRowsManager.selectedRows, selectedSections = selectedRowsManager.selectedSections; | ||
selectedIndices = selectedRowsManager.getSelectedIndices(); | ||
@@ -693,2 +699,29 @@ | ||
sectionRequests = []; | ||
_iterator = _createForOfIteratorHelper(selectedSections); | ||
try { | ||
_loop3 = function _loop3() { | ||
var sectionKey = _step.value; | ||
var absoluteSectionRowIndex = (0, _getSectionRawRowIndex["default"])(columnAndOverviewData.sections, sectionKey, getEffectiveSectionRowCount); | ||
if (!absoluteSectionRowIndex) { | ||
throw new Error("Could not find absolute sectino row index for section - ".concat(sectionKey, " ")); | ||
} | ||
var sectionPromise = sheetDataForStreakSheet.requestRowDataForRange([[absoluteSectionRowIndex + 1, 0], [absoluteSectionRowIndex + getEffectiveSectionRowCount(columnAndOverviewData.sections.find(function (section) { | ||
return section.key === sectionKey; | ||
})), 0]]); | ||
sectionRequests.push(sectionPromise); | ||
}; | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
_loop3(); | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
regions = {}; | ||
@@ -722,6 +755,14 @@ regionRequests = []; | ||
_context.next = 12; | ||
_context.next = 15; | ||
return Promise.all(sectionRequests); | ||
case 15: | ||
sectionData = _context.sent; | ||
sectionData.map(function (data) { | ||
selectedRowData.push.apply(selectedRowData, (0, _toConsumableArray2["default"])(data)); | ||
}); | ||
_context.next = 19; | ||
return Promise.all(regionRequests); | ||
case 12: | ||
case 19: | ||
regionData = _context.sent; | ||
@@ -737,3 +778,3 @@ regionData.map(function (data) { | ||
case 15: | ||
case 22: | ||
case "end": | ||
@@ -740,0 +781,0 @@ return _context.stop(); |
@@ -81,2 +81,3 @@ "use strict"; | ||
delete draft.unselectedRows[_sectionKey2]; | ||
delete draft.selectedIndices[_sectionKey2]; | ||
@@ -143,2 +144,7 @@ if (!draft.selectedSections.includes(_sectionKey2)) { | ||
draft.selectedIndices[_sectionKey4] = (0, _toConsumableArray2["default"])(_sectionIndexSet); | ||
if (draft.selectedIndices[_sectionKey4].length === 0) { | ||
delete draft.selectedIndices[_sectionKey4]; | ||
} | ||
var selectedRowKeysSet = new Set(draft.selectedRows[_sectionKey4] || []); | ||
@@ -170,2 +176,3 @@ | ||
draft.selectedRanges = []; | ||
draft.selectedIndices = {}; | ||
return draft; | ||
@@ -206,9 +213,17 @@ } | ||
var _useState5 = (0, _react.useState)(rowsBySection), | ||
var _useState5 = (0, _react.useState)(function () { | ||
return state.selectedSections; | ||
}), | ||
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2), | ||
lastRowsBySection = _useState6[0], | ||
setLastRowsBySection = _useState6[1]; | ||
lastSelectedSections = _useState6[0], | ||
setLastSelectedSections = _useState6[1]; | ||
if (lastGetRelativeRowIndex !== getSectionRelativeRowIndex || lastRowsBySection !== rowsBySection || lastSelectedIndices !== state.selectedIndices) { | ||
var _useState7 = (0, _react.useState)(rowsBySection), | ||
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2), | ||
lastRowsBySection = _useState8[0], | ||
setLastRowsBySection = _useState8[1]; | ||
if (lastGetRelativeRowIndex !== getSectionRelativeRowIndex || lastRowsBySection !== rowsBySection || lastSelectedIndices !== state.selectedIndices || lastSelectedSections !== state.selectedSections) { | ||
var selectedIndices = state.selectedIndices; | ||
setLastSelectedSections(state.selectedSections); | ||
setLastSelectedIndices(state.selectedIndices); | ||
@@ -215,0 +230,0 @@ setLastGetRelativeRowIndex(function () { |
@@ -178,3 +178,8 @@ "use strict"; | ||
}; | ||
missingRows = []; | ||
missingRows = []; // TODO: We should be passing in `startedRowsRequests` | ||
// as the first param here. But in doing so, we don't have | ||
// a way to get the data for those startedRowsRequest objects | ||
// that have already resolved. So, this results in us always | ||
// sending out a request, even if we have that data available locally. | ||
(0, _findMissingRowsInRange["default"])({}, columnAndOverviewData.sections, range, getEffectiveSectionRowCount, function (_missingRows) { | ||
@@ -181,0 +186,0 @@ return missingRows.push(_missingRows); |
{ | ||
"name": "streaksheet", | ||
"version": "0.8.9", | ||
"version": "0.8.10", | ||
"author": "Chris Cowan <agentme49@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
689844
5976