@nebula.js/stardust 4.9.0 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/esm/dev.js +545 -444
- package/core/esm/dev.js.map +1 -1
- package/core/esm/index.js +4 -4
- package/core/esm/index.js.map +1 -1
- package/core/package.json +2 -2
- package/dist/stardust.dev.js +551 -451
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +14 -14
- package/dist/stardust.js.map +1 -1
- package/package.json +12 -12
package/core/esm/dev.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust
|
|
2
|
+
* @nebula.js/stardust v5.0.0-alpha.1
|
|
3
3
|
* Copyright (c) 2023 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import React__default, { useState as useState$1, useEffect as useEffect$1, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useReducer, useCallback, useLayoutEffect as useLayoutEffect$1, PureComponent, useRef,
|
|
8
|
+
import React__default, { useState as useState$1, useEffect as useEffect$1, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useContext, useReducer, useCallback, useLayoutEffect as useLayoutEffect$1, PureComponent, useRef, createElement, Component } from 'react';
|
|
9
9
|
import ReactDOM from 'react-dom';
|
|
10
10
|
import { CacheProvider, ThemeContext as ThemeContext$2 } from '@emotion/react';
|
|
11
11
|
import { Checkbox, Radio, Typography, FormControlLabel, Box, Grid, Tooltip, Paper, IconButton, styled as styled$4, Popover, MenuList, MenuItem, ListItemIcon, Divider, OutlinedInput, InputAdornment, Badge, List, ListItem, Button, Icon, CircularProgress } from '@mui/material';
|
|
@@ -282,8 +282,9 @@ var runtime = {exports: {}};
|
|
|
282
282
|
throw arg;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
// Be forgiving, per
|
|
286
|
-
// https://
|
|
285
|
+
// Be forgiving, per GeneratorResume behavior specified since ES2015:
|
|
286
|
+
// ES2015 spec, step 3: https://262.ecma-international.org/6.0/#sec-generatorresume
|
|
287
|
+
// Latest spec, step 2: https://tc39.es/ecma262/#sec-generatorresume
|
|
287
288
|
return doneResult();
|
|
288
289
|
}
|
|
289
290
|
context.method = method;
|
|
@@ -343,7 +344,7 @@ var runtime = {exports: {}};
|
|
|
343
344
|
var method = delegate.iterator[methodName];
|
|
344
345
|
if (method === undefined$1) {
|
|
345
346
|
// A .throw or .return when the delegate iterator has no .throw
|
|
346
|
-
// method, or a missing .next
|
|
347
|
+
// method, or a missing .next method, always terminate the
|
|
347
348
|
// yield* loop.
|
|
348
349
|
context.delegate = null;
|
|
349
350
|
|
|
@@ -482,7 +483,7 @@ var runtime = {exports: {}};
|
|
|
482
483
|
};
|
|
483
484
|
};
|
|
484
485
|
function values(iterable) {
|
|
485
|
-
if (iterable
|
|
486
|
+
if (iterable != null) {
|
|
486
487
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
487
488
|
if (iteratorMethod) {
|
|
488
489
|
return iteratorMethod.call(iterable);
|
|
@@ -708,26 +709,26 @@ var runtime = {exports: {}};
|
|
|
708
709
|
}
|
|
709
710
|
})(runtime);
|
|
710
711
|
|
|
711
|
-
function ownKeys(
|
|
712
|
-
var
|
|
712
|
+
function ownKeys(object, enumerableOnly) {
|
|
713
|
+
var keys = Object.keys(object);
|
|
713
714
|
if (Object.getOwnPropertySymbols) {
|
|
714
|
-
var
|
|
715
|
-
|
|
716
|
-
return Object.getOwnPropertyDescriptor(
|
|
717
|
-
})),
|
|
718
|
-
}
|
|
719
|
-
return
|
|
720
|
-
}
|
|
721
|
-
function _objectSpread2(
|
|
722
|
-
for (var
|
|
723
|
-
var
|
|
724
|
-
|
|
725
|
-
_defineProperty(
|
|
726
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
727
|
-
Object.defineProperty(
|
|
715
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
716
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
717
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
718
|
+
})), keys.push.apply(keys, symbols);
|
|
719
|
+
}
|
|
720
|
+
return keys;
|
|
721
|
+
}
|
|
722
|
+
function _objectSpread2(target) {
|
|
723
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
724
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
725
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
726
|
+
_defineProperty(target, key, source[key]);
|
|
727
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
728
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
728
729
|
});
|
|
729
730
|
}
|
|
730
|
-
return
|
|
731
|
+
return target;
|
|
731
732
|
}
|
|
732
733
|
function _defineProperty(obj, key, value) {
|
|
733
734
|
key = _toPropertyKey(key);
|
|
@@ -2819,7 +2820,7 @@ var extend$1 = function extend() {
|
|
|
2819
2820
|
|
|
2820
2821
|
var extend$2 = /*@__PURE__*/getDefaultExportFromCjs(extend$1);
|
|
2821
2822
|
|
|
2822
|
-
var fontSize = "
|
|
2823
|
+
var fontSize = "12px";
|
|
2823
2824
|
var fontFamily = "'Source Sans Pro', 'Arial', 'sans-serif'";
|
|
2824
2825
|
var backgroundColor$1 = "transparent";
|
|
2825
2826
|
var dataColors = {
|
|
@@ -3184,15 +3185,14 @@ function theme$1(resolvedTheme) {
|
|
|
3184
3185
|
},
|
|
3185
3186
|
dataColors() {
|
|
3186
3187
|
/** @interface Theme~DataColorSpecials */
|
|
3187
|
-
return
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
);
|
|
3188
|
+
return /** @lends Theme~DataColorSpecials */{
|
|
3189
|
+
/** @type {string} */
|
|
3190
|
+
primary: resolvedTheme.dataColors.primaryColor,
|
|
3191
|
+
/** @type {string} */
|
|
3192
|
+
nil: resolvedTheme.dataColors.nullColor,
|
|
3193
|
+
/** @type {string} */
|
|
3194
|
+
others: resolvedTheme.dataColors.othersColor
|
|
3195
|
+
};
|
|
3196
3196
|
},
|
|
3197
3197
|
uiColor(c, shift) {
|
|
3198
3198
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -3518,7 +3518,6 @@ function resolveVariables(objTree, variables) {
|
|
|
3518
3518
|
}
|
|
3519
3519
|
});
|
|
3520
3520
|
}
|
|
3521
|
-
|
|
3522
3521
|
styleResolver.resolveRawTheme = raw => {
|
|
3523
3522
|
// TODO - validate format
|
|
3524
3523
|
const c = extend$2(true, {}, raw);
|
|
@@ -4075,7 +4074,6 @@ function useEventCallback(fn) {
|
|
|
4075
4074
|
});
|
|
4076
4075
|
return React.useRef((...args) =>
|
|
4077
4076
|
// @ts-expect-error hide `this`
|
|
4078
|
-
// tslint:disable-next-line:ban-comma-operator
|
|
4079
4077
|
(0, ref.current)(...args)).current;
|
|
4080
4078
|
}
|
|
4081
4079
|
|
|
@@ -4327,6 +4325,7 @@ var ClassNameGenerator$1 = ClassNameGenerator;
|
|
|
4327
4325
|
|
|
4328
4326
|
// If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
|
|
4329
4327
|
// \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
|
|
4328
|
+
|
|
4330
4329
|
const globalStateClassesMapping = {
|
|
4331
4330
|
active: 'active',
|
|
4332
4331
|
checked: 'checked',
|
|
@@ -5670,7 +5669,7 @@ function StyledEngineProvider(props) {
|
|
|
5670
5669
|
}
|
|
5671
5670
|
|
|
5672
5671
|
/**
|
|
5673
|
-
* @mui/styled-engine v5.
|
|
5672
|
+
* @mui/styled-engine v5.15.0
|
|
5674
5673
|
*
|
|
5675
5674
|
* @license MIT
|
|
5676
5675
|
* This source code is licensed under the MIT license found in the
|
|
@@ -5749,7 +5748,6 @@ function createBreakpoints(breakpoints) {
|
|
|
5749
5748
|
// desktop
|
|
5750
5749
|
xl: 1536 // large screen
|
|
5751
5750
|
},
|
|
5752
|
-
|
|
5753
5751
|
unit = 'px',
|
|
5754
5752
|
step = 5
|
|
5755
5753
|
} = breakpoints,
|
|
@@ -5824,7 +5822,6 @@ const values = {
|
|
|
5824
5822
|
// desktop
|
|
5825
5823
|
xl: 1536 // large screen
|
|
5826
5824
|
};
|
|
5827
|
-
|
|
5828
5825
|
const defaultBreakpoints = {
|
|
5829
5826
|
// Sorted ASC by size. That's important.
|
|
5830
5827
|
// It can't be configured as it's used statically for propTypes.
|
|
@@ -6071,8 +6068,6 @@ padding.filterProps = paddingKeys;
|
|
|
6071
6068
|
|
|
6072
6069
|
// The different signatures imply different meaning for their arguments that can't be expressed structurally.
|
|
6073
6070
|
// We express the difference with variable names.
|
|
6074
|
-
/* tslint:disable:unified-signatures */
|
|
6075
|
-
/* tslint:enable:unified-signatures */
|
|
6076
6071
|
|
|
6077
6072
|
function createSpacing(spacingInput = 8) {
|
|
6078
6073
|
// Already transformed.
|
|
@@ -6126,51 +6121,25 @@ function borderTransform(value) {
|
|
|
6126
6121
|
}
|
|
6127
6122
|
return `${value}px solid`;
|
|
6128
6123
|
}
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
const
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
const
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
});
|
|
6149
|
-
const borderLeft = style$1({
|
|
6150
|
-
prop: 'borderLeft',
|
|
6151
|
-
themeKey: 'borders',
|
|
6152
|
-
transform: borderTransform
|
|
6153
|
-
});
|
|
6154
|
-
const borderColor = style$1({
|
|
6155
|
-
prop: 'borderColor',
|
|
6156
|
-
themeKey: 'palette'
|
|
6157
|
-
});
|
|
6158
|
-
const borderTopColor = style$1({
|
|
6159
|
-
prop: 'borderTopColor',
|
|
6160
|
-
themeKey: 'palette'
|
|
6161
|
-
});
|
|
6162
|
-
const borderRightColor = style$1({
|
|
6163
|
-
prop: 'borderRightColor',
|
|
6164
|
-
themeKey: 'palette'
|
|
6165
|
-
});
|
|
6166
|
-
const borderBottomColor = style$1({
|
|
6167
|
-
prop: 'borderBottomColor',
|
|
6168
|
-
themeKey: 'palette'
|
|
6169
|
-
});
|
|
6170
|
-
const borderLeftColor = style$1({
|
|
6171
|
-
prop: 'borderLeftColor',
|
|
6172
|
-
themeKey: 'palette'
|
|
6173
|
-
});
|
|
6124
|
+
function createBorderStyle(prop, transform) {
|
|
6125
|
+
return style$1({
|
|
6126
|
+
prop,
|
|
6127
|
+
themeKey: 'borders',
|
|
6128
|
+
transform
|
|
6129
|
+
});
|
|
6130
|
+
}
|
|
6131
|
+
const border = createBorderStyle('border', borderTransform);
|
|
6132
|
+
const borderTop = createBorderStyle('borderTop', borderTransform);
|
|
6133
|
+
const borderRight = createBorderStyle('borderRight', borderTransform);
|
|
6134
|
+
const borderBottom = createBorderStyle('borderBottom', borderTransform);
|
|
6135
|
+
const borderLeft = createBorderStyle('borderLeft', borderTransform);
|
|
6136
|
+
const borderColor = createBorderStyle('borderColor');
|
|
6137
|
+
const borderTopColor = createBorderStyle('borderTopColor');
|
|
6138
|
+
const borderRightColor = createBorderStyle('borderRightColor');
|
|
6139
|
+
const borderBottomColor = createBorderStyle('borderBottomColor');
|
|
6140
|
+
const borderLeftColor = createBorderStyle('borderLeftColor');
|
|
6141
|
+
const outline = createBorderStyle('outline', borderTransform);
|
|
6142
|
+
const outlineColor = createBorderStyle('outlineColor');
|
|
6174
6143
|
|
|
6175
6144
|
// false positive
|
|
6176
6145
|
// eslint-disable-next-line react/function-component-definition
|
|
@@ -6186,7 +6155,7 @@ const borderRadius$1 = props => {
|
|
|
6186
6155
|
};
|
|
6187
6156
|
borderRadius$1.propTypes = {};
|
|
6188
6157
|
borderRadius$1.filterProps = ['borderRadius'];
|
|
6189
|
-
compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius$1);
|
|
6158
|
+
compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius$1, outline, outlineColor);
|
|
6190
6159
|
|
|
6191
6160
|
// false positive
|
|
6192
6161
|
// eslint-disable-next-line react/function-component-definition
|
|
@@ -6384,6 +6353,13 @@ const defaultSxConfig = {
|
|
|
6384
6353
|
borderLeftColor: {
|
|
6385
6354
|
themeKey: 'palette'
|
|
6386
6355
|
},
|
|
6356
|
+
outline: {
|
|
6357
|
+
themeKey: 'borders',
|
|
6358
|
+
transform: borderTransform
|
|
6359
|
+
},
|
|
6360
|
+
outlineColor: {
|
|
6361
|
+
themeKey: 'palette'
|
|
6362
|
+
},
|
|
6387
6363
|
borderRadius: {
|
|
6388
6364
|
themeKey: 'shape.borderRadius',
|
|
6389
6365
|
style: borderRadius$1
|
|
@@ -6693,7 +6669,6 @@ function unstable_createStyleFunctionSx() {
|
|
|
6693
6669
|
if (!sx) {
|
|
6694
6670
|
return null; // Emotion & styled-components will neglect null
|
|
6695
6671
|
}
|
|
6696
|
-
|
|
6697
6672
|
const config = (_theme$unstable_sxCon = theme.unstable_sxConfig) != null ? _theme$unstable_sxCon : defaultSxConfig$1;
|
|
6698
6673
|
|
|
6699
6674
|
/*
|
|
@@ -7271,7 +7246,6 @@ function getLuminance(color) {
|
|
|
7271
7246
|
if (color.type !== 'color') {
|
|
7272
7247
|
val /= 255; // normalized
|
|
7273
7248
|
}
|
|
7274
|
-
|
|
7275
7249
|
return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
|
|
7276
7250
|
});
|
|
7277
7251
|
|
|
@@ -8551,7 +8525,7 @@ function create$3(definition) {
|
|
|
8551
8525
|
return cache[key];
|
|
8552
8526
|
}
|
|
8553
8527
|
|
|
8554
|
-
const NEBULA_VERSION_HASH = "
|
|
8528
|
+
const NEBULA_VERSION_HASH = "5ec7" ;
|
|
8555
8529
|
ClassNameGenerator$1.configure(componentName => {
|
|
8556
8530
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
8557
8531
|
});
|
|
@@ -8562,9 +8536,49 @@ var InstanceContext = React__default.createContext({
|
|
|
8562
8536
|
translator: null,
|
|
8563
8537
|
constraints: {},
|
|
8564
8538
|
interactions: {},
|
|
8565
|
-
themeApi: null
|
|
8539
|
+
themeApi: null,
|
|
8540
|
+
modelStore: {},
|
|
8541
|
+
selectionStore: {}
|
|
8566
8542
|
});
|
|
8567
8543
|
|
|
8544
|
+
const DEFAULT_INTERACTIONS = {
|
|
8545
|
+
active: true,
|
|
8546
|
+
select: true,
|
|
8547
|
+
passive: true,
|
|
8548
|
+
edit: false
|
|
8549
|
+
};
|
|
8550
|
+
function pickConstraintsOrInteractions(context) {
|
|
8551
|
+
const {
|
|
8552
|
+
constraints = {},
|
|
8553
|
+
interactions = {}
|
|
8554
|
+
} = context;
|
|
8555
|
+
// If some interaction is defined, then we use that
|
|
8556
|
+
if (Object.keys(interactions).length > 0) {
|
|
8557
|
+
return interactions;
|
|
8558
|
+
}
|
|
8559
|
+
const ret = {};
|
|
8560
|
+
Object.keys(constraints).forEach(state => {
|
|
8561
|
+
ret[state] = !constraints[state];
|
|
8562
|
+
});
|
|
8563
|
+
return ret;
|
|
8564
|
+
}
|
|
8565
|
+
function unifyContraintsAndInteractions(context) {
|
|
8566
|
+
const interactions = {};
|
|
8567
|
+
const constraints = {};
|
|
8568
|
+
const definedSettings = pickConstraintsOrInteractions(context);
|
|
8569
|
+
Object.keys(DEFAULT_INTERACTIONS).forEach(state => {
|
|
8570
|
+
if (definedSettings[state] !== undefined) {
|
|
8571
|
+
interactions[state] = definedSettings[state];
|
|
8572
|
+
constraints[state] = !definedSettings[state];
|
|
8573
|
+
} else {
|
|
8574
|
+
interactions[state] = DEFAULT_INTERACTIONS[state];
|
|
8575
|
+
constraints[state] = !DEFAULT_INTERACTIONS[state];
|
|
8576
|
+
}
|
|
8577
|
+
});
|
|
8578
|
+
context.constraints = constraints;
|
|
8579
|
+
context.interactions = interactions;
|
|
8580
|
+
}
|
|
8581
|
+
|
|
8568
8582
|
var createKeyStore = (function () {
|
|
8569
8583
|
let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8570
8584
|
let applyMiddleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
|
|
@@ -8607,169 +8621,97 @@ var createKeyStore = (function () {
|
|
|
8607
8621
|
return [useKeyStore, store];
|
|
8608
8622
|
});
|
|
8609
8623
|
|
|
8610
|
-
|
|
8611
|
-
const [
|
|
8612
|
-
const [
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
} = _ref;
|
|
8619
|
-
const key = "".concat(app.id);
|
|
8620
|
-
const end = async function () {
|
|
8621
|
-
let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8622
|
-
const {
|
|
8623
|
-
model,
|
|
8624
|
-
objectSelections
|
|
8625
|
-
} = modalObjectStore.get(key) || {};
|
|
8626
|
-
if (model) {
|
|
8627
|
-
await model.endSelections(accept);
|
|
8628
|
-
modalObjectStore.clear(key);
|
|
8629
|
-
objectSelections.emit('deactivated');
|
|
8630
|
-
}
|
|
8631
|
-
};
|
|
8632
|
-
const begin = async _ref2 => {
|
|
8633
|
-
var _modalObjectStore$get;
|
|
8624
|
+
function initializeStores$1(appId) {
|
|
8625
|
+
const [useRpcResultStore, rpcResultStore] = createKeyStore({});
|
|
8626
|
+
const [useRpcRequestStore, rpcRequestStore] = createKeyStore({});
|
|
8627
|
+
const [useRpcRequestSessionModelStore, rpcRequestSessionModelStore] = createKeyStore({});
|
|
8628
|
+
const [useRpcRequestModelStore, rpcRequestModelStore] = createKeyStore({});
|
|
8629
|
+
const [useModelChangedStore, modelChangedStore] = createKeyStore({});
|
|
8630
|
+
const [, modelInitializedStore] = createKeyStore({});
|
|
8631
|
+
const modelStoreMiddleware = _ref => {
|
|
8634
8632
|
let {
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
}
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8633
|
+
type,
|
|
8634
|
+
value: model
|
|
8635
|
+
} = _ref;
|
|
8636
|
+
const initialized = modelInitializedStore.get(model.id);
|
|
8637
|
+
modelInitializedStore.set(model.id, {});
|
|
8638
|
+
const onChanged = () => {
|
|
8639
|
+
rpcRequestStore.clear(model.id);
|
|
8640
|
+
modelChangedStore.set(model.id, {});
|
|
8641
|
+
modelChangedStore.dispatch(true); // Force new state to trigger hooks
|
|
8642
|
+
};
|
|
8643
|
+
const unsubscribe = () => {
|
|
8644
|
+
model.removeListener('changed', onChanged);
|
|
8645
|
+
rpcResultStore.clear(model.id);
|
|
8646
|
+
rpcRequestStore.clear(model.id);
|
|
8647
|
+
rpcRequestSessionModelStore.clear(model.id);
|
|
8648
|
+
rpcRequestModelStore.clear(model.id);
|
|
8649
|
+
modelChangedStore.clear(model.id);
|
|
8650
|
+
modelInitializedStore.clear(model.id);
|
|
8651
|
+
};
|
|
8652
|
+
switch (type) {
|
|
8653
|
+
case 'SET':
|
|
8654
|
+
if (!initialized) {
|
|
8655
|
+
model.on('changed', onChanged);
|
|
8656
|
+
model.once('closed', () => {
|
|
8657
|
+
unsubscribe();
|
|
8658
|
+
});
|
|
8659
|
+
}
|
|
8660
|
+
break;
|
|
8643
8661
|
}
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
model
|
|
8651
|
-
objectSelections
|
|
8662
|
+
return unsubscribe;
|
|
8663
|
+
};
|
|
8664
|
+
const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
|
|
8665
|
+
const subscribe = model => {
|
|
8666
|
+
const unsubscribe = modelStoreMiddleware({
|
|
8667
|
+
type: 'SET',
|
|
8668
|
+
value: model
|
|
8652
8669
|
});
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
await model.beginSelections(p);
|
|
8657
|
-
modalObjectStore.set(key, {
|
|
8658
|
-
model,
|
|
8659
|
-
objectSelections
|
|
8660
|
-
}); // We have a modal
|
|
8661
|
-
} catch (err) {
|
|
8662
|
-
if (err.code === 6003 && !skipRetry) {
|
|
8663
|
-
await app.abortModal(accept);
|
|
8664
|
-
beginSelections(true);
|
|
8665
|
-
} else {
|
|
8666
|
-
modalObjectStore.clear(key); // No modal
|
|
8667
|
-
}
|
|
8668
|
-
}
|
|
8670
|
+
return () => {
|
|
8671
|
+
unsubscribe();
|
|
8672
|
+
modelStore.clear(model.id);
|
|
8669
8673
|
};
|
|
8670
|
-
|
|
8671
|
-
await beginSelections();
|
|
8672
|
-
};
|
|
8673
|
-
const appModal = {
|
|
8674
|
-
begin,
|
|
8675
|
-
end
|
|
8676
8674
|
};
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
},
|
|
8693
|
-
forward() {
|
|
8694
|
-
return appModal.end().then(() => app.forward());
|
|
8695
|
-
},
|
|
8696
|
-
back() {
|
|
8697
|
-
return appModal.end().then(() => app.back());
|
|
8698
|
-
},
|
|
8699
|
-
clear() {
|
|
8700
|
-
return appModal.end().then(() => app.clearAll());
|
|
8701
|
-
},
|
|
8702
|
-
clearField(field) {
|
|
8703
|
-
let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
|
|
8704
|
-
return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
|
|
8705
|
-
}
|
|
8675
|
+
return {
|
|
8676
|
+
subscribe,
|
|
8677
|
+
useModelStore,
|
|
8678
|
+
modelStore,
|
|
8679
|
+
useModelChangedStore,
|
|
8680
|
+
useRpcResultStore,
|
|
8681
|
+
rpcResultStore,
|
|
8682
|
+
useRpcRequestStore,
|
|
8683
|
+
rpcRequestStore,
|
|
8684
|
+
useRpcRequestModelStore,
|
|
8685
|
+
rpcRequestModelStore,
|
|
8686
|
+
useRpcRequestSessionModelStore,
|
|
8687
|
+
rpcRequestSessionModelStore,
|
|
8688
|
+
modelChangedStore,
|
|
8689
|
+
appId
|
|
8706
8690
|
};
|
|
8707
|
-
return appSelections;
|
|
8708
|
-
}
|
|
8709
|
-
function useAppSelections(app) {
|
|
8710
|
-
if (!app.session) {
|
|
8711
|
-
// assume the app is mocked if session is undefined
|
|
8712
|
-
return [];
|
|
8713
|
-
}
|
|
8714
|
-
const [appSelectionsStore] = useAppSelectionsStore();
|
|
8715
|
-
const key = app ? app.id : null;
|
|
8716
|
-
let appSelections = appSelectionsStore.get(key);
|
|
8717
|
-
useEffect$1(() => {
|
|
8718
|
-
if (!app || appSelections) return;
|
|
8719
|
-
appSelections = createAppSelections({
|
|
8720
|
-
app
|
|
8721
|
-
});
|
|
8722
|
-
appSelectionsStore.set(key, appSelections);
|
|
8723
|
-
appSelectionsStore.dispatch(true);
|
|
8724
|
-
}, [app]);
|
|
8725
|
-
return [appSelections];
|
|
8726
8691
|
}
|
|
8727
8692
|
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
return interactions;
|
|
8742
|
-
}
|
|
8743
|
-
const ret = {};
|
|
8744
|
-
Object.keys(constraints).forEach(state => {
|
|
8745
|
-
ret[state] = !constraints[state];
|
|
8746
|
-
});
|
|
8747
|
-
return ret;
|
|
8748
|
-
}
|
|
8749
|
-
function unifyContraintsAndInteractions(context) {
|
|
8750
|
-
const interactions = {};
|
|
8751
|
-
const constraints = {};
|
|
8752
|
-
const definedSettings = pickConstraintsOrInteractions(context);
|
|
8753
|
-
Object.keys(DEFAULT_INTERACTIONS).forEach(state => {
|
|
8754
|
-
if (definedSettings[state] !== undefined) {
|
|
8755
|
-
interactions[state] = definedSettings[state];
|
|
8756
|
-
constraints[state] = !definedSettings[state];
|
|
8757
|
-
} else {
|
|
8758
|
-
interactions[state] = DEFAULT_INTERACTIONS[state];
|
|
8759
|
-
constraints[state] = !DEFAULT_INTERACTIONS[state];
|
|
8760
|
-
}
|
|
8761
|
-
});
|
|
8762
|
-
context.constraints = constraints;
|
|
8763
|
-
context.interactions = interactions;
|
|
8693
|
+
function initializeStores(appId) {
|
|
8694
|
+
const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
|
|
8695
|
+
const [useAppModalStore, appModalStore] = createKeyStore({});
|
|
8696
|
+
const [useModalObjectStore, modalObjectStore] = createKeyStore({});
|
|
8697
|
+
return {
|
|
8698
|
+
useAppSelectionsStore,
|
|
8699
|
+
useAppModalStore,
|
|
8700
|
+
appSelectionsStore,
|
|
8701
|
+
appModalStore,
|
|
8702
|
+
useModalObjectStore,
|
|
8703
|
+
modalObjectStore,
|
|
8704
|
+
appId
|
|
8705
|
+
};
|
|
8764
8706
|
}
|
|
8765
8707
|
|
|
8766
8708
|
const NebulaApp = forwardRef((_ref, ref) => {
|
|
8767
8709
|
let {
|
|
8768
8710
|
initialContext,
|
|
8769
|
-
|
|
8770
|
-
|
|
8711
|
+
renderCallback,
|
|
8712
|
+
modelStore,
|
|
8713
|
+
selectionStore
|
|
8771
8714
|
} = _ref;
|
|
8772
|
-
const [appSelections] = useAppSelections(app);
|
|
8773
8715
|
const [context, setContext] = useState$1(initialContext);
|
|
8774
8716
|
const [muiThemeName, setMuiThemeName] = useState$1();
|
|
8775
8717
|
const {
|
|
@@ -8789,9 +8731,12 @@ const NebulaApp = forwardRef((_ref, ref) => {
|
|
|
8789
8731
|
setComponents([...comps]);
|
|
8790
8732
|
},
|
|
8791
8733
|
setMuiThemeName,
|
|
8792
|
-
setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext)
|
|
8793
|
-
getAppSelections: () => appSelections
|
|
8734
|
+
setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext)
|
|
8794
8735
|
}), []);
|
|
8736
|
+
if (context) {
|
|
8737
|
+
context.modelStore = modelStore;
|
|
8738
|
+
context.selectionStore = selectionStore;
|
|
8739
|
+
}
|
|
8795
8740
|
return /*#__PURE__*/React__default.createElement(StyledEngineProvider, {
|
|
8796
8741
|
injectFirst: true
|
|
8797
8742
|
}, /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
@@ -8812,18 +8757,21 @@ function boot(_ref2) {
|
|
|
8812
8757
|
const appRef = React__default.createRef();
|
|
8813
8758
|
const element = document.createElement('div');
|
|
8814
8759
|
element.style.display = 'none';
|
|
8815
|
-
element.setAttribute('data-nebulajs-version', "
|
|
8760
|
+
element.setAttribute('data-nebulajs-version', "5.0.0-alpha.1" );
|
|
8816
8761
|
element.setAttribute('data-app-id', app.id);
|
|
8817
8762
|
document.body.appendChild(element);
|
|
8818
8763
|
if (context) {
|
|
8819
8764
|
unifyContraintsAndInteractions(context);
|
|
8820
8765
|
}
|
|
8766
|
+
const modelStore = initializeStores$1(app.id);
|
|
8767
|
+
const selectionStore = initializeStores(app.id);
|
|
8821
8768
|
const root = client.createRoot(element);
|
|
8822
8769
|
root.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
|
|
8823
8770
|
ref: appRef,
|
|
8824
|
-
app: app,
|
|
8825
8771
|
initialContext: context,
|
|
8826
|
-
renderCallback: resolveRender
|
|
8772
|
+
renderCallback: resolveRender,
|
|
8773
|
+
modelStore: modelStore,
|
|
8774
|
+
selectionStore: selectionStore
|
|
8827
8775
|
}));
|
|
8828
8776
|
const cells = {};
|
|
8829
8777
|
const components = [];
|
|
@@ -8872,65 +8820,40 @@ function boot(_ref2) {
|
|
|
8872
8820
|
}
|
|
8873
8821
|
appRef.current.setContext(ctx);
|
|
8874
8822
|
})();
|
|
8875
|
-
},
|
|
8876
|
-
getAppSelections: async () => {
|
|
8877
|
-
await rendered;
|
|
8878
|
-
return appRef.current.getAppSelections();
|
|
8879
8823
|
}
|
|
8880
|
-
}, appRef, rendered];
|
|
8824
|
+
}, modelStore, selectionStore, appRef, rendered];
|
|
8881
8825
|
}
|
|
8882
8826
|
|
|
8883
|
-
|
|
8884
|
-
const
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
const
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
const
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
};
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
if (!initialized) {
|
|
8914
|
-
model.on('changed', onChanged);
|
|
8915
|
-
model.once('closed', () => {
|
|
8916
|
-
unsubscribe();
|
|
8917
|
-
});
|
|
8918
|
-
}
|
|
8919
|
-
break;
|
|
8920
|
-
}
|
|
8921
|
-
return unsubscribe;
|
|
8922
|
-
};
|
|
8923
|
-
const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
|
|
8924
|
-
const subscribe = model => {
|
|
8925
|
-
const unsubscribe = modelStoreMiddleware({
|
|
8926
|
-
type: 'SET',
|
|
8927
|
-
value: model
|
|
8928
|
-
});
|
|
8929
|
-
return () => {
|
|
8930
|
-
unsubscribe();
|
|
8931
|
-
modelStore.clear(model.id);
|
|
8932
|
-
};
|
|
8933
|
-
};
|
|
8827
|
+
function useModelStore() {
|
|
8828
|
+
const {
|
|
8829
|
+
useModelStore: useFunc
|
|
8830
|
+
} = useContext(InstanceContext).modelStore;
|
|
8831
|
+
return useFunc();
|
|
8832
|
+
}
|
|
8833
|
+
function useModelChangedStore() {
|
|
8834
|
+
const {
|
|
8835
|
+
useModelChangedStore: useFunc
|
|
8836
|
+
} = useContext(InstanceContext).modelStore;
|
|
8837
|
+
return useFunc();
|
|
8838
|
+
}
|
|
8839
|
+
function useRpcResultStore() {
|
|
8840
|
+
const {
|
|
8841
|
+
useRpcResultStore: useFunc
|
|
8842
|
+
} = useContext(InstanceContext).modelStore;
|
|
8843
|
+
return useFunc();
|
|
8844
|
+
}
|
|
8845
|
+
function useRpcRequestStore() {
|
|
8846
|
+
const {
|
|
8847
|
+
useRpcRequestStore: useFunc
|
|
8848
|
+
} = useContext(InstanceContext).modelStore;
|
|
8849
|
+
return useFunc();
|
|
8850
|
+
}
|
|
8851
|
+
function useRpcRequestSessionModelStore() {
|
|
8852
|
+
const {
|
|
8853
|
+
useRpcRequestSessionModelStore: useFunc
|
|
8854
|
+
} = useContext(InstanceContext).modelStore;
|
|
8855
|
+
return useFunc();
|
|
8856
|
+
}
|
|
8934
8857
|
|
|
8935
8858
|
function useSessionModel(definition, app) {
|
|
8936
8859
|
const key = app ? "".concat(app.id, "/").concat(JSON.stringify(definition)) : null;
|
|
@@ -10058,7 +9981,6 @@ const getMaxFreqWidth = _ref2 => {
|
|
|
10058
9981
|
if (frequencyMode === 'P') {
|
|
10059
9982
|
return sizes.freqMinWidth; // because it will never grow beyond "100.0%"
|
|
10060
9983
|
}
|
|
10061
|
-
|
|
10062
9984
|
return sizes.freqMaxWidth;
|
|
10063
9985
|
};
|
|
10064
9986
|
const getSelectedStyle = _ref3 => {
|
|
@@ -11065,7 +10987,6 @@ function getRowsKeyboardNavigation(_ref) {
|
|
|
11065
10987
|
} else {
|
|
11066
10988
|
return; // propagate to other Esc handler
|
|
11067
10989
|
}
|
|
11068
|
-
|
|
11069
10990
|
break;
|
|
11070
10991
|
case KEYS.HOME:
|
|
11071
10992
|
focusListItems.setFirst(true);
|
|
@@ -11099,7 +11020,6 @@ function getRowsKeyboardNavigation(_ref) {
|
|
|
11099
11020
|
return;
|
|
11100
11021
|
// don't stop propagation since we want to outsource keydown to other handlers.
|
|
11101
11022
|
}
|
|
11102
|
-
|
|
11103
11023
|
if (elementToFocus) {
|
|
11104
11024
|
elementToFocus.focus();
|
|
11105
11025
|
}
|
|
@@ -11265,7 +11185,6 @@ function RowColumn(_ref) {
|
|
|
11265
11185
|
if (!cell) {
|
|
11266
11186
|
return null; // prevent rendering empty rows
|
|
11267
11187
|
}
|
|
11268
|
-
|
|
11269
11188
|
const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
|
|
11270
11189
|
const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
|
|
11271
11190
|
// Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
|
|
@@ -14158,7 +14077,6 @@ function ListBox(_ref) {
|
|
|
14158
14077
|
if (s.scrollPosition === 'overflowEnd') {
|
|
14159
14078
|
return; // Do keyScroll.reset() in fetchData() to avoid scrolling to top.
|
|
14160
14079
|
}
|
|
14161
|
-
|
|
14162
14080
|
keyScroll.reset();
|
|
14163
14081
|
}, [keyScroll.state.up, keyScroll.state.down, keyScroll.state.scrollPosition]);
|
|
14164
14082
|
const {
|
|
@@ -14943,6 +14861,7 @@ const StyledOutlinedInput = styled$1(OutlinedInput, {
|
|
|
14943
14861
|
fontSize: 14,
|
|
14944
14862
|
borderRadius: 0,
|
|
14945
14863
|
backgroundColor: styles.search.backgroundColor,
|
|
14864
|
+
backdropFilter: styles.background.backgroundImage ? styles.search.backdropFilter : undefined,
|
|
14946
14865
|
paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
|
|
14947
14866
|
flexDirection: isRtl ? 'row-reverse' : 'row',
|
|
14948
14867
|
'& fieldset': {
|
|
@@ -14950,6 +14869,9 @@ const StyledOutlinedInput = styled$1(OutlinedInput, {
|
|
|
14950
14869
|
borderWidth: '1px 0 1px 0',
|
|
14951
14870
|
borderRadius: 0
|
|
14952
14871
|
},
|
|
14872
|
+
'&.Mui-focused fieldset': {
|
|
14873
|
+
borderColor: "".concat(styles.search.highlightBorderColor, " !important")
|
|
14874
|
+
},
|
|
14953
14875
|
'& .MuiInputBase-root': _objectSpread2({}, styles.search),
|
|
14954
14876
|
'& *': {
|
|
14955
14877
|
color: styles.search.color
|
|
@@ -14957,9 +14879,6 @@ const StyledOutlinedInput = styled$1(OutlinedInput, {
|
|
|
14957
14879
|
'& input': {
|
|
14958
14880
|
color: styles.search.color,
|
|
14959
14881
|
textAlign: isRtl ? 'right' : 'left'
|
|
14960
|
-
},
|
|
14961
|
-
'&.Mui-focused fieldset.OutlinedInput-notchedOutline': {
|
|
14962
|
-
borderColor: "".concat(styles.search.highlightBorderColor, " !important")
|
|
14963
14882
|
}
|
|
14964
14883
|
}, denseProps);
|
|
14965
14884
|
});
|
|
@@ -15137,6 +15056,128 @@ function ListBoxSearch(_ref2) {
|
|
|
15137
15056
|
});
|
|
15138
15057
|
}
|
|
15139
15058
|
|
|
15059
|
+
/* eslint no-underscore-dangle: 0 */
|
|
15060
|
+
function createAppSelections(_ref) {
|
|
15061
|
+
let {
|
|
15062
|
+
app,
|
|
15063
|
+
selectionStore
|
|
15064
|
+
} = _ref;
|
|
15065
|
+
const key = "".concat(app.id);
|
|
15066
|
+
const {
|
|
15067
|
+
modalObjectStore,
|
|
15068
|
+
appModalStore
|
|
15069
|
+
} = selectionStore;
|
|
15070
|
+
const end = async function () {
|
|
15071
|
+
let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
15072
|
+
const {
|
|
15073
|
+
model,
|
|
15074
|
+
objectSelections
|
|
15075
|
+
} = modalObjectStore.get(key) || {};
|
|
15076
|
+
if (model) {
|
|
15077
|
+
await model.endSelections(accept);
|
|
15078
|
+
modalObjectStore.clear(key);
|
|
15079
|
+
objectSelections.emit('deactivated');
|
|
15080
|
+
}
|
|
15081
|
+
};
|
|
15082
|
+
const begin = async _ref2 => {
|
|
15083
|
+
var _modalObjectStore$get;
|
|
15084
|
+
let {
|
|
15085
|
+
model,
|
|
15086
|
+
paths,
|
|
15087
|
+
accept = true,
|
|
15088
|
+
objectSelections
|
|
15089
|
+
} = _ref2;
|
|
15090
|
+
// Quick return if it's already in modal
|
|
15091
|
+
if (objectSelections === ((_modalObjectStore$get = modalObjectStore.get(key)) === null || _modalObjectStore$get === void 0 ? void 0 : _modalObjectStore$get.objectSelections)) {
|
|
15092
|
+
return;
|
|
15093
|
+
}
|
|
15094
|
+
|
|
15095
|
+
// If other model is in modal state end it
|
|
15096
|
+
end(accept);
|
|
15097
|
+
|
|
15098
|
+
// Pending modal
|
|
15099
|
+
modalObjectStore.set(key, {
|
|
15100
|
+
model,
|
|
15101
|
+
objectSelections
|
|
15102
|
+
});
|
|
15103
|
+
const p = Array.isArray(paths) ? paths : [paths];
|
|
15104
|
+
const beginSelections = async skipRetry => {
|
|
15105
|
+
try {
|
|
15106
|
+
await model.beginSelections(p);
|
|
15107
|
+
modalObjectStore.set(key, {
|
|
15108
|
+
model,
|
|
15109
|
+
objectSelections
|
|
15110
|
+
}); // We have a modal
|
|
15111
|
+
} catch (err) {
|
|
15112
|
+
if (err.code === 6003 && !skipRetry) {
|
|
15113
|
+
await app.abortModal(accept);
|
|
15114
|
+
beginSelections(true);
|
|
15115
|
+
} else {
|
|
15116
|
+
modalObjectStore.clear(key); // No modal
|
|
15117
|
+
}
|
|
15118
|
+
}
|
|
15119
|
+
};
|
|
15120
|
+
await beginSelections();
|
|
15121
|
+
};
|
|
15122
|
+
const appModal = {
|
|
15123
|
+
begin,
|
|
15124
|
+
end
|
|
15125
|
+
};
|
|
15126
|
+
appModalStore.set(key, appModal);
|
|
15127
|
+
|
|
15128
|
+
/**
|
|
15129
|
+
* @class
|
|
15130
|
+
* @alias AppSelections
|
|
15131
|
+
*/
|
|
15132
|
+
const appSelections = {
|
|
15133
|
+
model: app,
|
|
15134
|
+
isInModal() {
|
|
15135
|
+
return !!modalObjectStore.get(key);
|
|
15136
|
+
},
|
|
15137
|
+
isModal(objectSelections) {
|
|
15138
|
+
var _modalObjectStore$get2;
|
|
15139
|
+
// TODO check model state
|
|
15140
|
+
return objectSelections ? ((_modalObjectStore$get2 = modalObjectStore.get(key)) === null || _modalObjectStore$get2 === void 0 ? void 0 : _modalObjectStore$get2.objectSelections) === objectSelections : !!modalObjectStore.get(key);
|
|
15141
|
+
},
|
|
15142
|
+
forward() {
|
|
15143
|
+
return appModal.end().then(() => app.forward());
|
|
15144
|
+
},
|
|
15145
|
+
back() {
|
|
15146
|
+
return appModal.end().then(() => app.back());
|
|
15147
|
+
},
|
|
15148
|
+
clear() {
|
|
15149
|
+
return appModal.end().then(() => app.clearAll());
|
|
15150
|
+
},
|
|
15151
|
+
clearField(field) {
|
|
15152
|
+
let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
|
|
15153
|
+
return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
|
|
15154
|
+
}
|
|
15155
|
+
};
|
|
15156
|
+
return appSelections;
|
|
15157
|
+
}
|
|
15158
|
+
function useAppSelections(app) {
|
|
15159
|
+
if (!app.session) {
|
|
15160
|
+
// assume the app is mocked if session is undefined
|
|
15161
|
+
return [];
|
|
15162
|
+
}
|
|
15163
|
+
const {
|
|
15164
|
+
selectionStore
|
|
15165
|
+
} = useContext(InstanceContext);
|
|
15166
|
+
const [appSelectionsStore] = selectionStore.useAppSelectionsStore();
|
|
15167
|
+
const key = app ? app.id : null;
|
|
15168
|
+
let appSelections = appSelectionsStore.get(key);
|
|
15169
|
+
useEffect$1(() => {
|
|
15170
|
+
if (!app || appSelections) return;
|
|
15171
|
+
appSelections = createAppSelections({
|
|
15172
|
+
app,
|
|
15173
|
+
selectionStore
|
|
15174
|
+
});
|
|
15175
|
+
appSelectionsStore.set(key, appSelections);
|
|
15176
|
+
appSelectionsStore.dispatch(true);
|
|
15177
|
+
}, [app]);
|
|
15178
|
+
return [appSelections];
|
|
15179
|
+
}
|
|
15180
|
+
|
|
15140
15181
|
function eventmixin (obj) {
|
|
15141
15182
|
/* eslint no-param-reassign: 0 */
|
|
15142
15183
|
Object.keys(EventEmitter$1.prototype).forEach(key => {
|
|
@@ -15380,7 +15421,9 @@ function useObjectSelections(app, model, elements, options) {
|
|
|
15380
15421
|
const elementsArr = Array.isArray(elements) ? elements : [elements];
|
|
15381
15422
|
const [appSelections] = useAppSelections(app);
|
|
15382
15423
|
const [layout] = useLayout$1(model);
|
|
15383
|
-
const
|
|
15424
|
+
const {
|
|
15425
|
+
appModalStore
|
|
15426
|
+
} = useContext(InstanceContext).selectionStore;
|
|
15384
15427
|
const appModal = appModalStore.get(app.id);
|
|
15385
15428
|
const [objectSelections, setObjectSelections] = useState$1();
|
|
15386
15429
|
useEffect$1(() => {
|
|
@@ -16727,7 +16770,6 @@ class Color {
|
|
|
16727
16770
|
this._lumi = 0.299 * this._r + 0.587 * this._g + 0.114 * this._b; // option 2
|
|
16728
16771
|
// this._lumi = Math.sqrt( 0.241 * this._r * this._r + 0.691 * this._g * this._g + 0.068 * this._b * this._b ); // option 3
|
|
16729
16772
|
}
|
|
16730
|
-
|
|
16731
16773
|
return this._lumi;
|
|
16732
16774
|
}
|
|
16733
16775
|
|
|
@@ -17286,7 +17328,7 @@ function resolveBgImage(bgComp, app) {
|
|
|
17286
17328
|
function resolveBgColor(comp, theme, objectType) {
|
|
17287
17329
|
const bgColor = comp === null || comp === void 0 ? void 0 : comp.bgColor;
|
|
17288
17330
|
if (bgColor && theme) {
|
|
17289
|
-
if (bgColor.useExpression) {
|
|
17331
|
+
if (bgColor.useExpression || bgColor.useColorExpression) {
|
|
17290
17332
|
return theme.validateColor(bgColor.colorExpression);
|
|
17291
17333
|
}
|
|
17292
17334
|
}
|
|
@@ -17381,24 +17423,25 @@ function getOverridesAsObject() {
|
|
|
17381
17423
|
return overrides;
|
|
17382
17424
|
}
|
|
17383
17425
|
function getSelectionColors(_ref) {
|
|
17384
|
-
var _overrides$theme, _theme$palette, _overrides$theme$cont, _overrides$theme2, _overrides$selections,
|
|
17426
|
+
var _overrides$theme, _theme$palette, _overrides$theme$cont, _overrides$theme2, _overrides$selections, _theme$palette2, _theme$palette3, _theme$palette4, _theme$palette5, _theme$palette6, _theme$palette7, _theme$palette8, _theme$palette9, _theme$palette10, _theme$palette11;
|
|
17385
17427
|
let {
|
|
17428
|
+
getColorPickerColor,
|
|
17386
17429
|
theme,
|
|
17387
17430
|
getListboxStyle,
|
|
17388
17431
|
overrides,
|
|
17389
17432
|
checkboxes
|
|
17390
17433
|
} = _ref;
|
|
17391
|
-
const componentContentTextColor = (_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0
|
|
17392
|
-
const desiredTextColor = componentContentTextColor || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
|
|
17434
|
+
const componentContentTextColor = (_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0 ? void 0 : _overrides$theme.fontColor;
|
|
17435
|
+
const desiredTextColor = getColorPickerColor(componentContentTextColor) || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
|
|
17393
17436
|
const useContrastTextColor = !checkboxes && ((_overrides$theme$cont = (_overrides$theme2 = overrides.theme) === null || _overrides$theme2 === void 0 || (_overrides$theme2 = _overrides$theme2.content) === null || _overrides$theme2 === void 0 ? void 0 : _overrides$theme2.useContrastColor) !== null && _overrides$theme$cont !== void 0 ? _overrides$theme$cont : true);
|
|
17394
17437
|
|
|
17395
17438
|
// Background colors
|
|
17396
17439
|
const selectionColors = ((_overrides$selections = overrides.selections) === null || _overrides$selections === void 0 ? void 0 : _overrides$selections.colors) || {};
|
|
17397
|
-
const selected = (
|
|
17398
|
-
const alternative = (
|
|
17399
|
-
const excluded = (
|
|
17400
|
-
const selectedExcluded = (
|
|
17401
|
-
const possible = (
|
|
17440
|
+
const selected = getColorPickerColor(selectionColors.selected) || ((_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.selected.main) || '#009845';
|
|
17441
|
+
const alternative = getColorPickerColor(selectionColors.alternative) || ((_theme$palette3 = theme.palette) === null || _theme$palette3 === void 0 ? void 0 : _theme$palette3.selected.alternative) || '#E4E4E4';
|
|
17442
|
+
const excluded = getColorPickerColor(selectionColors.excluded) || ((_theme$palette4 = theme.palette) === null || _theme$palette4 === void 0 ? void 0 : _theme$palette4.selected.excluded) || '#A9A9A9';
|
|
17443
|
+
const selectedExcluded = getColorPickerColor(selectionColors.selectedExcluded) || ((_theme$palette5 = theme.palette) === null || _theme$palette5 === void 0 ? void 0 : _theme$palette5.selected.selectedExcluded) || '#A9A9A9';
|
|
17444
|
+
const possible = getColorPickerColor(selectionColors.possible) || getListboxStyle('', 'backgroundColor') || ((_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.selected.possible) || '#FFFFFF';
|
|
17402
17445
|
|
|
17403
17446
|
// Font colors
|
|
17404
17447
|
let selectedContrast = desiredTextColor || ((_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.selected.selectedContrastText);
|
|
@@ -17442,8 +17485,7 @@ function getBackgroundColor(_ref2) {
|
|
|
17442
17485
|
bgColor
|
|
17443
17486
|
}, themeApi, 'listBox');
|
|
17444
17487
|
} else {
|
|
17445
|
-
|
|
17446
|
-
color = (_themeApi$getColorPic = themeApi.getColorPickerColor(bgColor, true)) === null || _themeApi$getColorPic === void 0 ? void 0 : _themeApi$getColorPic.color;
|
|
17488
|
+
color = themeApi.getColorPickerColor(bgColor === null || bgColor === void 0 ? void 0 : bgColor.color, false);
|
|
17447
17489
|
}
|
|
17448
17490
|
return color;
|
|
17449
17491
|
}
|
|
@@ -17463,14 +17505,16 @@ function getStyles(_ref3) {
|
|
|
17463
17505
|
} = _ref3;
|
|
17464
17506
|
const overrides = getOverridesAsObject(components);
|
|
17465
17507
|
const getListboxStyle = (path, prop) => themeApi.getStyle('object.listBox', path, prop);
|
|
17508
|
+
const getColorPickerColor = c => (c === null || c === void 0 ? void 0 : c.index) > 0 || c !== null && c !== void 0 && c.color ? themeApi.getColorPickerColor(c, false) : undefined;
|
|
17466
17509
|
const selections = getSelectionColors({
|
|
17510
|
+
getColorPickerColor,
|
|
17467
17511
|
theme,
|
|
17468
17512
|
getListboxStyle,
|
|
17469
17513
|
overrides,
|
|
17470
17514
|
checkboxes
|
|
17471
17515
|
});
|
|
17472
17516
|
const themeOverrides = overrides.theme || {};
|
|
17473
|
-
const headerColor = ((_themeOverrides$heade = themeOverrides.header) === null || _themeOverrides$heade === void 0
|
|
17517
|
+
const headerColor = getColorPickerColor((_themeOverrides$heade = themeOverrides.header) === null || _themeOverrides$heade === void 0 ? void 0 : _themeOverrides$heade.fontColor) || getListboxStyle('title.main', 'color');
|
|
17474
17518
|
const bgComponentColor = getBackgroundColor({
|
|
17475
17519
|
themeApi,
|
|
17476
17520
|
themeOverrides
|
|
@@ -17513,8 +17557,9 @@ function getStyles(_ref3) {
|
|
|
17513
17557
|
search: {
|
|
17514
17558
|
color: searchColor,
|
|
17515
17559
|
borderColor: theme.palette.divider,
|
|
17516
|
-
highlightBorderColor: theme.palette.
|
|
17517
|
-
backgroundColor: searchBgColor
|
|
17560
|
+
highlightBorderColor: theme.palette.custom.focusBorder,
|
|
17561
|
+
backgroundColor: searchBgColor,
|
|
17562
|
+
backdropFilter: 'blur(8px)'
|
|
17518
17563
|
},
|
|
17519
17564
|
selections
|
|
17520
17565
|
};
|
|
@@ -17780,7 +17825,6 @@ function OneField(_ref) {
|
|
|
17780
17825
|
segments.forEach((s, i) => {
|
|
17781
17826
|
s.offset = i ? segments[i - 1].offset + segments[i - 1].ratio : 0; // eslint-disable-line
|
|
17782
17827
|
});
|
|
17783
|
-
|
|
17784
17828
|
let Header = null;
|
|
17785
17829
|
let Icon = null;
|
|
17786
17830
|
let SegmentsIndicator = null;
|
|
@@ -18233,7 +18277,9 @@ function SelectedFields(_ref) {
|
|
|
18233
18277
|
items: [],
|
|
18234
18278
|
more: []
|
|
18235
18279
|
});
|
|
18236
|
-
const
|
|
18280
|
+
const {
|
|
18281
|
+
modalObjectStore
|
|
18282
|
+
} = useContext(InstanceContext).selectionStore;
|
|
18237
18283
|
const [containerRef, containerRect] = useRect$1();
|
|
18238
18284
|
const [maxItems, setMaxItems] = useState$1(0);
|
|
18239
18285
|
const isInListboxPopover = () => {
|
|
@@ -19011,7 +19057,6 @@ function getListboxContainerKeyboardNavigation(_ref) {
|
|
|
19011
19057
|
if (!event.target.classList.contains('listbox-container')) {
|
|
19012
19058
|
break; // don't mess with keydown handlers within the listbox (e.g. row seletion)
|
|
19013
19059
|
}
|
|
19014
|
-
|
|
19015
19060
|
keyboard.focus();
|
|
19016
19061
|
prevent();
|
|
19017
19062
|
break;
|
|
@@ -19194,9 +19239,8 @@ function getContainerPadding(_ref) {
|
|
|
19194
19239
|
}
|
|
19195
19240
|
containerPadding = layoutOrder === 'row' ? "".concat(paddingY, " 4px") : "".concat(paddingY, " 6px ").concat(paddingY, " 4px");
|
|
19196
19241
|
} else {
|
|
19197
|
-
containerPadding = undefined;
|
|
19242
|
+
containerPadding = undefined;
|
|
19198
19243
|
}
|
|
19199
|
-
|
|
19200
19244
|
return containerPadding;
|
|
19201
19245
|
}
|
|
19202
19246
|
|
|
@@ -19268,7 +19312,6 @@ const Title = styled$1(Typography)(_ref3 => {
|
|
|
19268
19312
|
paddingRight: '1px' // make place for italic font style
|
|
19269
19313
|
});
|
|
19270
19314
|
});
|
|
19271
|
-
|
|
19272
19315
|
const isModal = _ref4 => {
|
|
19273
19316
|
var _app$isInModalSelecti, _app$isInModalSelecti2;
|
|
19274
19317
|
let {
|
|
@@ -20143,7 +20186,6 @@ function ListBoxWrapper(_ref) {
|
|
|
20143
20186
|
frequencyMode: getFrequencyModeLetter(options.frequencyMode) // stick to letter option hereafter
|
|
20144
20187
|
});
|
|
20145
20188
|
}
|
|
20146
|
-
|
|
20147
20189
|
const [changeCount, setChangeCount] = useState$1(0);
|
|
20148
20190
|
useEffect$1(() => {
|
|
20149
20191
|
if (changeCount) {
|
|
@@ -20545,7 +20587,6 @@ async function populateData(_ref, halo) {
|
|
|
20545
20587
|
{
|
|
20546
20588
|
console.warn('Attempting to add fields to an object without a specified data target'); // eslint-disable-line no-console
|
|
20547
20589
|
}
|
|
20548
|
-
|
|
20549
20590
|
return;
|
|
20550
20591
|
}
|
|
20551
20592
|
const {
|
|
@@ -20644,7 +20685,6 @@ const getValue = (data, reference, defaultValue) => {
|
|
|
20644
20685
|
if (step === '') {
|
|
20645
20686
|
continue; // eslint-disable-line no-continue
|
|
20646
20687
|
}
|
|
20647
|
-
|
|
20648
20688
|
if (dataContainer[step] === undefined || dataContainer[step] === null) {
|
|
20649
20689
|
return defaultValue;
|
|
20650
20690
|
}
|
|
@@ -20814,7 +20854,6 @@ function copyPropertyOrSetDefault(propertyName, source, target, defaultValue) {
|
|
|
20814
20854
|
function getOthersLabel() {
|
|
20815
20855
|
return 'Others'; // TODO: translator.get('properties.dimensionLimits.others')
|
|
20816
20856
|
}
|
|
20817
|
-
|
|
20818
20857
|
function createDefaultDimension(dimensionDef, dimensionProperties) {
|
|
20819
20858
|
const def = extend$2(true, {}, dimensionProperties, dimensionDef);
|
|
20820
20859
|
if (!utils.getValue(def, 'qOtherTotalSpec.qOtherCounted')) {
|
|
@@ -21340,7 +21379,6 @@ const getDefaultExportPropertiesFn = path => {
|
|
|
21340
21379
|
}
|
|
21341
21380
|
return undefined; // TODO: add listbox and other
|
|
21342
21381
|
};
|
|
21343
|
-
|
|
21344
21382
|
const getExportPropertiesFnc = qae => {
|
|
21345
21383
|
if (qae.exportProperties) {
|
|
21346
21384
|
return qae.exportProperties;
|
|
@@ -21355,7 +21393,6 @@ const getDefaultImportPropertiesFnc = path => {
|
|
|
21355
21393
|
}
|
|
21356
21394
|
return undefined; // TODO: add listbox and other
|
|
21357
21395
|
};
|
|
21358
|
-
|
|
21359
21396
|
const getImportPropertiesFnc = qae => {
|
|
21360
21397
|
if (qae.importProperties) {
|
|
21361
21398
|
return qae.importProperties;
|
|
@@ -23393,7 +23430,6 @@ function flushMacro(hooks) {
|
|
|
23393
23430
|
hooks.macro = null;
|
|
23394
23431
|
maybeEndChain(hooks); // eslint-disable-line no-use-before-define
|
|
23395
23432
|
}
|
|
23396
|
-
|
|
23397
23433
|
function maybeEndChain(hooks) {
|
|
23398
23434
|
if (hooks.pendingPromises.length || hooks.micro || hooks.macro) {
|
|
23399
23435
|
return;
|
|
@@ -24930,7 +24966,6 @@ const resolveValue = (data, reference, defaultValue) => {
|
|
|
24930
24966
|
if (steps[i] === '') {
|
|
24931
24967
|
continue; // eslint-disable-line no-continue
|
|
24932
24968
|
}
|
|
24933
|
-
|
|
24934
24969
|
if (typeof dataContainer[steps[i]] === 'undefined') {
|
|
24935
24970
|
return defaultValue;
|
|
24936
24971
|
}
|
|
@@ -25406,7 +25441,6 @@ function viz() {
|
|
|
25406
25441
|
// resize() {},
|
|
25407
25442
|
// show() {},
|
|
25408
25443
|
};
|
|
25409
|
-
|
|
25410
25444
|
return api;
|
|
25411
25445
|
}
|
|
25412
25446
|
|
|
@@ -25468,7 +25502,7 @@ async function init(model, optional, halo, initialError) {
|
|
|
25468
25502
|
* };
|
|
25469
25503
|
* nebbie.render(createConfig);
|
|
25470
25504
|
*/
|
|
25471
|
-
async function createSessionObject(_ref, halo) {
|
|
25505
|
+
async function createSessionObject(_ref, halo, store) {
|
|
25472
25506
|
let {
|
|
25473
25507
|
type,
|
|
25474
25508
|
version,
|
|
@@ -25481,6 +25515,10 @@ async function createSessionObject(_ref, halo) {
|
|
|
25481
25515
|
} = _ref;
|
|
25482
25516
|
let mergedProps = {};
|
|
25483
25517
|
const children = [];
|
|
25518
|
+
const {
|
|
25519
|
+
modelStore,
|
|
25520
|
+
subscribe
|
|
25521
|
+
} = store;
|
|
25484
25522
|
let error;
|
|
25485
25523
|
try {
|
|
25486
25524
|
const t = halo.types.get({
|
|
@@ -25512,7 +25550,6 @@ async function createSessionObject(_ref, halo) {
|
|
|
25512
25550
|
};
|
|
25513
25551
|
// console.error(e); // eslint-disable-line
|
|
25514
25552
|
}
|
|
25515
|
-
|
|
25516
25553
|
const model = await halo.app.createSessionObject(mergedProps);
|
|
25517
25554
|
if (children.length > 0) {
|
|
25518
25555
|
await model.setFullPropertyTree({
|
|
@@ -25546,7 +25583,7 @@ async function createSessionObject(_ref, halo) {
|
|
|
25546
25583
|
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
25547
25584
|
*/
|
|
25548
25585
|
|
|
25549
|
-
async function createObject(_ref, halo, generateOnly) {
|
|
25586
|
+
async function createObject(_ref, halo, generateOnly, store) {
|
|
25550
25587
|
let {
|
|
25551
25588
|
type,
|
|
25552
25589
|
version,
|
|
@@ -25556,6 +25593,9 @@ async function createObject(_ref, halo, generateOnly) {
|
|
|
25556
25593
|
} = _ref;
|
|
25557
25594
|
let mergedProps = {};
|
|
25558
25595
|
const children = [];
|
|
25596
|
+
const {
|
|
25597
|
+
modelStore
|
|
25598
|
+
} = store;
|
|
25559
25599
|
// let error;
|
|
25560
25600
|
try {
|
|
25561
25601
|
const t = halo.types.get({
|
|
@@ -25591,7 +25631,6 @@ async function createObject(_ref, halo, generateOnly) {
|
|
|
25591
25631
|
}
|
|
25592
25632
|
// console.error(e); // eslint-disable-line
|
|
25593
25633
|
}
|
|
25594
|
-
|
|
25595
25634
|
if (!generateOnly) {
|
|
25596
25635
|
const model = await halo.app.createObject(mergedProps);
|
|
25597
25636
|
if (children.length > 0) {
|
|
@@ -25606,13 +25645,17 @@ async function createObject(_ref, halo, generateOnly) {
|
|
|
25606
25645
|
return mergedProps;
|
|
25607
25646
|
}
|
|
25608
25647
|
|
|
25609
|
-
async function getObject$1(_ref, halo) {
|
|
25648
|
+
async function getObject$1(_ref, halo, store) {
|
|
25610
25649
|
let {
|
|
25611
25650
|
id,
|
|
25612
25651
|
options,
|
|
25613
25652
|
plugins,
|
|
25614
25653
|
element
|
|
25615
25654
|
} = _ref;
|
|
25655
|
+
const {
|
|
25656
|
+
modelStore,
|
|
25657
|
+
rpcRequestModelStore
|
|
25658
|
+
} = store;
|
|
25616
25659
|
const key = "".concat(id);
|
|
25617
25660
|
let rpc = rpcRequestModelStore.get(key);
|
|
25618
25661
|
if (!rpc) {
|
|
@@ -25689,7 +25732,8 @@ function Sheet(_ref) {
|
|
|
25689
25732
|
} = halo;
|
|
25690
25733
|
const [layout] = useLayout$1(model);
|
|
25691
25734
|
const {
|
|
25692
|
-
theme: themeName
|
|
25735
|
+
theme: themeName,
|
|
25736
|
+
modelStore
|
|
25693
25737
|
} = useContext(InstanceContext);
|
|
25694
25738
|
const [cells, setCells] = useState$1([]);
|
|
25695
25739
|
const [bgColor, setBgColor] = useState$1(undefined);
|
|
@@ -25734,7 +25778,7 @@ function Sheet(_ref) {
|
|
|
25734
25778
|
}
|
|
25735
25779
|
const vs = await getObject$1({
|
|
25736
25780
|
id: c.name
|
|
25737
|
-
}, halo);
|
|
25781
|
+
}, halo, modelStore);
|
|
25738
25782
|
return {
|
|
25739
25783
|
model: vs.model,
|
|
25740
25784
|
id: c.name,
|
|
@@ -25968,13 +26012,17 @@ async function initSheet(model, optional, halo, initialError) {
|
|
|
25968
26012
|
return api;
|
|
25969
26013
|
}
|
|
25970
26014
|
|
|
25971
|
-
async function getObject(_ref, halo) {
|
|
26015
|
+
async function getObject(_ref, halo, store) {
|
|
25972
26016
|
let {
|
|
25973
26017
|
id,
|
|
25974
26018
|
options,
|
|
25975
26019
|
plugins,
|
|
25976
26020
|
element
|
|
25977
26021
|
} = _ref;
|
|
26022
|
+
const {
|
|
26023
|
+
modelStore,
|
|
26024
|
+
rpcRequestModelStore
|
|
26025
|
+
} = store;
|
|
25978
26026
|
const key = "".concat(id);
|
|
25979
26027
|
let rpc = rpcRequestModelStore.get(key);
|
|
25980
26028
|
if (!rpc) {
|
|
@@ -26003,15 +26051,14 @@ function flagsFn () {
|
|
|
26003
26051
|
* @interface Flags
|
|
26004
26052
|
*/
|
|
26005
26053
|
|
|
26006
|
-
return
|
|
26007
|
-
|
|
26008
|
-
|
|
26009
|
-
|
|
26010
|
-
|
|
26011
|
-
|
|
26012
|
-
|
|
26013
|
-
|
|
26014
|
-
);
|
|
26054
|
+
return /** @lends Flags */{
|
|
26055
|
+
/**
|
|
26056
|
+
* Checks whether the specified flag is enabled.
|
|
26057
|
+
* @param {string} flag - The value flag to check.
|
|
26058
|
+
* @returns {boolean} True if the specified flag is enabled, false otherwise.
|
|
26059
|
+
*/
|
|
26060
|
+
isEnabled: f => flags[f] === true
|
|
26061
|
+
};
|
|
26015
26062
|
}
|
|
26016
26063
|
|
|
26017
26064
|
var iterator;
|
|
@@ -26458,6 +26505,7 @@ try {
|
|
|
26458
26505
|
|
|
26459
26506
|
// A linked list to keep track of recently-used-ness
|
|
26460
26507
|
const Yallist = yallist;
|
|
26508
|
+
|
|
26461
26509
|
const MAX = Symbol('max');
|
|
26462
26510
|
const LENGTH = Symbol('length');
|
|
26463
26511
|
const LENGTH_CALCULATOR = Symbol('lengthCalculator');
|
|
@@ -26468,6 +26516,7 @@ const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
|
|
|
26468
26516
|
const LRU_LIST = Symbol('lruList');
|
|
26469
26517
|
const CACHE = Symbol('cache');
|
|
26470
26518
|
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
|
|
26519
|
+
|
|
26471
26520
|
const naiveLength = () => 1;
|
|
26472
26521
|
|
|
26473
26522
|
// lruList is a yallist where the head is the youngest
|
|
@@ -26479,18 +26528,23 @@ const naiveLength = () => 1;
|
|
|
26479
26528
|
// cache is a Map (or PseudoMap) that matches the keys to
|
|
26480
26529
|
// the Yallist.Node object.
|
|
26481
26530
|
class LRUCache {
|
|
26482
|
-
constructor(options) {
|
|
26483
|
-
if (typeof options === 'number')
|
|
26484
|
-
max: options
|
|
26485
|
-
|
|
26486
|
-
if (!options)
|
|
26487
|
-
|
|
26531
|
+
constructor (options) {
|
|
26532
|
+
if (typeof options === 'number')
|
|
26533
|
+
options = { max: options };
|
|
26534
|
+
|
|
26535
|
+
if (!options)
|
|
26536
|
+
options = {};
|
|
26537
|
+
|
|
26538
|
+
if (options.max && (typeof options.max !== 'number' || options.max < 0))
|
|
26539
|
+
throw new TypeError('max must be a non-negative number')
|
|
26488
26540
|
// Kind of weird to have a default max of Infinity, but oh well.
|
|
26489
26541
|
this[MAX] = options.max || Infinity;
|
|
26542
|
+
|
|
26490
26543
|
const lc = options.length || naiveLength;
|
|
26491
|
-
this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;
|
|
26544
|
+
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
|
|
26492
26545
|
this[ALLOW_STALE] = options.stale || false;
|
|
26493
|
-
if (options.maxAge && typeof options.maxAge !== 'number')
|
|
26546
|
+
if (options.maxAge && typeof options.maxAge !== 'number')
|
|
26547
|
+
throw new TypeError('maxAge must be a number')
|
|
26494
26548
|
this[MAX_AGE] = options.maxAge || 0;
|
|
26495
26549
|
this[DISPOSE] = options.dispose;
|
|
26496
26550
|
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
|
|
@@ -26499,32 +26553,40 @@ class LRUCache {
|
|
|
26499
26553
|
}
|
|
26500
26554
|
|
|
26501
26555
|
// resize the cache when the max changes.
|
|
26502
|
-
set max(mL) {
|
|
26503
|
-
if (typeof mL !== 'number' || mL < 0)
|
|
26556
|
+
set max (mL) {
|
|
26557
|
+
if (typeof mL !== 'number' || mL < 0)
|
|
26558
|
+
throw new TypeError('max must be a non-negative number')
|
|
26559
|
+
|
|
26504
26560
|
this[MAX] = mL || Infinity;
|
|
26505
26561
|
trim(this);
|
|
26506
26562
|
}
|
|
26507
|
-
get max() {
|
|
26508
|
-
return this[MAX]
|
|
26563
|
+
get max () {
|
|
26564
|
+
return this[MAX]
|
|
26509
26565
|
}
|
|
26510
|
-
|
|
26566
|
+
|
|
26567
|
+
set allowStale (allowStale) {
|
|
26511
26568
|
this[ALLOW_STALE] = !!allowStale;
|
|
26512
26569
|
}
|
|
26513
|
-
get allowStale() {
|
|
26514
|
-
return this[ALLOW_STALE]
|
|
26570
|
+
get allowStale () {
|
|
26571
|
+
return this[ALLOW_STALE]
|
|
26515
26572
|
}
|
|
26516
|
-
|
|
26517
|
-
|
|
26573
|
+
|
|
26574
|
+
set maxAge (mA) {
|
|
26575
|
+
if (typeof mA !== 'number')
|
|
26576
|
+
throw new TypeError('maxAge must be a non-negative number')
|
|
26577
|
+
|
|
26518
26578
|
this[MAX_AGE] = mA;
|
|
26519
26579
|
trim(this);
|
|
26520
26580
|
}
|
|
26521
|
-
get maxAge() {
|
|
26522
|
-
return this[MAX_AGE]
|
|
26581
|
+
get maxAge () {
|
|
26582
|
+
return this[MAX_AGE]
|
|
26523
26583
|
}
|
|
26524
26584
|
|
|
26525
26585
|
// resize the cache when the lengthCalculator changes.
|
|
26526
|
-
set lengthCalculator(lC) {
|
|
26527
|
-
if (typeof lC !== 'function')
|
|
26586
|
+
set lengthCalculator (lC) {
|
|
26587
|
+
if (typeof lC !== 'function')
|
|
26588
|
+
lC = naiveLength;
|
|
26589
|
+
|
|
26528
26590
|
if (lC !== this[LENGTH_CALCULATOR]) {
|
|
26529
26591
|
this[LENGTH_CALCULATOR] = lC;
|
|
26530
26592
|
this[LENGTH] = 0;
|
|
@@ -26535,16 +26597,12 @@ class LRUCache {
|
|
|
26535
26597
|
}
|
|
26536
26598
|
trim(this);
|
|
26537
26599
|
}
|
|
26538
|
-
get lengthCalculator() {
|
|
26539
|
-
|
|
26540
|
-
}
|
|
26541
|
-
get
|
|
26542
|
-
|
|
26543
|
-
|
|
26544
|
-
get itemCount() {
|
|
26545
|
-
return this[LRU_LIST].length;
|
|
26546
|
-
}
|
|
26547
|
-
rforEach(fn, thisp) {
|
|
26600
|
+
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
|
|
26601
|
+
|
|
26602
|
+
get length () { return this[LENGTH] }
|
|
26603
|
+
get itemCount () { return this[LRU_LIST].length }
|
|
26604
|
+
|
|
26605
|
+
rforEach (fn, thisp) {
|
|
26548
26606
|
thisp = thisp || this;
|
|
26549
26607
|
for (let walker = this[LRU_LIST].tail; walker !== null;) {
|
|
26550
26608
|
const prev = walker.prev;
|
|
@@ -26552,7 +26610,8 @@ class LRUCache {
|
|
|
26552
26610
|
walker = prev;
|
|
26553
26611
|
}
|
|
26554
26612
|
}
|
|
26555
|
-
|
|
26613
|
+
|
|
26614
|
+
forEach (fn, thisp) {
|
|
26556
26615
|
thisp = thisp || this;
|
|
26557
26616
|
for (let walker = this[LRU_LIST].head; walker !== null;) {
|
|
26558
26617
|
const next = walker.next;
|
|
@@ -26560,49 +26619,65 @@ class LRUCache {
|
|
|
26560
26619
|
walker = next;
|
|
26561
26620
|
}
|
|
26562
26621
|
}
|
|
26563
|
-
|
|
26564
|
-
|
|
26622
|
+
|
|
26623
|
+
keys () {
|
|
26624
|
+
return this[LRU_LIST].toArray().map(k => k.key)
|
|
26565
26625
|
}
|
|
26566
|
-
|
|
26567
|
-
|
|
26626
|
+
|
|
26627
|
+
values () {
|
|
26628
|
+
return this[LRU_LIST].toArray().map(k => k.value)
|
|
26568
26629
|
}
|
|
26569
|
-
|
|
26570
|
-
|
|
26630
|
+
|
|
26631
|
+
reset () {
|
|
26632
|
+
if (this[DISPOSE] &&
|
|
26633
|
+
this[LRU_LIST] &&
|
|
26634
|
+
this[LRU_LIST].length) {
|
|
26571
26635
|
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
|
|
26572
26636
|
}
|
|
26637
|
+
|
|
26573
26638
|
this[CACHE] = new Map(); // hash of items by key
|
|
26574
26639
|
this[LRU_LIST] = new Yallist(); // list of items in order of use recency
|
|
26575
26640
|
this[LENGTH] = 0; // length of items in the list
|
|
26576
26641
|
}
|
|
26577
26642
|
|
|
26578
|
-
dump() {
|
|
26579
|
-
return this[LRU_LIST].map(hit =>
|
|
26580
|
-
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
|
|
26643
|
+
dump () {
|
|
26644
|
+
return this[LRU_LIST].map(hit =>
|
|
26645
|
+
isStale(this, hit) ? false : {
|
|
26646
|
+
k: hit.key,
|
|
26647
|
+
v: hit.value,
|
|
26648
|
+
e: hit.now + (hit.maxAge || 0)
|
|
26649
|
+
}).toArray().filter(h => h)
|
|
26584
26650
|
}
|
|
26585
|
-
|
|
26586
|
-
|
|
26651
|
+
|
|
26652
|
+
dumpLru () {
|
|
26653
|
+
return this[LRU_LIST]
|
|
26587
26654
|
}
|
|
26588
|
-
|
|
26655
|
+
|
|
26656
|
+
set (key, value, maxAge) {
|
|
26589
26657
|
maxAge = maxAge || this[MAX_AGE];
|
|
26590
|
-
|
|
26658
|
+
|
|
26659
|
+
if (maxAge && typeof maxAge !== 'number')
|
|
26660
|
+
throw new TypeError('maxAge must be a number')
|
|
26661
|
+
|
|
26591
26662
|
const now = maxAge ? Date.now() : 0;
|
|
26592
26663
|
const len = this[LENGTH_CALCULATOR](value, key);
|
|
26664
|
+
|
|
26593
26665
|
if (this[CACHE].has(key)) {
|
|
26594
26666
|
if (len > this[MAX]) {
|
|
26595
26667
|
del(this, this[CACHE].get(key));
|
|
26596
|
-
return false
|
|
26668
|
+
return false
|
|
26597
26669
|
}
|
|
26670
|
+
|
|
26598
26671
|
const node = this[CACHE].get(key);
|
|
26599
26672
|
const item = node.value;
|
|
26600
26673
|
|
|
26601
26674
|
// dispose of the old one before overwriting
|
|
26602
26675
|
// split out into 2 ifs for better coverage tracking
|
|
26603
26676
|
if (this[DISPOSE]) {
|
|
26604
|
-
if (!this[NO_DISPOSE_ON_SET])
|
|
26677
|
+
if (!this[NO_DISPOSE_ON_SET])
|
|
26678
|
+
this[DISPOSE](key, item.value);
|
|
26605
26679
|
}
|
|
26680
|
+
|
|
26606
26681
|
item.now = now;
|
|
26607
26682
|
item.maxAge = maxAge;
|
|
26608
26683
|
item.value = value;
|
|
@@ -26610,44 +26685,57 @@ class LRUCache {
|
|
|
26610
26685
|
item.length = len;
|
|
26611
26686
|
this.get(key);
|
|
26612
26687
|
trim(this);
|
|
26613
|
-
return true
|
|
26688
|
+
return true
|
|
26614
26689
|
}
|
|
26690
|
+
|
|
26615
26691
|
const hit = new Entry(key, value, len, now, maxAge);
|
|
26616
26692
|
|
|
26617
26693
|
// oversized objects fall out of cache automatically.
|
|
26618
26694
|
if (hit.length > this[MAX]) {
|
|
26619
|
-
if (this[DISPOSE])
|
|
26620
|
-
|
|
26695
|
+
if (this[DISPOSE])
|
|
26696
|
+
this[DISPOSE](key, value);
|
|
26697
|
+
|
|
26698
|
+
return false
|
|
26621
26699
|
}
|
|
26700
|
+
|
|
26622
26701
|
this[LENGTH] += hit.length;
|
|
26623
26702
|
this[LRU_LIST].unshift(hit);
|
|
26624
26703
|
this[CACHE].set(key, this[LRU_LIST].head);
|
|
26625
26704
|
trim(this);
|
|
26626
|
-
return true
|
|
26705
|
+
return true
|
|
26627
26706
|
}
|
|
26628
|
-
|
|
26629
|
-
|
|
26707
|
+
|
|
26708
|
+
has (key) {
|
|
26709
|
+
if (!this[CACHE].has(key)) return false
|
|
26630
26710
|
const hit = this[CACHE].get(key).value;
|
|
26631
|
-
return !isStale(this, hit)
|
|
26711
|
+
return !isStale(this, hit)
|
|
26632
26712
|
}
|
|
26633
|
-
|
|
26634
|
-
|
|
26713
|
+
|
|
26714
|
+
get (key) {
|
|
26715
|
+
return get(this, key, true)
|
|
26635
26716
|
}
|
|
26636
|
-
|
|
26637
|
-
|
|
26717
|
+
|
|
26718
|
+
peek (key) {
|
|
26719
|
+
return get(this, key, false)
|
|
26638
26720
|
}
|
|
26639
|
-
|
|
26721
|
+
|
|
26722
|
+
pop () {
|
|
26640
26723
|
const node = this[LRU_LIST].tail;
|
|
26641
|
-
if (!node)
|
|
26724
|
+
if (!node)
|
|
26725
|
+
return null
|
|
26726
|
+
|
|
26642
26727
|
del(this, node);
|
|
26643
|
-
return node.value
|
|
26728
|
+
return node.value
|
|
26644
26729
|
}
|
|
26645
|
-
|
|
26730
|
+
|
|
26731
|
+
del (key) {
|
|
26646
26732
|
del(this, this[CACHE].get(key));
|
|
26647
26733
|
}
|
|
26648
|
-
|
|
26734
|
+
|
|
26735
|
+
load (arr) {
|
|
26649
26736
|
// reset the cache
|
|
26650
26737
|
this.reset();
|
|
26738
|
+
|
|
26651
26739
|
const now = Date.now();
|
|
26652
26740
|
// A previous serialized cache has the most recent items first
|
|
26653
26741
|
for (let l = arr.length - 1; l >= 0; l--) {
|
|
@@ -26655,7 +26743,8 @@ class LRUCache {
|
|
|
26655
26743
|
const expiresAt = hit.e || 0;
|
|
26656
26744
|
if (expiresAt === 0)
|
|
26657
26745
|
// the item was created without expiration in a non aged cache
|
|
26658
|
-
this.set(hit.k, hit.v);
|
|
26746
|
+
this.set(hit.k, hit.v);
|
|
26747
|
+
else {
|
|
26659
26748
|
const maxAge = expiresAt - now;
|
|
26660
26749
|
// dont add already expired items
|
|
26661
26750
|
if (maxAge > 0) {
|
|
@@ -26664,34 +26753,44 @@ class LRUCache {
|
|
|
26664
26753
|
}
|
|
26665
26754
|
}
|
|
26666
26755
|
}
|
|
26667
|
-
|
|
26756
|
+
|
|
26757
|
+
prune () {
|
|
26668
26758
|
this[CACHE].forEach((value, key) => get(this, key, false));
|
|
26669
26759
|
}
|
|
26670
26760
|
}
|
|
26761
|
+
|
|
26671
26762
|
const get = (self, key, doUse) => {
|
|
26672
26763
|
const node = self[CACHE].get(key);
|
|
26673
26764
|
if (node) {
|
|
26674
26765
|
const hit = node.value;
|
|
26675
26766
|
if (isStale(self, hit)) {
|
|
26676
26767
|
del(self, node);
|
|
26677
|
-
if (!self[ALLOW_STALE])
|
|
26768
|
+
if (!self[ALLOW_STALE])
|
|
26769
|
+
return undefined
|
|
26678
26770
|
} else {
|
|
26679
26771
|
if (doUse) {
|
|
26680
|
-
if (self[UPDATE_AGE_ON_GET])
|
|
26772
|
+
if (self[UPDATE_AGE_ON_GET])
|
|
26773
|
+
node.value.now = Date.now();
|
|
26681
26774
|
self[LRU_LIST].unshiftNode(node);
|
|
26682
26775
|
}
|
|
26683
26776
|
}
|
|
26684
|
-
return hit.value
|
|
26777
|
+
return hit.value
|
|
26685
26778
|
}
|
|
26686
26779
|
};
|
|
26780
|
+
|
|
26687
26781
|
const isStale = (self, hit) => {
|
|
26688
|
-
if (!hit || !hit.maxAge && !self[MAX_AGE])
|
|
26782
|
+
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
|
|
26783
|
+
return false
|
|
26784
|
+
|
|
26689
26785
|
const diff = Date.now() - hit.now;
|
|
26690
|
-
return hit.maxAge ? diff > hit.maxAge
|
|
26786
|
+
return hit.maxAge ? diff > hit.maxAge
|
|
26787
|
+
: self[MAX_AGE] && (diff > self[MAX_AGE])
|
|
26691
26788
|
};
|
|
26789
|
+
|
|
26692
26790
|
const trim = self => {
|
|
26693
26791
|
if (self[LENGTH] > self[MAX]) {
|
|
26694
|
-
for (let walker = self[LRU_LIST].tail;
|
|
26792
|
+
for (let walker = self[LRU_LIST].tail;
|
|
26793
|
+
self[LENGTH] > self[MAX] && walker !== null;) {
|
|
26695
26794
|
// We know that we're about to delete this one, and also
|
|
26696
26795
|
// what the next least recently used key will be, so just
|
|
26697
26796
|
// go ahead and set it now.
|
|
@@ -26701,17 +26800,21 @@ const trim = self => {
|
|
|
26701
26800
|
}
|
|
26702
26801
|
}
|
|
26703
26802
|
};
|
|
26803
|
+
|
|
26704
26804
|
const del = (self, node) => {
|
|
26705
26805
|
if (node) {
|
|
26706
26806
|
const hit = node.value;
|
|
26707
|
-
if (self[DISPOSE])
|
|
26807
|
+
if (self[DISPOSE])
|
|
26808
|
+
self[DISPOSE](hit.key, hit.value);
|
|
26809
|
+
|
|
26708
26810
|
self[LENGTH] -= hit.length;
|
|
26709
26811
|
self[CACHE].delete(hit.key);
|
|
26710
26812
|
self[LRU_LIST].removeNode(node);
|
|
26711
26813
|
}
|
|
26712
26814
|
};
|
|
26815
|
+
|
|
26713
26816
|
class Entry {
|
|
26714
|
-
constructor(key, value, length, now, maxAge) {
|
|
26817
|
+
constructor (key, value, length, now, maxAge) {
|
|
26715
26818
|
this.key = key;
|
|
26716
26819
|
this.value = value;
|
|
26717
26820
|
this.length = length;
|
|
@@ -26719,14 +26822,18 @@ class Entry {
|
|
|
26719
26822
|
this.maxAge = maxAge || 0;
|
|
26720
26823
|
}
|
|
26721
26824
|
}
|
|
26825
|
+
|
|
26722
26826
|
const forEachStep = (self, fn, node, thisp) => {
|
|
26723
26827
|
let hit = node.value;
|
|
26724
26828
|
if (isStale(self, hit)) {
|
|
26725
26829
|
del(self, node);
|
|
26726
|
-
if (!self[ALLOW_STALE])
|
|
26830
|
+
if (!self[ALLOW_STALE])
|
|
26831
|
+
hit = undefined;
|
|
26727
26832
|
}
|
|
26728
|
-
if (hit)
|
|
26833
|
+
if (hit)
|
|
26834
|
+
fn.call(thisp, hit.value, hit.key, self);
|
|
26729
26835
|
};
|
|
26836
|
+
|
|
26730
26837
|
var lruCache = LRUCache;
|
|
26731
26838
|
|
|
26732
26839
|
// parse out just the options we care about
|
|
@@ -27933,7 +28040,6 @@ async function load(name, version, _ref, loader) {
|
|
|
27933
28040
|
{
|
|
27934
28041
|
console.warn(e); // eslint-disable-line no-console
|
|
27935
28042
|
}
|
|
27936
|
-
|
|
27937
28043
|
throw new Error("Failed to load visualization: '".concat(sKey, "'"));
|
|
27938
28044
|
});
|
|
27939
28045
|
}
|
|
@@ -28066,7 +28172,6 @@ function create(_ref) {
|
|
|
28066
28172
|
{
|
|
28067
28173
|
console.warn("Visualization ".concat(name, " is not registered. Adding it now.")); // eslint-disable-line no-console
|
|
28068
28174
|
}
|
|
28069
|
-
|
|
28070
28175
|
this.register({
|
|
28071
28176
|
name,
|
|
28072
28177
|
version
|
|
@@ -28077,7 +28182,6 @@ function create(_ref) {
|
|
|
28077
28182
|
{
|
|
28078
28183
|
console.warn("Version ".concat(version, " of ").concat(name, " is not registered. Falling back to version ").concat(versionToUse)); // eslint-disable-line no-console
|
|
28079
28184
|
}
|
|
28080
|
-
|
|
28081
28185
|
version = versionToUse;
|
|
28082
28186
|
}
|
|
28083
28187
|
return tc[name].get(version) || p.get(typeInfo);
|
|
@@ -28287,7 +28391,7 @@ function nuked() {
|
|
|
28287
28391
|
let currentContext = _objectSpread2(_objectSpread2({}, configuration.context), {}, {
|
|
28288
28392
|
translator: locale.translator
|
|
28289
28393
|
});
|
|
28290
|
-
const [root] = boot({
|
|
28394
|
+
const [root, modelStore] = boot({
|
|
28291
28395
|
app,
|
|
28292
28396
|
context: currentContext
|
|
28293
28397
|
});
|
|
@@ -28313,7 +28417,6 @@ function nuked() {
|
|
|
28313
28417
|
translator: locale.translator,
|
|
28314
28418
|
nebbie: null // actual value is set further down
|
|
28315
28419
|
};
|
|
28316
|
-
|
|
28317
28420
|
const halo = {
|
|
28318
28421
|
app,
|
|
28319
28422
|
root,
|
|
@@ -28381,9 +28484,9 @@ function nuked() {
|
|
|
28381
28484
|
render: async cfg => {
|
|
28382
28485
|
await currentThemePromise;
|
|
28383
28486
|
if (cfg.id) {
|
|
28384
|
-
return getObject(cfg, halo);
|
|
28487
|
+
return getObject(cfg, halo, modelStore);
|
|
28385
28488
|
}
|
|
28386
|
-
return createSessionObject(cfg, halo);
|
|
28489
|
+
return createSessionObject(cfg, halo, modelStore);
|
|
28387
28490
|
},
|
|
28388
28491
|
/**
|
|
28389
28492
|
* Creates a visualization model
|
|
@@ -28399,7 +28502,7 @@ function nuked() {
|
|
|
28399
28502
|
* }
|
|
28400
28503
|
* );
|
|
28401
28504
|
*/
|
|
28402
|
-
create: async cfg => createObject(cfg, halo, false),
|
|
28505
|
+
create: async cfg => createObject(cfg, halo, false, modelStore),
|
|
28403
28506
|
/**
|
|
28404
28507
|
* Generates properties for a visualization object
|
|
28405
28508
|
* @param {CreateConfig} cfg The create configuration.
|
|
@@ -28462,7 +28565,6 @@ function nuked() {
|
|
|
28462
28565
|
*/
|
|
28463
28566
|
selections: async () => {
|
|
28464
28567
|
if (!selectionsApi) {
|
|
28465
|
-
// const appSelections = await root.getAppSelections(); // Don't expose this for now
|
|
28466
28568
|
selectionsApi = /** @lends AppSelections# */{
|
|
28467
28569
|
/**
|
|
28468
28570
|
* Mounts the app selection UI into the provided HTMLElement.
|
|
@@ -28475,7 +28577,6 @@ function nuked() {
|
|
|
28475
28577
|
{
|
|
28476
28578
|
console.error('Already mounted'); // eslint-disable-line no-console
|
|
28477
28579
|
}
|
|
28478
|
-
|
|
28479
28580
|
return;
|
|
28480
28581
|
}
|
|
28481
28582
|
selectionsComponentReference = mount({
|