gather-content-ui
Version:
GatherContent UI Library
80 lines (79 loc) • 3.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Nested = Nested;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _index = require("../../index");
var _windowingData = require("./windowingData");
var _WindowingIdsMock = require("./WindowingIdsMock");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _default = exports["default"] = {
title: "Legacy/Windowing/Nested",
args: {
parents: 20,
children: 20
}
};
function Nested(_ref) {
var parents = _ref.parents,
children = _ref.children;
var _createData = (0, _windowingData.createData)(parents, children),
allIds = _createData.allIds,
parentIds = _createData.parentIds,
byId = _createData.byId;
return /*#__PURE__*/_react["default"].createElement(_WindowingIdsMock.WindowingIdsMock, {
allWindowingIds: allIds
}, function (_ref2) {
var allWindowingIds = _ref2.allWindowingIds,
addIds = _ref2.addIds,
removeIds = _ref2.removeIds;
return /*#__PURE__*/_react["default"].createElement(_index.Windowing, {
itemHeight: 50,
buffer: 20,
allIds: allWindowingIds,
containerHeight: "500px"
}, /*#__PURE__*/_react["default"].createElement(_index.Windowing.Scroller, {
style: {}
}, /*#__PURE__*/_react["default"].createElement(_index.Windowing.List, null, function (_ref3) {
var inViewWindowingIds = _ref3.inViewWindowingIds;
return inViewWindowingIds.map(function (i) {
return (
/*#__PURE__*/
// @ts-expect-error TS(2339): Property 'Item' does not exist on type '{ ({ child... Remove this comment to see the full error message
_react["default"].createElement(_index.Windowing.Item, {
key: i,
index: allIds.indexOf(i),
style: {
paddingLeft: "".concat(byId[i].depth * 40, "px")
}
}, parentIds.indexOf(i) === -1 ? /*#__PURE__*/_react["default"].createElement(_index.ItemRow, {
bordered: true
}, /*#__PURE__*/_react["default"].createElement(_index.ItemRow.Name, null, byId[i].name)) : /*#__PURE__*/_react["default"].createElement(_index.FolderRow, {
open: true
}, function (show, setShow) {
return (
/*#__PURE__*/
// @ts-expect-error TS(2339): Property 'Inner' does not exist on type 'typeof Fo... Remove this comment to see the full error message
_react["default"].createElement(_index.FolderRow.Inner, {
style: {
minWidth: "320px"
}
}, /*#__PURE__*/_react["default"].createElement(_index.FolderRow.Name, {
show: show,
setShow: setShow,
handleOnClick: show ? function () {
return removeIds(allWindowingIds.indexOf(i) + 1, allWindowingIds.length - (allWindowingIds.indexOf(i) + 1));
} : function () {
return addIds(allIds.slice(allIds.indexOf(i) + 1, allIds.length), allWindowingIds.indexOf(i) + 1);
}
}, byId[i].name))
);
}))
);
});
})));
});
}
//# sourceMappingURL=NestedWindoing.stories.js.map