@adobe/uxp-optimized
Version:
Library of react components optimized for Adobe's Unified Extensibility Platform
54 lines (52 loc) • 2.48 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/*
Copyright 2019 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in
accordance with the terms of the Adobe license agreement accompanying
it. If you have received this file from a source other than Adobe,
then your use, modification, or distribution of it requires the prior
written permission of Adobe.
*/
const react_1 = __importStar(require("react"));
const _1 = __importDefault(require("."));
/**
* This component provides a higher level, simpler interface for virtualization.
* Each child must be a react element with a key specified.
* The element type should be a uniquely named function or class.
* Elements will be recycled during virtualization based upon element type name.
* @see the NewContainer sample for usage.
*/
exports.default = (0, react_1.forwardRef)(function Container(properties, ref) {
let { children, ...rest } = properties;
let items = (Array.isArray(children) ? children : [children]).flat(Number.MAX_SAFE_INTEGER).filter(Boolean);
// we need type field.
return (react_1.default.createElement(_1.default, { items: items, itemKey: "key", itemType: item => item.type.name || item.type.toString(), ref: ref, ...rest }, (item) => item));
});