mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 09:48:18 -05:00
chore(deps): update major, minor and patch (#399)
This commit is contained in:
@@ -13,7 +13,7 @@ export default function translator({ initial = 'en-US', fallback = 'en-US' } = {
|
||||
* @hideconstructor
|
||||
*/
|
||||
const api = /** @lends Translator# */ {
|
||||
language: lang => {
|
||||
language: (lang) => {
|
||||
if (lang) {
|
||||
currentLocale = lang;
|
||||
}
|
||||
@@ -34,10 +34,10 @@ export default function translator({ initial = 'en-US', fallback = 'en-US' } = {
|
||||
* });
|
||||
* translator.get('company.hello_user', ['John']); // Hello John
|
||||
*/
|
||||
add: item => {
|
||||
add: (item) => {
|
||||
// TODO - disallow override?
|
||||
const { id, locale } = item;
|
||||
Object.keys(locale).forEach(lang => {
|
||||
Object.keys(locale).forEach((lang) => {
|
||||
if (!dictionaries[lang]) {
|
||||
dictionaries[lang] = {};
|
||||
}
|
||||
|
||||
@@ -31,21 +31,21 @@
|
||||
"@material-ui/core": "^4.9.0",
|
||||
"@material-ui/icons": "^4.5.1",
|
||||
"@material-ui/styles": "^4.9.0",
|
||||
"@nebula.js/supernova": "^0.1.0-alpha.28",
|
||||
"@nebula.js/supernova": "^0.x",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@material-ui/core": "4.9.0",
|
||||
"@material-ui/icons": "4.5.1",
|
||||
"@material-ui/styles": "4.9.0",
|
||||
"@material-ui/core": "4.9.9",
|
||||
"@material-ui/icons": "4.9.1",
|
||||
"@material-ui/styles": "4.9.6",
|
||||
"@nebula.js/locale": "0.4.0",
|
||||
"@nebula.js/theme": "0.4.0",
|
||||
"@nebula.js/ui": "0.4.0",
|
||||
"node-event-emitter": "0.0.1",
|
||||
"react": "16.12.0",
|
||||
"react-dom": "16.12.0",
|
||||
"react-test-renderer": "16.12.0",
|
||||
"react": "16.13.1",
|
||||
"react-dom": "16.13.1",
|
||||
"react-test-renderer": "16.13.1",
|
||||
"react-window": "1.8.5",
|
||||
"react-window-infinite-loader": "1.0.5",
|
||||
"semver": "6.3.0"
|
||||
|
||||
@@ -58,7 +58,7 @@ describe('app-theme', () => {
|
||||
themes: [
|
||||
{
|
||||
id: 'darkish',
|
||||
load: () => new Promise(resolve => setTimeout(resolve, 6000)),
|
||||
load: () => new Promise((resolve) => setTimeout(resolve, 6000)),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('nucleus', () => {
|
||||
const delay = 1000;
|
||||
appThemeFn.returns({
|
||||
setTheme: () =>
|
||||
new Promise(resolve => {
|
||||
new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
waited = true;
|
||||
resolve();
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* eslint no-underscore-dangle:0 */
|
||||
import themeFn from '@nebula.js/theme';
|
||||
|
||||
const timed = (t, v) => new Promise(resolve => setTimeout(() => resolve(v), t));
|
||||
const timed = (t, v) => new Promise((resolve) => setTimeout(() => resolve(v), t));
|
||||
|
||||
const LOAD_THEME_TIMEOUT = 5000;
|
||||
|
||||
export default function appTheme({ themes = [], root } = {}) {
|
||||
const wrappedTheme = themeFn();
|
||||
|
||||
const setTheme = async themeId => {
|
||||
const found = themes.filter(t => t.id === themeId)[0];
|
||||
const setTheme = async (themeId) => {
|
||||
const found = themes.filter((t) => t.id === themeId)[0];
|
||||
let muiTheme = themeId === 'dark' ? 'dark' : 'light';
|
||||
if (found && found.load) {
|
||||
try {
|
||||
|
||||
@@ -16,7 +16,7 @@ import useLayout, { useAppLayout } from '../hooks/useLayout';
|
||||
import InstanceContext from '../contexts/InstanceContext';
|
||||
import useObjectSelections from '../hooks/useObjectSelections';
|
||||
|
||||
const initialState = err => ({
|
||||
const initialState = (err) => ({
|
||||
loading: false,
|
||||
loaded: false,
|
||||
longRunningQuery: false,
|
||||
@@ -103,12 +103,12 @@ const handleModal = ({ sn, layout, model }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const filterData = d => (d.qError ? d.qError.qErrorCode === 7005 : true);
|
||||
const filterData = (d) => (d.qError ? d.qError.qErrorCode === 7005 : true);
|
||||
|
||||
const validateTargets = (translator, layout, { targets }) => {
|
||||
const layoutErrors = [];
|
||||
const requirementsError = [];
|
||||
targets.forEach(def => {
|
||||
targets.forEach((def) => {
|
||||
const minD = def.dimensions.min();
|
||||
const minM = def.measures.min();
|
||||
const hc = def.resolveLayout(layout);
|
||||
@@ -180,7 +180,7 @@ const Cell = forwardRef(({ corona, model, initialSnOptions, initialError, onMoun
|
||||
if (initialError || !appLayout) {
|
||||
return undefined;
|
||||
}
|
||||
const validate = sn => {
|
||||
const validate = (sn) => {
|
||||
const [showError, error] = validateTargets(translator, layout, sn.generator.qae.data);
|
||||
if (showError) {
|
||||
dispatch({ type: 'ERROR', error });
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { makeStyles, Typography, Grid } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
itemStyle: {
|
||||
minWidth: 0,
|
||||
paddingTop: theme.spacing(1),
|
||||
|
||||
@@ -9,7 +9,7 @@ const ITEM_SPACING = 4;
|
||||
const NUMBER_OF_ITEMS = 6;
|
||||
const MIN_WIDTH = (ITEM_WIDTH + ITEM_SPACING) * NUMBER_OF_ITEMS;
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
containerStyle: {
|
||||
flexGrow: 0,
|
||||
},
|
||||
@@ -35,7 +35,7 @@ const Header = ({ layout, sn, anchorEl }) => {
|
||||
if (!sn || !sn.component || !sn.component.isHooked) {
|
||||
return;
|
||||
}
|
||||
sn.component.observeActions(actions => setItems(actions));
|
||||
sn.component.observeActions((actions) => setItems(actions));
|
||||
}, [sn]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -60,7 +60,7 @@ export { NebulaApp };
|
||||
|
||||
export default function boot({ app, context }) {
|
||||
let resolveRender;
|
||||
const rendered = new Promise(resolve => {
|
||||
const rendered = new Promise((resolve) => {
|
||||
resolveRender = resolve;
|
||||
});
|
||||
const appRef = React.createRef();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { CircularProgress } from '@material-ui/core';
|
||||
|
||||
import { makeStyles } from '@nebula.js/ui/theme';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
position: 'relative',
|
||||
display: 'inline-block',
|
||||
|
||||
@@ -6,7 +6,7 @@ import SvgIcon from '@nebula.js/ui/icons/SvgIcon';
|
||||
|
||||
import { makeStyles, useTheme } from '@nebula.js/ui/theme';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
icon: {
|
||||
color: theme.palette.text.primary,
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@ const Supernova = ({ sn, snOptions: options, layout, appLayout, corona }) => {
|
||||
const [renderCnt, setRenderCnt] = useState(0);
|
||||
const [containerRef, containerRect, containerNode] = useRect();
|
||||
const [snNode, setSnNode] = useState(null);
|
||||
const snRef = useCallback(ref => {
|
||||
const snRef = useCallback((ref) => {
|
||||
if (!ref) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ describe('<Cell />', () => {
|
||||
await act(async () => {
|
||||
renderer = create(
|
||||
<ThemeProvider theme={theme}>
|
||||
<InstanceContext.Provider value={{ translator: { get: s => s, language: () => 'sv' } }}>
|
||||
<InstanceContext.Provider value={{ translator: { get: (s) => s, language: () => 'sv' } }}>
|
||||
<Cell ref={cellRef} corona={corona} model={model} initialSnOptions={initialSnOptions} onMount={onMount} />
|
||||
</InstanceContext.Provider>
|
||||
</ThemeProvider>,
|
||||
|
||||
@@ -21,11 +21,11 @@ describe('<Error />', () => {
|
||||
});
|
||||
it('should render default error', async () => {
|
||||
await render();
|
||||
const title = renderer.root.find(el => {
|
||||
const title = renderer.root.find((el) => {
|
||||
return el.props['data-tid'] === 'error-title';
|
||||
});
|
||||
expect(title.props.children).to.equal('Error');
|
||||
const message = renderer.root.find(el => {
|
||||
const message = renderer.root.find((el) => {
|
||||
return el.props['data-tid'] === 'error-message';
|
||||
});
|
||||
expect(message.props.children).to.equal('');
|
||||
@@ -33,15 +33,15 @@ describe('<Error />', () => {
|
||||
|
||||
it('should render error', async () => {
|
||||
await render('foo', 'bar', [{ path: 'baz', error: { qErrorCode: 1337 } }]);
|
||||
const title = renderer.root.find(el => {
|
||||
const title = renderer.root.find((el) => {
|
||||
return el.props['data-tid'] === 'error-title';
|
||||
});
|
||||
expect(title.props.children).to.equal('foo');
|
||||
const message = renderer.root.find(el => {
|
||||
const message = renderer.root.find((el) => {
|
||||
return el.props['data-tid'] === 'error-message';
|
||||
});
|
||||
expect(message.props.children).to.equal('bar');
|
||||
const data = renderer.root.find(el => {
|
||||
const data = renderer.root.find((el) => {
|
||||
return el.props.children && Array.isArray(el.props.children) ? el.props.children[0] === 'baz' : false;
|
||||
});
|
||||
expect(data.props).to.deep.equal({ variant: 'subtitle2', align: 'center', children: ['baz', ' ', '-', ' ', 1337] });
|
||||
|
||||
@@ -10,7 +10,7 @@ describe('<Footer />', () => {
|
||||
let render;
|
||||
beforeEach(() => {
|
||||
sandbox = sinon.createSandbox();
|
||||
render = async layout => {
|
||||
render = async (layout) => {
|
||||
await act(async () => {
|
||||
renderer = create(<Footer layout={layout} />);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { create, act } from 'react-test-renderer';
|
||||
import { makeStyles, Grid, Typography } from '@material-ui/core';
|
||||
|
||||
const Popover = props => props.children;
|
||||
const Popover = (props) => props.children;
|
||||
const SelectionToolbar = () => 'selectiontoolbar';
|
||||
|
||||
describe('<Header />', () => {
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('<LongRunningQuery />', () => {
|
||||
render = async (canCancel, canRetry) => {
|
||||
await act(async () => {
|
||||
renderer = create(
|
||||
<InstanceContext.Provider value={{ translator: { get: s => s } }}>
|
||||
<InstanceContext.Provider value={{ translator: { get: (s) => s } }}>
|
||||
<LongRunningQuery canCancel={canCancel} canRetry={canRetry} api={api} />
|
||||
</InstanceContext.Provider>
|
||||
);
|
||||
|
||||
@@ -135,7 +135,7 @@ describe('<NebulaApp />', () => {
|
||||
renderer = create(
|
||||
<StylesProvider>
|
||||
<ThemeProvider theme={theme}>
|
||||
<InstanceContext.Provider value={{ translator: { get: s => s, language: () => 'sv' } }}>
|
||||
<InstanceContext.Provider value={{ translator: { get: (s) => s, language: () => 'sv' } }}>
|
||||
<NebulaApp ref={ref} initialContext={initialContext} app={app} />
|
||||
</InstanceContext.Provider>
|
||||
</ThemeProvider>
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('<Progress />', () => {
|
||||
let render;
|
||||
beforeEach(() => {
|
||||
sandbox = sinon.createSandbox();
|
||||
render = async size => {
|
||||
render = async (size) => {
|
||||
await act(async () => {
|
||||
renderer = create(<Progress size={size} />);
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('<SelectionToolbarWithDefault />', () => {
|
||||
render = async (api, xItems, onCancel, onConfirm) => {
|
||||
await act(async () => {
|
||||
renderer = create(
|
||||
<InstanceContext.Provider value={{ translator: { get: s => s } }}>
|
||||
<InstanceContext.Provider value={{ translator: { get: (s) => s } }}>
|
||||
<SelectionToolbarWithDefault api={api} xItems={xItems} onCancel={onCancel} onConfirm={onConfirm} />
|
||||
</InstanceContext.Provider>
|
||||
);
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('<Supernova />', () => {
|
||||
it('should render', async () => {
|
||||
let initialRenderResolve;
|
||||
// eslint-disable-next-line no-new
|
||||
const initialRender = new Promise(resolve => {
|
||||
const initialRender = new Promise((resolve) => {
|
||||
initialRenderResolve = resolve;
|
||||
});
|
||||
const logicalSize = sandbox.stub().returns('logical');
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function ListBox({ model, selections, direction }) {
|
||||
});
|
||||
|
||||
const onClick = useCallback(
|
||||
e => {
|
||||
(e) => {
|
||||
if (layout && layout.qListObject.qDimensionInfo.qLocked) {
|
||||
return;
|
||||
}
|
||||
@@ -45,12 +45,12 @@ export default function ListBox({ model, selections, direction }) {
|
||||
);
|
||||
|
||||
const isItemLoaded = useCallback(
|
||||
index => {
|
||||
(index) => {
|
||||
if (!pages || !local.current.validPages) {
|
||||
return false;
|
||||
}
|
||||
local.current.checkIdx = index;
|
||||
const page = pages.filter(p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
|
||||
const page = pages.filter((p) => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
|
||||
return page && page.qArea.qTop <= index && index < page.qArea.qTop + page.qArea.qHeight;
|
||||
},
|
||||
[layout, pages]
|
||||
@@ -69,21 +69,21 @@ export default function ListBox({ model, selections, direction }) {
|
||||
local.current.queue.shift();
|
||||
}
|
||||
clearTimeout(local.current.timeout);
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
local.current.timeout = setTimeout(
|
||||
() => {
|
||||
const sorted = local.current.queue.slice(-2).sort((a, b) => a.start - b.start);
|
||||
model
|
||||
.getListObjectData(
|
||||
'/qListObjectDef',
|
||||
sorted.map(s => ({
|
||||
sorted.map((s) => ({
|
||||
qTop: s.start,
|
||||
qHeight: s.stop - s.start + 1,
|
||||
qLeft: 0,
|
||||
qWidth: 1,
|
||||
}))
|
||||
)
|
||||
.then(p => {
|
||||
.then((p) => {
|
||||
local.current.validPages = true;
|
||||
listData.current.pages = p;
|
||||
setPages(p);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { makeStyles } from '@nebula.js/ui/theme';
|
||||
import Lock from '@nebula.js/ui/icons/lock';
|
||||
import Tick from '@nebula.js/ui/icons/tick';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
row: {
|
||||
flexWrap: 'nowrap',
|
||||
borderBottom: `1px solid ${theme.palette.divider}`,
|
||||
@@ -58,7 +58,7 @@ export default function Row({ index, style, data }) {
|
||||
const { onClick, pages } = data;
|
||||
let cell;
|
||||
if (pages) {
|
||||
const page = pages.filter(p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
|
||||
const page = pages.filter((p) => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
|
||||
if (page) {
|
||||
const area = page.qArea;
|
||||
if (index >= area.qTop && index < area.qTop + area.qHeight) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { makeStyles } from '@nebula.js/ui/theme';
|
||||
|
||||
import InstanceContext from '../../contexts/InstanceContext';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
'& fieldset': {
|
||||
borderRadius: 0,
|
||||
@@ -19,11 +19,11 @@ const TREE_PATH = '/qListObjectDef';
|
||||
export default function ListBoxSearch({ model }) {
|
||||
const { translator } = useContext(InstanceContext);
|
||||
const [value, setValue] = useState('');
|
||||
const onChange = e => {
|
||||
const onChange = (e) => {
|
||||
setValue(e.target.value);
|
||||
model.searchListObjectFor(TREE_PATH, e.target.value);
|
||||
};
|
||||
const onKeyDown = e => {
|
||||
const onKeyDown = (e) => {
|
||||
switch (e.key) {
|
||||
case 'Enter':
|
||||
model.acceptListObjectSearch(TREE_PATH, true);
|
||||
|
||||
@@ -5,22 +5,22 @@ import { selectExcluded } from '@nebula.js/ui/icons/select-excluded';
|
||||
|
||||
export default ({ layout, model, translator, onSelected = () => {} }) => {
|
||||
const canSelectAll = () => {
|
||||
return ['qOption', 'qAlternative', 'qExcluded', 'qDeselected'].some(sc => {
|
||||
return ['qOption', 'qAlternative', 'qExcluded', 'qDeselected'].some((sc) => {
|
||||
return layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0;
|
||||
});
|
||||
};
|
||||
const canSelectPossible = () => {
|
||||
return ['qOption'].some(sc => {
|
||||
return ['qOption'].some((sc) => {
|
||||
return layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0;
|
||||
});
|
||||
};
|
||||
const canSelectAlternative = () => {
|
||||
return ['qAlternative'].some(sc => {
|
||||
return ['qAlternative'].some((sc) => {
|
||||
return layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0;
|
||||
});
|
||||
};
|
||||
const canSelectExcluded = () => {
|
||||
return ['qAlternative', 'qExcluded'].some(sc => {
|
||||
return ['qAlternative', 'qExcluded'].some((sc) => {
|
||||
return layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import DownArrow from '@nebula.js/ui/icons/down-arrow';
|
||||
import OneField from './OneField';
|
||||
import MultiState from './MultiState';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
item: {
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
position: 'relative',
|
||||
@@ -31,7 +31,7 @@ export default function More({ items = [], api }) {
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
const alignTo = useRef();
|
||||
|
||||
const handleShowMoreItems = e => {
|
||||
const handleShowMoreItems = (e) => {
|
||||
if (e.currentTarget.contains(e.target)) {
|
||||
// because click in popover will propagate to parent
|
||||
setAnchorEl(e.currentTarget);
|
||||
@@ -115,7 +115,7 @@ export default function More({ items = [], api }) {
|
||||
<List dense>
|
||||
{items.map((s, ix) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<ListItem key={ix} title={s.name} onClick={e => handleShowItem(e, ix)}>
|
||||
<ListItem key={ix} title={s.name} onClick={(e) => handleShowItem(e, ix)}>
|
||||
<Box border={1} width="100%" borderRadius="borderRadius" borderColor="divider">
|
||||
{s.states.length > 1 ? <MultiState field={s} api={api} /> : <OneField field={s} api={api} />}
|
||||
</Box>
|
||||
|
||||
@@ -8,7 +8,7 @@ import InstanceContext from '../../contexts/InstanceContext';
|
||||
|
||||
import ListBoxPopover from '../listbox/ListBoxPopover';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
item: {
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
position: 'relative',
|
||||
@@ -36,7 +36,7 @@ export default function MultiState({ field, api, moreAlignTo = null, onClose = (
|
||||
const { translator } = useContext(InstanceContext);
|
||||
const clearAllStates = translator.get('Selection.ClearAllStates');
|
||||
|
||||
const handleShowFields = e => {
|
||||
const handleShowFields = (e) => {
|
||||
if (e.currentTarget.contains(e.target)) {
|
||||
// because click in popover will propagate to parent
|
||||
setAnchorEl(e.currentTarget);
|
||||
@@ -62,7 +62,7 @@ export default function MultiState({ field, api, moreAlignTo = null, onClose = (
|
||||
};
|
||||
|
||||
const handleClearAllStates = () => {
|
||||
field.states.forEach(s => api.clearField(field.name, s));
|
||||
field.states.forEach((s) => api.clearField(field.name, s));
|
||||
};
|
||||
|
||||
let Header = null;
|
||||
@@ -96,7 +96,7 @@ export default function MultiState({ field, api, moreAlignTo = null, onClose = (
|
||||
</ListItem>
|
||||
{field.states.map((s, ix) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<ListItem key={ix} title={field.name} onClick={e => handleShowState(e, ix)}>
|
||||
<ListItem key={ix} title={field.name} onClick={(e) => handleShowState(e, ix)}>
|
||||
<Box border={1} width="100%" borderRadius="borderRadius" borderColor="divider">
|
||||
<OneField field={field} api={api} stateIx={ix} skipHandleShowListBoxPopover />
|
||||
</Box>
|
||||
|
||||
@@ -11,7 +11,7 @@ import ListBoxPopover from '../listbox/ListBoxPopover';
|
||||
|
||||
import InstanceContext from '../../contexts/InstanceContext';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
item: {
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
position: 'relative',
|
||||
@@ -38,7 +38,7 @@ export default function OneField({
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
const handleShowListBoxPopover = e => {
|
||||
const handleShowListBoxPopover = (e) => {
|
||||
if (e.currentTarget.contains(e.target)) {
|
||||
// because click in popover will propagate to parent
|
||||
setShowListBoxPopover(!showListBoxPopover);
|
||||
@@ -75,7 +75,7 @@ export default function OneField({
|
||||
} else if (numSelected > 1 && selection.qTotal) {
|
||||
label = translator.get('CurrentSelections.Of', [numSelected, selection.qTotal]);
|
||||
} else if (selection.qSelectedFieldSelectionInfo) {
|
||||
label = selection.qSelectedFieldSelectionInfo.map(v => v.qName).join(', ');
|
||||
label = selection.qSelectedFieldSelectionInfo.map((v) => v.qName).join(', ');
|
||||
}
|
||||
if (field.states[stateIx] !== '$') {
|
||||
label = `${field.states[stateIx]}: ${label}`;
|
||||
@@ -116,7 +116,7 @@ export default function OneField({
|
||||
<Grid item>
|
||||
<IconButton
|
||||
title={translator.get('Selection.Clear')}
|
||||
onClick={e => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
api.clearField(selection.qField, field.states[stateIx]);
|
||||
}}
|
||||
@@ -137,7 +137,7 @@ export default function OneField({
|
||||
}}
|
||||
>
|
||||
{noSegments === false &&
|
||||
segments.map(s => (
|
||||
segments.map((s) => (
|
||||
<div
|
||||
key={s.color}
|
||||
style={{
|
||||
|
||||
@@ -16,7 +16,7 @@ const MIN_WIDTH = 120;
|
||||
const MIN_WIDTH_MORE = 72;
|
||||
|
||||
function collect(qSelectionObject, fields, state = '$') {
|
||||
qSelectionObject.qSelections.forEach(selection => {
|
||||
qSelectionObject.qSelections.forEach((selection) => {
|
||||
const name = selection.qField;
|
||||
const field = (fields[name] = fields[name] || { name, states: [], selections: [] }); // eslint-disable-line
|
||||
if (field.states.indexOf(state) === -1) {
|
||||
@@ -35,9 +35,9 @@ function getItems(layout) {
|
||||
collect(layout.qSelectionObject, fields);
|
||||
}
|
||||
if (layout.alternateStates) {
|
||||
layout.alternateStates.forEach(s => collect(s.qSelectionObject, fields, s.stateName));
|
||||
layout.alternateStates.forEach((s) => collect(s.qSelectionObject, fields, s.stateName));
|
||||
}
|
||||
return Object.keys(fields).map(key => fields[key]);
|
||||
return Object.keys(fields).map((key) => fields[key]);
|
||||
}
|
||||
|
||||
export default function SelectedFields({ api, app }) {
|
||||
@@ -67,11 +67,13 @@ export default function SelectedFields({ api, app }) {
|
||||
return;
|
||||
}
|
||||
const items = getItems(layout);
|
||||
setState(currState => {
|
||||
setState((currState) => {
|
||||
const newItems = items;
|
||||
// Maintain modal state in app selections
|
||||
if (isInListboxPopover() && newItems.length + 1 === currState.items.length) {
|
||||
const lastDeselectedField = currState.items.filter(f1 => newItems.some(f2 => f1.name === f2.name) === false)[0];
|
||||
const lastDeselectedField = currState.items.filter(
|
||||
(f1) => newItems.some((f2) => f1.name === f2.name) === false
|
||||
)[0];
|
||||
const { qField } = lastDeselectedField.selections[0];
|
||||
lastDeselectedField.selections = [{ qField }];
|
||||
const wasIx = currState.items.indexOf(lastDeselectedField);
|
||||
@@ -90,7 +92,7 @@ export default function SelectedFields({ api, app }) {
|
||||
|
||||
return (
|
||||
<Grid ref={containerRef} container spacing={0} wrap="nowrap" style={{ height: '100%' }}>
|
||||
{state.items.map(s => (
|
||||
{state.items.map((s) => (
|
||||
<Grid
|
||||
item
|
||||
key={`${s.states.join('::')}::${s.name}`}
|
||||
|
||||
@@ -6,7 +6,7 @@ import OneField from '../OneField';
|
||||
export default {
|
||||
title: 'Selections|One field',
|
||||
component: OneField,
|
||||
decorators: [story => <div style={{ backgroundColor: '#eee', padding: '16px' }}>{story()}</div>],
|
||||
decorators: [(story) => <div style={{ backgroundColor: '#eee', padding: '16px' }}>{story()}</div>],
|
||||
};
|
||||
|
||||
const api = {
|
||||
@@ -54,7 +54,7 @@ const states = [
|
||||
},
|
||||
];
|
||||
|
||||
const stateFn = state => (
|
||||
const stateFn = (state) => (
|
||||
<OneField
|
||||
api={api}
|
||||
field={{
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { create, act } from 'react-test-renderer';
|
||||
import { Badge, IconButton, Grid, Typography, Button, List, ListItem, Box } from '@material-ui/core';
|
||||
|
||||
const Popover = props => props.children;
|
||||
const Popover = (props) => props.children;
|
||||
const MockedOneField = () => 'OneField';
|
||||
const MockedMultiState = () => 'MultiState';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { create, act } from 'react-test-renderer';
|
||||
import { Badge, IconButton, Grid, Typography, Button, List, ListItem, Box } from '@material-ui/core';
|
||||
|
||||
const Popover = props => props.children;
|
||||
const Popover = (props) => props.children;
|
||||
const ListBoxPopover = () => null;
|
||||
const OneField = sinon.stub().returns('one-field');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default function(flags = {}) {
|
||||
export default function (flags = {}) {
|
||||
/**
|
||||
* @interface Flags
|
||||
*/
|
||||
@@ -9,6 +9,6 @@ export default function(flags = {}) {
|
||||
* @param {string} flag - The value flag to check.
|
||||
* @returns {boolean} True if the specified flag is enabled, false otherwise.
|
||||
*/
|
||||
isEnabled: f => flags[f] === true,
|
||||
isEnabled: (f) => flags[f] === true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ function createAppSelections({ app, currentSelectionsLayout, navState }) {
|
||||
modalObjectStore.set(key, model);
|
||||
|
||||
const p = Array.isArray(path) ? path : [path];
|
||||
const beginSelections = async skipRetry => {
|
||||
const beginSelections = async (skipRetry) => {
|
||||
try {
|
||||
await model.beginSelections(p);
|
||||
modalObjectStore.set(key, model); // We have a modal
|
||||
@@ -100,7 +100,7 @@ function createAppSelections({ app, currentSelectionsLayout, navState }) {
|
||||
return appModal.end().then(() => app.clearAll());
|
||||
},
|
||||
clearField(field, state = '$') {
|
||||
return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
|
||||
return appModal.end().then(() => app.getField(field, state).then((f) => f.clear()));
|
||||
},
|
||||
};
|
||||
return appSelections;
|
||||
|
||||
@@ -3,17 +3,17 @@ import useLayout, { useAppLayout } from './useLayout';
|
||||
import useCurrentSelectionsModel from './useCurrentSelectionsModel';
|
||||
|
||||
const patchAlternateState = (currentSelectionsModel, currentSelectionsLayout, appLayout) => {
|
||||
const states = [...(appLayout.qStateNames || [])].map(s => ({
|
||||
const states = [...(appLayout.qStateNames || [])].map((s) => ({
|
||||
stateName: s, // need this as reference in selection toolbar since qSelectionObject.qStateName is not in the layout
|
||||
qSelectionObjectDef: {
|
||||
qStateName: s,
|
||||
},
|
||||
}));
|
||||
const existingStates = (currentSelectionsLayout && currentSelectionsLayout.alternateStates
|
||||
? currentSelectionsLayout.alternateStates.map(s => s.stateName)
|
||||
? currentSelectionsLayout.alternateStates.map((s) => s.stateName)
|
||||
: []
|
||||
).join('::');
|
||||
const newStates = (appLayout.qStateNames || []).map(s => s).join('::');
|
||||
const newStates = (appLayout.qStateNames || []).map((s) => s).join('::');
|
||||
if (existingStates !== newStates) {
|
||||
currentSelectionsModel.applyPatches(
|
||||
[
|
||||
@@ -44,13 +44,13 @@ export default function useAppSelectionsNavigation(app) {
|
||||
let canGoBack = false;
|
||||
let canGoForward = false;
|
||||
let canClear = false;
|
||||
[currentSelectionsLayout, ...(currentSelectionsLayout.alternateStates || [])].forEach(state => {
|
||||
[currentSelectionsLayout, ...(currentSelectionsLayout.alternateStates || [])].forEach((state) => {
|
||||
canGoBack = canGoBack || (state.qSelectionObject && state.qSelectionObject.qBackCount > 0);
|
||||
canGoForward = canGoForward || (state.qSelectionObject && state.qSelectionObject.qForwardCount > 0);
|
||||
canClear =
|
||||
canClear ||
|
||||
((state.qSelectionObject && state.qSelectionObject.qSelections) || []).filter(s => s.qLocked !== true).length >
|
||||
0;
|
||||
((state.qSelectionObject && state.qSelectionObject.qSelections) || []).filter((s) => s.qLocked !== true)
|
||||
.length > 0;
|
||||
});
|
||||
setNavigationState({
|
||||
canGoBack,
|
||||
|
||||
@@ -136,7 +136,7 @@ function createObjectSelections({ appSelections, appModal, model }) {
|
||||
* @param {string[]} paths
|
||||
* @returns {Promise<undefined>}
|
||||
*/
|
||||
goModal: paths => appModal.begin(model, paths, false),
|
||||
goModal: (paths) => appModal.begin(model, paths, false),
|
||||
/**
|
||||
* @param {boolean} [accept=false]
|
||||
* @returns {Promise<undefined>}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useState, useCallback, useLayoutEffect } from 'react';
|
||||
export default function useRect() {
|
||||
const [node, setNode] = useState();
|
||||
const [rect, setRect] = useState();
|
||||
const callbackRef = useCallback(ref => {
|
||||
const callbackRef = useCallback((ref) => {
|
||||
if (!ref) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import { useReducer, useEffect } from 'react';
|
||||
import { useModelChangedStore, useRpcResultStore, useRpcRequestStore } from '../stores/modelStore';
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const sleep = delay => {
|
||||
return new Promise(resolve => {
|
||||
const sleep = (delay) => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, delay);
|
||||
});
|
||||
};
|
||||
@@ -78,7 +78,7 @@ export default function useRpc(model, method) {
|
||||
}
|
||||
}
|
||||
|
||||
const call = async skipRetry => {
|
||||
const call = async (skipRetry) => {
|
||||
let cache = rpcShared[method];
|
||||
if (!cache || (cache && cache.rpcRetry)) {
|
||||
const rpc = model[method]();
|
||||
|
||||
@@ -34,7 +34,7 @@ const DEFAULT_SNAPSHOT_CONFIG = /** @lends SnapshotConfiguration */ {
|
||||
* @param {string} id
|
||||
* @returns {Promise<SnapshotLayout>}
|
||||
*/
|
||||
get: async id => {
|
||||
get: async (id) => {
|
||||
const res = await fetch(`/njs/snapshot/${id}`);
|
||||
if (!res.ok) {
|
||||
throw new Error(res.statusText);
|
||||
@@ -48,7 +48,7 @@ const DEFAULT_SNAPSHOT_CONFIG = /** @lends SnapshotConfiguration */ {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
}).then(res => res.json());
|
||||
}).then((res) => res.json());
|
||||
},
|
||||
};
|
||||
|
||||
@@ -165,7 +165,7 @@ function nuked(configuration = {}) {
|
||||
|
||||
const types = typesFn({ corona });
|
||||
|
||||
configuration.types.forEach(t =>
|
||||
configuration.types.forEach((t) =>
|
||||
types.register(
|
||||
{
|
||||
name: t.name,
|
||||
@@ -214,7 +214,7 @@ function nuked(configuration = {}) {
|
||||
* fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }]
|
||||
* });
|
||||
*/
|
||||
render: async cfg => {
|
||||
render: async (cfg) => {
|
||||
await currentThemePromise;
|
||||
if (cfg.id) {
|
||||
return get(cfg, corona);
|
||||
@@ -233,10 +233,10 @@ function nuked(configuration = {}) {
|
||||
* // limit constraints
|
||||
* n.context({ constraints: { active: true } });
|
||||
*/
|
||||
context: async ctx => {
|
||||
context: async (ctx) => {
|
||||
// filter valid values to avoid triggering unnecessary rerender
|
||||
let changes;
|
||||
['theme', 'language', 'constraints'].forEach(key => {
|
||||
['theme', 'language', 'constraints'].forEach((key) => {
|
||||
if (ctx[key] && ctx[key] !== currentContext[key]) {
|
||||
if (!changes) {
|
||||
changes = {};
|
||||
@@ -347,7 +347,7 @@ function nuked(configuration = {}) {
|
||||
* d(app).render({ type: 'mekko' }); // will render the object with 'dark' theme
|
||||
* nucleus(app).render({ type: 'mekko' }); // will throw error since 'mekko' is not a register type on the default instance
|
||||
*/
|
||||
nucleus.createConfiguration = c => nuked(mergeConfigs(configuration, c));
|
||||
nucleus.createConfiguration = (c) => nuked(mergeConfigs(configuration, c));
|
||||
nucleus.config = configuration;
|
||||
|
||||
return nucleus;
|
||||
|
||||
@@ -6,7 +6,7 @@ export default function appLocaleFn(language) {
|
||||
initial: language,
|
||||
});
|
||||
|
||||
Object.keys(all).forEach(key => {
|
||||
Object.keys(all).forEach((key) => {
|
||||
l.translator.add(all[key]);
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('get-object', () => {
|
||||
beforeEach(() => {
|
||||
objectModel = sandbox.stub();
|
||||
init.returns('api');
|
||||
context = { app: { id: 'appid', getObject: async id => Promise.resolve(objectModel(id)) } };
|
||||
context = { app: { id: 'appid', getObject: async (id) => Promise.resolve(objectModel(id)) } };
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -23,13 +23,13 @@ function removeIndex(array, index) {
|
||||
return removeIdx;
|
||||
}
|
||||
|
||||
const nxDimension = f => ({
|
||||
const nxDimension = (f) => ({
|
||||
qDef: {
|
||||
qFieldDefs: [f],
|
||||
},
|
||||
});
|
||||
|
||||
const nxMeasure = f => ({
|
||||
const nxMeasure = (f) => ({
|
||||
qDef: {
|
||||
qDef: f,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import vizualizationAPI from '../viz';
|
||||
|
||||
export default async function(model, optional, corona, initialError, onDestroy = async () => {}) {
|
||||
export default async function (model, optional, corona, initialError, onDestroy = async () => {}) {
|
||||
const api = vizualizationAPI({
|
||||
model,
|
||||
corona,
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function populateData({ sn, properties, fields }) {
|
||||
properties,
|
||||
});
|
||||
|
||||
fields.forEach(f => {
|
||||
fields.forEach((f) => {
|
||||
const type = fieldType(f);
|
||||
|
||||
if (type === 'measure') {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import EventEmitter from 'node-event-emitter';
|
||||
|
||||
export default function(obj) {
|
||||
export default function (obj) {
|
||||
/* eslint no-param-reassign: 0 */
|
||||
Object.keys(EventEmitter.prototype).forEach(key => {
|
||||
Object.keys(EventEmitter.prototype).forEach((key) => {
|
||||
obj[key] = EventEmitter.prototype[key];
|
||||
});
|
||||
EventEmitter.init(obj);
|
||||
|
||||
@@ -18,14 +18,14 @@ export async function load(name, version, { config }, loader) {
|
||||
});
|
||||
const prom = Promise.resolve(p);
|
||||
LOADED[key] = prom
|
||||
.then(sn => {
|
||||
.then((sn) => {
|
||||
if (!sn) {
|
||||
// TODO - improve validation
|
||||
throw new Error(`load() of supernova '${sKey}' resolved to an invalid object`);
|
||||
}
|
||||
return sn;
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
if (__NEBULA_DEV__) {
|
||||
console.warn(e); // eslint-disable-line no-console
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export async function load(name, version, { config }, loader) {
|
||||
}
|
||||
|
||||
export function clearFromCache(name) {
|
||||
Object.keys(LOADED).forEach(key => {
|
||||
Object.keys(LOADED).forEach((key) => {
|
||||
if (key.split('__')[0] === name) {
|
||||
LOADED[key] = undefined;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function create(info, corona, opts = {}) {
|
||||
return true;
|
||||
},
|
||||
supernova: () =>
|
||||
load(type.name, type.version, corona, opts.load).then(SNDefinition => {
|
||||
load(type.name, type.version, corona, opts.load).then((SNDefinition) => {
|
||||
sn = sn || SNFactory(SNDefinition, corona.public.galaxy);
|
||||
stringified = JSON.stringify(sn.qae.properties.initial);
|
||||
return sn;
|
||||
|
||||
@@ -2,14 +2,14 @@ import type from './type';
|
||||
import { clearFromCache } from './load';
|
||||
|
||||
export function semverSort(arr) {
|
||||
const unversioned = arr.filter(v => v === 'undefined');
|
||||
const unversioned = arr.filter((v) => v === 'undefined');
|
||||
return [
|
||||
...unversioned,
|
||||
...arr
|
||||
.filter(v => v !== 'undefined')
|
||||
.map(v => v.split('.').map(n => parseInt(n, 10)))
|
||||
.filter((v) => v !== 'undefined')
|
||||
.map((v) => v.split('.').map((n) => parseInt(n, 10)))
|
||||
.sort((a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2])
|
||||
.map(n => n.join('.')),
|
||||
.map((n) => n.join('.')),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export function typeCollection(name, corona) {
|
||||
let sortedVersions = null;
|
||||
|
||||
return {
|
||||
get: version => versions[version],
|
||||
get: (version) => versions[version],
|
||||
register: (version, opts) => {
|
||||
if (versions[version]) {
|
||||
throw new Error(`Supernova '${name}@${version}' already registered.`);
|
||||
@@ -34,7 +34,7 @@ export function typeCollection(name, corona) {
|
||||
);
|
||||
sortedVersions = null;
|
||||
},
|
||||
getMatchingVersionFromProperties: propertyVersion => {
|
||||
getMatchingVersionFromProperties: (propertyVersion) => {
|
||||
if (!sortedVersions) {
|
||||
sortedVersions = semverSort(Object.keys(versions));
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export function create({ corona, parent }) {
|
||||
}
|
||||
return tc[name].get(version) || p.get(typeInfo);
|
||||
},
|
||||
clearFromCache: name => {
|
||||
clearFromCache: (name) => {
|
||||
if (tc[name]) {
|
||||
tc[name] = undefined;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export default (initialState, applyMiddleware = () => {}) => {
|
||||
const hookListeners = [];
|
||||
|
||||
const store = {
|
||||
get: key => sharedState[key],
|
||||
get: (key) => sharedState[key],
|
||||
set: (key, value) => {
|
||||
if (typeof key === 'undefined' || typeof key === 'object') {
|
||||
throw new Error(`Invalid key: ${JSON.stringify(key)}`);
|
||||
@@ -15,11 +15,11 @@ export default (initialState, applyMiddleware = () => {}) => {
|
||||
return value;
|
||||
},
|
||||
clear: () =>
|
||||
Object.keys(sharedState).forEach(key => {
|
||||
Object.keys(sharedState).forEach((key) => {
|
||||
sharedState[key] = null;
|
||||
}),
|
||||
dispatch: forceNewState => {
|
||||
hookListeners.forEach(listener => listener(forceNewState ? {} : sharedState));
|
||||
dispatch: (forceNewState) => {
|
||||
hookListeners.forEach((listener) => listener(forceNewState ? {} : sharedState));
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ const modelStoreMiddleware = ({ type, value: model }) => {
|
||||
|
||||
const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
|
||||
|
||||
const subscribe = model => {
|
||||
const subscribe = (model) => {
|
||||
return modelStoreMiddleware({ type: 'SET', value: model });
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ function isEqual(a, b) {
|
||||
|
||||
export default function getPatches(path = '/', obj, old) {
|
||||
const patches = [];
|
||||
Object.keys(obj).forEach(prop => {
|
||||
Object.keys(obj).forEach((prop) => {
|
||||
const v = obj[prop];
|
||||
if (typeof old[prop] === 'object' && typeof v === 'object' && !Array.isArray(v)) {
|
||||
patches.push(...getPatches(`${path}${prop}/`, obj[prop], old[prop]));
|
||||
|
||||
@@ -9,13 +9,13 @@ export default function viz({ model, corona, initialError, onDestroy = async ()
|
||||
let cellRef = null;
|
||||
let mountedReference = null;
|
||||
let onMount = null;
|
||||
const mounted = new Promise(resolve => {
|
||||
const mounted = new Promise((resolve) => {
|
||||
onMount = resolve;
|
||||
});
|
||||
|
||||
let initialSnOptions = {};
|
||||
|
||||
const setSnOptions = async opts => {
|
||||
const setSnOptions = async (opts) => {
|
||||
if (mountedReference) {
|
||||
(async () => {
|
||||
await mounted;
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
"prepublishOnly": "rm -rf dist && yarn run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"puppeteer": "2.0.0"
|
||||
"puppeteer": "2.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ function snapshooter({ snapshotUrl, chrome = {} } = {}) {
|
||||
return snapshots[id];
|
||||
},
|
||||
getStoredSnapshots() {
|
||||
return Object.keys(snapshots).map(key => snapshots[key]);
|
||||
return Object.keys(snapshots).map((key) => snapshots[key]);
|
||||
},
|
||||
storeSnapshot(snapshot) {
|
||||
if (!snapshot) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint no-param-reassign: 0 */
|
||||
async function renderSnapshot({ nucleus, element, snapshot: key }) {
|
||||
let snapshot = {};
|
||||
const renderError = e => {
|
||||
const renderError = (e) => {
|
||||
element.innerHTML = `<p>${e.message}</p>`;
|
||||
element.setAttribute('data-njs-error', e.message);
|
||||
};
|
||||
@@ -17,7 +17,7 @@ async function renderSnapshot({ nucleus, element, snapshot: key }) {
|
||||
layout,
|
||||
} = snapshot;
|
||||
|
||||
const objectModel = props => ({
|
||||
const objectModel = (props) => ({
|
||||
id: `${+new Date()}-object`,
|
||||
async getLayout() {
|
||||
return props;
|
||||
@@ -28,7 +28,7 @@ async function renderSnapshot({ nucleus, element, snapshot: key }) {
|
||||
|
||||
const app = {
|
||||
id: `${+new Date()}-app`,
|
||||
createSessionObject: async props => objectModel(props),
|
||||
createSessionObject: async (props) => objectModel(props),
|
||||
async getObject(id) {
|
||||
if (id === layout.qInfo.qId) {
|
||||
return objectModel(layout);
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('creator', () => {
|
||||
|
||||
const c = create(generator, params, galaxy).component;
|
||||
|
||||
['created', 'mounted', 'render', 'resize', 'willUnmount', 'destroy'].forEach(key => {
|
||||
['created', 'mounted', 'render', 'resize', 'willUnmount', 'destroy'].forEach((key) => {
|
||||
c[key]('a');
|
||||
expect(generator.component[key]).to.have.been.calledWithExactly('a');
|
||||
});
|
||||
@@ -359,7 +359,7 @@ describe('creator', () => {
|
||||
|
||||
const c = create(generator, params, galaxy).component;
|
||||
|
||||
['created', 'mounted', 'render', 'resize', 'willUnmount', 'destroy'].forEach(key =>
|
||||
['created', 'mounted', 'render', 'resize', 'willUnmount', 'destroy'].forEach((key) =>
|
||||
expect(c[key]).to.be.a('function')
|
||||
);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ describe('generator', () => {
|
||||
[{ default: generator }] = aw.mock(
|
||||
[
|
||||
['**/creator.js', () => (...a) => [...a]],
|
||||
['**/qae.js', () => qae => qae || 'qae'],
|
||||
['**/qae.js', () => (qae) => qae || 'qae'],
|
||||
],
|
||||
['../../src/generator']
|
||||
);
|
||||
|
||||
@@ -30,6 +30,6 @@
|
||||
"devDependencies": {
|
||||
"extend": "3.0.2",
|
||||
"node-event-emitter": "0.0.1",
|
||||
"regenerator-runtime": "0.13.3"
|
||||
"regenerator-runtime": "0.13.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('hooks', () => {
|
||||
let DEV;
|
||||
let frame;
|
||||
before(() => {
|
||||
frame = () => new Promise(resolve => setTimeout(resolve));
|
||||
frame = () => new Promise((resolve) => setTimeout(resolve));
|
||||
sandbox = sinon.createSandbox();
|
||||
DEV = global.__NEBULA_DEV__;
|
||||
global.__NEBULA_DEV__ = true;
|
||||
@@ -47,12 +47,12 @@ describe('hooks', () => {
|
||||
// so if an error occurs we won't know it.
|
||||
// we therefore stub the console.error method and throw the error
|
||||
// so that a test fails properly
|
||||
const err = e => {
|
||||
const err = (e) => {
|
||||
throw e;
|
||||
};
|
||||
sandbox.stub(console, 'error').callsFake(err);
|
||||
if (!global.requestAnimationFrame) {
|
||||
global.requestAnimationFrame = cb => setTimeout(cb, 20);
|
||||
global.requestAnimationFrame = (cb) => setTimeout(cb, 20);
|
||||
global.cancelAnimationFrame = clearTimeout;
|
||||
}
|
||||
});
|
||||
@@ -136,7 +136,7 @@ describe('hooks', () => {
|
||||
|
||||
describe('runSnaps', () => {
|
||||
it('should run snaps hooks', async () => {
|
||||
const take1 = layout => {
|
||||
const take1 = (layout) => {
|
||||
return Promise.resolve({ take1: 'yes', ...layout });
|
||||
};
|
||||
|
||||
@@ -218,7 +218,7 @@ describe('hooks', () => {
|
||||
|
||||
run(c);
|
||||
expect(countValue).to.equal(7);
|
||||
setter(prev => prev + 2);
|
||||
setter((prev) => prev + 2);
|
||||
await frame();
|
||||
expect(countValue).to.equal(9);
|
||||
});
|
||||
@@ -295,7 +295,7 @@ describe('hooks', () => {
|
||||
c = {};
|
||||
initiate(c);
|
||||
sandbox.useFakeTimers();
|
||||
global.requestAnimationFrame = cb => setTimeout(cb, 20);
|
||||
global.requestAnimationFrame = (cb) => setTimeout(cb, 20);
|
||||
clock = sandbox.clock;
|
||||
});
|
||||
afterEach(() => {
|
||||
@@ -381,7 +381,7 @@ describe('hooks', () => {
|
||||
it('should resolve run-phase when pending promises are resolved', async () => {
|
||||
let reject;
|
||||
let resolve;
|
||||
const prom1 = new Promise(r => {
|
||||
const prom1 = new Promise((r) => {
|
||||
resolve = r;
|
||||
});
|
||||
const prom2 = new Promise((r, j) => {
|
||||
@@ -677,7 +677,7 @@ describe('hooks', () => {
|
||||
getBoundingClientRect: sandbox.stub(),
|
||||
};
|
||||
|
||||
const err = e => {
|
||||
const err = (e) => {
|
||||
throw e;
|
||||
};
|
||||
sandbox.stub(console, 'error').callsFake(err);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import EventEmitter from 'node-event-emitter';
|
||||
|
||||
const mixin = obj => {
|
||||
const mixin = (obj) => {
|
||||
/* eslint no-param-reassign: 0 */
|
||||
Object.keys(EventEmitter.prototype).forEach(key => {
|
||||
Object.keys(EventEmitter.prototype).forEach((key) => {
|
||||
obj[key] = EventEmitter.prototype[key];
|
||||
});
|
||||
EventEmitter.init(obj);
|
||||
return obj;
|
||||
};
|
||||
|
||||
const actionWrapper = component => item => {
|
||||
const actionWrapper = (component) => (item) => {
|
||||
const wrapped = mixin({
|
||||
...item,
|
||||
action() {
|
||||
@@ -35,18 +35,18 @@ const actionWrapper = component => item => {
|
||||
return wrapped;
|
||||
};
|
||||
|
||||
export default function({ sn, component }) {
|
||||
export default function ({ sn, component }) {
|
||||
const actions = {};
|
||||
const selectionToolbarItems = [];
|
||||
const w = actionWrapper(component);
|
||||
((sn.definition.selectionToolbar || {}).items || []).forEach(item => {
|
||||
((sn.definition.selectionToolbar || {}).items || []).forEach((item) => {
|
||||
const wrapped = w(item);
|
||||
// TODO - check if key exists
|
||||
actions[item.key] = wrapped;
|
||||
selectionToolbarItems.push(wrapped);
|
||||
});
|
||||
|
||||
(sn.definition.actions || []).forEach(item => {
|
||||
(sn.definition.actions || []).forEach((item) => {
|
||||
const wrapped = w(item);
|
||||
// TODO - check if key exists
|
||||
actions[item.key] = wrapped;
|
||||
|
||||
@@ -23,14 +23,14 @@ const defaultComponent = {
|
||||
|
||||
// temporary
|
||||
observeActions() {},
|
||||
setSnapshotData: snapshot => Promise.resolve(snapshot),
|
||||
setSnapshotData: (snapshot) => Promise.resolve(snapshot),
|
||||
};
|
||||
|
||||
const reservedKeys = Object.keys(defaultComponent);
|
||||
|
||||
const mixin = obj => {
|
||||
const mixin = (obj) => {
|
||||
/* eslint no-param-reassign: 0 */
|
||||
Object.keys(EventEmitter.prototype).forEach(key => {
|
||||
Object.keys(EventEmitter.prototype).forEach((key) => {
|
||||
obj[key] = EventEmitter.prototype[key];
|
||||
});
|
||||
EventEmitter.init(obj);
|
||||
@@ -105,7 +105,7 @@ function createWithHooks(generator, opts, galaxy) {
|
||||
// the options object to ensure callbacks are triggered
|
||||
const op = {};
|
||||
let opChanged = false;
|
||||
Object.keys(r.options).forEach(key => {
|
||||
Object.keys(r.options).forEach((key) => {
|
||||
op[key] = r.options[key];
|
||||
if (this.context.options[key] !== r.options[key]) {
|
||||
opChanged = true;
|
||||
@@ -118,7 +118,7 @@ function createWithHooks(generator, opts, galaxy) {
|
||||
}
|
||||
|
||||
// do a deep check on 'small' objects
|
||||
deepCheck.forEach(key => {
|
||||
deepCheck.forEach((key) => {
|
||||
const ref = r.context;
|
||||
if (ref && Object.prototype.hasOwnProperty.call(ref, key)) {
|
||||
let s = JSON.stringify(ref[key]);
|
||||
@@ -184,7 +184,7 @@ function createWithHooks(generator, opts, galaxy) {
|
||||
isHooked: true,
|
||||
};
|
||||
|
||||
deepCheck.forEach(key => {
|
||||
deepCheck.forEach((key) => {
|
||||
current[key] = JSON.stringify(c.context[key]);
|
||||
});
|
||||
current.themeName = c.context.theme ? c.context.theme.name() : undefined;
|
||||
@@ -214,7 +214,7 @@ function createClassical(generator, opts) {
|
||||
},
|
||||
};
|
||||
|
||||
Object.keys(generator.component || {}).forEach(key => {
|
||||
Object.keys(generator.component || {}).forEach((key) => {
|
||||
if (reservedKeys.indexOf(key) !== -1) {
|
||||
componentInstance[key] = generator.component[key].bind(userInstance);
|
||||
} else {
|
||||
@@ -279,16 +279,16 @@ export default function create(generator, opts, galaxy) {
|
||||
|
||||
opts.model.applyPatches = function applyPatches(qPatches, qSoftPatch) {
|
||||
const method = qSoftPatch ? 'getEffectiveProperties' : 'getProperties';
|
||||
return opts.model[method]().then(currentProperties => {
|
||||
return opts.model[method]().then((currentProperties) => {
|
||||
// apply patches to current props
|
||||
const original = JSONPatch.clone(currentProperties);
|
||||
const patches = qPatches.map(p => ({ op: p.qOp, value: JSON.parse(p.qValue), path: p.qPath }));
|
||||
const patches = qPatches.map((p) => ({ op: p.qOp, value: JSON.parse(p.qValue), path: p.qPath }));
|
||||
JSONPatch.apply(currentProperties, patches);
|
||||
|
||||
generator.qae.properties.onChange.call({ model: opts.model }, currentProperties);
|
||||
|
||||
// calculate new patches from after change
|
||||
const newPatches = JSONPatch.generate(original, currentProperties).map(p => ({
|
||||
const newPatches = JSONPatch.generate(original, currentProperties).map((p) => ({
|
||||
qOp: p.op,
|
||||
qValue: JSON.stringify(p.value),
|
||||
qPath: p.path,
|
||||
@@ -313,7 +313,7 @@ export default function create(generator, opts, galaxy) {
|
||||
items: hero ? hero.selectionToolbarItems : [],
|
||||
},
|
||||
destroy() {
|
||||
teardowns.forEach(t => t());
|
||||
teardowns.forEach((t) => t());
|
||||
},
|
||||
logicalSize: generator.definition.logicalSize || (() => false),
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ export default function generatorFn(UserSN, galaxy) {
|
||||
definition: {},
|
||||
};
|
||||
|
||||
Object.keys(sn).forEach(key => {
|
||||
Object.keys(sn).forEach((key) => {
|
||||
if (!generator[key]) {
|
||||
generator.definition[key] = sn[key];
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export async function run(component) {
|
||||
currentComponent = undefined;
|
||||
|
||||
if (!hooks.chain.promise) {
|
||||
hooks.chain.promise = new Promise(resolve => {
|
||||
hooks.chain.promise = new Promise((resolve) => {
|
||||
hooks.chain.resolve = resolve;
|
||||
});
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export async function run(component) {
|
||||
|
||||
function flushPending(list, skipUpdate) {
|
||||
try {
|
||||
list.forEach(fx => {
|
||||
list.forEach((fx) => {
|
||||
// teardown existing
|
||||
typeof fx.teardown === 'function' ? fx.teardown() : null;
|
||||
|
||||
@@ -146,10 +146,10 @@ function maybeEndChain(hooks) {
|
||||
export function runSnaps(component, layout) {
|
||||
try {
|
||||
return Promise.all(
|
||||
component.__hooks.snaps.map(h => {
|
||||
component.__hooks.snaps.map((h) => {
|
||||
return Promise.resolve(h.fn(layout));
|
||||
})
|
||||
).then(snaps => {
|
||||
).then((snaps) => {
|
||||
return snaps[snaps.length - 1];
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -264,7 +264,7 @@ export function useState(initial) {
|
||||
if (!h.value) {
|
||||
// initiate
|
||||
h.component = currentComponent;
|
||||
const setState = s => {
|
||||
const setState = (s) => {
|
||||
if (h.component.__hooks.obsolete) {
|
||||
if (__NEBULA_DEV__) {
|
||||
throw new Error(
|
||||
@@ -402,7 +402,7 @@ export function usePromise(p, deps) {
|
||||
// });
|
||||
|
||||
p()
|
||||
.then(v => {
|
||||
.then((v) => {
|
||||
if (canceled) {
|
||||
return;
|
||||
}
|
||||
@@ -413,7 +413,7 @@ export function usePromise(p, deps) {
|
||||
state: 'resolved',
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
if (canceled) {
|
||||
return;
|
||||
}
|
||||
@@ -503,7 +503,7 @@ export function useRect() {
|
||||
const r = ref.current;
|
||||
|
||||
if (r.width !== width || r.height !== height || r.left !== left || r.top !== top) {
|
||||
ref.setters.forEach(setR => setR({ left, top, width, height }));
|
||||
ref.setters.forEach((setR) => setR({ left, top, width, height }));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -52,10 +52,7 @@ function isSpecialProperty(obj, key) {
|
||||
*/
|
||||
function getParent(data, str) {
|
||||
const seperator = '/';
|
||||
const parts = str
|
||||
.substring(1)
|
||||
.split(seperator)
|
||||
.slice(0, -1);
|
||||
const parts = str.substring(1).split(seperator).slice(0, -1);
|
||||
let numPart;
|
||||
|
||||
parts.forEach((part, i) => {
|
||||
@@ -79,7 +76,7 @@ function getParent(data, str) {
|
||||
* @param {Object} obj The object to clean
|
||||
*/
|
||||
function emptyObject(obj) {
|
||||
Object.keys(obj).forEach(key => {
|
||||
Object.keys(obj).forEach((key) => {
|
||||
const config = Object.getOwnPropertyDescriptor(obj, key);
|
||||
|
||||
if (config.configurable && !isSpecialProperty(obj, key)) {
|
||||
@@ -103,7 +100,7 @@ function compare(a, b) {
|
||||
if (Object.keys(a).length !== Object.keys(b).length) {
|
||||
return false;
|
||||
}
|
||||
Object.keys(a).forEach(key => {
|
||||
Object.keys(a).forEach((key) => {
|
||||
if (!compare(a[key], b[key])) {
|
||||
isIdentical = false;
|
||||
}
|
||||
@@ -220,7 +217,7 @@ JSONPatch.generate = function generate(original, newData, basePath) {
|
||||
basePath = basePath || '';
|
||||
let patches = [];
|
||||
|
||||
Object.keys(newData).forEach(key => {
|
||||
Object.keys(newData).forEach((key) => {
|
||||
const val = generateValue(newData[key]);
|
||||
const oldVal = original[key];
|
||||
const tmpPath = `${basePath}/${key}`;
|
||||
@@ -250,7 +247,7 @@ JSONPatch.generate = function generate(original, newData, basePath) {
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(original).forEach(key => {
|
||||
Object.keys(original).forEach((key) => {
|
||||
if (isUndef(newData[key]) && !isSpecialProperty(original, key)) {
|
||||
// this property does not exist anymore
|
||||
patches.push({
|
||||
@@ -271,7 +268,7 @@ JSONPatch.generate = function generate(original, newData, basePath) {
|
||||
* @param {Array} patches The list of patches to apply
|
||||
*/
|
||||
JSONPatch.apply = function apply(original, patches) {
|
||||
patches.forEach(patch => {
|
||||
patches.forEach((patch) => {
|
||||
let parent = getParent(original, patch.path);
|
||||
let key = patch.path.split('/').splice(-1)[0];
|
||||
let target = key && isNaN(+key) ? parent[key] : parent[+key] || parent;
|
||||
|
||||
@@ -69,7 +69,7 @@ function target(def) {
|
||||
return {
|
||||
propertyPath,
|
||||
layoutPath,
|
||||
resolveLayout: layout => {
|
||||
resolveLayout: (layout) => {
|
||||
return resolveValue(layout, layoutPath, {});
|
||||
},
|
||||
dimensions: defFn(def.dimensions),
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
"prepublishOnly": "rm -rf dist && yarn run build"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nebula.js/supernova": "^0.1.0-alpha.28"
|
||||
"@nebula.js/supernova": "^0.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"regenerator-runtime": "0.13.3"
|
||||
"regenerator-runtime": "0.13.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import 'regenerator-runtime/runtime'; // temporary polyfill for transpiled async
|
||||
import { hook } from '@nebula.js/supernova';
|
||||
|
||||
if (!global.requestAnimationFrame) {
|
||||
global.requestAnimationFrame = cb => setTimeout(cb, 10);
|
||||
global.cancelAnimationFrame = id => clearTimeout(id);
|
||||
global.requestAnimationFrame = (cb) => setTimeout(cb, 10);
|
||||
global.cancelAnimationFrame = (id) => clearTimeout(id);
|
||||
}
|
||||
export function create(definition, context = {}) {
|
||||
const hooked = hook(definition);
|
||||
|
||||
@@ -81,14 +81,14 @@ describe('theme', () => {
|
||||
dataPalettes: () => 'p data palettes',
|
||||
uiPalettes: () => `p ui palettes`,
|
||||
dataColors: () => 'p data colors',
|
||||
uiColor: a => `p ui ${a}`,
|
||||
uiColor: (a) => `p ui ${a}`,
|
||||
});
|
||||
|
||||
styleResolverFn.withArgs('', 'resolved').returns({
|
||||
getStyle: () => '#eeeeee',
|
||||
});
|
||||
|
||||
contrasterFn.returns({ getBestContrastColor: c => `contrast ${c}` });
|
||||
contrasterFn.returns({ getBestContrastColor: (c) => `contrast ${c}` });
|
||||
|
||||
t = create().externalAPI;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function colorFn(colors = ['#333333', '#ffffff']) {
|
||||
}
|
||||
const L = luminance(colorString);
|
||||
|
||||
const contrasts = luminances.map(lum => contrast(L, lum));
|
||||
const contrasts = luminances.map((lum) => contrast(L, lum));
|
||||
const c = colors[contrasts.indexOf(Math.max(...contrasts))];
|
||||
|
||||
cache[colorString] = c;
|
||||
|
||||
@@ -5,8 +5,8 @@ export default function luminance(colStr) {
|
||||
const { r, g, b } = c;
|
||||
|
||||
// https://www.w3.org/TR/WCAG20/#relativeluminancedef
|
||||
const [sR, sG, sB] = [r, g, b].map(v => v / 255);
|
||||
const [R, G, B] = [sR, sG, sB].map(v => (v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4));
|
||||
const [sR, sG, sB] = [r, g, b].map((v) => v / 255);
|
||||
const [R, G, B] = [sR, sG, sB].map((v) => (v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4));
|
||||
|
||||
return +(0.2126 * R + 0.7152 * G + 0.0722 * B).toFixed(5);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ export default function theme() {
|
||||
},
|
||||
};
|
||||
|
||||
Object.keys(EventEmitter.prototype).forEach(key => {
|
||||
Object.keys(EventEmitter.prototype).forEach((key) => {
|
||||
externalAPI[key] = EventEmitter.prototype[key];
|
||||
});
|
||||
EventEmitter.init(externalAPI);
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function theme(resolvedTheme) {
|
||||
return {
|
||||
dataScales() {
|
||||
const pals = [];
|
||||
resolvedTheme.scales.forEach(s => {
|
||||
resolvedTheme.scales.forEach((s) => {
|
||||
pals.push({
|
||||
key: s.propertyValue,
|
||||
name: s.name,
|
||||
@@ -39,7 +39,7 @@ export default function theme(resolvedTheme) {
|
||||
},
|
||||
dataPalettes() {
|
||||
const pals = [];
|
||||
resolvedTheme.palettes.data.forEach(s => {
|
||||
resolvedTheme.palettes.data.forEach((s) => {
|
||||
pals.push({
|
||||
key: s.propertyValue,
|
||||
name: s.name,
|
||||
@@ -53,7 +53,7 @@ export default function theme(resolvedTheme) {
|
||||
},
|
||||
uiPalettes() {
|
||||
const pals = [];
|
||||
resolvedTheme.palettes.ui.forEach(s => {
|
||||
resolvedTheme.palettes.ui.forEach((s) => {
|
||||
pals.push({
|
||||
key: 'ui',
|
||||
name: s.name,
|
||||
|
||||
@@ -121,7 +121,7 @@ export default function styleResolver(basePath, themeJSON) {
|
||||
* @param {Object} - variables
|
||||
*/
|
||||
function resolveVariables(objTree, variables) {
|
||||
Object.keys(objTree).forEach(key => {
|
||||
Object.keys(objTree).forEach((key) => {
|
||||
if (typeof objTree[key] === 'object' && objTree[key] !== null) {
|
||||
resolveVariables(objTree[key], variables);
|
||||
} else if (typeof objTree[key] === 'string' && objTree[key].charAt(0) === '@') {
|
||||
@@ -131,7 +131,7 @@ function resolveVariables(objTree, variables) {
|
||||
});
|
||||
}
|
||||
|
||||
styleResolver.resolveRawTheme = raw => {
|
||||
styleResolver.resolveRawTheme = (raw) => {
|
||||
// TODO - validate format
|
||||
// TODO - generate class-pyramid
|
||||
const c = extend(true, {}, raw);
|
||||
|
||||
@@ -92,14 +92,11 @@ const config = ({ mode = 'production', format = 'umd', cwd = process.cwd(), argv
|
||||
globals: {
|
||||
'@nebula.js/supernova': 'supernova',
|
||||
},
|
||||
output: {
|
||||
preamble: banner,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const minified = async argv => {
|
||||
const minified = async (argv) => {
|
||||
const c = config({
|
||||
mode: 'production',
|
||||
format: 'umd',
|
||||
@@ -109,7 +106,7 @@ const minified = async argv => {
|
||||
await bundle.write(c.output);
|
||||
};
|
||||
|
||||
const esm = async argv => {
|
||||
const esm = async (argv) => {
|
||||
const c = config({
|
||||
mode: 'development',
|
||||
format: 'esm',
|
||||
@@ -135,7 +132,7 @@ function clearScreen(msg) {
|
||||
}
|
||||
}
|
||||
|
||||
const watch = async argv => {
|
||||
const watch = async (argv) => {
|
||||
const c = config({
|
||||
mode: 'development',
|
||||
format: 'umd',
|
||||
@@ -161,7 +158,7 @@ const watch = async argv => {
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
watcher.on('event', event => {
|
||||
watcher.on('event', (event) => {
|
||||
switch (event.code) {
|
||||
case 'BUNDLE_START':
|
||||
hasWarnings = false;
|
||||
|
||||
@@ -25,8 +25,8 @@ const options = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = yargs =>
|
||||
yargs.options(options).config('config', configPath => {
|
||||
module.exports = (yargs) =>
|
||||
yargs.options(options).config('config', (configPath) => {
|
||||
if (configPath === null) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
"@babel/cli": "7.8.4",
|
||||
"@babel/core": "7.9.0",
|
||||
"@babel/preset-env": "7.9.0",
|
||||
"@rollup/plugin-commonjs": "11.0.1",
|
||||
"@rollup/plugin-node-resolve": "7.0.0",
|
||||
"@rollup/plugin-replace": "2.3.0",
|
||||
"chalk": "3.0.0",
|
||||
"@rollup/plugin-commonjs": "11.0.2",
|
||||
"@rollup/plugin-node-resolve": "7.1.1",
|
||||
"@rollup/plugin-replace": "2.3.1",
|
||||
"chalk": "4.0.0",
|
||||
"extend": "3.0.2",
|
||||
"rollup": "1.30.0",
|
||||
"rollup-plugin-babel": "4.3.3",
|
||||
"rollup-plugin-postcss": "2.0.5",
|
||||
"rollup-plugin-terser": "5.2.0",
|
||||
"yargs": "15.1.0"
|
||||
"rollup": "2.3.3",
|
||||
"rollup-plugin-babel": "4.4.0",
|
||||
"rollup-plugin-postcss": "2.5.0",
|
||||
"rollup-plugin-terser": "5.3.0",
|
||||
"yargs": "15.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ const importCwd = require('import-cwd');
|
||||
|
||||
yargs.usage('nebula <command> [options]');
|
||||
|
||||
const tryAddCommand = m => {
|
||||
const tryAddCommand = (m) => {
|
||||
let cmd;
|
||||
try {
|
||||
cmd = require(`${m}/command`); // eslint-disable-line
|
||||
@@ -37,7 +37,4 @@ const tryAddCommand = m => {
|
||||
tryAddCommand
|
||||
);
|
||||
|
||||
yargs
|
||||
.demandCommand()
|
||||
.alias('h', 'help')
|
||||
.wrap(Math.min(80, yargs.terminalWidth())).argv;
|
||||
yargs.demandCommand().alias('h', 'help').wrap(Math.min(80, yargs.terminalWidth())).argv;
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
"dependencies": {
|
||||
"@nebula.js/cli-create": "0.4.0",
|
||||
"import-cwd": "3.0.0",
|
||||
"yargs": "15.1.0"
|
||||
"yargs": "15.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,10 @@ const hasYarn = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const author = async cwd => {
|
||||
const author = async (cwd) => {
|
||||
try {
|
||||
const email = execSync('git config --get user.email', { cwd })
|
||||
.toString()
|
||||
.trim();
|
||||
const name = execSync('git config --get user.name', { cwd })
|
||||
.toString()
|
||||
.trim();
|
||||
const email = execSync('git config --get user.email', { cwd }).toString().trim();
|
||||
const name = execSync('git config --get user.name', { cwd }).toString().trim();
|
||||
return {
|
||||
email,
|
||||
name,
|
||||
@@ -58,7 +54,7 @@ function copyFactory(root, destination) {
|
||||
};
|
||||
}
|
||||
|
||||
const create = async argv => {
|
||||
const create = async (argv) => {
|
||||
const { name } = argv;
|
||||
|
||||
const isMashup = argv._.includes('mashup');
|
||||
@@ -132,7 +128,7 @@ const create = async argv => {
|
||||
const traverse = (sourceFolder, targetFolder = '') => {
|
||||
const files = fs.readdirSync(path.resolve(templatesRoot, sourceFolder));
|
||||
|
||||
files.forEach(file => {
|
||||
files.forEach((file) => {
|
||||
const p = `${sourceFolder}/${file}`;
|
||||
const stats = fs.lstatSync(path.resolve(templatesRoot, p));
|
||||
const next = `${targetFolder}/${file}`.replace(/^\//, '');
|
||||
@@ -148,7 +144,7 @@ const create = async argv => {
|
||||
});
|
||||
};
|
||||
|
||||
folders.forEach(folder => {
|
||||
folders.forEach((folder) => {
|
||||
traverse(folder);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
"generate": "yo ./generator/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "3.0.0",
|
||||
"ejs": "3.0.1",
|
||||
"fs-extra": "8.1.0",
|
||||
"inquirer": "7.0.4"
|
||||
"chalk": "4.0.0",
|
||||
"ejs": "3.0.2",
|
||||
"fs-extra": "9.0.0",
|
||||
"inquirer": "7.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ async function getQCSHeaders({ webIntegrationId, url }) {
|
||||
|
||||
async function getEnigmaApp({ host, appId, headers }) {
|
||||
const params = Object.keys(headers)
|
||||
.map(key => `${key}=${headers[key]}`)
|
||||
.map((key) => `${key}=${headers[key]}`)
|
||||
.join('&');
|
||||
|
||||
const enigmaGlobal = await enigma
|
||||
|
||||
@@ -4,7 +4,7 @@ describe('sn', () => {
|
||||
const app = encodeURIComponent(process.env.APP_ID || '/apps/ctrl00.qvf');
|
||||
await page.goto(`${process.env.BASE_URL}/render/?app=${app}`);
|
||||
await page.waitForSelector(content, { visible: true });
|
||||
const text = await page.$eval(content, el => el.textContent);
|
||||
const text = await page.$eval(content, (el) => el.textContent);
|
||||
expect(text).to.equal('Hello!');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const serve = require('@nebula.js/cli-serve'); // eslint-disable-line
|
||||
|
||||
page.on('pageerror', e => {
|
||||
page.on('pageerror', (e) => {
|
||||
console.error('Web: ', e.message);
|
||||
});
|
||||
|
||||
page.on('console', msg => {
|
||||
page.on('console', (msg) => {
|
||||
for (let i = 0; i < msg.args().length; ++i) {
|
||||
console.log(`console ${msg.text()}`);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ describe('interaction', () => {
|
||||
await page.waitForSelector('button[title="Confirm selection"]:not([disabled])', { visible: true });
|
||||
await page.click('button[title="Confirm selection"]');
|
||||
|
||||
await page.waitForFunction(selector => document.querySelectorAll(selector).length === 2, {}, 'rect[data-label]');
|
||||
await page.waitForFunction((selector) => document.querySelectorAll(selector).length === 2, {}, 'rect[data-label]');
|
||||
|
||||
const rects = await page.$$eval('rect[data-label]', sel => sel.map(r => r.getAttribute('data-label')));
|
||||
const rects = await page.$$eval('rect[data-label]', (sel) => sel.map((r) => r.getAttribute('data-label')));
|
||||
expect(rects).to.eql(['K', 'S']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,15 +11,15 @@ const KEYS = {
|
||||
|
||||
const instances = [];
|
||||
let expando = 0;
|
||||
const confirmOrCancelSelection = e => {
|
||||
const active = instances.filter(a => a.selections && a.selections.isActive());
|
||||
const confirmOrCancelSelection = (e) => {
|
||||
const active = instances.filter((a) => a.selections && a.selections.isActive());
|
||||
if (!active.length) {
|
||||
return;
|
||||
}
|
||||
if (e.key === KEYS.ENTER) {
|
||||
active.forEach(a => a.selections.confirm());
|
||||
active.forEach((a) => a.selections.confirm());
|
||||
} else if (e.key === KEYS.ESCAPE || e.key === KEYS.IE11_ESC) {
|
||||
active.forEach(a => a.selections.cancel());
|
||||
active.forEach((a) => a.selections.cancel());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -33,18 +33,18 @@ const teardown = () => {
|
||||
// ------------------------------------------------------
|
||||
|
||||
const addListeners = (emitter, listeners) => {
|
||||
Object.keys(listeners).forEach(type => {
|
||||
Object.keys(listeners).forEach((type) => {
|
||||
emitter.on(type, listeners[type]);
|
||||
});
|
||||
};
|
||||
|
||||
const removeListeners = (emitter, listeners) => {
|
||||
Object.keys(listeners).forEach(type => {
|
||||
Object.keys(listeners).forEach((type) => {
|
||||
emitter.removeListener(type, listeners[type]);
|
||||
});
|
||||
};
|
||||
|
||||
export default function({ selections, brush, picassoQ } = {}, { path = '/qHyperCubeDef' } = {}) {
|
||||
export default function ({ selections, brush, picassoQ } = {}, { path = '/qHyperCubeDef' } = {}) {
|
||||
if (!selections) {
|
||||
return {
|
||||
layout: () => {},
|
||||
@@ -56,9 +56,9 @@ export default function({ selections, brush, picassoQ } = {}, { path = '/qHyperC
|
||||
let layout = null;
|
||||
|
||||
// interceptors primary job is to ensure selections only occur on either values OR ranges
|
||||
const valueInterceptor = added => {
|
||||
const valueInterceptor = (added) => {
|
||||
const brushes = brush.brushes();
|
||||
brushes.forEach(b => {
|
||||
brushes.forEach((b) => {
|
||||
if (b.type === 'range') {
|
||||
// has range selections
|
||||
brush.clear([]);
|
||||
@@ -67,11 +67,11 @@ export default function({ selections, brush, picassoQ } = {}, { path = '/qHyperC
|
||||
brush.clear([]);
|
||||
}
|
||||
});
|
||||
return added.filter(t => t.value !== -2); // do not allow selection on null value
|
||||
return added.filter((t) => t.value !== -2); // do not allow selection on null value
|
||||
};
|
||||
|
||||
const rangeInterceptor = a => {
|
||||
const v = brush.brushes().filter(b => b.type === 'value');
|
||||
const rangeInterceptor = (a) => {
|
||||
const v = brush.brushes().filter((b) => b.type === 'value');
|
||||
if (v.length) {
|
||||
// has dimension values selected
|
||||
brush.clear([]);
|
||||
@@ -101,7 +101,7 @@ export default function({ selections, brush, picassoQ } = {}, { path = '/qHyperC
|
||||
|
||||
brush.on('update', () => {
|
||||
const generated = picassoQ.selections(brush, {}, layout);
|
||||
generated.forEach(s => selections.select(s));
|
||||
generated.forEach((s) => selections.select(s));
|
||||
});
|
||||
|
||||
if (instances.length === 0) {
|
||||
@@ -114,12 +114,12 @@ export default function({ selections, brush, picassoQ } = {}, { path = '/qHyperC
|
||||
});
|
||||
|
||||
return {
|
||||
layout: lt => {
|
||||
layout: (lt) => {
|
||||
layout = lt;
|
||||
},
|
||||
release: () => {
|
||||
layout = null;
|
||||
const idx = instances.indexOf(instances.filter(i => i.key === key)[0]);
|
||||
const idx = instances.indexOf(instances.filter((i) => i.key === key)[0]);
|
||||
if (idx !== -1) {
|
||||
instances.splice(idx, 1);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const serve = require('@nebula.js/cli-serve'); // eslint-disable-line
|
||||
|
||||
page.on('pageerror', e => {
|
||||
page.on('pageerror', (e) => {
|
||||
console.error('Web: ', e.message);
|
||||
});
|
||||
|
||||
page.on('console', msg => {
|
||||
page.on('console', (msg) => {
|
||||
for (let i = 0; i < msg.args().length; ++i) {
|
||||
console.log(`console ${msg.text()}`);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default function({
|
||||
export default function ({
|
||||
layout, // eslint-disable-line no-unused-vars
|
||||
context, // eslint-disable-line no-unused-vars
|
||||
}) {
|
||||
|
||||
@@ -54,7 +54,7 @@ async function build(argv) {
|
||||
if (supernovaPkg.files) {
|
||||
[extDefinition ? path.basename(qextTargetDir) : false, path.basename(qextFileNameJs), path.basename(qextFileName)]
|
||||
.filter(Boolean)
|
||||
.forEach(f => {
|
||||
.forEach((f) => {
|
||||
if (!supernovaPkg.files.includes(f)) {
|
||||
console.warn(` \x1b[33mwarn:\x1b[0m \x1b[36m${f}\x1b[0m should be included in package.json 'files' array`);
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
"@babel/cli": "7.8.4",
|
||||
"@babel/core": "7.9.0",
|
||||
"@babel/preset-env": "7.9.0",
|
||||
"@rollup/plugin-commonjs": "11.0.1",
|
||||
"@rollup/plugin-node-resolve": "7.0.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"rollup": "1.30.0",
|
||||
"rollup-plugin-babel": "4.3.3",
|
||||
"rollup-plugin-terser": "5.2.0",
|
||||
"yargs": "15.1.0"
|
||||
"@rollup/plugin-commonjs": "11.0.2",
|
||||
"@rollup/plugin-node-resolve": "7.1.1",
|
||||
"fs-extra": "9.0.0",
|
||||
"rollup": "2.3.3",
|
||||
"rollup-plugin-babel": "4.4.0",
|
||||
"rollup-plugin-terser": "5.3.0",
|
||||
"yargs": "15.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@ const execCmd = (cmd, cmdArgs = [], opts) => {
|
||||
err: '',
|
||||
};
|
||||
child.on('error', reject);
|
||||
child.stdout.on('data', chunk => {
|
||||
child.stdout.on('data', (chunk) => {
|
||||
res.out += chunk.toString();
|
||||
});
|
||||
child.stderr.on('data', chunk => {
|
||||
child.stderr.on('data', (chunk) => {
|
||||
res.err += chunk.toString();
|
||||
});
|
||||
child.on('exit', exitCode => {
|
||||
child.on('exit', (exitCode) => {
|
||||
res.exitCode = exitCode;
|
||||
if (exitCode === 0) {
|
||||
resolve(res);
|
||||
|
||||
@@ -64,8 +64,8 @@ const options = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = yargs =>
|
||||
yargs.options(options).config('config', configPath => {
|
||||
module.exports = (yargs) =>
|
||||
yargs.options(options).config('config', (configPath) => {
|
||||
if (configPath === null) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const useEngine = require('./engine');
|
||||
const initiateWatch = async ({ snPath, snName, host }) => {
|
||||
// TODO - timeout
|
||||
let onInitiated;
|
||||
const done = new Promise(resolve => {
|
||||
const done = new Promise((resolve) => {
|
||||
onInitiated = resolve;
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ const initiateWatch = async ({ snPath, snName, host }) => {
|
||||
});
|
||||
|
||||
choker.on('change', () => {
|
||||
[...ws.clients].forEach(client => {
|
||||
[...ws.clients].forEach((client) => {
|
||||
client.send(
|
||||
JSON.stringify({
|
||||
changed: [snName],
|
||||
@@ -92,7 +92,7 @@ const initiateWatch = async ({ snPath, snName, host }) => {
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = async argv => {
|
||||
module.exports = async (argv) => {
|
||||
const context = process.cwd();
|
||||
let defaultServeConfig = {};
|
||||
|
||||
@@ -166,7 +166,7 @@ module.exports = async argv => {
|
||||
server.close();
|
||||
};
|
||||
|
||||
['SIGINT', 'SIGTERM'].forEach(signal => {
|
||||
['SIGINT', 'SIGTERM'].forEach((signal) => {
|
||||
process.on(signal, close);
|
||||
});
|
||||
|
||||
|
||||
@@ -13,11 +13,7 @@ const favicon = path.resolve(__dirname, '../../../docs/assets/njs.png');
|
||||
const crypto = require('crypto');
|
||||
const { version } = require('../package.json');
|
||||
|
||||
const versionHash = crypto
|
||||
.createHash('md5')
|
||||
.update(version)
|
||||
.digest('hex')
|
||||
.slice(0, 4);
|
||||
const versionHash = crypto.createHash('md5').update(version).digest('hex').slice(0, 4);
|
||||
|
||||
const cfg = ({ srcDir, distDir, dev = false, serveConfig = {} }) => {
|
||||
const config = {
|
||||
|
||||
@@ -7,10 +7,7 @@ const NM = /node_modules/;
|
||||
const WP = /\/\(?webpack\)?/;
|
||||
|
||||
const cfg = ({ srcDir = path.resolve(__dirname, '../dist'), serveConfig = {} }) => {
|
||||
const folderName = process
|
||||
.cwd()
|
||||
.split('/')
|
||||
.slice(-1)[0];
|
||||
const folderName = process.cwd().split('/').slice(-1)[0];
|
||||
|
||||
const config = {
|
||||
mode: 'development',
|
||||
@@ -19,7 +16,7 @@ const cfg = ({ srcDir = path.resolve(__dirname, '../dist'), serveConfig = {} })
|
||||
output: {
|
||||
path: path.resolve(srcDir, 'temp'),
|
||||
filename: '[name].js',
|
||||
devtoolModuleFilenameTemplate: info => {
|
||||
devtoolModuleFilenameTemplate: (info) => {
|
||||
// attempt to improve the mapping of multiple libraries into
|
||||
// a better folder structure for easier debugging
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = async ({
|
||||
|
||||
const snapshooter = snapshooterFn({ snapshotUrl: `http://${host}:${port}/eRender.html` });
|
||||
|
||||
(serveConfig.snapshots || []).forEach(s => {
|
||||
(serveConfig.snapshots || []).forEach((s) => {
|
||||
snapshooter.storeSnapshot(s);
|
||||
});
|
||||
|
||||
@@ -88,12 +88,12 @@ module.exports = async ({
|
||||
}
|
||||
|
||||
app.get('/themes', (req, res) => {
|
||||
const arr = themes.map(theme => theme.id);
|
||||
const arr = themes.map((theme) => theme.id);
|
||||
res.json(arr);
|
||||
});
|
||||
|
||||
app.get('/theme/:id', (req, res) => {
|
||||
const t = themes.filter(theme => theme.id === req.params.id)[0];
|
||||
const t = themes.filter((theme) => theme.id === req.params.id)[0];
|
||||
if (!t) {
|
||||
res.sendStatus('404');
|
||||
} else {
|
||||
@@ -112,7 +112,7 @@ module.exports = async ({
|
||||
sock: {
|
||||
port: entryWatcher && entryWatcher.port,
|
||||
},
|
||||
themes: themes.map(theme => theme.id),
|
||||
themes: themes.map((theme) => theme.id),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -149,13 +149,13 @@ module.exports = async ({
|
||||
server.close();
|
||||
};
|
||||
|
||||
['SIGINT', 'SIGTERM'].forEach(signal => {
|
||||
['SIGINT', 'SIGTERM'].forEach((signal) => {
|
||||
process.on(signal, close);
|
||||
});
|
||||
|
||||
if (watcher) {
|
||||
let inError = false;
|
||||
watcher.on('event', event => {
|
||||
watcher.on('event', (event) => {
|
||||
if (event.code === 'ERROR') {
|
||||
inError = true;
|
||||
server.sockWrite(server.sockets, 'errors', [event.error.stack]);
|
||||
@@ -170,7 +170,7 @@ module.exports = async ({
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// eslint-disable-line consistent-return
|
||||
compiler.hooks.done.tap('nebula serve', stats => {
|
||||
compiler.hooks.done.tap('nebula serve', (stats) => {
|
||||
if (!initiated) {
|
||||
initiated = true;
|
||||
const url = `http://${host}:${port}`;
|
||||
@@ -183,7 +183,7 @@ module.exports = async ({
|
||||
});
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
stats.compilation.errors.forEach(e => {
|
||||
stats.compilation.errors.forEach((e) => {
|
||||
console.log(chalk.red(e));
|
||||
});
|
||||
process.exit(1);
|
||||
@@ -191,7 +191,7 @@ module.exports = async ({
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(port, host, err => {
|
||||
server.listen(port, host, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
|
||||
@@ -30,26 +30,26 @@
|
||||
"@nebula.js/cli-build": "0.4.0",
|
||||
"@nebula.js/snapshooter": "0.4.0",
|
||||
"body-parser": "1.19.0",
|
||||
"chalk": "3.0.0",
|
||||
"chalk": "4.0.0",
|
||||
"chokidar": "3.3.1",
|
||||
"cross-env": "6.0.3",
|
||||
"cross-env": "7.0.2",
|
||||
"express": "4.17.1",
|
||||
"extend": "3.0.2",
|
||||
"html-webpack-plugin": "3.2.0",
|
||||
"html-webpack-plugin": "4.0.4",
|
||||
"portfinder": "1.0.25",
|
||||
"puppeteer": "2.0.0",
|
||||
"regenerator-runtime": "0.13.3",
|
||||
"puppeteer": "2.1.1",
|
||||
"regenerator-runtime": "0.13.5",
|
||||
"source-map-loader": "0.2.4",
|
||||
"webpack": "4.41.5",
|
||||
"webpack-dev-server": "3.10.1",
|
||||
"ws": "7.2.1",
|
||||
"yargs": "15.1.0"
|
||||
"webpack": "4.42.1",
|
||||
"webpack-dev-server": "3.10.3",
|
||||
"ws": "7.2.3",
|
||||
"yargs": "15.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.9.0",
|
||||
"@babel/preset-env": "7.9.0",
|
||||
"@babel/preset-react": "7.9.1",
|
||||
"@material-ui/core": "4.9.0",
|
||||
"@babel/preset-react": "7.9.4",
|
||||
"@material-ui/core": "4.9.9",
|
||||
"@nebula.js/nucleus": "0.4.0",
|
||||
"@nebula.js/supernova": "0.4.0",
|
||||
"@nebula.js/ui": "0.4.0",
|
||||
@@ -57,10 +57,10 @@
|
||||
"babel-loader": "8.1.0",
|
||||
"d3-require": "1.2.4",
|
||||
"enigma.js": "2.6.3",
|
||||
"monaco-editor": "0.19.3",
|
||||
"monaco-editor-webpack-plugin": "1.8.2",
|
||||
"react": "16.12.0",
|
||||
"react-dom": "16.12.0",
|
||||
"webpack-cli": "3.3.10"
|
||||
"monaco-editor": "0.20.0",
|
||||
"monaco-editor-webpack-plugin": "1.9.0",
|
||||
"react": "16.13.1",
|
||||
"react-dom": "16.13.1",
|
||||
"webpack-cli": "3.3.11"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,14 +84,14 @@ export default function App({ app, info }) {
|
||||
theme: currentThemeName,
|
||||
language: currentLanguage,
|
||||
},
|
||||
load: type => Promise.resolve(window[type.name]),
|
||||
load: (type) => Promise.resolve(window[type.name]),
|
||||
themes: info.themes
|
||||
? info.themes.map(t => ({
|
||||
? info.themes.map((t) => ({
|
||||
key: t,
|
||||
load: () =>
|
||||
fetch(`/theme/${t}`)
|
||||
.then(response => response.json())
|
||||
.then(raw => {
|
||||
.then((response) => response.json())
|
||||
.then((raw) => {
|
||||
setCurrentMuiThemeName(raw.type === 'dark' ? 'dark' : 'light');
|
||||
return raw;
|
||||
}),
|
||||
@@ -117,7 +117,7 @@ export default function App({ app, info }) {
|
||||
}
|
||||
};
|
||||
|
||||
nebbie.selections().then(s => s.mount(currentSelectionsRef.current));
|
||||
nebbie.selections().then((s) => s.mount(currentSelectionsRef.current));
|
||||
window.onHotChange(info.supernova.name, () => {
|
||||
nebbie.types.clearFromCache(info.supernova.name);
|
||||
nebbie.types.register(info.supernova);
|
||||
@@ -146,13 +146,13 @@ export default function App({ app, info }) {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleThemeChange = t => {
|
||||
const handleThemeChange = (t) => {
|
||||
setThemeChooserAnchorEl(null);
|
||||
storage.save('themeName', t);
|
||||
setCurrentThemeName(t);
|
||||
};
|
||||
|
||||
const handleLanguageChange = lang => {
|
||||
const handleLanguageChange = (lang) => {
|
||||
setLanguageChooserAnchorEl(null);
|
||||
storage.save('language', lang);
|
||||
setCurrentLanguage(lang);
|
||||
@@ -224,7 +224,7 @@ export default function App({ app, info }) {
|
||||
<Grid item>
|
||||
{customThemes.length ? (
|
||||
<>
|
||||
<IconButton title="Select theme" onClick={e => setThemeChooserAnchorEl(e.currentTarget)}>
|
||||
<IconButton title="Select theme" onClick={(e) => setThemeChooserAnchorEl(e.currentTarget)}>
|
||||
<ColorLens fontSize="small" />
|
||||
</IconButton>
|
||||
<Menu
|
||||
@@ -233,7 +233,7 @@ export default function App({ app, info }) {
|
||||
keepMounted
|
||||
onClose={() => setThemeChooserAnchorEl(null)}
|
||||
>
|
||||
{customThemes.map(t => (
|
||||
{customThemes.map((t) => (
|
||||
<MenuItem key={t} selected={t === currentThemeName} onClick={() => handleThemeChange(t)}>
|
||||
{t}
|
||||
</MenuItem>
|
||||
@@ -254,7 +254,7 @@ export default function App({ app, info }) {
|
||||
<Button
|
||||
startIcon={<Language />}
|
||||
title="Select language"
|
||||
onClick={e => setLanguageChooserAnchorEl(e.currentTarget)}
|
||||
onClick={(e) => setLanguageChooserAnchorEl(e.currentTarget)}
|
||||
>
|
||||
{currentLanguage}
|
||||
</Button>
|
||||
@@ -264,7 +264,7 @@ export default function App({ app, info }) {
|
||||
keepMounted
|
||||
onClose={() => setLanguageChooserAnchorEl(null)}
|
||||
>
|
||||
{languages.map(t => (
|
||||
{languages.map((t) => (
|
||||
<MenuItem key={t} selected={t === currentLanguage} onClick={() => handleLanguageChange(t)}>
|
||||
{t}
|
||||
</MenuItem>
|
||||
|
||||
@@ -18,7 +18,7 @@ import { ExpandMore } from '@nebula.js/ui/icons';
|
||||
|
||||
import { makeStyles } from '@nebula.js/ui/theme';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
summary: {
|
||||
padding: theme.spacing(0, 1),
|
||||
backgroundColor: theme.palette.background.lighter,
|
||||
@@ -29,7 +29,7 @@ const useStyles = makeStyles(theme => ({
|
||||
},
|
||||
}));
|
||||
|
||||
const usePanelStyles = makeStyles(theme => ({
|
||||
const usePanelStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
boxShadow: 'none',
|
||||
marginLeft: -theme.spacing(1),
|
||||
@@ -42,7 +42,7 @@ const usePanelStyles = makeStyles(theme => ({
|
||||
expanded: {},
|
||||
}));
|
||||
|
||||
const getType = value => {
|
||||
const getType = (value) => {
|
||||
if (Array.isArray(value)) {
|
||||
return 'array';
|
||||
}
|
||||
@@ -62,7 +62,7 @@ const getType = value => {
|
||||
};
|
||||
|
||||
const Bool = ({ property, value, target, changed }) => {
|
||||
const handleChange = e => {
|
||||
const handleChange = (e) => {
|
||||
target[property] = e.target.checked;
|
||||
changed();
|
||||
};
|
||||
@@ -77,7 +77,7 @@ const Bool = ({ property, value, target, changed }) => {
|
||||
|
||||
const Str = ({ property, value, target, changed }) => {
|
||||
const [s, setS] = useState(value);
|
||||
const handleChange = e => {
|
||||
const handleChange = (e) => {
|
||||
setS(e.target.value);
|
||||
};
|
||||
const onBlur = () => {
|
||||
@@ -92,7 +92,7 @@ const Str = ({ property, value, target, changed }) => {
|
||||
|
||||
const Num = ({ property, value, target, changed }) => {
|
||||
const [s, setS] = useState(+value);
|
||||
const handleChange = e => {
|
||||
const handleChange = (e) => {
|
||||
setS(e.target.value);
|
||||
};
|
||||
const onBlur = () => {
|
||||
@@ -129,7 +129,7 @@ const QRX = /^q[A-Z]/;
|
||||
|
||||
function generateComponents(properties, changed) {
|
||||
const components = Object.keys(properties)
|
||||
.map(key => {
|
||||
.map((key) => {
|
||||
if (['visualization', 'version'].indexOf(key) !== -1) {
|
||||
return false;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ function generateComponents(properties, changed) {
|
||||
|
||||
return (
|
||||
<Grid container direction="column" spacing={0} alignItems="stretch">
|
||||
{components.map(c => (
|
||||
{components.map((c) => (
|
||||
<Grid item xs key={c.key} style={{ width: '100%' }}>
|
||||
<c.Component key={c.key} property={c.property} value={c.value} target={properties} changed={changed} />
|
||||
</Grid>
|
||||
|
||||
@@ -12,7 +12,7 @@ import VizContext from '../contexts/VizContext';
|
||||
|
||||
import Chart from './Chart';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
secondaryIcon: {
|
||||
color: theme.palette.text.secondary,
|
||||
},
|
||||
@@ -22,7 +22,7 @@ const useStyles = makeStyles(theme => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export default function({ id, expandable, minHeight }) {
|
||||
export default function ({ id, expandable, minHeight }) {
|
||||
const language = 'en-US'; // TODO - useLocale
|
||||
const app = useContext(AppContext);
|
||||
const [model, setModel] = useState(null);
|
||||
@@ -37,13 +37,13 @@ export default function({ id, expandable, minHeight }) {
|
||||
|
||||
const vizRef = useRef();
|
||||
useEffect(() => {
|
||||
const v = app.getObject(id).then(m => {
|
||||
const v = app.getObject(id).then((m) => {
|
||||
setModel(m);
|
||||
return m;
|
||||
});
|
||||
|
||||
return () => {
|
||||
v.then(m => m.emit('close'));
|
||||
v.then((m) => m.emit('close'));
|
||||
};
|
||||
}, [id]);
|
||||
|
||||
@@ -79,7 +79,7 @@ export default function({ id, expandable, minHeight }) {
|
||||
}
|
||||
if (doExport) {
|
||||
setExporting(true);
|
||||
vizRef.current.viz.exportImage().then(res => {
|
||||
vizRef.current.viz.exportImage().then((res) => {
|
||||
if (res && res.url) {
|
||||
window.open(res.url);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ export default function({ id, expandable, minHeight }) {
|
||||
});
|
||||
} else {
|
||||
const containerSize = vizRef.current.el.getBoundingClientRect();
|
||||
vizRef.current.viz.takeSnapshot().then(snapshot => {
|
||||
vizRef.current.viz.takeSnapshot().then((snapshot) => {
|
||||
fetch('/njs/snapshot', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
@@ -15,11 +15,11 @@ export default function Chart({ id, onLoad }) {
|
||||
id,
|
||||
element: el.current,
|
||||
});
|
||||
n.then(viz => {
|
||||
n.then((viz) => {
|
||||
onLoad(viz, el.current);
|
||||
});
|
||||
return () => {
|
||||
n.then(v => {
|
||||
n.then((v) => {
|
||||
v.destroy();
|
||||
});
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user