@nodeject/ui-components
Version:
UI library for non-trivial components
28 lines (27 loc) • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DragNDropList = void 0;
var React = require("react");
var react_window_1 = require("react-window");
var styles = require("./VirtualList.module.less");
var itemCount = 145;
// These row heights are arbitrary.
// Yours should be based on the content of the row.
var rowSizes = new Array(itemCount).fill(true).map(function () { return 25 + Math.round(Math.random() * 50); });
var getItemSize = function (index) {
return rowSizes[index];
};
var Row = function (_a) {
var data = _a.data, index = _a.index, style = _a.style;
return (React.createElement("div", { className: index % 2 ? styles.listItemOdd : styles.listItemEven, style: style },
"Row ",
index));
};
var test = function (index) {
};
var DragNDropList = function (props) {
var data = props.data;
return (React.createElement("div", { className: styles.list, style: { width: '300px' } },
React.createElement(react_window_1.VariableSizeList, { height: 500, itemCount: data.itemIds.length, itemData: data, estimatedItemSize: 40, itemSize: getItemSize, width: '100%' }, Row)));
};
exports.DragNDropList = DragNDropList;