streaksheet
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -44,3 +44,5 @@ "use strict"; | ||
var content = row ? props.data.renderCell(row.key, props.data.columnAndOverviewData.columns[props.columnIndex].key) : null; | ||
return <div style={style}>{content}</div>; | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style | ||
}, content); | ||
}, function (prevProps, nextProps) { | ||
@@ -47,0 +49,0 @@ // TODO only update if the specific cell content updated |
@@ -57,5 +57,6 @@ "use strict"; | ||
}) + 'px'; | ||
return <div style={props.style}> | ||
{props.children} | ||
<div style={{ | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: props.style | ||
}, props.children, /*#__PURE__*/_react["default"].createElement("div", { | ||
style: { | ||
position: 'sticky', | ||
@@ -69,6 +70,46 @@ top: 0, | ||
height: info.sheetProps.defaultRowHeight + 'px' | ||
}}> | ||
{info.sheetProps.columnAndOverviewData.columns.map(function (_ref, i) { | ||
var key = _ref.key; | ||
return <div key={i} style={{ | ||
} | ||
}, info.sheetProps.columnAndOverviewData.columns.map(function (_ref, i) { | ||
var key = _ref.key; | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: i, | ||
style: { | ||
display: 'inline-block', | ||
verticalAlign: 'top', | ||
boxSizing: 'border-box', | ||
overflow: 'hidden', | ||
borderStyle: 'solid', | ||
borderColor: 'rgb(230,230,230)', | ||
borderWidth: '1px', | ||
width: info.sheetProps.columnAndOverviewData.columns[i].width + 'px', | ||
height: info.sheetProps.defaultRowHeight + 'px' | ||
} | ||
}, key); | ||
})), info.sheetProps.columnAndOverviewData.sections.map(function (section) { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: section.key, | ||
style: { | ||
// elements that can be overlapped by sticky stuff can not be contain:layout | ||
contain: 'size', | ||
width: totalWidthLength, | ||
height: section.sectionRowHeight + section.rowCount * info.sheetProps.defaultRowHeight + 'px' | ||
} | ||
}, true | ||
/* TODO allow sections to not have section row */ | ||
&& | ||
/*#__PURE__*/ | ||
_react["default"].createElement("div", { | ||
style: { | ||
position: 'sticky', | ||
top: info.sheetProps.defaultRowHeight + 'px', | ||
background: '#fff', | ||
contain: 'size', | ||
fontWeight: 'bold', | ||
width: totalWidthLength, | ||
height: section.sectionRowHeight + 'px' | ||
} | ||
}, info.sheetProps.columnAndOverviewData.columns.map(function (column) { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: column.key, | ||
style: { | ||
display: 'inline-block', | ||
@@ -81,46 +122,8 @@ verticalAlign: 'top', | ||
borderWidth: '1px', | ||
width: info.sheetProps.columnAndOverviewData.columns[i].width + 'px', | ||
height: info.sheetProps.defaultRowHeight + 'px' | ||
}}> | ||
{key} | ||
</div>; | ||
})} | ||
</div> | ||
{info.sheetProps.columnAndOverviewData.sections.map(function (section) { | ||
return <div key={section.key} style={{ | ||
// elements that can be overlapped by sticky stuff can not be contain:layout | ||
contain: 'size', | ||
width: totalWidthLength, | ||
height: section.sectionRowHeight + section.rowCount * info.sheetProps.defaultRowHeight + 'px' | ||
}}> | ||
{true | ||
/* TODO allow sections to not have section row */ | ||
&& <div style={{ | ||
position: 'sticky', | ||
top: info.sheetProps.defaultRowHeight + 'px', | ||
background: '#fff', | ||
contain: 'size', | ||
fontWeight: 'bold', | ||
width: totalWidthLength, | ||
width: column.width + 'px', | ||
height: section.sectionRowHeight + 'px' | ||
}}> | ||
{info.sheetProps.columnAndOverviewData.columns.map(function (column) { | ||
return <div key={column.key} style={{ | ||
display: 'inline-block', | ||
verticalAlign: 'top', | ||
boxSizing: 'border-box', | ||
overflow: 'hidden', | ||
borderStyle: 'solid', | ||
borderColor: 'rgb(230,230,230)', | ||
borderWidth: '1px', | ||
width: column.width + 'px', | ||
height: section.sectionRowHeight + 'px' | ||
}}> | ||
{info.sheetProps.renderSectionRowCell(section.key, column.key)} | ||
</div>; | ||
})} | ||
</div>} | ||
</div>; | ||
})} | ||
</div>; | ||
} | ||
}, info.sheetProps.renderSectionRowCell(section.key, column.key)); | ||
}))); | ||
})); | ||
} | ||
@@ -206,9 +209,13 @@ | ||
}; | ||
return <InternalSheetInnerElementCtx.Provider value={{ | ||
sheetProps: this.props, | ||
sheetState: this.state | ||
}}> | ||
<_reactWindow.VariableSizeGrid columnCount={this.props.columnAndOverviewData.columns.length} columnWidth={function (index) { | ||
return /*#__PURE__*/_react["default"].createElement(InternalSheetInnerElementCtx.Provider, { | ||
value: { | ||
sheetProps: this.props, | ||
sheetState: this.state | ||
} | ||
}, /*#__PURE__*/_react["default"].createElement(_reactWindow.VariableSizeGrid, { | ||
columnCount: this.props.columnAndOverviewData.columns.length, | ||
columnWidth: function columnWidth(index) { | ||
return _this3.props.columnAndOverviewData.columns[index].width; | ||
}} rowCount={(0, _sumBy["default"])(this.props.columnAndOverviewData.sections, function (s) { | ||
}, | ||
rowCount: (0, _sumBy["default"])(this.props.columnAndOverviewData.sections, function (s) { | ||
return ( | ||
@@ -220,3 +227,4 @@ /* sticky row */ | ||
/* column headers row */ | ||
} rowHeight={function (index) { | ||
, | ||
rowHeight: function rowHeight(index) { | ||
var _sectionRowMatcher$ge = sectionRowMatcher.getSectionRow(index), | ||
@@ -231,3 +239,8 @@ section = _sectionRowMatcher$ge.section, | ||
} | ||
}} width={this.props.width} height={this.props.height} innerElementType={InnerElement} itemData={itemData} itemKey={function (_ref2) { | ||
}, | ||
width: this.props.width, | ||
height: this.props.height, | ||
innerElementType: InnerElement, | ||
itemData: itemData, | ||
itemKey: function itemKey(_ref2) { | ||
var columnIndex = _ref2.columnIndex, | ||
@@ -237,6 +250,6 @@ rowIndex = _ref2.rowIndex; | ||
return columnIndex + '-' + rowIndex; | ||
}} overscanColumnCount={(_this$props$overscanC = this.props.overscanColumnCount) !== null && _this$props$overscanC !== void 0 ? _this$props$overscanC : 5} overscanRowCount={(_this$props$overscanR = this.props.overscanRowCount) !== null && _this$props$overscanR !== void 0 ? _this$props$overscanR : 100}> | ||
{_Cell["default"]} | ||
</_reactWindow.VariableSizeGrid> | ||
</InternalSheetInnerElementCtx.Provider>; | ||
}, | ||
overscanColumnCount: (_this$props$overscanC = this.props.overscanColumnCount) !== null && _this$props$overscanC !== void 0 ? _this$props$overscanC : 5, | ||
overscanRowCount: (_this$props$overscanR = this.props.overscanRowCount) !== null && _this$props$overscanR !== void 0 ? _this$props$overscanR : 100 | ||
}, _Cell["default"])); | ||
} | ||
@@ -243,0 +256,0 @@ }, { |
{ | ||
"name": "streaksheet", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Chris Cowan <agentme49@gmail.com>", | ||
@@ -29,2 +29,3 @@ "license": "MIT", | ||
"@babel/preset-env": "^7.8.4", | ||
"@babel/preset-react": "^7.9.4", | ||
"@babel/preset-typescript": "^7.8.3", | ||
@@ -31,0 +32,0 @@ "@types/jest": "^25.1.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
47890
486
29