Metro Layout (React)

This example demonstrates the options you have when using the masonry layout.

This example uses React.

This example demonstrates the options you have when using the masonry layout. The Masonry Layout Engine organizes items automatically according to size, but you have options such as order, column and row sizing, gutter width, and more. You can also set grouping strategies which dictate how items are arranged. This demo gives you controls to show you what each option does. These controls are labeled by their JavaScript option names. keepOrder: when set to true, the engine preserves the order of the data. When set to false, the engine optimizes the order. rowHeight: sets the minimum vertical padding between items. gutter: sets the padding between items. columnWidth: sets the minimum horizontal padding between items. This demo also has three buttons, metro, pinterest, and random, that load preset grouping strategies. Metro groups items in a manner that optimizes layout. Pinterest uses a set item width. Random randomizes item size.
<!DOCTYPE html> <html lang="en"> <head> <base href="/dataviewsjs/demos/en/sample/DataViews/Masonry/MetroLayout/react/" /> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="keywords" content="masonry, metro, pinterest, pinterest like" /> <meta name="description" content="This example demonstrates the options you have when using the masonry layout." /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Metro Layout | Data Views | MESCIUS DataViewsJS React Demos</title> <link href="/dataviewsjs/demos/node_modules/normalize.css/normalize.css" rel="stylesheet" type="text/css" /> <link href="/dataviewsjs/demos/static/css/base.css" rel="stylesheet" type="text/css" /> <link href="/dataviewsjs/demos/static/css/bootstrap-snippet.min.css" rel="stylesheet" type="text/css" /> <link href="/dataviewsjs/demos/node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css" /> <link href="/dataviewsjs/demos/static/dataviews/gc.dataviews.core.min.css" rel="stylesheet" type="text/css" /> <link href="/dataviewsjs/demos/static/dataviews/gc.dataviews.masonry.min.css" rel="stylesheet" type="text/css" /> <link href="styles.css" rel="stylesheet" type="text/css" /> <script src="/dataviewsjs/demos/static/js/app-polyfills.min.js" type="text/javascript"></script> <script type="text/javascript"> window.process = { env: { NODE_ENV: 'production', USE_NPM: false, USE_CDN: false, SITE_ROOT: '/dataviewsjs/demos', FRAMEWORK: 'react', DVJS_L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G5WTvUGTsV4T6knQYRzKxxUdk9EarplU7d6VLF6KIR7bPJ5N6ZUMWZWaURGRKRDbLJDN5YjSN5mUoxmaxonSD56LEh7Y7RXenpmTvomevZlV9dkaysCO7hTRQFHcGRWQyc5LI9kQmB7QwR4Z7ZHOR3CSXp6SiFWYzFXeXZUSp94K8VDTkFjdwl4KptSYlRWcDxmNE5kS6kzdrkVcNJXROVGbLJkcTNGRzIER8tmd4YGNhh7dxAnMvIHRv46VtBXS4U5KvJ6dZJ6M5p4TxIjd9I5QSpXTTV6SDZXb7lzaL56ZiojITJCLikTQxUTQFV4NiojIIJCLyETO7UzM7kTO0IicfJye&amp;Qf35VfikkR9IkI0IyQiwiIyEjL6ByUKBCZhVmcwNlI0IiTis7W0ICZyBlIsISNwkTN6ADI8EDMxMjMwIjI0ICdyNkIsIyc59yc5l6YzVWbuoCLwpmLzVXajNXZt9iKs2WauMXdpN6cl5mLqwSbvNmLzVXajNXZt9iKsAnau26YuMXdpN6cl5mLqwSbvNmL6VGZ9RXajVGchJ7ZuoCLuNmLt36YukHdpNWZwFmcn9iKs46bj9Se4l6YlBXYydmLqwicr9ybj9Se4l6YlBXYydmLqwCcq9ybj9Se4l6YlBXYydmLqIiOiMXbEJCLiMVVJN4UF5kI0ISYONkIsUWdyRnOiwmdFJCLiYzMyUjNxIDNxUDO5gTM5IiOiQWSiwSfdtlOicGbmJCLlNHbhZmOiI7ckJye0ICbuFkI1pjIEJCLi4TPRtGOhtWWEFWd4IDOLRVRvx4SyMGcDhTW6n4ep', }, }; </script> <script src="/dataviewsjs/demos/node_modules/lodash/lodash.min.js" type="text/javascript"></script> <script src="/dataviewsjs/demos/node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script> <script src="/dataviewsjs/demos/static/js/license.js" type="text/javascript"></script> <script src="/dataviewsjs/demos/node_modules/systemjs/dist/system.js" type="text/javascript"></script> <script src="systemjs.config.js" type="text/javascript"></script> </head> <body class="theme-default"> <noscript>You need to enable JavaScript to run this app.</noscript> <template id="rowTemplate" style="display: none"> <div data-column="block"></div> </template> <div id="root"></div> <script type="text/javascript"> System.import('./app.js'); </script> </body> </html>
import _ from 'lodash'; import React from 'react'; import ReactDOM from 'react-dom'; import DataView, { getControlByElement } from '@grapecity/dataviews.react'; import MasonryLayout from '@grapecity/dataviews.masonry'; import { data } from './data'; import locale from './locale'; export const cols = [ { id: 'block', dataField: 'block', presenter: '<div class="block" style="width:{{=it.block.width}}px;height:{{=it.block.height}}px;background-color:{{=it.currentColor}};"></div>', }, { id: 'currentColor', dataField: 'currentColor', visible: false, }, { id: 'color', dataField: 'color', visible: false, }, { id: 'darkerColor', dataField: 'darkerColor', visible: false, }, ]; const { useState } = React; const layout = new MasonryLayout({ rowTemplate: '#rowTemplate', keepOrder: false, }); function toggleSize(dataView, item) { const maxWidth = dataView.getLayoutInfo().viewport.contentWidth; if (item.size === 'small') { item.block.width = Math.min(maxWidth, 2 * item.block.width); item.block.height *= 2; item.size = 'large'; item.currentColor = item.darkerColor; } else { item.block.width /= 2; item.block.height /= 2; item.size = 'small'; item.currentColor = item.color; } } const Range = ({ options, setOptions, name, min, max, width = 100 }) => { const value = options[name]; const label = locale[name]; const isBool = name === 'keepOrder'; const indicator = isBool ? (value ? locale.on : locale.off) : value; const inputValue = isBool ? (value ? 1 : 0) : value; const handleChange = (e) => { const value = parseInt(e.target.value, 10); setOptions(_.assign({}, options, { [name]: isBool ? !!value : value })); }; return ( <div className="range-container"> <b className="label">{label}:</b> <div className="range-wrapper"> <input type="range" name={name} min={min} max={max} style={{ width }} value={inputValue} onChange={handleChange} /> <span className="indicator">{indicator}</span> </div> </div> ); }; const App = () => { const [dataset, setDataset] = useState('metroData'); const [options, setOptions] = useState({ keepOrder: 0, gutter: 0, rowHeight: 1, columnWidth: 1, }); const btnClass = (name) => { const active = name === dataset ? ' active' : ''; return `btn btn-default${active}`; }; const changeDataSet = (name) => { const currData = window[name]; data.forEach((item, index) => { const factor = item.size === 'small' ? 1 : 2; item.block.width = currData[index].width * factor; item.block.height = currData[index].height * factor; }); setDataset(name); }; const handleMouseClick = (args) => { const dataView = getControlByElement(document.body); const hitTestInfo = dataView.hitTest(args); if (hitTestInfo && hitTestInfo.row > -1) { const item = dataView.data.getItem(hitTestInfo.row); if (item) { toggleSize(dataView, item); dataView.invalidate(); } } }; return ( <div className="main-container responsive-container" onClick={handleMouseClick}> <div className="mobile-only toggle-options"> <span className="fa fa-cog"></span> </div> <DataView id="grid" className="grid main-content" data={data} cols={cols} layout={layout} options={options} /> <div className="sample-options"> <div className="option-row"> <div className="btn-group" role="group"> <button id="metroData" className={btnClass('metroData')} onClick={() => changeDataSet('metroData')}> {locale.metro} </button> <button id="pinterestData" className={btnClass('pinterestData')} onClick={() => changeDataSet('pinterestData')} > {locale.pinterest} </button> <button id="randomData" className={btnClass('randomData')} onClick={() => changeDataSet('randomData')}> {locale.random} </button> </div> </div> <div className="option-row"> <Range name="keepOrder" min={0} max={1} width={100} options={options} setOptions={setOptions} /> </div> <div className="option-row"> <Range name="gutter" min={0} max={50} width={200} options={options} setOptions={setOptions} /> </div> <div className="option-row"> <Range name="rowHeight" min={1} max={200} width={200} options={options} setOptions={setOptions} /> </div> <div className="option-row"> <Range name="columnWidth" min={1} max={200} width={200} options={options} setOptions={setOptions} /> </div> </div> </div> ); }; ReactDOM.render(<App />, document.getElementById('root')); // helpers for responsive options panel $(function () { $('body').on('click', '.toggle-options', function () { const options = $('.sample-options'); const display = options.css('display'); options.css({ display: display === 'flex' ? 'none' : 'flex' }); $('.toggle-options .fa').toggleClass('fa-cog').toggleClass('fa-times'); }); window.addEventListener('resize', function () { if ($('.mobile-only').css('visibility') === 'hidden') { $('.sample-options').css({ display: 'flex' }); } }); });
import _ from 'lodash'; const colors = ['#CFF09E', '#A8DBA8', '#79BD9A', '#3B8686']; const darkerColors = ['#67DB67', '#40BC7C', '#0E8787', '#00436B']; export const data = []; const pinterestData = []; const metroData = []; const randomData = []; for (let i = 0; i < 80; i++) { // to control the probability const tempFactor = _.random(1, 13); const sideLength = tempFactor < 2 ? 160 : tempFactor < 5 ? 80 : 40; metroData.push({ width: sideLength, height: sideLength, }); pinterestData.push({ width: 100, height: _.random(4, 6) * 20, }); randomData.push({ width: _.random(1, 3) * 40, height: _.random(1, 3) * 40, }); data.push({ block: { width: metroData[i].width, height: metroData[i].height, }, size: 'small', currentColor: colors[i % colors.length], color: colors[i % colors.length], darkerColor: darkerColors[i % colors.length], }); } window.metroData = metroData; window.pinterestData = pinterestData; window.randomData = randomData;
module.exports = { keepOrder: 'Keep Order', on: 'ON', off: 'OFF', rowHeight: 'Row Height', gutter: 'Gutter', columnWidth: 'Column Width', metro: 'Metro', pinterest: 'Pinterest', random: 'Random', };
.main-container { width: 100%; height: 100%; } .sample-options { background: #fbfbfb; box-sizing: border-box; height: 100%; overflow: auto; padding: 10px; min-width: 240px; max-width: 300px; } .sample-options label { display: inline-block; font-weight: normal; width: 75px; } .sample-options select { border: 1px solid #999; } .sample-options .range-container { width: 100%; } .sample-options .range-wrapper { display: flex; flex-direction: row; } .sample-options .range-wrapper input { flex: 1 1 auto; } .sample-options .range-wrapper .indicator { padding: 1rem; min-width: 2rem; } .sample-options .option-row { margin-bottom: 5px; } .sample-options .option-row .label { display: block; margin-bottom: 5px; } .sample-options .option-row range { width: 100%; } .sample-options .btn-group { display: inline-flex; white-space: nowrap; } #grid { height: 100%; } .block { border: 2px solid #f1f1f1; box-sizing: border-box; } .block:hover { border: 2px solid #fff; } .flex-break { flex-basis: 100%; height: 0; } .mobile-only { visibility: hidden; } .responsive-container { display: flex; box-sizing: border-box; } .responsive-container .main-content { box-sizing: border-box; height: 100%; flex-grow: 1; flex-shrink: 1; min-width: 50%; max-width: 100%; } .responsive-container .sample-options { box-sizing: border-box; display: inline-flex; flex-direction: column; height: 100%; flex-grow: 0; flex-shrink: 1; } .responsive-container .sample-options .option-row { box-sizing: border-box; display: inline-flex; align-items: center; flex-grow: 0; flex-shrink: 0; flex-basis: auto; white-space: nowrap; padding-right: 10px; width: auto; } .responsive-container .toggle-options { align-items: center; justify-content: center; position: absolute; top: 5px; right: 5px; background-color: #ebebeb; color: #47a06c; border-radius: 16px; cursor: pointer; width: 36px; height: 36px; font-size: 28px; z-index: 101; display: none; } @media (min-width: 320px) and (max-width: 480px) and (orientation: portrait) { .mobile-only { visibility: visible; } .responsive-container { display: block; position: relative; } .responsive-container .main-content { position: absolute; display: block; top: 0; left: 0; width: 100%; max-width: 100%; z-index: 99; } .responsive-container .toggle-options { display: flex; } .responsive-container .sample-options { display: none; position: absolute; top: 0; left: 0; width: 100%; max-width: 100%; height: 100%; z-index: 100; } .responsive-container .sample-options .option-row { padding-right: 20px; } } /*# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkRhdGFWaWV3cy9NYXNvbnJ5L01ldHJvTGF5b3V0L3JlYWN0L3N0eWxlcy5zY3NzIiwiRGF0YVZpZXdzL01hc29ucnkvTWV0cm9MYXlvdXQvcmVhY3Qvc3R5bGVzLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtFQUNFLFdBQUE7RUFDQSxZQUFBO0FDQ0Y7O0FERUE7RUFDRSxtQkFBQTtFQUNBLHNCQUFBO0VBQ0EsWUFBQTtFQUNBLGNBQUE7RUFDQSxhQUFBO0VBQ0EsZ0JBQUE7RUFDQSxnQkFBQTtBQ0NGO0FEQ0U7RUFDRSxxQkFBQTtFQUNBLG1CQUFBO0VBQ0EsV0FBQTtBQ0NKO0FERUU7RUFDRSxzQkFBQTtBQ0FKO0FER0U7RUFDRSxXQUFBO0FDREo7QURJRTtFQUNFLGFBQUE7RUFDQSxtQkFBQTtBQ0ZKO0FESUk7RUFDRSxjQUFBO0FDRk47QURLSTtFQUNFLGFBQUE7RUFDQSxlQUFBO0FDSE47QURPRTtFQUNFLGtCQUFBO0FDTEo7QURPSTtFQUNFLGNBQUE7RUFDQSxrQkFBQTtBQ0xOO0FEUUk7RUFDRSxX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cG9uc2l2ZS1jb250YWluZXIgLnNhbXBsZS1vcHRpb25zIHtcbiAgICBkaXNwbGF5OiBub25lO1xuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDA7XG4gICAgbGVmdDogMDtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgaGVpZ2h0OiAxMDAlO1xuICAgIHotaW5kZXg6IDEwMDtcbiAgfVxuICAucmVzcG9uc2l2ZS1jb250YWluZXIgLnNhbXBsZS1vcHRpb25zIC5vcHRpb24tcm93IHtcbiAgICBwYWRkaW5nLXJpZ2h0OiAyMHB4O1xuICB9XG59Il19 */
(function () { const IS_PROD = window.process.env.NODE_ENV === 'production'; const USE_NPM = window.process.env.USE_NPM; const USE_CDN = window.process.env.USE_CDN; const SITE_ROOT = window.process.env.SITE_ROOT; const FRAMEWORK = window.process.env.FRAMEWORK; const ext = IS_PROD ? '.min.js' : '.js'; function js(name) { return name + ext; } function npm(t) { if (!t.file) { t.file = IS_PROD ? t.prod : t.dev; } const version = USE_CDN && t.version ? '@' + t.version : ''; const path = t.pkg + version + '/' + t.file; if (USE_CDN) { return 'https://unpkg.com/' + path; } return 'npm:' + path; } function dv(t) { if (USE_CDN || USE_NPM) { t.file = 'dist/' + t.file + '.min.js'; return npm(t); } return SITE_ROOT + '/static/dataviews/' + js(t.file); } const isTypeScript = FRAMEWORK === 'angular'; const babelConfig = { es2015: true, react: true, }; const meta = { js: { babelOptions: babelConfig, }, ts: { typescriptOptions: { tsconfig: true }, }, }; const map = { // gc.dataviews packages '@grapecity/dataviews.common': dv({pkg:'@grapecity/dataviews.common',file:'gc.dataviews.common',version:'1.8.17'}), '@grapecity/dataviews.core': dv({pkg:'@grapecity/dataviews.core',file:'gc.dataviews.core',version:'1.8.17'}), '@grapecity/dataviews.grid': dv({pkg:'@grapecity/dataviews.grid',file:'gc.dataviews.grid',version:'1.8.17'}), '@grapecity/dataviews.cardlayout': dv({pkg:'@grapecity/dataviews.cardlayout',file:'gc.dataviews.cardlayout',version:'1.8.17'}), '@grapecity/dataviews.masonry': dv({pkg:'@grapecity/dataviews.masonry',file:'gc.dataviews.masonry',version:'1.8.17'}), '@grapecity/dataviews.calendar': dv({pkg:'@grapecity/dataviews.calendar',file:'gc.dataviews.calendar',version:'1.8.17'}), '@grapecity/dataviews.timeline': dv({pkg:'@grapecity/dataviews.timeline',file:'gc.dataviews.timeline',version:'1.8.17'}), '@grapecity/dataviews.trellis': dv({pkg:'@grapecity/dataviews.trellis',file:'gc.dataviews.trellis',version:'1.8.17'}), '@grapecity/dataviews.gantt': dv({pkg:'@grapecity/dataviews.gantt',file:'gc.dataviews.gantt',version:'1.8.17'}), '@grapecity/dataviews.searchbox': dv({pkg:'@grapecity/dataviews.searchbox',file:'gc.dataviews.searchbox',version:'1.8.17'}), '@grapecity/dataviews.react': dv({pkg:'@grapecity/dataviews.react',file:'gc.dataviews.react',version:'1.8.17'}), '@grapecity/dataviews.vue': dv({pkg:'@grapecity/dataviews.vue',file:'gc.dataviews.vue',version:'1.8.17'}), '@grapecity/dataviews.angular': dv({pkg:'@grapecity/dataviews.angular',file:'gc.dataviews.angular',version:'1.8.17'}), '@grapecity/dataviews.csvexport': dv({pkg:'@grapecity/dataviews.angular',file:'gc.dataviews.csvexport',version:'1.8.17'}), // third-party libs react: npm({pkg:'react',prod:'umd/react.production.min.js',dev:'umd/react.development.js',version:'16.13.1'}), 'react-dom': npm({pkg:'react-dom',prod:'umd/react-dom.production.min.js',dev:'umd/react-dom.development.js',version:'16.13.1'}), 'react-router-dom': npm({pkg:'react-router-dom',prod:'umd/react-router-dom.min.js',dev:'umd/react-router-dom.js',version:'5.2.0'}), 'vue': npm({pkg:'vue',file:'dist/vue.js',version:'2.6.12'}), 'vue-router': npm({pkg:'vue-router',file:'dist/vue-router.js',version:'3.4.3'}), 'lodash': npm({pkg: 'lodash', file: js('lodash')}), 'zone.js': npm({pkg: 'zone.js', file: js('dist/zone')}), 'rxjs': npm({pkg: 'rxjs', file: js('bundles/rxjs.umd')}), 'rxjs/operators': npm({pkg:'rxjs-operators-bundle',prod:'dist/bundle.min.js',dev:'dist/bundle.js',version:'1.0.2'}), '@angular/core': npm({pkg: '@angular/core', file: js('bundles/core.umd')}), '@angular/common': npm({pkg: '@angular/common', file: js('bundles/common.umd')}), '@angular/compiler': npm({pkg: '@angular/compiler', file: js('bundles/compiler.umd')}), '@angular/platform-browser': npm({pkg: '@angular/platform-browser', file: js('bundles/platform-browser.umd')}), '@angular/platform-browser-dynamic': npm({pkg: '@angular/platform-browser-dynamic', file: js('bundles/platform-browser-dynamic.umd')}), '@angular/http': npm({pkg: '@angular/http', file: js('bundles/http.umd')}), '@angular/common/http': npm({pkg: '@angular/common', file: js('bundles/common-http.umd')}), '@angular/router': npm({pkg: '@angular/router', file: js('bundles/router.umd')}), '@angular/forms': npm({pkg: '@angular/forms', file: js('bundles/forms.umd')}), // systemjs plugins 'systemjs-plugin-json': npm({pkg:'systemjs-plugin-json',file:'json.js',version:'0.3.0'}), 'systemjs-plugin-css': npm({pkg:'systemjs-plugin-css',file:'css.js',version:'0.1.37'}), 'systemjs-plugin-babel': npm({pkg:'systemjs-plugin-babel',file:'plugin-babel.js',version:'0.0.25'}), 'systemjs-babel-build': npm({pkg:'systemjs-plugin-babel',file:'systemjs-babel-browser.js',version:'0.0.25'}), 'plugin-typescript': npm({pkg:'plugin-typescript',file:'lib/plugin.js',version:'8.0.0'}), 'typescript': npm({pkg:'typescript',file:'lib/typescript.js',version:'4.0.2'}), 'systemjs-vue-browser': npm({pkg:'systemjs-vue-browser',file:'index.js',version:'1.0.11'}), }; const config = { defaultJSExtensions: true, transpiler: isTypeScript ? 'plugin-typescript' : 'systemjs-plugin-babel', typescriptOptions: { tsconfig: true }, meta: { '*.json': {loader: 'systemjs-plugin-json'}, '*.css': {loader: 'systemjs-plugin-css'}, '*.vue': {loader: 'systemjs-vue-browser'}, '*.js': meta.js, '*.ts': meta.ts, 'app.js': { format: 'esm', babelOptions: babelConfig, }, 'typescript': { exports: 'ts', }, '@grapecity/dataviews.common': { format: 'amd', }, '@grapecity/dataviews.core': { format: 'amd', deps: [ '@grapecity/dataviews.common', ], }, '@grapecity/dataviews.grid': { format: 'amd', deps: [ '@grapecity/dataviews.common', '@grapecity/dataviews.core', ], }, '@grapecity/dataviews.cardlayout': { format: 'amd', deps: [ '@grapecity/dataviews.common', ], }, '@grapecity/dataviews.masonry': { format: 'amd', deps: [ '@grapecity/dataviews.common', ], }, '@grapecity/dataviews.calendar': { format: 'amd', deps: [ '@grapecity/dataviews.common', '@grapecity/dataviews.core', ], }, '@grapecity/dataviews.timeline': { format: 'amd', deps: [ '@grapecity/dataviews.common', ], }, '@grapecity/dataviews.trellis': { format: 'amd', deps: [ '@grapecity/dataviews.common', ], }, '@grapecity/dataviews.gantt': { format: 'amd', deps: [ '@grapecity/dataviews.common', ], }, '@grapecity/dataviews.searchbox': { format: 'amd', deps: [ '@grapecity/dataviews.common', ], }, '@grapecity/dataviews.react': { format: 'amd', deps: [ 'react', '@grapecity/dataviews.common', '@grapecity/dataviews.core' ], }, '@grapecity/dataviews.vue': { format: 'amd', deps: [ 'vue', '@grapecity/dataviews.common', '@grapecity/dataviews.core' ], }, '@grapecity/dataviews.angular': { format: 'amd', deps: [ '@angular/core', '@grapecity/dataviews.common', '@grapecity/dataviews.core' ], }, '@grapecity/dataviews.csvexport': { format: 'amd', deps: [ '@grapecity/dataviews.common' ], }, }, paths: { // paths serve as alias 'npm:': SITE_ROOT + '/node_modules/', }, // map tells the System loader where to look for things map: map, // packages tells the System loader how to load when no filename and/or no extension packages: { '.': { defaultExtension: isTypeScript ? 'ts' : 'js' }, node_modules: { defaultExtension: 'js' }, } }; // fast format detection to avoid detection by source code using regexp Object.keys(map).filter(function (key) { return !config.meta[key]; }).forEach(function (key) { const path = map[key]; if (path.indexOf('/umd') >= 0 || path.indexOf('.umd') >= 0) { config.meta[key] = { format: 'amd' }; } if (path.indexOf('/cjs') >= 0) { config.meta[key] = { format: 'cjs' }; } }); System.config(config); })(this);