@nebula.js/stardust 4.4.0 → 4.5.0
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 +2939 -2784
- 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 +1563 -1389
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +9 -9
- package/dist/stardust.js.map +1 -1
- package/package.json +14 -14
- package/types/index.d.ts +18 -13
package/dist/stardust.dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v4.
|
|
2
|
+
* @nebula.js/stardust v4.5.0
|
|
3
3
|
* Copyright (c) 2023 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -722,26 +722,26 @@
|
|
|
722
722
|
}
|
|
723
723
|
})(runtime);
|
|
724
724
|
|
|
725
|
-
function ownKeys(
|
|
726
|
-
var
|
|
725
|
+
function ownKeys(e, r) {
|
|
726
|
+
var t = Object.keys(e);
|
|
727
727
|
if (Object.getOwnPropertySymbols) {
|
|
728
|
-
var
|
|
729
|
-
|
|
730
|
-
return Object.getOwnPropertyDescriptor(
|
|
731
|
-
})),
|
|
732
|
-
}
|
|
733
|
-
return
|
|
734
|
-
}
|
|
735
|
-
function _objectSpread2(
|
|
736
|
-
for (var
|
|
737
|
-
var
|
|
738
|
-
|
|
739
|
-
_defineProperty(
|
|
740
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
741
|
-
Object.defineProperty(
|
|
728
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
729
|
+
r && (o = o.filter(function (r) {
|
|
730
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
731
|
+
})), t.push.apply(t, o);
|
|
732
|
+
}
|
|
733
|
+
return t;
|
|
734
|
+
}
|
|
735
|
+
function _objectSpread2(e) {
|
|
736
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
737
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
738
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
739
|
+
_defineProperty(e, r, t[r]);
|
|
740
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
741
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
|
-
return
|
|
744
|
+
return e;
|
|
745
745
|
}
|
|
746
746
|
function _defineProperty(obj, key, value) {
|
|
747
747
|
key = _toPropertyKey(key);
|
|
@@ -4417,7 +4417,11 @@
|
|
|
4417
4417
|
}
|
|
4418
4418
|
|
|
4419
4419
|
function isMuiElement(element, muiNames) {
|
|
4420
|
-
|
|
4420
|
+
var _muiName, _element$type;
|
|
4421
|
+
return /*#__PURE__*/reactExports.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
4422
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
4423
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
4424
|
+
(_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1;
|
|
4421
4425
|
}
|
|
4422
4426
|
|
|
4423
4427
|
function ownerDocument(node) {
|
|
@@ -4456,6 +4460,13 @@
|
|
|
4456
4460
|
}
|
|
4457
4461
|
}
|
|
4458
4462
|
|
|
4463
|
+
/**
|
|
4464
|
+
* A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
|
|
4465
|
+
* This is useful for effects that are only needed for client-side rendering but not for SSR.
|
|
4466
|
+
*
|
|
4467
|
+
* Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
4468
|
+
* and confirm it doesn't apply to your use-case.
|
|
4469
|
+
*/
|
|
4459
4470
|
const useEnhancedEffect = typeof window !== 'undefined' ? reactExports.useLayoutEffect : reactExports.useEffect;
|
|
4460
4471
|
var useEnhancedEffect$1 = useEnhancedEffect;
|
|
4461
4472
|
|
|
@@ -4520,7 +4531,8 @@
|
|
|
4520
4531
|
}
|
|
4521
4532
|
|
|
4522
4533
|
/**
|
|
4523
|
-
* https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
4534
|
+
* Inspired by https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
4535
|
+
* See RFC in https://github.com/reactjs/rfcs/pull/220
|
|
4524
4536
|
*/
|
|
4525
4537
|
|
|
4526
4538
|
function useEventCallback(fn) {
|
|
@@ -4797,16 +4809,19 @@
|
|
|
4797
4809
|
const ClassNameGenerator = createClassNameGenerator();
|
|
4798
4810
|
var ClassNameGenerator$1 = ClassNameGenerator;
|
|
4799
4811
|
|
|
4812
|
+
// If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
|
|
4813
|
+
// \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
|
|
4800
4814
|
const globalStateClassesMapping = {
|
|
4801
4815
|
active: 'active',
|
|
4802
4816
|
checked: 'checked',
|
|
4803
4817
|
completed: 'completed',
|
|
4804
4818
|
disabled: 'disabled',
|
|
4805
|
-
readOnly: 'readOnly',
|
|
4806
4819
|
error: 'error',
|
|
4807
4820
|
expanded: 'expanded',
|
|
4808
4821
|
focused: 'focused',
|
|
4809
4822
|
focusVisible: 'focusVisible',
|
|
4823
|
+
open: 'open',
|
|
4824
|
+
readOnly: 'readOnly',
|
|
4810
4825
|
required: 'required',
|
|
4811
4826
|
selected: 'selected'
|
|
4812
4827
|
};
|
|
@@ -6937,13 +6952,12 @@
|
|
|
6937
6952
|
}
|
|
6938
6953
|
|
|
6939
6954
|
/**
|
|
6940
|
-
* @mui/styled-engine v5.
|
|
6955
|
+
* @mui/styled-engine v5.14.11
|
|
6941
6956
|
*
|
|
6942
6957
|
* @license MIT
|
|
6943
6958
|
* This source code is licensed under the MIT license found in the
|
|
6944
6959
|
* LICENSE file in the root directory of this source tree.
|
|
6945
6960
|
*/
|
|
6946
|
-
/* eslint-disable no-underscore-dangle */
|
|
6947
6961
|
function styled$3(tag, options) {
|
|
6948
6962
|
const stylesFactory = newStyled(tag, options);
|
|
6949
6963
|
return stylesFactory;
|
|
@@ -6986,7 +7000,7 @@
|
|
|
6986
7000
|
return target;
|
|
6987
7001
|
}
|
|
6988
7002
|
|
|
6989
|
-
const _excluded$
|
|
7003
|
+
const _excluded$R = ["values", "unit", "step"];
|
|
6990
7004
|
const sortBreakpointsValues = values => {
|
|
6991
7005
|
const breakpointsAsArray = Object.keys(values).map(key => ({
|
|
6992
7006
|
key,
|
|
@@ -7021,7 +7035,7 @@
|
|
|
7021
7035
|
unit = 'px',
|
|
7022
7036
|
step = 5
|
|
7023
7037
|
} = breakpoints,
|
|
7024
|
-
other = _objectWithoutPropertiesLoose$2(breakpoints, _excluded$
|
|
7038
|
+
other = _objectWithoutPropertiesLoose$2(breakpoints, _excluded$R);
|
|
7025
7039
|
const sortedValues = sortBreakpointsValues(values);
|
|
7026
7040
|
const keys = Object.keys(sortedValues);
|
|
7027
7041
|
function up(key) {
|
|
@@ -7618,10 +7632,20 @@
|
|
|
7618
7632
|
const maxWidth = props => {
|
|
7619
7633
|
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
7620
7634
|
const styleFromPropValue = propValue => {
|
|
7621
|
-
var _props$theme;
|
|
7635
|
+
var _props$theme, _props$theme2;
|
|
7622
7636
|
const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values$1[propValue];
|
|
7637
|
+
if (!breakpoint) {
|
|
7638
|
+
return {
|
|
7639
|
+
maxWidth: sizingTransform(propValue)
|
|
7640
|
+
};
|
|
7641
|
+
}
|
|
7642
|
+
if (((_props$theme2 = props.theme) == null || (_props$theme2 = _props$theme2.breakpoints) == null ? void 0 : _props$theme2.unit) !== 'px') {
|
|
7643
|
+
return {
|
|
7644
|
+
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
|
|
7645
|
+
};
|
|
7646
|
+
}
|
|
7623
7647
|
return {
|
|
7624
|
-
maxWidth: breakpoint
|
|
7648
|
+
maxWidth: breakpoint
|
|
7625
7649
|
};
|
|
7626
7650
|
};
|
|
7627
7651
|
return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
|
|
@@ -8064,7 +8088,7 @@
|
|
|
8064
8088
|
styleFunctionSx.filterProps = ['sx'];
|
|
8065
8089
|
var styleFunctionSx$1 = styleFunctionSx;
|
|
8066
8090
|
|
|
8067
|
-
const _excluded$
|
|
8091
|
+
const _excluded$Q = ["breakpoints", "palette", "spacing", "shape"];
|
|
8068
8092
|
function createTheme$1(options = {}, ...args) {
|
|
8069
8093
|
const {
|
|
8070
8094
|
breakpoints: breakpointsInput = {},
|
|
@@ -8072,7 +8096,7 @@
|
|
|
8072
8096
|
spacing: spacingInput,
|
|
8073
8097
|
shape: shapeInput = {}
|
|
8074
8098
|
} = options,
|
|
8075
|
-
other = _objectWithoutPropertiesLoose$2(options, _excluded$
|
|
8099
|
+
other = _objectWithoutPropertiesLoose$2(options, _excluded$Q);
|
|
8076
8100
|
const breakpoints = createBreakpoints(breakpointsInput);
|
|
8077
8101
|
const spacing = createSpacing(spacingInput);
|
|
8078
8102
|
let muiTheme = deepmerge({
|
|
@@ -8122,7 +8146,7 @@
|
|
|
8122
8146
|
});
|
|
8123
8147
|
}
|
|
8124
8148
|
|
|
8125
|
-
const _excluded$
|
|
8149
|
+
const _excluded$P = ["sx"];
|
|
8126
8150
|
const splitProps = props => {
|
|
8127
8151
|
var _props$theme$unstable, _props$theme;
|
|
8128
8152
|
const result = {
|
|
@@ -8143,7 +8167,7 @@
|
|
|
8143
8167
|
const {
|
|
8144
8168
|
sx: inSx
|
|
8145
8169
|
} = props,
|
|
8146
|
-
other = _objectWithoutPropertiesLoose$2(props, _excluded$
|
|
8170
|
+
other = _objectWithoutPropertiesLoose$2(props, _excluded$P);
|
|
8147
8171
|
const {
|
|
8148
8172
|
systemProps,
|
|
8149
8173
|
otherProps
|
|
@@ -8169,7 +8193,7 @@
|
|
|
8169
8193
|
|
|
8170
8194
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
8171
8195
|
|
|
8172
|
-
const _excluded$
|
|
8196
|
+
const _excluded$O = ["className", "component"];
|
|
8173
8197
|
function createBox(options = {}) {
|
|
8174
8198
|
const {
|
|
8175
8199
|
themeId,
|
|
@@ -8187,7 +8211,7 @@
|
|
|
8187
8211
|
className,
|
|
8188
8212
|
component = 'div'
|
|
8189
8213
|
} = _extendSxProp,
|
|
8190
|
-
other = _objectWithoutPropertiesLoose$2(_extendSxProp, _excluded$
|
|
8214
|
+
other = _objectWithoutPropertiesLoose$2(_extendSxProp, _excluded$O);
|
|
8191
8215
|
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends$3({
|
|
8192
8216
|
as: component,
|
|
8193
8217
|
ref: ref,
|
|
@@ -8198,7 +8222,7 @@
|
|
|
8198
8222
|
return Box;
|
|
8199
8223
|
}
|
|
8200
8224
|
|
|
8201
|
-
const _excluded$
|
|
8225
|
+
const _excluded$N = ["variant"];
|
|
8202
8226
|
function isEmpty$3(string) {
|
|
8203
8227
|
return string.length === 0;
|
|
8204
8228
|
}
|
|
@@ -8212,7 +8236,7 @@
|
|
|
8212
8236
|
const {
|
|
8213
8237
|
variant
|
|
8214
8238
|
} = props,
|
|
8215
|
-
other = _objectWithoutPropertiesLoose$2(props, _excluded$
|
|
8239
|
+
other = _objectWithoutPropertiesLoose$2(props, _excluded$N);
|
|
8216
8240
|
let classKey = variant || '';
|
|
8217
8241
|
Object.keys(other).sort().forEach(key => {
|
|
8218
8242
|
if (key === 'color') {
|
|
@@ -8224,7 +8248,7 @@
|
|
|
8224
8248
|
return classKey;
|
|
8225
8249
|
}
|
|
8226
8250
|
|
|
8227
|
-
const _excluded$
|
|
8251
|
+
const _excluded$M = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
|
|
8228
8252
|
function isEmpty$2(obj) {
|
|
8229
8253
|
return Object.keys(obj).length === 0;
|
|
8230
8254
|
}
|
|
@@ -8330,7 +8354,7 @@
|
|
|
8330
8354
|
// For more details: https://github.com/mui/material-ui/pull/37908
|
|
8331
8355
|
overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot))
|
|
8332
8356
|
} = inputOptions,
|
|
8333
|
-
options = _objectWithoutPropertiesLoose$2(inputOptions, _excluded$
|
|
8357
|
+
options = _objectWithoutPropertiesLoose$2(inputOptions, _excluded$M);
|
|
8334
8358
|
|
|
8335
8359
|
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
|
8336
8360
|
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
|
|
@@ -8800,7 +8824,7 @@
|
|
|
8800
8824
|
});
|
|
8801
8825
|
}
|
|
8802
8826
|
|
|
8803
|
-
const _excluded$
|
|
8827
|
+
const _excluded$L = ["component", "direction", "spacing", "divider", "children", "className", "useFlexGap"];
|
|
8804
8828
|
const defaultTheme$3 = createTheme$1();
|
|
8805
8829
|
// widening Theme to any so that the consumer can own the theme structure.
|
|
8806
8830
|
const defaultCreateStyledComponent = systemStyled('div', {
|
|
@@ -8933,7 +8957,7 @@
|
|
|
8933
8957
|
className,
|
|
8934
8958
|
useFlexGap = false
|
|
8935
8959
|
} = props,
|
|
8936
|
-
other = _objectWithoutPropertiesLoose$2(props, _excluded$
|
|
8960
|
+
other = _objectWithoutPropertiesLoose$2(props, _excluded$L);
|
|
8937
8961
|
const ownerState = {
|
|
8938
8962
|
direction,
|
|
8939
8963
|
spacing,
|
|
@@ -8952,7 +8976,7 @@
|
|
|
8952
8976
|
return Stack;
|
|
8953
8977
|
}
|
|
8954
8978
|
|
|
8955
|
-
const _excluded$
|
|
8979
|
+
const _excluded$K = ["defaultProps", "mixins", "overrides", "palette", "props", "styleOverrides"],
|
|
8956
8980
|
_excluded2$4 = ["type", "mode"];
|
|
8957
8981
|
function adaptV4Theme(inputTheme) {
|
|
8958
8982
|
const {
|
|
@@ -8963,7 +8987,7 @@
|
|
|
8963
8987
|
props = {},
|
|
8964
8988
|
styleOverrides = {}
|
|
8965
8989
|
} = inputTheme,
|
|
8966
|
-
other = _objectWithoutPropertiesLoose$3(inputTheme, _excluded$
|
|
8990
|
+
other = _objectWithoutPropertiesLoose$3(inputTheme, _excluded$K);
|
|
8967
8991
|
const theme = _extends$5({}, other, {
|
|
8968
8992
|
components: {}
|
|
8969
8993
|
});
|
|
@@ -9176,7 +9200,7 @@
|
|
|
9176
9200
|
};
|
|
9177
9201
|
var green$1 = green;
|
|
9178
9202
|
|
|
9179
|
-
const _excluded$
|
|
9203
|
+
const _excluded$J = ["mode", "contrastThreshold", "tonalOffset"];
|
|
9180
9204
|
const light$1 = {
|
|
9181
9205
|
// The colors used to style the text.
|
|
9182
9206
|
text: {
|
|
@@ -9345,7 +9369,7 @@
|
|
|
9345
9369
|
contrastThreshold = 3,
|
|
9346
9370
|
tonalOffset = 0.2
|
|
9347
9371
|
} = palette,
|
|
9348
|
-
other = _objectWithoutPropertiesLoose$3(palette, _excluded$
|
|
9372
|
+
other = _objectWithoutPropertiesLoose$3(palette, _excluded$J);
|
|
9349
9373
|
const primary = palette.primary || getDefaultPrimary(mode);
|
|
9350
9374
|
const secondary = palette.secondary || getDefaultSecondary(mode);
|
|
9351
9375
|
const error = palette.error || getDefaultError(mode);
|
|
@@ -9444,7 +9468,7 @@
|
|
|
9444
9468
|
return paletteOutput;
|
|
9445
9469
|
}
|
|
9446
9470
|
|
|
9447
|
-
const _excluded$
|
|
9471
|
+
const _excluded$I = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
|
|
9448
9472
|
function round$2(value) {
|
|
9449
9473
|
return Math.round(value * 1e5) / 1e5;
|
|
9450
9474
|
}
|
|
@@ -9475,7 +9499,7 @@
|
|
|
9475
9499
|
allVariants,
|
|
9476
9500
|
pxToRem: pxToRem2
|
|
9477
9501
|
} = _ref,
|
|
9478
|
-
other = _objectWithoutPropertiesLoose$3(_ref, _excluded$
|
|
9502
|
+
other = _objectWithoutPropertiesLoose$3(_ref, _excluded$I);
|
|
9479
9503
|
const coef = fontSize / 14;
|
|
9480
9504
|
const pxToRem = pxToRem2 || (size => `${size / htmlFontSize * coef}rem`);
|
|
9481
9505
|
const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => _extends$5({
|
|
@@ -9535,7 +9559,7 @@
|
|
|
9535
9559
|
const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
|
|
9536
9560
|
var shadows$1 = shadows;
|
|
9537
9561
|
|
|
9538
|
-
const _excluded$
|
|
9562
|
+
const _excluded$H = ["duration", "easing", "delay"];
|
|
9539
9563
|
// Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves
|
|
9540
9564
|
// to learn the context in which each easing should be used.
|
|
9541
9565
|
const easing = {
|
|
@@ -9586,7 +9610,7 @@
|
|
|
9586
9610
|
easing: easingOption = mergedEasing.easeInOut,
|
|
9587
9611
|
delay = 0
|
|
9588
9612
|
} = options;
|
|
9589
|
-
_objectWithoutPropertiesLoose$3(options, _excluded$
|
|
9613
|
+
_objectWithoutPropertiesLoose$3(options, _excluded$H);
|
|
9590
9614
|
return (Array.isArray(props) ? props : [props]).map(animatedProp => `${animatedProp} ${typeof durationOption === 'string' ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === 'string' ? delay : formatMs(delay)}`).join(',');
|
|
9591
9615
|
};
|
|
9592
9616
|
return _extends$5({
|
|
@@ -9612,7 +9636,7 @@
|
|
|
9612
9636
|
};
|
|
9613
9637
|
var zIndex$1 = zIndex;
|
|
9614
9638
|
|
|
9615
|
-
const _excluded$
|
|
9639
|
+
const _excluded$G = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
|
|
9616
9640
|
function createTheme(options = {}, ...args) {
|
|
9617
9641
|
const {
|
|
9618
9642
|
mixins: mixinsInput = {},
|
|
@@ -9620,7 +9644,7 @@
|
|
|
9620
9644
|
transitions: transitionsInput = {},
|
|
9621
9645
|
typography: typographyInput = {}
|
|
9622
9646
|
} = options,
|
|
9623
|
-
other = _objectWithoutPropertiesLoose$3(options, _excluded$
|
|
9647
|
+
other = _objectWithoutPropertiesLoose$3(options, _excluded$G);
|
|
9624
9648
|
if (options.vars) {
|
|
9625
9649
|
throw new Error(formatMuiErrorMessage(18));
|
|
9626
9650
|
}
|
|
@@ -9675,12 +9699,12 @@
|
|
|
9675
9699
|
});
|
|
9676
9700
|
var styled$1 = styled;
|
|
9677
9701
|
|
|
9678
|
-
const _excluded$
|
|
9702
|
+
const _excluded$F = ["theme"];
|
|
9679
9703
|
function ThemeProvider(_ref) {
|
|
9680
9704
|
let {
|
|
9681
9705
|
theme: themeInput
|
|
9682
9706
|
} = _ref,
|
|
9683
|
-
props = _objectWithoutPropertiesLoose$3(_ref, _excluded$
|
|
9707
|
+
props = _objectWithoutPropertiesLoose$3(_ref, _excluded$F);
|
|
9684
9708
|
const scopedTheme = themeInput[THEME_ID];
|
|
9685
9709
|
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, _extends$5({}, props, {
|
|
9686
9710
|
themeId: scopedTheme ? THEME_ID : undefined,
|
|
@@ -10505,7 +10529,7 @@
|
|
|
10505
10529
|
const touchRippleClasses = generateUtilityClasses('MuiTouchRipple', ['root', 'ripple', 'rippleVisible', 'ripplePulsate', 'child', 'childLeaving', 'childPulsate']);
|
|
10506
10530
|
var touchRippleClasses$1 = touchRippleClasses;
|
|
10507
10531
|
|
|
10508
|
-
const _excluded$
|
|
10532
|
+
const _excluded$E = ["center", "classes", "className"];
|
|
10509
10533
|
let _$1 = t => t,
|
|
10510
10534
|
_t$1,
|
|
10511
10535
|
_t2$1,
|
|
@@ -10634,7 +10658,7 @@
|
|
|
10634
10658
|
classes = {},
|
|
10635
10659
|
className
|
|
10636
10660
|
} = props,
|
|
10637
|
-
other = _objectWithoutPropertiesLoose$3(props, _excluded$
|
|
10661
|
+
other = _objectWithoutPropertiesLoose$3(props, _excluded$E);
|
|
10638
10662
|
const [ripples, setRipples] = reactExports.useState([]);
|
|
10639
10663
|
const nextKey = reactExports.useRef(0);
|
|
10640
10664
|
const rippleCallback = reactExports.useRef(null);
|
|
@@ -10821,7 +10845,7 @@
|
|
|
10821
10845
|
const buttonBaseClasses = generateUtilityClasses('MuiButtonBase', ['root', 'disabled', 'focusVisible']);
|
|
10822
10846
|
var buttonBaseClasses$1 = buttonBaseClasses;
|
|
10823
10847
|
|
|
10824
|
-
const _excluded$
|
|
10848
|
+
const _excluded$D = ["action", "centerRipple", "children", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "LinkComponent", "onBlur", "onClick", "onContextMenu", "onDragLeave", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "tabIndex", "TouchRippleProps", "touchRippleRef", "type"];
|
|
10825
10849
|
const useUtilityClasses$r = ownerState => {
|
|
10826
10850
|
const {
|
|
10827
10851
|
disabled,
|
|
@@ -10923,7 +10947,7 @@
|
|
|
10923
10947
|
touchRippleRef,
|
|
10924
10948
|
type
|
|
10925
10949
|
} = props,
|
|
10926
|
-
other = _objectWithoutPropertiesLoose$3(props, _excluded$
|
|
10950
|
+
other = _objectWithoutPropertiesLoose$3(props, _excluded$D);
|
|
10927
10951
|
const buttonRef = reactExports.useRef(null);
|
|
10928
10952
|
const rippleRef = reactExports.useRef(null);
|
|
10929
10953
|
const handleRippleRef = useForkRef(rippleRef, touchRippleRef);
|
|
@@ -11127,7 +11151,13 @@
|
|
|
11127
11151
|
const ButtonGroupContext = /*#__PURE__*/reactExports.createContext({});
|
|
11128
11152
|
var ButtonGroupContext$1 = ButtonGroupContext;
|
|
11129
11153
|
|
|
11130
|
-
|
|
11154
|
+
/**
|
|
11155
|
+
* @ignore - internal component.
|
|
11156
|
+
*/
|
|
11157
|
+
const ButtonGroupButtonContext = /*#__PURE__*/reactExports.createContext(undefined);
|
|
11158
|
+
var ButtonGroupButtonContext$1 = ButtonGroupButtonContext;
|
|
11159
|
+
|
|
11160
|
+
const _excluded$C = ["children", "color", "component", "className", "disabled", "disableElevation", "disableFocusRipple", "endIcon", "focusVisibleClassName", "fullWidth", "size", "startIcon", "type", "variant"];
|
|
11131
11161
|
const useUtilityClasses$q = ownerState => {
|
|
11132
11162
|
const {
|
|
11133
11163
|
color,
|
|
@@ -11332,6 +11362,7 @@
|
|
|
11332
11362
|
const Button = /*#__PURE__*/reactExports.forwardRef(function Button(inProps, ref) {
|
|
11333
11363
|
// props priority: `inProps` > `contextProps` > `themeDefaultProps`
|
|
11334
11364
|
const contextProps = reactExports.useContext(ButtonGroupContext$1);
|
|
11365
|
+
const buttonGroupButtonContextPositionClassName = reactExports.useContext(ButtonGroupButtonContext$1);
|
|
11335
11366
|
const resolvedProps = resolveProps(contextProps, inProps);
|
|
11336
11367
|
const props = useThemeProps({
|
|
11337
11368
|
props: resolvedProps,
|
|
@@ -11353,7 +11384,7 @@
|
|
|
11353
11384
|
type,
|
|
11354
11385
|
variant = 'text'
|
|
11355
11386
|
} = props,
|
|
11356
|
-
other = _objectWithoutPropertiesLoose$3(props, _excluded$
|
|
11387
|
+
other = _objectWithoutPropertiesLoose$3(props, _excluded$C);
|
|
11357
11388
|
const ownerState = _extends$5({}, props, {
|
|
11358
11389
|
color,
|
|
11359
11390
|
component,
|
|
@@ -11376,9 +11407,10 @@
|
|
|
11376
11407
|
ownerState: ownerState,
|
|
11377
11408
|
children: endIconProp
|
|
11378
11409
|
});
|
|
11410
|
+
const positionClassName = buttonGroupButtonContextPositionClassName || '';
|
|
11379
11411
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(ButtonRoot, _extends$5({
|
|
11380
11412
|
ownerState: ownerState,
|
|
11381
|
-
className: clsx(contextProps.className, classes.root, className),
|
|
11413
|
+
className: clsx(contextProps.className, classes.root, className, positionClassName),
|
|
11382
11414
|
component: component,
|
|
11383
11415
|
disabled: disabled,
|
|
11384
11416
|
focusRipple: !disableFocusRipple,
|
|
@@ -11710,7 +11742,7 @@
|
|
|
11710
11742
|
return cache[key];
|
|
11711
11743
|
}
|
|
11712
11744
|
|
|
11713
|
-
const NEBULA_VERSION_HASH = "
|
|
11745
|
+
const NEBULA_VERSION_HASH = "7c03" ;
|
|
11714
11746
|
ClassNameGenerator$1.configure(componentName => {
|
|
11715
11747
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
11716
11748
|
});
|
|
@@ -11971,7 +12003,7 @@
|
|
|
11971
12003
|
const appRef = React.createRef();
|
|
11972
12004
|
const element = document.createElement('div');
|
|
11973
12005
|
element.style.display = 'none';
|
|
11974
|
-
element.setAttribute('data-nebulajs-version', "4.
|
|
12006
|
+
element.setAttribute('data-nebulajs-version', "4.5.0" );
|
|
11975
12007
|
element.setAttribute('data-app-id', app.id);
|
|
11976
12008
|
document.body.appendChild(element);
|
|
11977
12009
|
if (context) {
|
|
@@ -12044,7 +12076,7 @@
|
|
|
12044
12076
|
}
|
|
12045
12077
|
generateUtilityClasses('MuiSvgIcon', ['root', 'colorPrimary', 'colorSecondary', 'colorAction', 'colorError', 'colorDisabled', 'fontSizeInherit', 'fontSizeSmall', 'fontSizeMedium', 'fontSizeLarge']);
|
|
12046
12078
|
|
|
12047
|
-
const _excluded$
|
|
12079
|
+
const _excluded$B = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
|
|
12048
12080
|
const useUtilityClasses$p = ownerState => {
|
|
12049
12081
|
const {
|
|
12050
12082
|
color,
|
|
@@ -12112,7 +12144,7 @@
|
|
|
12112
12144
|
titleAccess,
|
|
12113
12145
|
viewBox = '0 0 24 24'
|
|
12114
12146
|
} = props,
|
|
12115
|
-
other = _objectWithoutPropertiesLoose$3(props, _excluded$
|
|
12147
|
+
other = _objectWithoutPropertiesLoose$3(props, _excluded$B);
|
|
12116
12148
|
const hasSvgAsChild = /*#__PURE__*/reactExports.isValidElement(children) && children.type === 'svg';
|
|
12117
12149
|
const ownerState = _extends$5({}, props, {
|
|
12118
12150
|
color,
|
|
@@ -12209,7 +12241,7 @@
|
|
|
12209
12241
|
}
|
|
12210
12242
|
generateUtilityClasses('MuiPaper', ['root', 'rounded', 'outlined', 'elevation', 'elevation0', 'elevation1', 'elevation2', 'elevation3', 'elevation4', 'elevation5', 'elevation6', 'elevation7', 'elevation8', 'elevation9', 'elevation10', 'elevation11', 'elevation12', 'elevation13', 'elevation14', 'elevation15', 'elevation16', 'elevation17', 'elevation18', 'elevation19', 'elevation20', 'elevation21', 'elevation22', 'elevation23', 'elevation24']);
|
|
12211
12243
|
|
|
12212
|
-
const _excluded$
|
|
12244
|
+
const _excluded$A = ["className", "component", "elevation", "square", "variant"];
|
|
12213
12245
|
const useUtilityClasses$o = ownerState => {
|
|
12214
12246
|
const {
|
|
12215
12247
|
square,
|
|
@@ -12264,7 +12296,7 @@
|
|
|
12264
12296
|
square = false,
|
|
12265
12297
|
variant = 'elevation'
|
|
12266
12298
|
} = props,
|
|
12267
|
-
other = _objectWithoutPropertiesLoose$3(props, _excluded$
|
|
12299
|
+
other = _objectWithoutPropertiesLoose$3(props, _excluded$A);
|
|
12268
12300
|
const ownerState = _extends$5({}, props, {
|
|
12269
12301
|
component,
|
|
12270
12302
|
elevation,
|
|
@@ -12287,7 +12319,7 @@
|
|
|
12287
12319
|
const iconButtonClasses = generateUtilityClasses('MuiIconButton', ['root', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning', 'edgeStart', 'edgeEnd', 'sizeSmall', 'sizeMedium', 'sizeLarge']);
|
|
12288
12320
|
var iconButtonClasses$1 = iconButtonClasses;
|
|
12289
12321
|
|
|
12290
|
-
const _excluded$
|
|
12322
|
+
const _excluded$z = ["edge", "children", "className", "color", "disabled", "disableFocusRipple", "size"];
|
|
12291
12323
|
const useUtilityClasses$n = ownerState => {
|
|
12292
12324
|
const {
|
|
12293
12325
|
classes,
|
|
@@ -12388,7 +12420,7 @@
|
|
|
12388
12420
|
disableFocusRipple = false,
|
|
12389
12421
|
size = 'medium'
|
|
12390
12422
|
} = props,
|
|
12391
|
-
other = _objectWithoutPropertiesLoose$3(props, _excluded$
|
|
12423
|
+
other = _objectWithoutPropertiesLoose$3(props, _excluded$z);
|
|
12392
12424
|
const ownerState = _extends$5({}, props, {
|
|
12393
12425
|
edge,
|
|
12394
12426
|
color,
|
|
@@ -12415,7 +12447,7 @@
|
|
|
12415
12447
|
}
|
|
12416
12448
|
generateUtilityClasses('MuiTypography', ['root', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'inherit', 'button', 'caption', 'overline', 'alignLeft', 'alignRight', 'alignCenter', 'alignJustify', 'noWrap', 'gutterBottom', 'paragraph']);
|
|
12417
12449
|
|
|
12418
|
-
const _excluded$
|
|
12450
|
+
const _excluded$y = ["align", "className", "component", "gutterBottom", "noWrap", "paragraph", "variant", "variantMapping"];
|
|
12419
12451
|
const useUtilityClasses$m = ownerState => {
|
|
12420
12452
|
const {
|
|
12421
12453
|
align,
|
|
@@ -12502,7 +12534,7 @@
|
|
|
12502
12534
|
variant = 'body1',
|
|
12503
12535
|
variantMapping = defaultVariantMapping
|
|
12504
12536
|
} = props,
|
|
12505
|
-
other = _objectWithoutPropertiesLoose$3(props, _excluded$
|
|
12537
|
+
other = _objectWithoutPropertiesLoose$3(props, _excluded$y);
|
|
12506
12538
|
const ownerState = _extends$5({}, props, {
|
|
12507
12539
|
align,
|
|
12508
12540
|
color,
|
|
@@ -12719,7 +12751,7 @@
|
|
|
12719
12751
|
};
|
|
12720
12752
|
}
|
|
12721
12753
|
|
|
12722
|
-
const _excluded$
|
|
12754
|
+
const _excluded$x = ["elementType", "externalSlotProps", "ownerState", "skipResolvingSlotProps"];
|
|
12723
12755
|
/**
|
|
12724
12756
|
* @ignore - do not document.
|
|
12725
12757
|
* Builds the props to be passed into the slot of an unstyled component.
|
|
@@ -12736,7 +12768,7 @@
|
|
|
12736
12768
|
ownerState,
|
|
12737
12769
|
skipResolvingSlotProps = false
|
|
12738
12770
|
} = parameters,
|
|
12739
|
-
rest = _objectWithoutPropertiesLoose(parameters, _excluded$
|
|
12771
|
+
rest = _objectWithoutPropertiesLoose(parameters, _excluded$x);
|
|
12740
12772
|
const resolvedComponentsProps = skipResolvingSlotProps ? {} : resolveComponentProps(externalSlotProps, ownerState);
|
|
12741
12773
|
const {
|
|
12742
12774
|
props: mergedProps,
|
|
@@ -12932,51 +12964,6 @@
|
|
|
12932
12964
|
return;
|
|
12933
12965
|
}
|
|
12934
12966
|
const doc = ownerDocument(rootRef.current);
|
|
12935
|
-
const contain = nativeEvent => {
|
|
12936
|
-
const {
|
|
12937
|
-
current: rootElement
|
|
12938
|
-
} = rootRef;
|
|
12939
|
-
|
|
12940
|
-
// Cleanup functions are executed lazily in React 17.
|
|
12941
|
-
// Contain can be called between the component being unmounted and its cleanup function being run.
|
|
12942
|
-
if (rootElement === null) {
|
|
12943
|
-
return;
|
|
12944
|
-
}
|
|
12945
|
-
if (!doc.hasFocus() || disableEnforceFocus || !isEnabled() || ignoreNextEnforceFocus.current) {
|
|
12946
|
-
ignoreNextEnforceFocus.current = false;
|
|
12947
|
-
return;
|
|
12948
|
-
}
|
|
12949
|
-
if (!rootElement.contains(doc.activeElement)) {
|
|
12950
|
-
// if the focus event is not coming from inside the children's react tree, reset the refs
|
|
12951
|
-
if (nativeEvent && reactFocusEventTarget.current !== nativeEvent.target || doc.activeElement !== reactFocusEventTarget.current) {
|
|
12952
|
-
reactFocusEventTarget.current = null;
|
|
12953
|
-
} else if (reactFocusEventTarget.current !== null) {
|
|
12954
|
-
return;
|
|
12955
|
-
}
|
|
12956
|
-
if (!activated.current) {
|
|
12957
|
-
return;
|
|
12958
|
-
}
|
|
12959
|
-
let tabbable = [];
|
|
12960
|
-
if (doc.activeElement === sentinelStart.current || doc.activeElement === sentinelEnd.current) {
|
|
12961
|
-
tabbable = getTabbable(rootRef.current);
|
|
12962
|
-
}
|
|
12963
|
-
if (tabbable.length > 0) {
|
|
12964
|
-
var _lastKeydown$current, _lastKeydown$current2;
|
|
12965
|
-
const isShiftTab = Boolean(((_lastKeydown$current = lastKeydown.current) == null ? void 0 : _lastKeydown$current.shiftKey) && ((_lastKeydown$current2 = lastKeydown.current) == null ? void 0 : _lastKeydown$current2.key) === 'Tab');
|
|
12966
|
-
const focusNext = tabbable[0];
|
|
12967
|
-
const focusPrevious = tabbable[tabbable.length - 1];
|
|
12968
|
-
if (typeof focusNext !== 'string' && typeof focusPrevious !== 'string') {
|
|
12969
|
-
if (isShiftTab) {
|
|
12970
|
-
focusPrevious.focus();
|
|
12971
|
-
} else {
|
|
12972
|
-
focusNext.focus();
|
|
12973
|
-
}
|
|
12974
|
-
}
|
|
12975
|
-
} else {
|
|
12976
|
-
rootElement.focus();
|
|
12977
|
-
}
|
|
12978
|
-
}
|
|
12979
|
-
};
|
|
12980
12967
|
const loopFocus = nativeEvent => {
|
|
12981
12968
|
lastKeydown.current = nativeEvent;
|
|
12982
12969
|
if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {
|
|
@@ -12994,6 +12981,62 @@
|
|
|
12994
12981
|
}
|
|
12995
12982
|
}
|
|
12996
12983
|
};
|
|
12984
|
+
const contain = () => {
|
|
12985
|
+
const rootElement = rootRef.current;
|
|
12986
|
+
|
|
12987
|
+
// Cleanup functions are executed lazily in React 17.
|
|
12988
|
+
// Contain can be called between the component being unmounted and its cleanup function being run.
|
|
12989
|
+
if (rootElement === null) {
|
|
12990
|
+
return;
|
|
12991
|
+
}
|
|
12992
|
+
if (!doc.hasFocus() || !isEnabled() || ignoreNextEnforceFocus.current) {
|
|
12993
|
+
ignoreNextEnforceFocus.current = false;
|
|
12994
|
+
return;
|
|
12995
|
+
}
|
|
12996
|
+
|
|
12997
|
+
// The focus is already inside
|
|
12998
|
+
if (rootElement.contains(doc.activeElement)) {
|
|
12999
|
+
return;
|
|
13000
|
+
}
|
|
13001
|
+
|
|
13002
|
+
// The disableEnforceFocus is set and the focus is outside of the focus trap (and sentinel nodes)
|
|
13003
|
+
if (disableEnforceFocus && doc.activeElement !== sentinelStart.current && doc.activeElement !== sentinelEnd.current) {
|
|
13004
|
+
return;
|
|
13005
|
+
}
|
|
13006
|
+
|
|
13007
|
+
// if the focus event is not coming from inside the children's react tree, reset the refs
|
|
13008
|
+
if (doc.activeElement !== reactFocusEventTarget.current) {
|
|
13009
|
+
reactFocusEventTarget.current = null;
|
|
13010
|
+
} else if (reactFocusEventTarget.current !== null) {
|
|
13011
|
+
return;
|
|
13012
|
+
}
|
|
13013
|
+
if (!activated.current) {
|
|
13014
|
+
return;
|
|
13015
|
+
}
|
|
13016
|
+
let tabbable = [];
|
|
13017
|
+
if (doc.activeElement === sentinelStart.current || doc.activeElement === sentinelEnd.current) {
|
|
13018
|
+
tabbable = getTabbable(rootRef.current);
|
|
13019
|
+
}
|
|
13020
|
+
|
|
13021
|
+
// one of the sentinel nodes was focused, so move the focus
|
|
13022
|
+
// to the first/last tabbable element inside the focus trap
|
|
13023
|
+
if (tabbable.length > 0) {
|
|
13024
|
+
var _lastKeydown$current, _lastKeydown$current2;
|
|
13025
|
+
const isShiftTab = Boolean(((_lastKeydown$current = lastKeydown.current) == null ? void 0 : _lastKeydown$current.shiftKey) && ((_lastKeydown$current2 = lastKeydown.current) == null ? void 0 : _lastKeydown$current2.key) === 'Tab');
|
|
13026
|
+
const focusNext = tabbable[0];
|
|
13027
|
+
const focusPrevious = tabbable[tabbable.length - 1];
|
|
13028
|
+
if (typeof focusNext !== 'string' && typeof focusPrevious !== 'string') {
|
|
13029
|
+
if (isShiftTab) {
|
|
13030
|
+
focusPrevious.focus();
|
|
13031
|
+
} else {
|
|
13032
|
+
focusNext.focus();
|
|
13033
|
+
}
|
|
13034
|
+
}
|
|
13035
|
+
// no tabbable elements in the trap focus or the focus was outside of the focus trap
|
|
13036
|
+
} else {
|
|
13037
|
+
rootElement.focus();
|
|
13038
|
+
}
|
|
13039
|
+
};
|
|
12997
13040
|
doc.addEventListener('focusin', contain);
|
|
12998
13041
|
doc.addEventListener('keydown', loopFocus, true);
|
|
12999
13042
|
|
|
@@ -13005,7 +13048,7 @@
|
|
|
13005
13048
|
// https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.
|
|
13006
13049
|
const interval = setInterval(() => {
|
|
13007
13050
|
if (doc.activeElement && doc.activeElement.tagName === 'BODY') {
|
|
13008
|
-
contain(
|
|
13051
|
+
contain();
|
|
13009
13052
|
}
|
|
13010
13053
|
}, 50);
|
|
13011
13054
|
return () => {
|
|
@@ -14900,7 +14943,7 @@
|
|
|
14900
14943
|
}
|
|
14901
14944
|
generateUtilityClasses('MuiPopper', ['root']);
|
|
14902
14945
|
|
|
14903
|
-
const _excluded$
|
|
14946
|
+
const _excluded$w = ["anchorEl", "children", "direction", "disablePortal", "modifiers", "open", "placement", "popperOptions", "popperRef", "slotProps", "slots", "TransitionProps", "ownerState"],
|
|
14904
14947
|
_excluded2$3 = ["anchorEl", "children", "container", "direction", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "style", "transition", "slotProps", "slots"];
|
|
14905
14948
|
function flipPlacement(placement, direction) {
|
|
14906
14949
|
if (direction === 'ltr') {
|
|
@@ -14950,7 +14993,7 @@
|
|
|
14950
14993
|
// @ts-ignore internal logic
|
|
14951
14994
|
// prevent from spreading to DOM, it can come from the parent component e.g. Select.
|
|
14952
14995
|
} = props,
|
|
14953
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
|
14996
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$w);
|
|
14954
14997
|
const tooltipRef = reactExports.useRef(null);
|
|
14955
14998
|
const ownRef = useForkRef(tooltipRef, forwardedRef);
|
|
14956
14999
|
const popperRef = reactExports.useRef(null);
|
|
@@ -15210,7 +15253,7 @@
|
|
|
15210
15253
|
if (container.parentNode instanceof DocumentFragment) {
|
|
15211
15254
|
scrollContainer = ownerDocument(container).body;
|
|
15212
15255
|
} else {
|
|
15213
|
-
//
|
|
15256
|
+
// Support html overflow-y: auto for scroll stability between pages
|
|
15214
15257
|
// https://css-tricks.com/snippets/css/force-vertical-scrollbar/
|
|
15215
15258
|
const parent = container.parentElement;
|
|
15216
15259
|
const containerWindow = ownerWindow(container);
|
|
@@ -15345,23 +15388,6 @@
|
|
|
15345
15388
|
}
|
|
15346
15389
|
}
|
|
15347
15390
|
|
|
15348
|
-
function getModalUtilityClass(slot) {
|
|
15349
|
-
return generateUtilityClass('MuiModal', slot);
|
|
15350
|
-
}
|
|
15351
|
-
generateUtilityClasses('MuiModal', ['root', 'hidden', 'backdrop']);
|
|
15352
|
-
|
|
15353
|
-
const _excluded$w = ["children", "closeAfterTransition", "container", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "manager", "onBackdropClick", "onClose", "onKeyDown", "open", "onTransitionEnter", "onTransitionExited", "slotProps", "slots"];
|
|
15354
|
-
const useUtilityClasses$k = ownerState => {
|
|
15355
|
-
const {
|
|
15356
|
-
open,
|
|
15357
|
-
exited
|
|
15358
|
-
} = ownerState;
|
|
15359
|
-
const slots = {
|
|
15360
|
-
root: ['root', !open && exited && 'hidden'],
|
|
15361
|
-
backdrop: ['backdrop']
|
|
15362
|
-
};
|
|
15363
|
-
return composeClasses(slots, useClassNamesOverride(getModalUtilityClass));
|
|
15364
|
-
};
|
|
15365
15391
|
function getContainer(container) {
|
|
15366
15392
|
return typeof container === 'function' ? container() : container;
|
|
15367
15393
|
}
|
|
@@ -15372,68 +15398,47 @@
|
|
|
15372
15398
|
// A modal manager used to track and manage the state of open Modals.
|
|
15373
15399
|
// Modals don't open on the server so this won't conflict with concurrent requests.
|
|
15374
15400
|
const defaultManager = new ModalManager();
|
|
15375
|
-
|
|
15376
15401
|
/**
|
|
15377
|
-
* Modal is a lower-level construct that is leveraged by the following components:
|
|
15378
|
-
*
|
|
15379
|
-
* * [Dialog](https://mui.com/material-ui/api/dialog/)
|
|
15380
|
-
* * [Drawer](https://mui.com/material-ui/api/drawer/)
|
|
15381
|
-
* * [Menu](https://mui.com/material-ui/api/menu/)
|
|
15382
|
-
* * [Popover](https://mui.com/material-ui/api/popover/)
|
|
15383
|
-
*
|
|
15384
|
-
* If you are creating a modal dialog, you probably want to use the [Dialog](https://mui.com/material-ui/api/dialog/) component
|
|
15385
|
-
* rather than directly using Modal.
|
|
15386
|
-
*
|
|
15387
|
-
* This component shares many concepts with [react-overlays](https://react-bootstrap.github.io/react-overlays/#modals).
|
|
15388
15402
|
*
|
|
15389
15403
|
* Demos:
|
|
15390
15404
|
*
|
|
15391
|
-
* - [Modal](https://mui.com/base-ui/react-modal
|
|
15405
|
+
* - [Modal](https://mui.com/base-ui/react-modal/#hook)
|
|
15392
15406
|
*
|
|
15393
15407
|
* API:
|
|
15394
15408
|
*
|
|
15395
|
-
* - [
|
|
15409
|
+
* - [useModal API](https://mui.com/base-ui/react-modal/hooks-api/#use-modal)
|
|
15396
15410
|
*/
|
|
15397
|
-
|
|
15398
|
-
var _props$ariaHidden, _slots$root;
|
|
15411
|
+
function useModal(parameters) {
|
|
15399
15412
|
const {
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
onKeyDown,
|
|
15416
|
-
open,
|
|
15417
|
-
onTransitionEnter,
|
|
15418
|
-
onTransitionExited,
|
|
15419
|
-
slotProps = {},
|
|
15420
|
-
slots = {}
|
|
15421
|
-
} = props,
|
|
15422
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$w);
|
|
15423
|
-
// TODO: `modal`` must change its type in this file to match the type of methods
|
|
15424
|
-
// provided by `ModalManager`
|
|
15425
|
-
const manager = managerProp;
|
|
15426
|
-
const [exited, setExited] = reactExports.useState(!open);
|
|
15413
|
+
container,
|
|
15414
|
+
disableEscapeKeyDown = false,
|
|
15415
|
+
disableScrollLock = false,
|
|
15416
|
+
// @ts-ignore internal logic - Base UI supports the manager as a prop too
|
|
15417
|
+
manager = defaultManager,
|
|
15418
|
+
closeAfterTransition = false,
|
|
15419
|
+
onTransitionEnter,
|
|
15420
|
+
onTransitionExited,
|
|
15421
|
+
children,
|
|
15422
|
+
onClose,
|
|
15423
|
+
open,
|
|
15424
|
+
rootRef
|
|
15425
|
+
} = parameters;
|
|
15426
|
+
|
|
15427
|
+
// @ts-ignore internal logic
|
|
15427
15428
|
const modal = reactExports.useRef({});
|
|
15428
15429
|
const mountNodeRef = reactExports.useRef(null);
|
|
15429
15430
|
const modalRef = reactExports.useRef(null);
|
|
15430
|
-
const handleRef = useForkRef(modalRef,
|
|
15431
|
+
const handleRef = useForkRef(modalRef, rootRef);
|
|
15432
|
+
const [exited, setExited] = reactExports.useState(!open);
|
|
15431
15433
|
const hasTransition = getHasTransition(children);
|
|
15432
|
-
|
|
15434
|
+
let ariaHiddenProp = true;
|
|
15435
|
+
if (parameters['aria-hidden'] === 'false' || parameters['aria-hidden'] === false) {
|
|
15436
|
+
ariaHiddenProp = false;
|
|
15437
|
+
}
|
|
15433
15438
|
const getDoc = () => ownerDocument(mountNodeRef.current);
|
|
15434
15439
|
const getModal = () => {
|
|
15435
15440
|
modal.current.modalRef = modalRef.current;
|
|
15436
|
-
modal.current.
|
|
15441
|
+
modal.current.mount = mountNodeRef.current;
|
|
15437
15442
|
return modal.current;
|
|
15438
15443
|
};
|
|
15439
15444
|
const handleMounted = () => {
|
|
@@ -15458,18 +15463,18 @@
|
|
|
15458
15463
|
const isTopModal = reactExports.useCallback(() => manager.isTopModal(getModal()), [manager]);
|
|
15459
15464
|
const handlePortalRef = useEventCallback(node => {
|
|
15460
15465
|
mountNodeRef.current = node;
|
|
15461
|
-
if (!node
|
|
15466
|
+
if (!node) {
|
|
15462
15467
|
return;
|
|
15463
15468
|
}
|
|
15464
15469
|
if (open && isTopModal()) {
|
|
15465
15470
|
handleMounted();
|
|
15466
|
-
} else {
|
|
15471
|
+
} else if (modalRef.current) {
|
|
15467
15472
|
ariaHidden(modalRef.current, ariaHiddenProp);
|
|
15468
15473
|
}
|
|
15469
15474
|
});
|
|
15470
15475
|
const handleClose = reactExports.useCallback(() => {
|
|
15471
15476
|
manager.remove(getModal(), ariaHiddenProp);
|
|
15472
|
-
}, [
|
|
15477
|
+
}, [ariaHiddenProp, manager]);
|
|
15473
15478
|
reactExports.useEffect(() => {
|
|
15474
15479
|
return () => {
|
|
15475
15480
|
handleClose();
|
|
@@ -15482,49 +15487,9 @@
|
|
|
15482
15487
|
handleClose();
|
|
15483
15488
|
}
|
|
15484
15489
|
}, [open, handleClose, hasTransition, closeAfterTransition, handleOpen]);
|
|
15485
|
-
const
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
disableEnforceFocus,
|
|
15489
|
-
disableEscapeKeyDown,
|
|
15490
|
-
disablePortal,
|
|
15491
|
-
disableRestoreFocus,
|
|
15492
|
-
disableScrollLock,
|
|
15493
|
-
exited,
|
|
15494
|
-
hideBackdrop,
|
|
15495
|
-
keepMounted
|
|
15496
|
-
});
|
|
15497
|
-
const classes = useUtilityClasses$k(ownerState);
|
|
15498
|
-
const handleEnter = () => {
|
|
15499
|
-
setExited(false);
|
|
15500
|
-
if (onTransitionEnter) {
|
|
15501
|
-
onTransitionEnter();
|
|
15502
|
-
}
|
|
15503
|
-
};
|
|
15504
|
-
const handleExited = () => {
|
|
15505
|
-
setExited(true);
|
|
15506
|
-
if (onTransitionExited) {
|
|
15507
|
-
onTransitionExited();
|
|
15508
|
-
}
|
|
15509
|
-
if (closeAfterTransition) {
|
|
15510
|
-
handleClose();
|
|
15511
|
-
}
|
|
15512
|
-
};
|
|
15513
|
-
const handleBackdropClick = event => {
|
|
15514
|
-
if (event.target !== event.currentTarget) {
|
|
15515
|
-
return;
|
|
15516
|
-
}
|
|
15517
|
-
if (onBackdropClick) {
|
|
15518
|
-
onBackdropClick(event);
|
|
15519
|
-
}
|
|
15520
|
-
if (onClose) {
|
|
15521
|
-
onClose(event, 'backdropClick');
|
|
15522
|
-
}
|
|
15523
|
-
};
|
|
15524
|
-
const handleKeyDown = event => {
|
|
15525
|
-
if (onKeyDown) {
|
|
15526
|
-
onKeyDown(event);
|
|
15527
|
-
}
|
|
15490
|
+
const createHandleKeyDown = otherHandlers => event => {
|
|
15491
|
+
var _otherHandlers$onKeyD;
|
|
15492
|
+
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event);
|
|
15528
15493
|
|
|
15529
15494
|
// The handler doesn't take event.defaultPrevented into account:
|
|
15530
15495
|
//
|
|
@@ -15543,62 +15508,71 @@
|
|
|
15543
15508
|
}
|
|
15544
15509
|
}
|
|
15545
15510
|
};
|
|
15546
|
-
const
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15511
|
+
const createHandleBackdropClick = otherHandlers => event => {
|
|
15512
|
+
var _otherHandlers$onClic;
|
|
15513
|
+
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event);
|
|
15514
|
+
if (event.target !== event.currentTarget) {
|
|
15515
|
+
return;
|
|
15516
|
+
}
|
|
15517
|
+
if (onClose) {
|
|
15518
|
+
onClose(event, 'backdropClick');
|
|
15519
|
+
}
|
|
15520
|
+
};
|
|
15521
|
+
const getRootProps = (otherHandlers = {}) => {
|
|
15522
|
+
const propsEventHandlers = extractEventHandlers(parameters);
|
|
15550
15523
|
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
});
|
|
15569
|
-
const BackdropComponent = slots.backdrop;
|
|
15570
|
-
const backdropProps = useSlotProps({
|
|
15571
|
-
elementType: BackdropComponent,
|
|
15572
|
-
externalSlotProps: slotProps.backdrop,
|
|
15573
|
-
additionalProps: {
|
|
15574
|
-
'aria-hidden': true,
|
|
15575
|
-
onClick: handleBackdropClick,
|
|
15524
|
+
// The custom event handlers shouldn't be spread on the root element
|
|
15525
|
+
delete propsEventHandlers.onTransitionEnter;
|
|
15526
|
+
delete propsEventHandlers.onTransitionExited;
|
|
15527
|
+
const externalEventHandlers = _extends({}, propsEventHandlers, otherHandlers);
|
|
15528
|
+
return _extends({
|
|
15529
|
+
role: 'presentation'
|
|
15530
|
+
}, externalEventHandlers, {
|
|
15531
|
+
onKeyDown: createHandleKeyDown(externalEventHandlers),
|
|
15532
|
+
ref: handleRef
|
|
15533
|
+
});
|
|
15534
|
+
};
|
|
15535
|
+
const getBackdropProps = (otherHandlers = {}) => {
|
|
15536
|
+
const externalEventHandlers = otherHandlers;
|
|
15537
|
+
return _extends({
|
|
15538
|
+
'aria-hidden': true
|
|
15539
|
+
}, externalEventHandlers, {
|
|
15540
|
+
onClick: createHandleBackdropClick(externalEventHandlers),
|
|
15576
15541
|
open
|
|
15577
|
-
}
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
|
|
15599
|
-
|
|
15600
|
-
|
|
15601
|
-
|
|
15542
|
+
});
|
|
15543
|
+
};
|
|
15544
|
+
const getTransitionProps = () => {
|
|
15545
|
+
const handleEnter = () => {
|
|
15546
|
+
setExited(false);
|
|
15547
|
+
if (onTransitionEnter) {
|
|
15548
|
+
onTransitionEnter();
|
|
15549
|
+
}
|
|
15550
|
+
};
|
|
15551
|
+
const handleExited = () => {
|
|
15552
|
+
setExited(true);
|
|
15553
|
+
if (onTransitionExited) {
|
|
15554
|
+
onTransitionExited();
|
|
15555
|
+
}
|
|
15556
|
+
if (closeAfterTransition) {
|
|
15557
|
+
handleClose();
|
|
15558
|
+
}
|
|
15559
|
+
};
|
|
15560
|
+
return {
|
|
15561
|
+
onEnter: createChainedFunction(handleEnter, children == null ? void 0 : children.props.onEnter),
|
|
15562
|
+
onExited: createChainedFunction(handleExited, children == null ? void 0 : children.props.onExited)
|
|
15563
|
+
};
|
|
15564
|
+
};
|
|
15565
|
+
return {
|
|
15566
|
+
getRootProps,
|
|
15567
|
+
getBackdropProps,
|
|
15568
|
+
getTransitionProps,
|
|
15569
|
+
rootRef: handleRef,
|
|
15570
|
+
portalRef: handlePortalRef,
|
|
15571
|
+
isTopModal,
|
|
15572
|
+
exited,
|
|
15573
|
+
hasTransition
|
|
15574
|
+
};
|
|
15575
|
+
}
|
|
15602
15576
|
|
|
15603
15577
|
const _excluded$v = ["onChange", "maxRows", "minRows", "style", "value"];
|
|
15604
15578
|
function getStyleValue(value) {
|
|
@@ -15723,53 +15697,51 @@
|
|
|
15723
15697
|
if (isEmpty$1(newState)) {
|
|
15724
15698
|
return;
|
|
15725
15699
|
}
|
|
15726
|
-
setState(prevState =>
|
|
15727
|
-
return updateState(prevState, newState);
|
|
15728
|
-
});
|
|
15700
|
+
setState(prevState => updateState(prevState, newState));
|
|
15729
15701
|
}, [getUpdatedState]);
|
|
15730
|
-
|
|
15731
|
-
const
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15702
|
+
useEnhancedEffect$1(() => {
|
|
15703
|
+
const syncHeightWithFlushSync = () => {
|
|
15704
|
+
const newState = getUpdatedState();
|
|
15705
|
+
if (isEmpty$1(newState)) {
|
|
15706
|
+
return;
|
|
15707
|
+
}
|
|
15735
15708
|
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15709
|
+
// In React 18, state updates in a ResizeObserver's callback are happening after
|
|
15710
|
+
// the paint, this leads to an infinite rendering.
|
|
15711
|
+
//
|
|
15712
|
+
// Using flushSync ensures that the states is updated before the next pain.
|
|
15713
|
+
// Related issue - https://github.com/facebook/react/issues/24331
|
|
15714
|
+
reactDomExports.flushSync(() => {
|
|
15715
|
+
setState(prevState => updateState(prevState, newState));
|
|
15742
15716
|
});
|
|
15743
|
-
}
|
|
15744
|
-
|
|
15745
|
-
reactExports.useEffect(() => {
|
|
15746
|
-
const handleResize = debounce$1(() => {
|
|
15717
|
+
};
|
|
15718
|
+
const handleResize = () => {
|
|
15747
15719
|
renders.current = 0;
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
});
|
|
15757
|
-
let resizeObserver;
|
|
15720
|
+
syncHeightWithFlushSync();
|
|
15721
|
+
};
|
|
15722
|
+
// Workaround a "ResizeObserver loop completed with undelivered notifications" error
|
|
15723
|
+
// in test.
|
|
15724
|
+
// Note that we might need to use this logic in production per https://github.com/WICG/resize-observer/issues/38
|
|
15725
|
+
// Also see https://github.com/mui/mui-x/issues/8733
|
|
15726
|
+
let rAF;
|
|
15727
|
+
const debounceHandleResize = debounce$1(handleResize);
|
|
15758
15728
|
const input = inputRef.current;
|
|
15759
15729
|
const containerWindow = ownerWindow(input);
|
|
15760
|
-
containerWindow.addEventListener('resize',
|
|
15730
|
+
containerWindow.addEventListener('resize', debounceHandleResize);
|
|
15731
|
+
let resizeObserver;
|
|
15761
15732
|
if (typeof ResizeObserver !== 'undefined') {
|
|
15762
15733
|
resizeObserver = new ResizeObserver(handleResize);
|
|
15763
15734
|
resizeObserver.observe(input);
|
|
15764
15735
|
}
|
|
15765
15736
|
return () => {
|
|
15766
|
-
|
|
15767
|
-
|
|
15737
|
+
debounceHandleResize.clear();
|
|
15738
|
+
cancelAnimationFrame(rAF);
|
|
15739
|
+
containerWindow.removeEventListener('resize', debounceHandleResize);
|
|
15768
15740
|
if (resizeObserver) {
|
|
15769
15741
|
resizeObserver.disconnect();
|
|
15770
15742
|
}
|
|
15771
15743
|
};
|
|
15772
|
-
});
|
|
15744
|
+
}, [getUpdatedState]);
|
|
15773
15745
|
useEnhancedEffect$1(() => {
|
|
15774
15746
|
syncHeight();
|
|
15775
15747
|
});
|
|
@@ -15956,7 +15928,7 @@
|
|
|
15956
15928
|
} = props;
|
|
15957
15929
|
return [styles.input, ownerState.size === 'small' && styles.inputSizeSmall, ownerState.multiline && styles.inputMultiline, ownerState.type === 'search' && styles.inputTypeSearch, ownerState.startAdornment && styles.inputAdornedStart, ownerState.endAdornment && styles.inputAdornedEnd, ownerState.hiddenLabel && styles.inputHiddenLabel];
|
|
15958
15930
|
};
|
|
15959
|
-
const useUtilityClasses$
|
|
15931
|
+
const useUtilityClasses$k = ownerState => {
|
|
15960
15932
|
const {
|
|
15961
15933
|
classes,
|
|
15962
15934
|
color,
|
|
@@ -15974,7 +15946,7 @@
|
|
|
15974
15946
|
type
|
|
15975
15947
|
} = ownerState;
|
|
15976
15948
|
const slots = {
|
|
15977
|
-
root: ['root', `color${capitalize(color)}`, disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', focused && 'focused', formControl && 'formControl', size
|
|
15949
|
+
root: ['root', `color${capitalize(color)}`, disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', focused && 'focused', formControl && 'formControl', size && size !== 'medium' && `size${capitalize(size)}`, multiline && 'multiline', startAdornment && 'adornedStart', endAdornment && 'adornedEnd', hiddenLabel && 'hiddenLabel', readOnly && 'readOnly'],
|
|
15978
15950
|
input: ['input', disabled && 'disabled', type === 'search' && 'inputTypeSearch', multiline && 'inputMultiline', size === 'small' && 'inputSizeSmall', hiddenLabel && 'inputHiddenLabel', startAdornment && 'inputAdornedStart', endAdornment && 'inputAdornedEnd', readOnly && 'readOnly']
|
|
15979
15951
|
};
|
|
15980
15952
|
return composeClasses(slots, getInputBaseUtilityClass, classes);
|
|
@@ -16282,7 +16254,7 @@
|
|
|
16282
16254
|
if (inputRef.current && event.currentTarget === event.target) {
|
|
16283
16255
|
inputRef.current.focus();
|
|
16284
16256
|
}
|
|
16285
|
-
if (onClick
|
|
16257
|
+
if (onClick) {
|
|
16286
16258
|
onClick(event);
|
|
16287
16259
|
}
|
|
16288
16260
|
};
|
|
@@ -16329,7 +16301,7 @@
|
|
|
16329
16301
|
startAdornment,
|
|
16330
16302
|
type
|
|
16331
16303
|
});
|
|
16332
|
-
const classes = useUtilityClasses$
|
|
16304
|
+
const classes = useUtilityClasses$k(ownerState);
|
|
16333
16305
|
const Root = slots.root || components.Root || InputBaseRoot;
|
|
16334
16306
|
const rootProps = slotProps.root || componentsProps.root || {};
|
|
16335
16307
|
const Input = slots.input || components.Input || InputBaseComponent;
|
|
@@ -16511,7 +16483,7 @@
|
|
|
16511
16483
|
generateUtilityClasses('MuiBackdrop', ['root', 'invisible']);
|
|
16512
16484
|
|
|
16513
16485
|
const _excluded$r = ["children", "className", "component", "components", "componentsProps", "invisible", "open", "slotProps", "slots", "TransitionComponent", "transitionDuration"];
|
|
16514
|
-
const useUtilityClasses$
|
|
16486
|
+
const useUtilityClasses$j = ownerState => {
|
|
16515
16487
|
const {
|
|
16516
16488
|
classes,
|
|
16517
16489
|
invisible
|
|
@@ -16570,7 +16542,7 @@
|
|
|
16570
16542
|
component,
|
|
16571
16543
|
invisible
|
|
16572
16544
|
});
|
|
16573
|
-
const classes = useUtilityClasses$
|
|
16545
|
+
const classes = useUtilityClasses$j(ownerState);
|
|
16574
16546
|
const rootSlotProps = (_slotProps$root = slotProps.root) != null ? _slotProps$root : componentsProps.root;
|
|
16575
16547
|
return /*#__PURE__*/jsxRuntimeExports.jsx(TransitionComponent, _extends$5({
|
|
16576
16548
|
in: open,
|
|
@@ -16601,7 +16573,7 @@
|
|
|
16601
16573
|
const _excluded$q = ["anchorOrigin", "className", "classes", "component", "components", "componentsProps", "children", "overlap", "color", "invisible", "max", "badgeContent", "slots", "slotProps", "showZero", "variant"];
|
|
16602
16574
|
const RADIUS_STANDARD = 10;
|
|
16603
16575
|
const RADIUS_DOT = 4;
|
|
16604
|
-
const useUtilityClasses$
|
|
16576
|
+
const useUtilityClasses$i = ownerState => {
|
|
16605
16577
|
const {
|
|
16606
16578
|
color,
|
|
16607
16579
|
anchorOrigin,
|
|
@@ -16804,7 +16776,7 @@
|
|
|
16804
16776
|
overlap,
|
|
16805
16777
|
variant
|
|
16806
16778
|
});
|
|
16807
|
-
const classes = useUtilityClasses$
|
|
16779
|
+
const classes = useUtilityClasses$i(ownerState);
|
|
16808
16780
|
|
|
16809
16781
|
// support both `slots` and `components` for backward compatibility
|
|
16810
16782
|
const RootSlot = (_ref = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components.Root) != null ? _ref : BadgeRoot;
|
|
@@ -16851,7 +16823,7 @@
|
|
|
16851
16823
|
generateUtilityClasses('PrivateSwitchBase', ['root', 'checked', 'disabled', 'input', 'edgeStart', 'edgeEnd']);
|
|
16852
16824
|
|
|
16853
16825
|
const _excluded$p = ["autoFocus", "checked", "checkedIcon", "className", "defaultChecked", "disabled", "disableFocusRipple", "edge", "icon", "id", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "readOnly", "required", "tabIndex", "type", "value"];
|
|
16854
|
-
const useUtilityClasses$
|
|
16826
|
+
const useUtilityClasses$h = ownerState => {
|
|
16855
16827
|
const {
|
|
16856
16828
|
classes,
|
|
16857
16829
|
checked,
|
|
@@ -16963,7 +16935,7 @@
|
|
|
16963
16935
|
disableFocusRipple,
|
|
16964
16936
|
edge
|
|
16965
16937
|
});
|
|
16966
|
-
const classes = useUtilityClasses$
|
|
16938
|
+
const classes = useUtilityClasses$h(ownerState);
|
|
16967
16939
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(SwitchBaseRoot, _extends$5({
|
|
16968
16940
|
component: "span",
|
|
16969
16941
|
className: clsx(classes.root, className),
|
|
@@ -17018,7 +16990,7 @@
|
|
|
17018
16990
|
var checkboxClasses$1 = checkboxClasses;
|
|
17019
16991
|
|
|
17020
16992
|
const _excluded$o = ["checkedIcon", "color", "icon", "indeterminate", "indeterminateIcon", "inputProps", "size", "className"];
|
|
17021
|
-
const useUtilityClasses$
|
|
16993
|
+
const useUtilityClasses$g = ownerState => {
|
|
17022
16994
|
const {
|
|
17023
16995
|
classes,
|
|
17024
16996
|
indeterminate,
|
|
@@ -17089,7 +17061,7 @@
|
|
|
17089
17061
|
indeterminate,
|
|
17090
17062
|
size
|
|
17091
17063
|
});
|
|
17092
|
-
const classes = useUtilityClasses$
|
|
17064
|
+
const classes = useUtilityClasses$g(ownerState);
|
|
17093
17065
|
return /*#__PURE__*/jsxRuntimeExports.jsx(CheckboxRoot, _extends$5({
|
|
17094
17066
|
type: "checkbox",
|
|
17095
17067
|
inputProps: _extends$5({
|
|
@@ -17147,7 +17119,7 @@
|
|
|
17147
17119
|
stroke-dashoffset: -125px;
|
|
17148
17120
|
}
|
|
17149
17121
|
`));
|
|
17150
|
-
const useUtilityClasses$
|
|
17122
|
+
const useUtilityClasses$f = ownerState => {
|
|
17151
17123
|
const {
|
|
17152
17124
|
classes,
|
|
17153
17125
|
variant,
|
|
@@ -17249,7 +17221,7 @@
|
|
|
17249
17221
|
value,
|
|
17250
17222
|
variant
|
|
17251
17223
|
});
|
|
17252
|
-
const classes = useUtilityClasses$
|
|
17224
|
+
const classes = useUtilityClasses$f(ownerState);
|
|
17253
17225
|
const circleStyle = {};
|
|
17254
17226
|
const rootStyle = {};
|
|
17255
17227
|
const rootProps = {};
|
|
@@ -17289,7 +17261,24 @@
|
|
|
17289
17261
|
});
|
|
17290
17262
|
var CircularProgress$1 = CircularProgress;
|
|
17291
17263
|
|
|
17292
|
-
|
|
17264
|
+
function getModalUtilityClass(slot) {
|
|
17265
|
+
return generateUtilityClass('MuiModal', slot);
|
|
17266
|
+
}
|
|
17267
|
+
generateUtilityClasses('MuiModal', ['root', 'hidden', 'backdrop']);
|
|
17268
|
+
|
|
17269
|
+
const _excluded$m = ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "container", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "onBackdropClick", "onClose", "onTransitionEnter", "onTransitionExited", "open", "slotProps", "slots", "theme"];
|
|
17270
|
+
const useUtilityClasses$e = ownerState => {
|
|
17271
|
+
const {
|
|
17272
|
+
open,
|
|
17273
|
+
exited,
|
|
17274
|
+
classes
|
|
17275
|
+
} = ownerState;
|
|
17276
|
+
const slots = {
|
|
17277
|
+
root: ['root', !open && exited && 'hidden'],
|
|
17278
|
+
backdrop: ['backdrop']
|
|
17279
|
+
};
|
|
17280
|
+
return composeClasses(slots, getModalUtilityClass, classes);
|
|
17281
|
+
};
|
|
17293
17282
|
const ModalRoot = styled$1('div', {
|
|
17294
17283
|
name: 'MuiModal',
|
|
17295
17284
|
slot: 'Root',
|
|
@@ -17344,7 +17333,6 @@
|
|
|
17344
17333
|
const {
|
|
17345
17334
|
BackdropComponent = ModalBackdrop,
|
|
17346
17335
|
BackdropProps,
|
|
17347
|
-
classes,
|
|
17348
17336
|
className,
|
|
17349
17337
|
closeAfterTransition = false,
|
|
17350
17338
|
children,
|
|
@@ -17361,17 +17349,13 @@
|
|
|
17361
17349
|
hideBackdrop = false,
|
|
17362
17350
|
keepMounted = false,
|
|
17363
17351
|
onBackdropClick,
|
|
17364
|
-
onClose,
|
|
17365
17352
|
open,
|
|
17366
17353
|
slotProps,
|
|
17367
|
-
slots
|
|
17354
|
+
slots
|
|
17368
17355
|
// eslint-disable-next-line react/prop-types
|
|
17369
|
-
theme
|
|
17370
17356
|
} = props,
|
|
17371
17357
|
other = _objectWithoutPropertiesLoose$3(props, _excluded$m);
|
|
17372
|
-
const
|
|
17373
|
-
const commonProps = {
|
|
17374
|
-
container,
|
|
17358
|
+
const propsWithDefaults = _extends$5({}, props, {
|
|
17375
17359
|
closeAfterTransition,
|
|
17376
17360
|
disableAutoFocus,
|
|
17377
17361
|
disableEnforceFocus,
|
|
@@ -17380,40 +17364,90 @@
|
|
|
17380
17364
|
disableRestoreFocus,
|
|
17381
17365
|
disableScrollLock,
|
|
17382
17366
|
hideBackdrop,
|
|
17383
|
-
keepMounted
|
|
17384
|
-
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17367
|
+
keepMounted
|
|
17368
|
+
});
|
|
17369
|
+
const {
|
|
17370
|
+
getRootProps,
|
|
17371
|
+
getBackdropProps,
|
|
17372
|
+
getTransitionProps,
|
|
17373
|
+
portalRef,
|
|
17374
|
+
isTopModal,
|
|
17375
|
+
exited,
|
|
17376
|
+
hasTransition
|
|
17377
|
+
} = useModal(_extends$5({}, propsWithDefaults, {
|
|
17378
|
+
rootRef: ref
|
|
17379
|
+
}));
|
|
17380
|
+
const ownerState = _extends$5({}, propsWithDefaults, {
|
|
17389
17381
|
exited
|
|
17390
17382
|
});
|
|
17383
|
+
const classes = useUtilityClasses$e(ownerState);
|
|
17384
|
+
const childProps = {};
|
|
17385
|
+
if (children.props.tabIndex === undefined) {
|
|
17386
|
+
childProps.tabIndex = '-1';
|
|
17387
|
+
}
|
|
17388
|
+
|
|
17389
|
+
// It's a Transition like component
|
|
17390
|
+
if (hasTransition) {
|
|
17391
|
+
const {
|
|
17392
|
+
onEnter,
|
|
17393
|
+
onExited
|
|
17394
|
+
} = getTransitionProps();
|
|
17395
|
+
childProps.onEnter = onEnter;
|
|
17396
|
+
childProps.onExited = onExited;
|
|
17397
|
+
}
|
|
17391
17398
|
const RootSlot = (_ref = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components.Root) != null ? _ref : ModalRoot;
|
|
17392
17399
|
const BackdropSlot = (_ref2 = (_slots$backdrop = slots == null ? void 0 : slots.backdrop) != null ? _slots$backdrop : components.Backdrop) != null ? _ref2 : BackdropComponent;
|
|
17393
17400
|
const rootSlotProps = (_slotProps$root = slotProps == null ? void 0 : slotProps.root) != null ? _slotProps$root : componentsProps.root;
|
|
17394
17401
|
const backdropSlotProps = (_slotProps$backdrop = slotProps == null ? void 0 : slotProps.backdrop) != null ? _slotProps$backdrop : componentsProps.backdrop;
|
|
17395
|
-
|
|
17396
|
-
|
|
17397
|
-
|
|
17398
|
-
|
|
17402
|
+
const rootProps = useSlotProps({
|
|
17403
|
+
elementType: RootSlot,
|
|
17404
|
+
externalSlotProps: rootSlotProps,
|
|
17405
|
+
externalForwardedProps: other,
|
|
17406
|
+
getSlotProps: getRootProps,
|
|
17407
|
+
additionalProps: {
|
|
17408
|
+
ref,
|
|
17409
|
+
as: component
|
|
17399
17410
|
},
|
|
17400
|
-
|
|
17401
|
-
|
|
17402
|
-
|
|
17403
|
-
|
|
17404
|
-
|
|
17405
|
-
|
|
17406
|
-
|
|
17407
|
-
|
|
17408
|
-
|
|
17409
|
-
|
|
17411
|
+
ownerState,
|
|
17412
|
+
className: clsx(className, rootSlotProps == null ? void 0 : rootSlotProps.className, classes == null ? void 0 : classes.root, !ownerState.open && ownerState.exited && (classes == null ? void 0 : classes.hidden))
|
|
17413
|
+
});
|
|
17414
|
+
const backdropProps = useSlotProps({
|
|
17415
|
+
elementType: BackdropSlot,
|
|
17416
|
+
externalSlotProps: backdropSlotProps,
|
|
17417
|
+
additionalProps: BackdropProps,
|
|
17418
|
+
getSlotProps: otherHandlers => {
|
|
17419
|
+
return getBackdropProps(_extends$5({}, otherHandlers, {
|
|
17420
|
+
onClick: e => {
|
|
17421
|
+
if (onBackdropClick) {
|
|
17422
|
+
onBackdropClick(e);
|
|
17423
|
+
}
|
|
17424
|
+
if (otherHandlers != null && otherHandlers.onClick) {
|
|
17425
|
+
otherHandlers.onClick(e);
|
|
17426
|
+
}
|
|
17427
|
+
}
|
|
17428
|
+
}));
|
|
17410
17429
|
},
|
|
17411
|
-
|
|
17412
|
-
|
|
17413
|
-
|
|
17414
|
-
|
|
17415
|
-
|
|
17416
|
-
}
|
|
17430
|
+
className: clsx(backdropSlotProps == null ? void 0 : backdropSlotProps.className, BackdropProps == null ? void 0 : BackdropProps.className, classes == null ? void 0 : classes.backdrop),
|
|
17431
|
+
ownerState
|
|
17432
|
+
});
|
|
17433
|
+
if (!keepMounted && !open && (!hasTransition || exited)) {
|
|
17434
|
+
return null;
|
|
17435
|
+
}
|
|
17436
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(Portal, {
|
|
17437
|
+
ref: portalRef,
|
|
17438
|
+
container: container,
|
|
17439
|
+
disablePortal: disablePortal,
|
|
17440
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsxs(RootSlot, _extends$5({}, rootProps, {
|
|
17441
|
+
children: [!hideBackdrop && BackdropComponent ? /*#__PURE__*/jsxRuntimeExports.jsx(BackdropSlot, _extends$5({}, backdropProps)) : null, /*#__PURE__*/jsxRuntimeExports.jsx(FocusTrap, {
|
|
17442
|
+
disableEnforceFocus: disableEnforceFocus,
|
|
17443
|
+
disableAutoFocus: disableAutoFocus,
|
|
17444
|
+
disableRestoreFocus: disableRestoreFocus,
|
|
17445
|
+
isEnabled: isTopModal,
|
|
17446
|
+
open: open,
|
|
17447
|
+
children: /*#__PURE__*/reactExports.cloneElement(children, childProps)
|
|
17448
|
+
})]
|
|
17449
|
+
}))
|
|
17450
|
+
});
|
|
17417
17451
|
});
|
|
17418
17452
|
var Modal$1 = Modal;
|
|
17419
17453
|
|
|
@@ -19248,7 +19282,7 @@
|
|
|
19248
19282
|
generateUtilityClasses('MuiPopover', ['root', 'paper']);
|
|
19249
19283
|
|
|
19250
19284
|
const _excluded$a = ["onEntering"],
|
|
19251
|
-
_excluded2$1 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "slots", "slotProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps"],
|
|
19285
|
+
_excluded2$1 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "slots", "slotProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps", "disableScrollLock"],
|
|
19252
19286
|
_excluded3 = ["slotProps"];
|
|
19253
19287
|
function getOffsetTop(rect, vertical) {
|
|
19254
19288
|
let offset = 0;
|
|
@@ -19342,7 +19376,8 @@
|
|
|
19342
19376
|
transitionDuration: transitionDurationProp = 'auto',
|
|
19343
19377
|
TransitionProps: {
|
|
19344
19378
|
onEntering
|
|
19345
|
-
} = {}
|
|
19379
|
+
} = {},
|
|
19380
|
+
disableScrollLock = false
|
|
19346
19381
|
} = props,
|
|
19347
19382
|
TransitionProps = _objectWithoutPropertiesLoose$3(props.TransitionProps, _excluded$a),
|
|
19348
19383
|
other = _objectWithoutPropertiesLoose$3(props, _excluded2$1);
|
|
@@ -19419,18 +19454,18 @@
|
|
|
19419
19454
|
const widthThreshold = containerWindow.innerWidth - marginThreshold;
|
|
19420
19455
|
|
|
19421
19456
|
// Check if the vertical axis needs shifting
|
|
19422
|
-
if (top < marginThreshold) {
|
|
19457
|
+
if (marginThreshold !== null && top < marginThreshold) {
|
|
19423
19458
|
const diff = top - marginThreshold;
|
|
19424
19459
|
top -= diff;
|
|
19425
19460
|
elemTransformOrigin.vertical += diff;
|
|
19426
|
-
} else if (bottom > heightThreshold) {
|
|
19461
|
+
} else if (marginThreshold !== null && bottom > heightThreshold) {
|
|
19427
19462
|
const diff = bottom - heightThreshold;
|
|
19428
19463
|
top -= diff;
|
|
19429
19464
|
elemTransformOrigin.vertical += diff;
|
|
19430
19465
|
}
|
|
19431
19466
|
|
|
19432
19467
|
// Check if the horizontal axis needs shifting
|
|
19433
|
-
if (left < marginThreshold) {
|
|
19468
|
+
if (marginThreshold !== null && left < marginThreshold) {
|
|
19434
19469
|
const diff = left - marginThreshold;
|
|
19435
19470
|
left -= diff;
|
|
19436
19471
|
elemTransformOrigin.horizontal += diff;
|
|
@@ -19461,6 +19496,12 @@
|
|
|
19461
19496
|
element.style.transformOrigin = positioning.transformOrigin;
|
|
19462
19497
|
setIsPositioned(true);
|
|
19463
19498
|
}, [getPositioningStyle]);
|
|
19499
|
+
reactExports.useEffect(() => {
|
|
19500
|
+
if (disableScrollLock) {
|
|
19501
|
+
window.addEventListener('scroll', setPositioningStyles);
|
|
19502
|
+
}
|
|
19503
|
+
return () => window.removeEventListener('scroll', setPositioningStyles);
|
|
19504
|
+
}, [anchorEl, disableScrollLock, setPositioningStyles]);
|
|
19464
19505
|
const handleEntering = (element, isAppearing) => {
|
|
19465
19506
|
if (onEntering) {
|
|
19466
19507
|
onEntering(element, isAppearing);
|
|
@@ -19541,7 +19582,8 @@
|
|
|
19541
19582
|
} = _useSlotProps,
|
|
19542
19583
|
rootProps = _objectWithoutPropertiesLoose$3(_useSlotProps, _excluded3);
|
|
19543
19584
|
return /*#__PURE__*/jsxRuntimeExports.jsx(RootSlot, _extends$5({}, rootProps, !isHostComponent(RootSlot) && {
|
|
19544
|
-
slotProps: rootSlotPropsProp
|
|
19585
|
+
slotProps: rootSlotPropsProp,
|
|
19586
|
+
disableScrollLock
|
|
19545
19587
|
}, {
|
|
19546
19588
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(TransitionComponent, _extends$5({
|
|
19547
19589
|
appear: true,
|
|
@@ -20069,17 +20111,18 @@
|
|
|
20069
20111
|
function getRadioUtilityClass(slot) {
|
|
20070
20112
|
return generateUtilityClass('MuiRadio', slot);
|
|
20071
20113
|
}
|
|
20072
|
-
const radioClasses = generateUtilityClasses('MuiRadio', ['root', 'checked', 'disabled', 'colorPrimary', 'colorSecondary']);
|
|
20114
|
+
const radioClasses = generateUtilityClasses('MuiRadio', ['root', 'checked', 'disabled', 'colorPrimary', 'colorSecondary', 'sizeSmall']);
|
|
20073
20115
|
var radioClasses$1 = radioClasses;
|
|
20074
20116
|
|
|
20075
20117
|
const _excluded$6 = ["checked", "checkedIcon", "color", "icon", "name", "onChange", "size", "className"];
|
|
20076
20118
|
const useUtilityClasses$1 = ownerState => {
|
|
20077
20119
|
const {
|
|
20078
20120
|
classes,
|
|
20079
|
-
color
|
|
20121
|
+
color,
|
|
20122
|
+
size
|
|
20080
20123
|
} = ownerState;
|
|
20081
20124
|
const slots = {
|
|
20082
|
-
root: ['root', `color${capitalize(color)}`]
|
|
20125
|
+
root: ['root', `color${capitalize(color)}`, size !== 'medium' && `size${capitalize(size)}`]
|
|
20083
20126
|
};
|
|
20084
20127
|
return _extends$5({}, classes, composeClasses(slots, getRadioUtilityClass, classes));
|
|
20085
20128
|
};
|
|
@@ -21855,6 +21898,9 @@
|
|
|
21855
21898
|
const barPadPx = 4;
|
|
21856
21899
|
const barBorderWidthPx = 1;
|
|
21857
21900
|
const barWithCheckboxLeftPadPx = 29;
|
|
21901
|
+
const GRID_ROW_HEIGHT = 32;
|
|
21902
|
+
const LIST_ROW_HEIGHT = 29;
|
|
21903
|
+
const DENSE_ROW_HEIGHT = 20; // same for both list and grid in dense mode
|
|
21858
21904
|
|
|
21859
21905
|
const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
|
|
21860
21906
|
const getBarWidth = _ref => {
|
|
@@ -22696,13 +22742,13 @@
|
|
|
22696
22742
|
const getElementIndex = currentTarget => +currentTarget.getAttribute('data-n');
|
|
22697
22743
|
const focusSearch = container => {
|
|
22698
22744
|
const searchField = container === null || container === void 0 ? void 0 : container.querySelector('.search input');
|
|
22699
|
-
searchField === null || searchField === void 0
|
|
22745
|
+
searchField === null || searchField === void 0 || searchField.focus();
|
|
22700
22746
|
return searchField;
|
|
22701
22747
|
};
|
|
22702
22748
|
const focusRow = container => {
|
|
22703
22749
|
const row = container === null || container === void 0 ? void 0 : container.querySelector('.value.last-focused, .value.selector, .value');
|
|
22704
|
-
row === null || row === void 0
|
|
22705
|
-
row === null || row === void 0
|
|
22750
|
+
row === null || row === void 0 || row.setAttribute('tabIndex', 0);
|
|
22751
|
+
row === null || row === void 0 || row.focus();
|
|
22706
22752
|
return row;
|
|
22707
22753
|
};
|
|
22708
22754
|
|
|
@@ -22884,18 +22930,18 @@
|
|
|
22884
22930
|
case KEYS.HOME:
|
|
22885
22931
|
focusListItems.setFirst(true);
|
|
22886
22932
|
if (ctrlKey) {
|
|
22887
|
-
setScrollPosition === null || setScrollPosition === void 0
|
|
22933
|
+
setScrollPosition === null || setScrollPosition === void 0 || setScrollPosition('overflowStart');
|
|
22888
22934
|
break;
|
|
22889
22935
|
}
|
|
22890
|
-
setScrollPosition === null || setScrollPosition === void 0
|
|
22936
|
+
setScrollPosition === null || setScrollPosition === void 0 || setScrollPosition('start');
|
|
22891
22937
|
break;
|
|
22892
22938
|
case KEYS.END:
|
|
22893
22939
|
focusListItems.setLast(true);
|
|
22894
22940
|
if (ctrlKey) {
|
|
22895
|
-
setScrollPosition === null || setScrollPosition === void 0
|
|
22941
|
+
setScrollPosition === null || setScrollPosition === void 0 || setScrollPosition('overflowEnd');
|
|
22896
22942
|
break;
|
|
22897
22943
|
}
|
|
22898
|
-
setScrollPosition === null || setScrollPosition === void 0
|
|
22944
|
+
setScrollPosition === null || setScrollPosition === void 0 || setScrollPosition('end');
|
|
22899
22945
|
break;
|
|
22900
22946
|
case KEYS.A:
|
|
22901
22947
|
if (ctrlKey || metaKey) {
|
|
@@ -25076,9 +25122,8 @@
|
|
|
25076
25122
|
let rowCount;
|
|
25077
25123
|
const isGridMode = dataLayout === 'grid';
|
|
25078
25124
|
const itemPadding = 4;
|
|
25079
|
-
const
|
|
25080
|
-
|
|
25081
|
-
let itemHeight = dense ? denseItemHeight : normalItemHeight;
|
|
25125
|
+
const normalItemHeight = isGridMode ? GRID_ROW_HEIGHT : LIST_ROW_HEIGHT;
|
|
25126
|
+
let itemHeight = dense ? DENSE_ROW_HEIGHT : normalItemHeight;
|
|
25082
25127
|
if (isGridMode) {
|
|
25083
25128
|
// Emulate a margin between items using padding, since the list library
|
|
25084
25129
|
// needs an explicit row height and cannot handle margins.
|
|
@@ -25656,7 +25701,7 @@
|
|
|
25656
25701
|
const cardinal = layout === null || layout === void 0 ? void 0 : layout.qListObject.qDimensionInfo.qCardinal;
|
|
25657
25702
|
if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages.length && !awaitingFrequencyMax || cardinal === 0) {
|
|
25658
25703
|
// All necessary data fetching done - signal rendering done!
|
|
25659
|
-
renderedCallback === null || renderedCallback === void 0
|
|
25704
|
+
renderedCallback === null || renderedCallback === void 0 || renderedCallback();
|
|
25660
25705
|
}
|
|
25661
25706
|
const isItemLoaded = reactExports.useCallback(index => {
|
|
25662
25707
|
if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
|
|
@@ -26409,7 +26454,7 @@
|
|
|
26409
26454
|
actionsRefMock = null,
|
|
26410
26455
|
// for testing
|
|
26411
26456
|
direction = 'ltr',
|
|
26412
|
-
autoConfirm
|
|
26457
|
+
autoConfirm = false
|
|
26413
26458
|
} = _ref3;
|
|
26414
26459
|
const defaultSelectionActions = useDefaultSelectionActions(selections);
|
|
26415
26460
|
const {
|
|
@@ -26456,14 +26501,7 @@
|
|
|
26456
26501
|
focusHandler.on('focus_toolbar_last', focusLast);
|
|
26457
26502
|
}, []);
|
|
26458
26503
|
if (autoConfirm) {
|
|
26459
|
-
|
|
26460
|
-
if (canConfirm) {
|
|
26461
|
-
const confirm = defaultSelectionActions.find(o => o.key === 'confirm') || {
|
|
26462
|
-
action: () => {}
|
|
26463
|
-
};
|
|
26464
|
-
confirm.action();
|
|
26465
|
-
}
|
|
26466
|
-
return null;
|
|
26504
|
+
return undefined;
|
|
26467
26505
|
}
|
|
26468
26506
|
let moreEnabled = more$1.enabled;
|
|
26469
26507
|
let moreActions = more$1.actions;
|
|
@@ -26540,13 +26578,15 @@
|
|
|
26540
26578
|
transformOrigin: popoverTransformOrigin,
|
|
26541
26579
|
hideBackdrop: true,
|
|
26542
26580
|
style: popoverStyle,
|
|
26543
|
-
|
|
26544
|
-
|
|
26545
|
-
|
|
26546
|
-
|
|
26547
|
-
|
|
26548
|
-
|
|
26549
|
-
|
|
26581
|
+
slotProps: {
|
|
26582
|
+
paper: {
|
|
26583
|
+
id: 'njs-action-toolbar-popover',
|
|
26584
|
+
'data-testid': 'njs-action-toolbar-popover',
|
|
26585
|
+
className: ActionToolbarElement.className,
|
|
26586
|
+
style: {
|
|
26587
|
+
pointerEvents: 'auto',
|
|
26588
|
+
padding: theme.spacing(0.5, 0.25)
|
|
26589
|
+
}
|
|
26550
26590
|
}
|
|
26551
26591
|
}
|
|
26552
26592
|
}, Actions) : show && Actions;
|
|
@@ -26677,7 +26717,7 @@
|
|
|
26677
26717
|
function focusRow(container) {
|
|
26678
26718
|
const row = (container === null || container === void 0 ? void 0 : container.querySelector('.last-focused')) || (container === null || container === void 0 ? void 0 : container.querySelector('[role="row"]:first-child'));
|
|
26679
26719
|
row.setAttribute('tabIndex', 0);
|
|
26680
|
-
row === null || row === void 0
|
|
26720
|
+
row === null || row === void 0 || row.focus();
|
|
26681
26721
|
}
|
|
26682
26722
|
const onKeyDown = async e => {
|
|
26683
26723
|
const {
|
|
@@ -26703,7 +26743,7 @@
|
|
|
26703
26743
|
focusRow(container);
|
|
26704
26744
|
|
|
26705
26745
|
// Clean up.
|
|
26706
|
-
container === null || container === void 0
|
|
26746
|
+
container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
|
|
26707
26747
|
elm.classList.remove('last-focused');
|
|
26708
26748
|
});
|
|
26709
26749
|
}
|
|
@@ -27012,12 +27052,12 @@
|
|
|
27012
27052
|
activateClickOut() {
|
|
27013
27053
|
var _options$onSelectionA;
|
|
27014
27054
|
document.addEventListener('mousedown', handler);
|
|
27015
|
-
options === null || options === void 0 || (_options$onSelectionA = options.onSelectionActivated) === null || _options$onSelectionA === void 0
|
|
27055
|
+
options === null || options === void 0 || (_options$onSelectionA = options.onSelectionActivated) === null || _options$onSelectionA === void 0 || _options$onSelectionA.call(options);
|
|
27016
27056
|
},
|
|
27017
27057
|
deactivateClickOut() {
|
|
27018
27058
|
var _options$onSelectionD;
|
|
27019
27059
|
document.removeEventListener('mousedown', handler);
|
|
27020
|
-
options === null || options === void 0 || (_options$onSelectionD = options.onSelectionDeactivated) === null || _options$onSelectionD === void 0
|
|
27060
|
+
options === null || options === void 0 || (_options$onSelectionD = options.onSelectionDeactivated) === null || _options$onSelectionD === void 0 || _options$onSelectionD.call(options);
|
|
27021
27061
|
}
|
|
27022
27062
|
};
|
|
27023
27063
|
};
|
|
@@ -27142,7 +27182,7 @@
|
|
|
27142
27182
|
if (selected && !additive) {
|
|
27143
27183
|
state.itemStates[elementNumber] = false;
|
|
27144
27184
|
} else if (!selected) {
|
|
27145
|
-
selectedValues === null || selectedValues === void 0
|
|
27185
|
+
selectedValues === null || selectedValues === void 0 || selectedValues.push(elementNumber);
|
|
27146
27186
|
state.itemStates[elementNumber] = true;
|
|
27147
27187
|
}
|
|
27148
27188
|
},
|
|
@@ -27282,7 +27322,7 @@
|
|
|
27282
27322
|
});
|
|
27283
27323
|
const onCtrlF = () => {
|
|
27284
27324
|
const input = searchContainerRef.current.querySelector('input');
|
|
27285
|
-
input === null || input === void 0
|
|
27325
|
+
input === null || input === void 0 || input.focus();
|
|
27286
27326
|
};
|
|
27287
27327
|
const hasSelections$1 = hasSelections(layout);
|
|
27288
27328
|
return /*#__PURE__*/React.createElement(Popover$1, {
|
|
@@ -28535,12 +28575,12 @@
|
|
|
28535
28575
|
var DrillDownIcon = (props => SvgIcon(drillDown(props)));
|
|
28536
28576
|
|
|
28537
28577
|
function removeInnnerTabStops(container) {
|
|
28538
|
-
container === null || container === void 0
|
|
28578
|
+
container === null || container === void 0 || container.querySelectorAll('[tabIndex="0"]').forEach(elm => {
|
|
28539
28579
|
elm.setAttribute('tabIndex', -1);
|
|
28540
28580
|
});
|
|
28541
28581
|
}
|
|
28542
28582
|
function removeLastFocused(container) {
|
|
28543
|
-
container === null || container === void 0
|
|
28583
|
+
container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
|
|
28544
28584
|
elm.classList.remove('last-focused');
|
|
28545
28585
|
});
|
|
28546
28586
|
}
|
|
@@ -28588,13 +28628,13 @@
|
|
|
28588
28628
|
const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
|
|
28589
28629
|
const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
|
|
28590
28630
|
const elementToFocus = searchField || lastSelectedRow || firstRowElement || confirmButton;
|
|
28591
|
-
elementToFocus === null || elementToFocus === void 0
|
|
28592
|
-
elementToFocus === null || elementToFocus === void 0
|
|
28631
|
+
elementToFocus === null || elementToFocus === void 0 || elementToFocus.setAttribute('tabIndex', 0);
|
|
28632
|
+
elementToFocus === null || elementToFocus === void 0 || elementToFocus.focus();
|
|
28593
28633
|
},
|
|
28594
28634
|
focusSelection() {
|
|
28595
28635
|
const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
|
|
28596
|
-
confirmButton === null || confirmButton === void 0
|
|
28597
|
-
confirmButton === null || confirmButton === void 0
|
|
28636
|
+
confirmButton === null || confirmButton === void 0 || confirmButton.setAttribute('tabIndex', 0);
|
|
28637
|
+
confirmButton === null || confirmButton === void 0 || confirmButton.focus();
|
|
28598
28638
|
}
|
|
28599
28639
|
};
|
|
28600
28640
|
return keyboard;
|
|
@@ -28636,7 +28676,7 @@
|
|
|
28636
28676
|
keyboard.blur();
|
|
28637
28677
|
const c = currentTarget.closest('.listbox-container');
|
|
28638
28678
|
c.setAttribute('tabIndex', -1);
|
|
28639
|
-
c === null || c === void 0
|
|
28679
|
+
c === null || c === void 0 || c.focus();
|
|
28640
28680
|
}
|
|
28641
28681
|
};
|
|
28642
28682
|
const handleKeyDown = event => {
|
|
@@ -28799,11 +28839,9 @@
|
|
|
28799
28839
|
isLocked,
|
|
28800
28840
|
listboxSelectionToolbarItems,
|
|
28801
28841
|
selections,
|
|
28802
|
-
keyboard
|
|
28803
|
-
autoConfirm
|
|
28842
|
+
keyboard
|
|
28804
28843
|
} = _ref;
|
|
28805
28844
|
return {
|
|
28806
|
-
autoConfirm,
|
|
28807
28845
|
show: showToolbar && !isDetached,
|
|
28808
28846
|
popover: {
|
|
28809
28847
|
show: showToolbar && isDetached,
|
|
@@ -28824,10 +28862,10 @@
|
|
|
28824
28862
|
show: showToolbar,
|
|
28825
28863
|
api: selections,
|
|
28826
28864
|
onConfirm: () => {
|
|
28827
|
-
keyboard === null || keyboard === void 0
|
|
28865
|
+
keyboard === null || keyboard === void 0 || keyboard.focus();
|
|
28828
28866
|
},
|
|
28829
28867
|
onCancel: () => {
|
|
28830
|
-
keyboard === null || keyboard === void 0
|
|
28868
|
+
keyboard === null || keyboard === void 0 || keyboard.focus();
|
|
28831
28869
|
}
|
|
28832
28870
|
}
|
|
28833
28871
|
};
|
|
@@ -29109,10 +29147,6 @@
|
|
|
29109
29147
|
const showSearchToggle = search === 'toggle' && showSearch;
|
|
29110
29148
|
const searchVisible = (search === true || showSearchToggle) && !selectDisabled() && searchEnabled !== false;
|
|
29111
29149
|
const dense = (_layoutOptions$dense = layoutOptions.dense) !== null && _layoutOptions$dense !== void 0 ? _layoutOptions$dense : false;
|
|
29112
|
-
const searchHeight = dense ? 27 : 40;
|
|
29113
|
-
const extraheight = dense ? 39 : 49;
|
|
29114
|
-
const searchAddHeight = searchVisible ? searchHeight : 0;
|
|
29115
|
-
const minHeight = showToolbarWithTitle ? 49 + searchAddHeight + extraheight : 0;
|
|
29116
29150
|
const headerHeight = 32;
|
|
29117
29151
|
const onShowSearch = () => {
|
|
29118
29152
|
const newValue = !showSearch;
|
|
@@ -29123,17 +29157,18 @@
|
|
|
29123
29157
|
onShowSearch();
|
|
29124
29158
|
} else {
|
|
29125
29159
|
const input = searchContainer.current.querySelector('input');
|
|
29126
|
-
input === null || input === void 0
|
|
29160
|
+
input === null || input === void 0 || input.focus();
|
|
29127
29161
|
}
|
|
29128
29162
|
};
|
|
29129
|
-
const getActionToolbarProps = isDetached => getListboxActionProps({
|
|
29163
|
+
const getActionToolbarProps = isDetached => _objectSpread2(_objectSpread2({}, getListboxActionProps({
|
|
29130
29164
|
isDetached: isPopover ? false : isDetached,
|
|
29131
29165
|
showToolbar,
|
|
29132
29166
|
containerRef,
|
|
29133
29167
|
isLocked,
|
|
29134
29168
|
listboxSelectionToolbarItems,
|
|
29135
29169
|
selections,
|
|
29136
|
-
keyboard
|
|
29170
|
+
keyboard
|
|
29171
|
+
})), {}, {
|
|
29137
29172
|
autoConfirm
|
|
29138
29173
|
});
|
|
29139
29174
|
const shouldAutoFocus = searchVisible && search === 'toggle';
|
|
@@ -29181,7 +29216,7 @@
|
|
|
29181
29216
|
}
|
|
29182
29217
|
}));
|
|
29183
29218
|
if (isInvalid) {
|
|
29184
|
-
renderedCallback === null || renderedCallback === void 0
|
|
29219
|
+
renderedCallback === null || renderedCallback === void 0 || renderedCallback();
|
|
29185
29220
|
}
|
|
29186
29221
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showDetachedToolbarOnly && /*#__PURE__*/React.createElement(ActionsToolbar, _extends$7({
|
|
29187
29222
|
direction: direction
|
|
@@ -29194,7 +29229,6 @@
|
|
|
29194
29229
|
containerPadding: containerPadding,
|
|
29195
29230
|
style: {
|
|
29196
29231
|
height: '100%',
|
|
29197
|
-
minHeight: "".concat(minHeight, "px"),
|
|
29198
29232
|
flexFlow: 'column nowrap'
|
|
29199
29233
|
},
|
|
29200
29234
|
onKeyDown: handleKeyDown,
|
|
@@ -29249,7 +29283,7 @@
|
|
|
29249
29283
|
direction: "column",
|
|
29250
29284
|
style: {
|
|
29251
29285
|
height: '100%',
|
|
29252
|
-
minHeight:
|
|
29286
|
+
minHeight: DENSE_ROW_HEIGHT + SCROLL_BAR_WIDTH
|
|
29253
29287
|
},
|
|
29254
29288
|
role: "region",
|
|
29255
29289
|
"aria-label": translator.get('Listbox.ResultFilterLabel')
|
|
@@ -29464,7 +29498,7 @@
|
|
|
29464
29498
|
*/
|
|
29465
29499
|
wildCardSearch: false,
|
|
29466
29500
|
/**
|
|
29467
|
-
* Automatically confirm selections without showing the selections toolbar.
|
|
29501
|
+
* Automatically confirm selections when clicking outside a listbox, without showing the selections toolbar.
|
|
29468
29502
|
* @type {boolean=}
|
|
29469
29503
|
* @default
|
|
29470
29504
|
*/
|
|
@@ -31000,17 +31034,26 @@
|
|
|
31000
31034
|
halo,
|
|
31001
31035
|
model,
|
|
31002
31036
|
cellRef,
|
|
31003
|
-
newType
|
|
31037
|
+
newType,
|
|
31038
|
+
properties
|
|
31004
31039
|
} = _ref2;
|
|
31005
|
-
const propertyTree =
|
|
31040
|
+
const propertyTree = properties ? {
|
|
31041
|
+
qProperty: properties
|
|
31042
|
+
} : await model.getFullPropertyTree();
|
|
31006
31043
|
const sourceQae = cellRef.current.getQae();
|
|
31007
31044
|
const exportProperties = getExportPropertiesFnc(sourceQae);
|
|
31045
|
+
if (!exportProperties) {
|
|
31046
|
+
throw new Error('Source chart does not support conversion');
|
|
31047
|
+
}
|
|
31008
31048
|
const targetSnType = await getType$1({
|
|
31009
31049
|
halo,
|
|
31010
31050
|
name: newType
|
|
31011
31051
|
});
|
|
31012
31052
|
const targetQae = targetSnType.qae;
|
|
31013
31053
|
const importProperties = getImportPropertiesFnc(targetQae);
|
|
31054
|
+
if (!importProperties) {
|
|
31055
|
+
throw new Error('Target chart does not support conversion');
|
|
31056
|
+
}
|
|
31014
31057
|
const exportFormat = exportProperties({
|
|
31015
31058
|
propertyTree,
|
|
31016
31059
|
hypercubePath: helpers.getHypercubePath(sourceQae)
|
|
@@ -32082,7 +32125,8 @@
|
|
|
32082
32125
|
selections,
|
|
32083
32126
|
nebbie,
|
|
32084
32127
|
focusHandler,
|
|
32085
|
-
emitter
|
|
32128
|
+
emitter,
|
|
32129
|
+
onMount
|
|
32086
32130
|
} = _ref5;
|
|
32087
32131
|
try {
|
|
32088
32132
|
const snType = await getType({
|
|
@@ -32098,7 +32142,14 @@
|
|
|
32098
32142
|
focusHandler,
|
|
32099
32143
|
emitter
|
|
32100
32144
|
});
|
|
32101
|
-
|
|
32145
|
+
if (sn) {
|
|
32146
|
+
dispatch({
|
|
32147
|
+
type: 'LOADED',
|
|
32148
|
+
sn,
|
|
32149
|
+
visualization
|
|
32150
|
+
});
|
|
32151
|
+
onMount();
|
|
32152
|
+
}
|
|
32102
32153
|
} catch (err) {
|
|
32103
32154
|
if (!version) {
|
|
32104
32155
|
dispatch({
|
|
@@ -32115,8 +32166,8 @@
|
|
|
32115
32166
|
}
|
|
32116
32167
|
});
|
|
32117
32168
|
}
|
|
32169
|
+
onMount();
|
|
32118
32170
|
}
|
|
32119
|
-
return undefined;
|
|
32120
32171
|
};
|
|
32121
32172
|
const Cell = reactExports.forwardRef((_ref6, ref) => {
|
|
32122
32173
|
let {
|
|
@@ -32222,7 +32273,12 @@
|
|
|
32222
32273
|
}
|
|
32223
32274
|
};
|
|
32224
32275
|
reactExports.useEffect(() => {
|
|
32225
|
-
if (initialError
|
|
32276
|
+
if (initialError) {
|
|
32277
|
+
// To resolve the Viz promise for missing types
|
|
32278
|
+
onMount();
|
|
32279
|
+
return undefined;
|
|
32280
|
+
}
|
|
32281
|
+
if (!appLayout || !layout) {
|
|
32226
32282
|
return undefined;
|
|
32227
32283
|
}
|
|
32228
32284
|
const validate = async sn => {
|
|
@@ -32247,7 +32303,7 @@
|
|
|
32247
32303
|
dispatch({
|
|
32248
32304
|
type: 'LOADING'
|
|
32249
32305
|
});
|
|
32250
|
-
|
|
32306
|
+
await loadType({
|
|
32251
32307
|
dispatch,
|
|
32252
32308
|
types,
|
|
32253
32309
|
visualization,
|
|
@@ -32257,17 +32313,9 @@
|
|
|
32257
32313
|
selections,
|
|
32258
32314
|
nebbie,
|
|
32259
32315
|
focusHandler: focusHandler.current,
|
|
32260
|
-
emitter
|
|
32316
|
+
emitter,
|
|
32317
|
+
onMount
|
|
32261
32318
|
});
|
|
32262
|
-
if (sn) {
|
|
32263
|
-
dispatch({
|
|
32264
|
-
type: 'LOADED',
|
|
32265
|
-
sn,
|
|
32266
|
-
visualization
|
|
32267
|
-
});
|
|
32268
|
-
onMount();
|
|
32269
|
-
}
|
|
32270
|
-
return undefined;
|
|
32271
32319
|
};
|
|
32272
32320
|
|
|
32273
32321
|
// Validate if it's still the same type
|
|
@@ -32535,865 +32583,87 @@
|
|
|
32535
32583
|
});
|
|
32536
32584
|
}
|
|
32537
32585
|
|
|
32538
|
-
const
|
|
32539
|
-
|
|
32540
|
-
|
|
32541
|
-
|
|
32542
|
-
halo,
|
|
32543
|
-
initialError,
|
|
32544
|
-
onDestroy = async () => {}
|
|
32545
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32546
|
-
let unmountCell = noopi$1;
|
|
32547
|
-
let cellRef = null;
|
|
32548
|
-
let mountedReference = null;
|
|
32549
|
-
let onMount = null;
|
|
32550
|
-
let onRender = null;
|
|
32551
|
-
const mounted = new Promise(resolve => {
|
|
32552
|
-
onMount = resolve;
|
|
32553
|
-
});
|
|
32554
|
-
const rendered = new Promise(resolve => {
|
|
32555
|
-
onRender = resolve;
|
|
32556
|
-
});
|
|
32557
|
-
const createOnInitialRender = override => () => {
|
|
32558
|
-
override && override();
|
|
32559
|
-
onRender();
|
|
32560
|
-
};
|
|
32561
|
-
let initialSnOptions = {};
|
|
32562
|
-
let initialSnPlugins = [];
|
|
32563
|
-
const emitter = new EventEmitter$1();
|
|
32564
|
-
const setSnOptions = async opts => {
|
|
32565
|
-
const override = opts.onInitialRender;
|
|
32566
|
-
if (mountedReference) {
|
|
32567
|
-
(async () => {
|
|
32568
|
-
await mounted;
|
|
32569
|
-
cellRef.current.setSnOptions(_objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
|
|
32570
|
-
onInitialRender: createOnInitialRender(override)
|
|
32571
|
-
}));
|
|
32572
|
-
})();
|
|
32573
|
-
} else {
|
|
32574
|
-
// Handle setting options before mount
|
|
32575
|
-
initialSnOptions = _objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
|
|
32576
|
-
onInitialRender: createOnInitialRender(override)
|
|
32577
|
-
});
|
|
32578
|
-
}
|
|
32579
|
-
};
|
|
32580
|
-
const setSnPlugins = async plugins => {
|
|
32581
|
-
validatePlugins(plugins);
|
|
32582
|
-
if (mountedReference) {
|
|
32583
|
-
(async () => {
|
|
32584
|
-
await mounted;
|
|
32585
|
-
cellRef.current.setSnPlugins(plugins);
|
|
32586
|
-
})();
|
|
32587
|
-
} else {
|
|
32588
|
-
// Handle setting plugins before mount
|
|
32589
|
-
initialSnPlugins = plugins;
|
|
32590
|
-
}
|
|
32591
|
-
};
|
|
32592
|
-
|
|
32593
|
-
/**
|
|
32594
|
-
* @class
|
|
32595
|
-
* @alias Viz
|
|
32596
|
-
* @classdesc A controller to further modify a visualization after it has been rendered.
|
|
32597
|
-
* @example
|
|
32598
|
-
* const viz = await embed(app).render({
|
|
32599
|
-
* element,
|
|
32600
|
-
* type: 'barchart'
|
|
32601
|
-
* });
|
|
32602
|
-
* viz.destroy();
|
|
32603
|
-
*/
|
|
32604
|
-
const api = /** @lends Viz# */{
|
|
32605
|
-
/**
|
|
32606
|
-
* The id of this visualization's generic object.
|
|
32607
|
-
* @type {string}
|
|
32608
|
-
*/
|
|
32609
|
-
id: model.id,
|
|
32610
|
-
/**
|
|
32611
|
-
* This visualizations Enigma model, a representation of the generic object.
|
|
32612
|
-
* @type {EngineAPI.IGenericObject}
|
|
32613
|
-
*/
|
|
32614
|
-
model,
|
|
32615
|
-
/**
|
|
32616
|
-
* Destroys the visualization and removes it from the the DOM.
|
|
32617
|
-
* @example
|
|
32618
|
-
* const viz = await embed(app).render({
|
|
32619
|
-
* element,
|
|
32620
|
-
* id: 'abc'
|
|
32621
|
-
* });
|
|
32622
|
-
* viz.destroy();
|
|
32623
|
-
*/
|
|
32624
|
-
async destroy() {
|
|
32625
|
-
await onDestroy();
|
|
32626
|
-
unmountCell();
|
|
32627
|
-
unmountCell = noopi$1;
|
|
32628
|
-
},
|
|
32629
|
-
/**
|
|
32630
|
-
* Converts the visualization to a different registered type
|
|
32631
|
-
* @since 1.1.0
|
|
32632
|
-
* @param {string} newType - Which registered type to convert to.
|
|
32633
|
-
* @param {boolean=} forceUpdate - Whether to run setProperties or not, defaults to true.
|
|
32634
|
-
* @returns {Promise<object>} Promise object that resolves to the full property tree of the converted visualization.
|
|
32635
|
-
* @example
|
|
32636
|
-
* const viz = await embed(app).render({
|
|
32637
|
-
* element,
|
|
32638
|
-
* id: 'abc'
|
|
32639
|
-
* });
|
|
32640
|
-
* viz.convertTo('barChart');
|
|
32641
|
-
*/
|
|
32642
|
-
async convertTo(newType) {
|
|
32643
|
-
let forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
32644
|
-
const propertyTree = await convertTo({
|
|
32645
|
-
halo,
|
|
32646
|
-
model,
|
|
32647
|
-
cellRef,
|
|
32648
|
-
newType
|
|
32649
|
-
});
|
|
32650
|
-
if (forceUpdate) {
|
|
32651
|
-
if (model.__snInterceptor) {
|
|
32652
|
-
await model.__snInterceptor.setProperties.call(model, propertyTree.qProperty);
|
|
32653
|
-
} else {
|
|
32654
|
-
await model.setProperties(propertyTree.qProperty);
|
|
32655
|
-
}
|
|
32656
|
-
}
|
|
32657
|
-
return propertyTree;
|
|
32658
|
-
},
|
|
32659
|
-
/**
|
|
32660
|
-
* Listens to custom events from inside the visualization. See useEmitter
|
|
32661
|
-
* @experimental
|
|
32662
|
-
* @param {string} eventName Event name to listen to
|
|
32663
|
-
* @param {Function} listener Callback function to invoke
|
|
32664
|
-
*/
|
|
32665
|
-
addListener(eventName, listener) {
|
|
32666
|
-
emitter.addListener(eventName, listener);
|
|
32667
|
-
},
|
|
32668
|
-
/**
|
|
32669
|
-
* Removes a listener
|
|
32670
|
-
* @experimental
|
|
32671
|
-
* @param {string} eventName Event name to remove from
|
|
32672
|
-
* @param {Function} listener Callback function to remove
|
|
32673
|
-
*/
|
|
32674
|
-
removeListener(eventName, listener) {
|
|
32675
|
-
emitter.removeListener(eventName, listener);
|
|
32676
|
-
},
|
|
32677
|
-
/**
|
|
32678
|
-
* Gets the specific api that a Viz exposes.
|
|
32679
|
-
* @returns {Promise<object>} object that contains the internal Viz api.
|
|
32680
|
-
*/
|
|
32681
|
-
async getImperativeHandle() {
|
|
32682
|
-
await rendered;
|
|
32683
|
-
return cellRef.current.getImperativeHandle();
|
|
32684
|
-
},
|
|
32685
|
-
// ===== unexposed experimental API - use at own risk ======
|
|
32686
|
-
__DO_NOT_USE__: {
|
|
32687
|
-
mount(element) {
|
|
32688
|
-
if (mountedReference) {
|
|
32689
|
-
throw new Error('Already mounted');
|
|
32690
|
-
}
|
|
32691
|
-
mountedReference = element;
|
|
32692
|
-
[unmountCell, cellRef] = glue$1({
|
|
32693
|
-
halo,
|
|
32694
|
-
element,
|
|
32695
|
-
model,
|
|
32696
|
-
initialSnOptions,
|
|
32697
|
-
initialSnPlugins,
|
|
32698
|
-
initialError,
|
|
32699
|
-
onMount,
|
|
32700
|
-
emitter
|
|
32701
|
-
});
|
|
32702
|
-
return mounted;
|
|
32703
|
-
},
|
|
32704
|
-
async applyProperties(props) {
|
|
32705
|
-
const current = await model.getEffectiveProperties();
|
|
32706
|
-
const patches = getPatches('/', props, current);
|
|
32707
|
-
if (patches.length) {
|
|
32708
|
-
return model.applyPatches(patches, true);
|
|
32709
|
-
}
|
|
32710
|
-
return undefined;
|
|
32711
|
-
},
|
|
32712
|
-
options(opts) {
|
|
32713
|
-
setSnOptions(opts);
|
|
32714
|
-
},
|
|
32715
|
-
plugins(plugins) {
|
|
32716
|
-
setSnPlugins(plugins);
|
|
32717
|
-
},
|
|
32718
|
-
exportImage() {
|
|
32719
|
-
return cellRef.current.exportImage();
|
|
32720
|
-
},
|
|
32721
|
-
takeSnapshot() {
|
|
32722
|
-
return cellRef.current.takeSnapshot();
|
|
32723
|
-
},
|
|
32724
|
-
getModel() {
|
|
32725
|
-
return model;
|
|
32726
|
-
}
|
|
32727
|
-
}
|
|
32586
|
+
const canSetProperties = layout => {
|
|
32587
|
+
var _layout$qMeta;
|
|
32588
|
+
return !!(layout && !layout.qHasSoftPatches && !layout.qExtendsId && (((_layout$qMeta = layout.qMeta) === null || _layout$qMeta === void 0 ? void 0 : _layout$qMeta.privileges) || []).indexOf('update') > -1);
|
|
32589
|
+
};
|
|
32728
32590
|
|
|
32729
|
-
|
|
32730
|
-
|
|
32731
|
-
|
|
32732
|
-
|
|
32733
|
-
|
|
32734
|
-
|
|
32735
|
-
|
|
32736
|
-
// show() {},
|
|
32737
|
-
// toggleDataView() {},
|
|
32738
|
-
};
|
|
32591
|
+
/* eslint-disable no-underscore-dangle */
|
|
32592
|
+
const setProperties = (model, newProperties) => {
|
|
32593
|
+
if (model.__snInterceptor) {
|
|
32594
|
+
return model.__snInterceptor.setProperties.call(model, newProperties);
|
|
32595
|
+
}
|
|
32596
|
+
return model.setProperties(newProperties);
|
|
32597
|
+
};
|
|
32739
32598
|
|
|
32740
|
-
|
|
32599
|
+
/* eslint no-param-reassign: 0, no-restricted-globals: 0 */
|
|
32600
|
+
const extend = extend$2.bind(null, true);
|
|
32601
|
+
const JSONPatch = {};
|
|
32602
|
+
const {
|
|
32603
|
+
isArray
|
|
32604
|
+
} = Array;
|
|
32605
|
+
function isObject(v) {
|
|
32606
|
+
return v != null && !Array.isArray(v) && typeof v === 'object';
|
|
32607
|
+
}
|
|
32608
|
+
function isUndef(v) {
|
|
32609
|
+
return typeof v === 'undefined';
|
|
32610
|
+
}
|
|
32611
|
+
function isFunction(v) {
|
|
32612
|
+
return typeof v === 'function';
|
|
32741
32613
|
}
|
|
32742
32614
|
|
|
32743
|
-
|
|
32744
|
-
|
|
32745
|
-
|
|
32746
|
-
|
|
32747
|
-
|
|
32748
|
-
|
|
32749
|
-
|
|
32750
|
-
|
|
32751
|
-
|
|
32752
|
-
|
|
32753
|
-
|
|
32754
|
-
|
|
32755
|
-
if (optional.plugins) {
|
|
32756
|
-
api.__DO_NOT_USE__.plugins(optional.plugins);
|
|
32757
|
-
}
|
|
32758
|
-
if (optional.element) {
|
|
32759
|
-
await api.__DO_NOT_USE__.mount(optional.element);
|
|
32615
|
+
/**
|
|
32616
|
+
* Generate an exact duplicate (with no references) of a specific value.
|
|
32617
|
+
*
|
|
32618
|
+
* @private
|
|
32619
|
+
* @param {Object} The value to duplicate
|
|
32620
|
+
* @returns {Object} a unique, duplicated value
|
|
32621
|
+
*/
|
|
32622
|
+
function generateValue(val) {
|
|
32623
|
+
if (val) {
|
|
32624
|
+
return extend({}, {
|
|
32625
|
+
val
|
|
32626
|
+
}).val;
|
|
32760
32627
|
}
|
|
32761
|
-
return
|
|
32628
|
+
return val;
|
|
32762
32629
|
}
|
|
32763
32630
|
|
|
32764
32631
|
/**
|
|
32765
|
-
*
|
|
32632
|
+
* An additional type checker used to determine if the property is of internal
|
|
32633
|
+
* use or not a type that can be translated into JSON (like functions).
|
|
32634
|
+
*
|
|
32635
|
+
* @private
|
|
32636
|
+
* @param {Object} obj The object which has the property to check
|
|
32637
|
+
* @param {String} The property name to check
|
|
32638
|
+
* @returns {Boolean} Whether the property is deemed special or not
|
|
32766
32639
|
*/
|
|
32640
|
+
function isSpecialProperty(obj, key) {
|
|
32641
|
+
return isFunction(obj[key]) || key.substring(0, 2) === '$$' || key.substring(0, 1) === '_';
|
|
32642
|
+
}
|
|
32767
32643
|
|
|
32768
32644
|
/**
|
|
32769
|
-
*
|
|
32770
|
-
*
|
|
32771
|
-
*
|
|
32772
|
-
* @
|
|
32773
|
-
* @
|
|
32774
|
-
* @
|
|
32775
|
-
* @
|
|
32776
|
-
* @property {string=} version For creating objects: Version of visualization to render
|
|
32777
|
-
* @property {(Field[])=} fields For creating objects: Data fields to use
|
|
32778
|
-
* @property {boolean=} [extendProperties=false] For creating objects: Whether to deeply extend properties or not. If false then subtrees will be overwritten.
|
|
32779
|
-
* @property {EngineAPI.IGenericObjectProperties=} properties For creating objects: Explicit properties to set
|
|
32780
|
-
* @example
|
|
32781
|
-
* // A config for Creating objects:
|
|
32782
|
-
* const createConfig = {
|
|
32783
|
-
* type: 'bar',
|
|
32784
|
-
* element: document.querySelector('.bar'),
|
|
32785
|
-
* extendProperties: true,
|
|
32786
|
-
* fields: ['[Country names]', '=Sum(Sales)'],
|
|
32787
|
-
* properties: {
|
|
32788
|
-
* legend: {
|
|
32789
|
-
* show: false,
|
|
32790
|
-
* },
|
|
32791
|
-
* }
|
|
32792
|
-
* };
|
|
32793
|
-
* nebbie.render(createConfig);
|
|
32794
|
-
* // A config for rendering an existing object:
|
|
32795
|
-
* const createConfig = {
|
|
32796
|
-
* id: 'jG5LP',
|
|
32797
|
-
* element: document.querySelector('.line'),
|
|
32798
|
-
* };
|
|
32799
|
-
* nebbie.render(createConfig);
|
|
32645
|
+
* Finds the parent object from a JSON-Pointer ("/foo/bar/baz" = "bar" is "baz" parent),
|
|
32646
|
+
* also creates the object structure needed.
|
|
32647
|
+
*
|
|
32648
|
+
* @private
|
|
32649
|
+
* @param {Object} data The root object to traverse through
|
|
32650
|
+
* @param {String} The JSON-Pointer string to use when traversing
|
|
32651
|
+
* @returns {Object} The parent object
|
|
32800
32652
|
*/
|
|
32801
|
-
|
|
32802
|
-
|
|
32803
|
-
|
|
32804
|
-
|
|
32805
|
-
|
|
32806
|
-
|
|
32807
|
-
|
|
32808
|
-
plugins,
|
|
32809
|
-
element,
|
|
32810
|
-
extendProperties
|
|
32811
|
-
} = _ref;
|
|
32812
|
-
let mergedProps = {};
|
|
32813
|
-
const children = [];
|
|
32814
|
-
let error;
|
|
32815
|
-
try {
|
|
32816
|
-
const t = halo.types.get({
|
|
32817
|
-
name: type,
|
|
32818
|
-
version
|
|
32819
|
-
});
|
|
32820
|
-
mergedProps = await t.initialProperties(properties, extendProperties);
|
|
32821
|
-
const sn = await t.supernova();
|
|
32822
|
-
if (fields) {
|
|
32823
|
-
await populateData({
|
|
32824
|
-
sn,
|
|
32825
|
-
properties: mergedProps,
|
|
32826
|
-
fields,
|
|
32827
|
-
children
|
|
32828
|
-
}, halo);
|
|
32829
|
-
}
|
|
32830
|
-
if (properties && sn && sn.qae.properties.onChange) {
|
|
32831
|
-
sn.qae.properties.onChange.call({}, mergedProps);
|
|
32653
|
+
function getParent(data, str) {
|
|
32654
|
+
const seperator = '/';
|
|
32655
|
+
const parts = str.substring(1).split(seperator).slice(0, -1);
|
|
32656
|
+
let numPart;
|
|
32657
|
+
parts.forEach((part, i) => {
|
|
32658
|
+
if (i === parts.length) {
|
|
32659
|
+
return;
|
|
32832
32660
|
}
|
|
32833
|
-
|
|
32834
|
-
|
|
32835
|
-
|
|
32836
|
-
|
|
32837
|
-
|
|
32838
|
-
|
|
32839
|
-
qType: type
|
|
32840
|
-
},
|
|
32841
|
-
visualization: type
|
|
32842
|
-
};
|
|
32843
|
-
// console.error(e); // eslint-disable-line
|
|
32844
|
-
}
|
|
32845
|
-
|
|
32846
|
-
const model = await halo.app.createSessionObject(mergedProps);
|
|
32847
|
-
if (children.length > 0) {
|
|
32848
|
-
await model.setFullPropertyTree({
|
|
32849
|
-
qProperty: mergedProps,
|
|
32850
|
-
qChildren: children
|
|
32851
|
-
});
|
|
32852
|
-
}
|
|
32853
|
-
modelStore.set(model.id, model);
|
|
32854
|
-
const unsubscribe = subscribe(model);
|
|
32855
|
-
const onDestroy = async () => {
|
|
32856
|
-
await halo.app.destroySessionObject(model.id);
|
|
32857
|
-
unsubscribe();
|
|
32858
|
-
};
|
|
32859
|
-
return init(model, {
|
|
32860
|
-
options,
|
|
32861
|
-
plugins,
|
|
32862
|
-
element
|
|
32863
|
-
}, halo, error, onDestroy);
|
|
32864
|
-
}
|
|
32865
|
-
|
|
32866
|
-
/**
|
|
32867
|
-
* @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
|
|
32868
|
-
*/
|
|
32869
|
-
|
|
32870
|
-
/**
|
|
32871
|
-
* @interface CreateConfig
|
|
32872
|
-
* @description Rendering configuration for creating and rendering a new object
|
|
32873
|
-
* @property {string} type
|
|
32874
|
-
* @property {string=} version
|
|
32875
|
-
* @property {(Field[])=} fields
|
|
32876
|
-
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
32877
|
-
*/
|
|
32878
|
-
|
|
32879
|
-
async function createObject(_ref, halo, generateOnly) {
|
|
32880
|
-
let {
|
|
32881
|
-
type,
|
|
32882
|
-
version,
|
|
32883
|
-
fields,
|
|
32884
|
-
properties,
|
|
32885
|
-
extendProperties /* , options, plugins, element */
|
|
32886
|
-
} = _ref;
|
|
32887
|
-
let mergedProps = {};
|
|
32888
|
-
const children = [];
|
|
32889
|
-
// let error;
|
|
32890
|
-
try {
|
|
32891
|
-
const t = halo.types.get({
|
|
32892
|
-
name: type,
|
|
32893
|
-
version
|
|
32894
|
-
});
|
|
32895
|
-
mergedProps = await t.initialProperties(properties, extendProperties);
|
|
32896
|
-
const sn = await t.supernova();
|
|
32897
|
-
if (fields) {
|
|
32898
|
-
await populateData({
|
|
32899
|
-
sn,
|
|
32900
|
-
properties: mergedProps,
|
|
32901
|
-
fields,
|
|
32902
|
-
children
|
|
32903
|
-
}, halo);
|
|
32904
|
-
}
|
|
32905
|
-
if (properties && sn && sn.qae.properties.onChange) {
|
|
32906
|
-
sn.qae.properties.onChange.call({}, mergedProps);
|
|
32907
|
-
}
|
|
32908
|
-
} catch (e) {
|
|
32909
|
-
// error = e;
|
|
32910
|
-
// minimal dummy object properties to allow it to be created
|
|
32911
|
-
// and rendered with the error
|
|
32912
|
-
if (!generateOnly) {
|
|
32913
|
-
mergedProps = {
|
|
32914
|
-
qInfo: {
|
|
32915
|
-
qType: type
|
|
32916
|
-
},
|
|
32917
|
-
visualization: type
|
|
32918
|
-
};
|
|
32919
|
-
} else {
|
|
32920
|
-
mergedProps = null;
|
|
32921
|
-
}
|
|
32922
|
-
// console.error(e); // eslint-disable-line
|
|
32923
|
-
}
|
|
32924
|
-
|
|
32925
|
-
if (!generateOnly) {
|
|
32926
|
-
const model = await halo.app.createObject(mergedProps);
|
|
32927
|
-
if (children.length > 0) {
|
|
32928
|
-
await model.setFullPropertyTree({
|
|
32929
|
-
qProperty: mergedProps,
|
|
32930
|
-
qChildren: children
|
|
32931
|
-
});
|
|
32932
|
-
}
|
|
32933
|
-
modelStore.set(model.id, model);
|
|
32934
|
-
return model;
|
|
32935
|
-
}
|
|
32936
|
-
return mergedProps;
|
|
32937
|
-
}
|
|
32938
|
-
|
|
32939
|
-
async function getObject$1(_ref, halo) {
|
|
32940
|
-
let {
|
|
32941
|
-
id,
|
|
32942
|
-
options,
|
|
32943
|
-
plugins,
|
|
32944
|
-
element
|
|
32945
|
-
} = _ref;
|
|
32946
|
-
const key = "".concat(id);
|
|
32947
|
-
let rpc = rpcRequestModelStore.get(key);
|
|
32948
|
-
if (!rpc) {
|
|
32949
|
-
rpc = halo.app.getObject(id);
|
|
32950
|
-
rpcRequestModelStore.set(key, rpc);
|
|
32951
|
-
}
|
|
32952
|
-
const model = await rpc;
|
|
32953
|
-
modelStore.set(key, model);
|
|
32954
|
-
return init(model, {
|
|
32955
|
-
options,
|
|
32956
|
-
plugins,
|
|
32957
|
-
element
|
|
32958
|
-
}, halo);
|
|
32959
|
-
}
|
|
32960
|
-
|
|
32961
|
-
/**
|
|
32962
|
-
* @interface
|
|
32963
|
-
* @extends HTMLElement
|
|
32964
|
-
* @experimental
|
|
32965
|
-
* @since 3.1.0
|
|
32966
|
-
*/
|
|
32967
|
-
const SheetElement = {
|
|
32968
|
-
/** @type {'njs-sheet'} */
|
|
32969
|
-
className: 'njs-sheet'
|
|
32970
|
-
};
|
|
32971
|
-
function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount) {
|
|
32972
|
-
const {
|
|
32973
|
-
x,
|
|
32974
|
-
y,
|
|
32975
|
-
width,
|
|
32976
|
-
height
|
|
32977
|
-
} = cell.bounds;
|
|
32978
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
32979
|
-
style: {
|
|
32980
|
-
left: "".concat(x, "%"),
|
|
32981
|
-
top: "".concat(y, "%"),
|
|
32982
|
-
width: "".concat(width, "%"),
|
|
32983
|
-
height: "".concat(height, "%"),
|
|
32984
|
-
position: 'absolute'
|
|
32985
|
-
}
|
|
32986
|
-
}, /*#__PURE__*/React.createElement(Cell, {
|
|
32987
|
-
ref: cell.cellRef,
|
|
32988
|
-
halo: halo,
|
|
32989
|
-
model: cell.model,
|
|
32990
|
-
currentId: cell.currentId,
|
|
32991
|
-
initialSnOptions: initialSnOptions,
|
|
32992
|
-
initialSnPlugins: initialSnPlugins,
|
|
32993
|
-
initialError: initialError,
|
|
32994
|
-
onMount: onMount
|
|
32995
|
-
}));
|
|
32996
|
-
}
|
|
32997
|
-
function Sheet(_ref) {
|
|
32998
|
-
let {
|
|
32999
|
-
model,
|
|
33000
|
-
halo,
|
|
33001
|
-
initialSnOptions,
|
|
33002
|
-
initialSnPlugins,
|
|
33003
|
-
initialError,
|
|
33004
|
-
onMount
|
|
33005
|
-
} = _ref;
|
|
33006
|
-
const {
|
|
33007
|
-
root
|
|
33008
|
-
} = halo;
|
|
33009
|
-
const [layout] = useLayout$1(model);
|
|
33010
|
-
const {
|
|
33011
|
-
theme: themeName
|
|
33012
|
-
} = reactExports.useContext(InstanceContext);
|
|
33013
|
-
const [cells, setCells] = reactExports.useState([]);
|
|
33014
|
-
const [bgColor, setBgColor] = reactExports.useState(undefined);
|
|
33015
|
-
const [bgImage, setBgImage] = reactExports.useState(undefined);
|
|
33016
|
-
const [deepHash, setDeepHash] = reactExports.useState('');
|
|
33017
|
-
|
|
33018
|
-
/// For each object
|
|
33019
|
-
reactExports.useEffect(() => {
|
|
33020
|
-
if (layout) {
|
|
33021
|
-
const hash = JSON.stringify(layout.cells);
|
|
33022
|
-
if (hash === deepHash) {
|
|
33023
|
-
return;
|
|
33024
|
-
}
|
|
33025
|
-
setDeepHash(hash);
|
|
33026
|
-
const fetchObjects = async () => {
|
|
33027
|
-
/*
|
|
33028
|
-
Need to always fetch and evaluate everything as the sheet need to support multiple instances of the same object?
|
|
33029
|
-
No, there is no way to add the same chart twice, so the optimization should be worth it.
|
|
33030
|
-
*/
|
|
33031
|
-
|
|
33032
|
-
// Clear the cell list
|
|
33033
|
-
cells.forEach(c => {
|
|
33034
|
-
root.removeCell(c.currentId);
|
|
33035
|
-
});
|
|
33036
|
-
const lCells = layout.cells;
|
|
33037
|
-
// TODO - should try reuse existing objects on subsequent renders
|
|
33038
|
-
// Non-id updates should only change the "css"
|
|
33039
|
-
const cs = await Promise.all(lCells.map(async c => {
|
|
33040
|
-
let mounted;
|
|
33041
|
-
const mountedPromise = new Promise(resolve => {
|
|
33042
|
-
mounted = resolve;
|
|
33043
|
-
});
|
|
33044
|
-
const cell = cells.find(ce => ce.id === c.name);
|
|
33045
|
-
if (cell) {
|
|
33046
|
-
cell.bounds = c.bounds;
|
|
33047
|
-
delete cell.mountedPromise;
|
|
33048
|
-
return cell;
|
|
33049
|
-
}
|
|
33050
|
-
const vs = await getObject$1({
|
|
33051
|
-
id: c.name
|
|
33052
|
-
}, halo);
|
|
33053
|
-
return {
|
|
33054
|
-
model: vs.model,
|
|
33055
|
-
id: c.name,
|
|
33056
|
-
bounds: c.bounds,
|
|
33057
|
-
cellRef: React.createRef(),
|
|
33058
|
-
currentId: uid(),
|
|
33059
|
-
mounted,
|
|
33060
|
-
mountedPromise
|
|
33061
|
-
};
|
|
33062
|
-
}));
|
|
33063
|
-
cs.forEach(c => root.addCell(c.currentId, c.cellRef));
|
|
33064
|
-
setCells(cs);
|
|
33065
|
-
};
|
|
33066
|
-
fetchObjects();
|
|
33067
|
-
}
|
|
33068
|
-
}, [layout]);
|
|
33069
|
-
const cellRenderers = reactExports.useMemo(() => cells ? cells.map(c => getCellRenderer(c, halo, initialSnOptions, initialSnPlugins, initialError, c.mounted)) : [], [cells]);
|
|
33070
|
-
reactExports.useEffect(() => {
|
|
33071
|
-
const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
|
|
33072
|
-
setBgColor(resolveBgColor(bgComp, halo.public.theme));
|
|
33073
|
-
setBgImage(resolveBgImage(bgComp, halo.app));
|
|
33074
|
-
}, [layout, halo.public.theme, halo.app, themeName]);
|
|
33075
|
-
|
|
33076
|
-
/* TODO
|
|
33077
|
-
- sheet title + bg + logo etc + as option
|
|
33078
|
-
- sheet exposed classnames for theming
|
|
33079
|
-
*/
|
|
33080
|
-
|
|
33081
|
-
const height = !layout || Number.isNaN(layout.height) ? '100%' : "".concat(Number(layout.height), "%");
|
|
33082
|
-
const promises = cells.map(c => c.mountedPromise);
|
|
33083
|
-
const ps = promises.filter(p => !!p);
|
|
33084
|
-
if (ps.length) {
|
|
33085
|
-
Promise.all(promises).then(() => {
|
|
33086
|
-
// TODO - correct? Currently called each time a new cell is mounted?
|
|
33087
|
-
onMount();
|
|
33088
|
-
});
|
|
33089
|
-
}
|
|
33090
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
33091
|
-
className: SheetElement.className,
|
|
33092
|
-
style: {
|
|
33093
|
-
width: "100%",
|
|
33094
|
-
height,
|
|
33095
|
-
position: 'relative',
|
|
33096
|
-
backgroundColor: bgColor,
|
|
33097
|
-
backgroundImage: bgImage && bgImage.url ? "url(".concat(bgImage.url, ")") : undefined,
|
|
33098
|
-
backgroundRepeat: 'no-repeat',
|
|
33099
|
-
backgroundSize: bgImage && bgImage.size,
|
|
33100
|
-
backgroundPosition: bgImage && bgImage.pos
|
|
33101
|
-
}
|
|
33102
|
-
}, cellRenderers);
|
|
33103
|
-
}
|
|
33104
|
-
|
|
33105
|
-
function glue(_ref) {
|
|
33106
|
-
let {
|
|
33107
|
-
halo,
|
|
33108
|
-
element,
|
|
33109
|
-
model,
|
|
33110
|
-
initialSnOptions,
|
|
33111
|
-
initialSnPlugins,
|
|
33112
|
-
onMount,
|
|
33113
|
-
initialError
|
|
33114
|
-
} = _ref;
|
|
33115
|
-
const {
|
|
33116
|
-
root
|
|
33117
|
-
} = halo;
|
|
33118
|
-
const sheetRef = React.createRef();
|
|
33119
|
-
const portal = ReactDOM.createPortal( /*#__PURE__*/React.createElement(Sheet, {
|
|
33120
|
-
ref: sheetRef,
|
|
33121
|
-
halo: halo,
|
|
33122
|
-
model: model,
|
|
33123
|
-
initialSnOptions: initialSnOptions,
|
|
33124
|
-
initialSnPlugins: initialSnPlugins,
|
|
33125
|
-
initialError: initialError,
|
|
33126
|
-
onMount: onMount
|
|
33127
|
-
}), element, model.id);
|
|
33128
|
-
const unmount = () => {
|
|
33129
|
-
root.remove(portal);
|
|
33130
|
-
model.removeListener('closed', unmount);
|
|
33131
|
-
};
|
|
33132
|
-
model.on('closed', unmount);
|
|
33133
|
-
root.add(portal);
|
|
33134
|
-
return [unmount, sheetRef];
|
|
33135
|
-
}
|
|
33136
|
-
|
|
33137
|
-
const noopi = () => {};
|
|
33138
|
-
function sheet() {
|
|
33139
|
-
let {
|
|
33140
|
-
model,
|
|
33141
|
-
halo,
|
|
33142
|
-
initialError,
|
|
33143
|
-
onDestroy = async () => {}
|
|
33144
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
33145
|
-
let unmountSheet = noopi;
|
|
33146
|
-
let sheetRef = null;
|
|
33147
|
-
let mountedReference = null;
|
|
33148
|
-
let onMount = null;
|
|
33149
|
-
const mounted = new Promise(resolve => {
|
|
33150
|
-
onMount = resolve;
|
|
33151
|
-
});
|
|
33152
|
-
let initialSnOptions = {};
|
|
33153
|
-
let initialSnPlugins = [];
|
|
33154
|
-
const setSnOptions = async opts => {
|
|
33155
|
-
if (mountedReference) {
|
|
33156
|
-
(async () => {
|
|
33157
|
-
await mounted;
|
|
33158
|
-
sheetRef.current.setSnOptions(_objectSpread2(_objectSpread2({}, initialSnOptions), opts));
|
|
33159
|
-
})();
|
|
33160
|
-
} else {
|
|
33161
|
-
// Handle setting options before mount
|
|
33162
|
-
initialSnOptions = _objectSpread2(_objectSpread2({}, initialSnOptions), opts);
|
|
33163
|
-
}
|
|
33164
|
-
};
|
|
33165
|
-
const setSnPlugins = async plugins => {
|
|
33166
|
-
validatePlugins(plugins);
|
|
33167
|
-
if (mountedReference) {
|
|
33168
|
-
(async () => {
|
|
33169
|
-
await mounted;
|
|
33170
|
-
sheetRef.current.setSnPlugins(plugins);
|
|
33171
|
-
})();
|
|
33172
|
-
} else {
|
|
33173
|
-
// Handle setting plugins before mount
|
|
33174
|
-
initialSnPlugins = plugins;
|
|
33175
|
-
}
|
|
33176
|
-
};
|
|
33177
|
-
|
|
33178
|
-
/**
|
|
33179
|
-
* @class
|
|
33180
|
-
* @alias Sheet
|
|
33181
|
-
* @classdesc A controller to further modify a visualization after it has been rendered.
|
|
33182
|
-
* @experimental
|
|
33183
|
-
* @since 3.1.0
|
|
33184
|
-
* @example
|
|
33185
|
-
* const sheet = await embed(app).render({
|
|
33186
|
-
* element,
|
|
33187
|
-
* id: "jD5Gd"
|
|
33188
|
-
* });
|
|
33189
|
-
* sheet.destroy();
|
|
33190
|
-
*/
|
|
33191
|
-
const api = /** @lends Sheet# */{
|
|
33192
|
-
/**
|
|
33193
|
-
* The id of this sheets's generic object.
|
|
33194
|
-
* @type {string}
|
|
33195
|
-
*/
|
|
33196
|
-
id: model.id,
|
|
33197
|
-
/**
|
|
33198
|
-
* This sheets Enigma model, a representation of the generic object.
|
|
33199
|
-
* @type {string}
|
|
33200
|
-
*/
|
|
33201
|
-
model,
|
|
33202
|
-
/**
|
|
33203
|
-
* Destroys the sheet and removes it from the the DOM.
|
|
33204
|
-
* @example
|
|
33205
|
-
* const sheet = await embed(app).render({
|
|
33206
|
-
* element,
|
|
33207
|
-
* id: "jD5Gd"
|
|
33208
|
-
* });
|
|
33209
|
-
* sheet.destroy();
|
|
33210
|
-
*/
|
|
33211
|
-
async destroy() {
|
|
33212
|
-
await onDestroy();
|
|
33213
|
-
unmountSheet();
|
|
33214
|
-
unmountSheet = noopi;
|
|
33215
|
-
},
|
|
33216
|
-
// ===== unexposed experimental API - use at own risk ======
|
|
33217
|
-
__DO_NOT_USE__: {
|
|
33218
|
-
mount(element) {
|
|
33219
|
-
if (mountedReference) {
|
|
33220
|
-
throw new Error('Already mounted');
|
|
33221
|
-
}
|
|
33222
|
-
mountedReference = element;
|
|
33223
|
-
[unmountSheet, sheetRef] = glue({
|
|
33224
|
-
halo,
|
|
33225
|
-
element,
|
|
33226
|
-
model,
|
|
33227
|
-
initialSnOptions,
|
|
33228
|
-
initialSnPlugins,
|
|
33229
|
-
initialError,
|
|
33230
|
-
onMount
|
|
33231
|
-
});
|
|
33232
|
-
return mounted;
|
|
33233
|
-
},
|
|
33234
|
-
async applyProperties(props) {
|
|
33235
|
-
const current = await model.getEffectiveProperties();
|
|
33236
|
-
const patches = getPatches('/', props, current);
|
|
33237
|
-
if (patches.length) {
|
|
33238
|
-
return model.applyPatches(patches, true);
|
|
33239
|
-
}
|
|
33240
|
-
return undefined;
|
|
33241
|
-
},
|
|
33242
|
-
options(opts) {
|
|
33243
|
-
setSnOptions(opts);
|
|
33244
|
-
},
|
|
33245
|
-
plugins(plugins) {
|
|
33246
|
-
setSnPlugins(plugins);
|
|
33247
|
-
},
|
|
33248
|
-
exportImage() {
|
|
33249
|
-
throw new Error('Not implemented');
|
|
33250
|
-
},
|
|
33251
|
-
takeSnapshot() {
|
|
33252
|
-
throw new Error('Not implemented');
|
|
33253
|
-
},
|
|
33254
|
-
getModel() {
|
|
33255
|
-
return model;
|
|
33256
|
-
}
|
|
33257
|
-
}
|
|
33258
|
-
};
|
|
33259
|
-
return api;
|
|
33260
|
-
}
|
|
33261
|
-
|
|
33262
|
-
/* eslint no-underscore-dangle:0 */
|
|
33263
|
-
async function initSheet(model, optional, halo, initialError) {
|
|
33264
|
-
let onDestroy = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : async () => {};
|
|
33265
|
-
const api = sheet({
|
|
33266
|
-
model,
|
|
33267
|
-
halo,
|
|
33268
|
-
initialError,
|
|
33269
|
-
onDestroy
|
|
33270
|
-
});
|
|
33271
|
-
if (optional.options) {
|
|
33272
|
-
api.__DO_NOT_USE__.options(optional.options);
|
|
33273
|
-
}
|
|
33274
|
-
if (optional.plugins) {
|
|
33275
|
-
api.__DO_NOT_USE__.plugins(optional.plugins);
|
|
33276
|
-
}
|
|
33277
|
-
if (optional.element) {
|
|
33278
|
-
await api.__DO_NOT_USE__.mount(optional.element);
|
|
33279
|
-
}
|
|
33280
|
-
return api;
|
|
33281
|
-
}
|
|
33282
|
-
|
|
33283
|
-
async function getObject(_ref, halo) {
|
|
33284
|
-
let {
|
|
33285
|
-
id,
|
|
33286
|
-
options,
|
|
33287
|
-
plugins,
|
|
33288
|
-
element
|
|
33289
|
-
} = _ref;
|
|
33290
|
-
const key = "".concat(id);
|
|
33291
|
-
let rpc = rpcRequestModelStore.get(key);
|
|
33292
|
-
if (!rpc) {
|
|
33293
|
-
rpc = halo.app.getObject(id);
|
|
33294
|
-
rpcRequestModelStore.set(key, rpc);
|
|
33295
|
-
}
|
|
33296
|
-
const model = await rpc;
|
|
33297
|
-
modelStore.set(key, model);
|
|
33298
|
-
if (model.genericType === 'sheet') {
|
|
33299
|
-
return initSheet(model, {
|
|
33300
|
-
options,
|
|
33301
|
-
plugins,
|
|
33302
|
-
element
|
|
33303
|
-
}, halo);
|
|
33304
|
-
}
|
|
33305
|
-
return init(model, {
|
|
33306
|
-
options,
|
|
33307
|
-
plugins,
|
|
33308
|
-
element
|
|
33309
|
-
}, halo);
|
|
33310
|
-
}
|
|
33311
|
-
|
|
33312
|
-
function flagsFn () {
|
|
33313
|
-
let flags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
33314
|
-
/**
|
|
33315
|
-
* @interface Flags
|
|
33316
|
-
*/
|
|
33317
|
-
|
|
33318
|
-
return (/** @lends Flags */{
|
|
33319
|
-
/**
|
|
33320
|
-
* Checks whether the specified flag is enabled.
|
|
33321
|
-
* @param {string} flag - The value flag to check.
|
|
33322
|
-
* @returns {boolean} True if the specified flag is enabled, false otherwise.
|
|
33323
|
-
*/
|
|
33324
|
-
isEnabled: f => flags[f] === true
|
|
33325
|
-
}
|
|
33326
|
-
);
|
|
33327
|
-
}
|
|
33328
|
-
|
|
33329
|
-
/* eslint no-param-reassign: 0, no-restricted-globals: 0 */
|
|
33330
|
-
const extend = extend$2.bind(null, true);
|
|
33331
|
-
const JSONPatch = {};
|
|
33332
|
-
const {
|
|
33333
|
-
isArray
|
|
33334
|
-
} = Array;
|
|
33335
|
-
function isObject(v) {
|
|
33336
|
-
return v != null && !Array.isArray(v) && typeof v === 'object';
|
|
33337
|
-
}
|
|
33338
|
-
function isUndef(v) {
|
|
33339
|
-
return typeof v === 'undefined';
|
|
33340
|
-
}
|
|
33341
|
-
function isFunction(v) {
|
|
33342
|
-
return typeof v === 'function';
|
|
33343
|
-
}
|
|
33344
|
-
|
|
33345
|
-
/**
|
|
33346
|
-
* Generate an exact duplicate (with no references) of a specific value.
|
|
33347
|
-
*
|
|
33348
|
-
* @private
|
|
33349
|
-
* @param {Object} The value to duplicate
|
|
33350
|
-
* @returns {Object} a unique, duplicated value
|
|
33351
|
-
*/
|
|
33352
|
-
function generateValue(val) {
|
|
33353
|
-
if (val) {
|
|
33354
|
-
return extend({}, {
|
|
33355
|
-
val
|
|
33356
|
-
}).val;
|
|
33357
|
-
}
|
|
33358
|
-
return val;
|
|
33359
|
-
}
|
|
33360
|
-
|
|
33361
|
-
/**
|
|
33362
|
-
* An additional type checker used to determine if the property is of internal
|
|
33363
|
-
* use or not a type that can be translated into JSON (like functions).
|
|
33364
|
-
*
|
|
33365
|
-
* @private
|
|
33366
|
-
* @param {Object} obj The object which has the property to check
|
|
33367
|
-
* @param {String} The property name to check
|
|
33368
|
-
* @returns {Boolean} Whether the property is deemed special or not
|
|
33369
|
-
*/
|
|
33370
|
-
function isSpecialProperty(obj, key) {
|
|
33371
|
-
return isFunction(obj[key]) || key.substring(0, 2) === '$$' || key.substring(0, 1) === '_';
|
|
33372
|
-
}
|
|
33373
|
-
|
|
33374
|
-
/**
|
|
33375
|
-
* Finds the parent object from a JSON-Pointer ("/foo/bar/baz" = "bar" is "baz" parent),
|
|
33376
|
-
* also creates the object structure needed.
|
|
33377
|
-
*
|
|
33378
|
-
* @private
|
|
33379
|
-
* @param {Object} data The root object to traverse through
|
|
33380
|
-
* @param {String} The JSON-Pointer string to use when traversing
|
|
33381
|
-
* @returns {Object} The parent object
|
|
33382
|
-
*/
|
|
33383
|
-
function getParent(data, str) {
|
|
33384
|
-
const seperator = '/';
|
|
33385
|
-
const parts = str.substring(1).split(seperator).slice(0, -1);
|
|
33386
|
-
let numPart;
|
|
33387
|
-
parts.forEach((part, i) => {
|
|
33388
|
-
if (i === parts.length) {
|
|
33389
|
-
return;
|
|
33390
|
-
}
|
|
33391
|
-
numPart = +part;
|
|
33392
|
-
const newPart = !isNaN(numPart) ? [] : {};
|
|
33393
|
-
data[numPart || part] = isUndef(data[numPart || part]) ? newPart : data[part];
|
|
33394
|
-
data = data[numPart || part];
|
|
33395
|
-
});
|
|
33396
|
-
return data;
|
|
32661
|
+
numPart = +part;
|
|
32662
|
+
const newPart = !isNaN(numPart) ? [] : {};
|
|
32663
|
+
data[numPart || part] = isUndef(data[numPart || part]) ? newPart : data[part];
|
|
32664
|
+
data = data[numPart || part];
|
|
32665
|
+
});
|
|
32666
|
+
return data;
|
|
33397
32667
|
}
|
|
33398
32668
|
|
|
33399
32669
|
/**
|
|
@@ -35408,130 +34678,1030 @@
|
|
|
35408
34678
|
if (steps[i] === '') {
|
|
35409
34679
|
continue; // eslint-disable-line no-continue
|
|
35410
34680
|
}
|
|
35411
|
-
|
|
35412
|
-
if (typeof dataContainer[steps[i]] === 'undefined') {
|
|
35413
|
-
return defaultValue;
|
|
34681
|
+
|
|
34682
|
+
if (typeof dataContainer[steps[i]] === 'undefined') {
|
|
34683
|
+
return defaultValue;
|
|
34684
|
+
}
|
|
34685
|
+
dataContainer = dataContainer[steps[i]];
|
|
34686
|
+
}
|
|
34687
|
+
return dataContainer;
|
|
34688
|
+
};
|
|
34689
|
+
function target(def) {
|
|
34690
|
+
const propertyPath = def.path || '/qHyperCubeDef';
|
|
34691
|
+
const layoutPath = propertyPath.slice(0, -3);
|
|
34692
|
+
if (/\/(qHyperCube|qListObject|qChildList)$/.test(layoutPath) === false) {
|
|
34693
|
+
const d = layoutPath.includes('/qHyperCube') ? 'qHyperCubeDef' : 'qListObjectDef';
|
|
34694
|
+
throw new Error("Incorrect definition for ".concat(d, " at ").concat(propertyPath, ". Valid paths include /qHyperCubeDef, /qListObjectDef, or /qChildListDef, e.g. data/qHyperCubeDef"));
|
|
34695
|
+
}
|
|
34696
|
+
return {
|
|
34697
|
+
propertyPath,
|
|
34698
|
+
layoutPath,
|
|
34699
|
+
resolveLayout: layout => resolveValue(layout, layoutPath, {}),
|
|
34700
|
+
dimensions: defFn(def.dimensions),
|
|
34701
|
+
measures: defFn(def.measures)
|
|
34702
|
+
};
|
|
34703
|
+
}
|
|
34704
|
+
function qae() {
|
|
34705
|
+
let def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34706
|
+
let initial = def.properties || {};
|
|
34707
|
+
let onChange;
|
|
34708
|
+
if (def.properties && (def.properties.initial || def.properties.onChange)) {
|
|
34709
|
+
initial = def.properties.initial;
|
|
34710
|
+
onChange = def.properties.onChange;
|
|
34711
|
+
}
|
|
34712
|
+
const q = {
|
|
34713
|
+
properties: {
|
|
34714
|
+
initial,
|
|
34715
|
+
onChange
|
|
34716
|
+
},
|
|
34717
|
+
data: {
|
|
34718
|
+
targets: ((def.data || {}).targets || []).map(target)
|
|
34719
|
+
},
|
|
34720
|
+
exportProperties: def.exportProperties,
|
|
34721
|
+
importProperties: def.importProperties
|
|
34722
|
+
};
|
|
34723
|
+
return q;
|
|
34724
|
+
}
|
|
34725
|
+
|
|
34726
|
+
/**
|
|
34727
|
+
* The entry point for defining a visualization.
|
|
34728
|
+
* @interface Visualization
|
|
34729
|
+
* @param {Galaxy} galaxy
|
|
34730
|
+
* @returns {VisualizationDefinition}
|
|
34731
|
+
* @example
|
|
34732
|
+
* import { useElement, useLayout } from '@nebula.js/stardust';
|
|
34733
|
+
*
|
|
34734
|
+
* export default function() {
|
|
34735
|
+
* return {
|
|
34736
|
+
* qae: {
|
|
34737
|
+
* properties: {
|
|
34738
|
+
* dude: 'Heisenberg',
|
|
34739
|
+
* }
|
|
34740
|
+
* },
|
|
34741
|
+
* component() {
|
|
34742
|
+
* const el = useElement();
|
|
34743
|
+
* const layout = useLayout();
|
|
34744
|
+
* el.innerHTML = `What's my name? ${layout.dude}!!!`;
|
|
34745
|
+
* }
|
|
34746
|
+
* };
|
|
34747
|
+
* }
|
|
34748
|
+
*/
|
|
34749
|
+
|
|
34750
|
+
/**
|
|
34751
|
+
* @interface VisualizationDefinition
|
|
34752
|
+
* @property {QAEDefinition} qae
|
|
34753
|
+
* @property {function():void} component
|
|
34754
|
+
*/
|
|
34755
|
+
|
|
34756
|
+
/**
|
|
34757
|
+
* @interface snGenerator
|
|
34758
|
+
* @param {Visualization} Sn
|
|
34759
|
+
* @param {Galaxy} galaxy
|
|
34760
|
+
* @returns {generator}
|
|
34761
|
+
* @private
|
|
34762
|
+
*/
|
|
34763
|
+
function generatorFn(UserSN, galaxy) {
|
|
34764
|
+
let sn;
|
|
34765
|
+
|
|
34766
|
+
// TODO validate galaxy API
|
|
34767
|
+
|
|
34768
|
+
if (typeof UserSN === 'function') {
|
|
34769
|
+
sn = UserSN(galaxy);
|
|
34770
|
+
} else {
|
|
34771
|
+
sn = UserSN;
|
|
34772
|
+
}
|
|
34773
|
+
|
|
34774
|
+
/**
|
|
34775
|
+
* @alias generator
|
|
34776
|
+
* @private
|
|
34777
|
+
*/
|
|
34778
|
+
const generator = /** @lends generator */{
|
|
34779
|
+
/**
|
|
34780
|
+
* @type {QAE}
|
|
34781
|
+
*/
|
|
34782
|
+
qae: qae(sn.qae),
|
|
34783
|
+
/**
|
|
34784
|
+
* @type {SnComponent}
|
|
34785
|
+
*/
|
|
34786
|
+
component: sn.component || {},
|
|
34787
|
+
/**
|
|
34788
|
+
* @param {object} p
|
|
34789
|
+
* @param {EnigmaAppModel} p.app
|
|
34790
|
+
* @param {EnigmaObjectModel} p.model
|
|
34791
|
+
* @param {ObjectSelections} p.selections
|
|
34792
|
+
*/
|
|
34793
|
+
create(params) {
|
|
34794
|
+
const ss = create$2(generator, params, galaxy);
|
|
34795
|
+
return ss;
|
|
34796
|
+
},
|
|
34797
|
+
definition: {}
|
|
34798
|
+
};
|
|
34799
|
+
Object.keys(sn).forEach(key => {
|
|
34800
|
+
if (!generator[key]) {
|
|
34801
|
+
generator.definition[key] = sn[key];
|
|
34802
|
+
}
|
|
34803
|
+
});
|
|
34804
|
+
return generator;
|
|
34805
|
+
}
|
|
34806
|
+
|
|
34807
|
+
/* eslint-disable no-underscore-dangle */
|
|
34808
|
+
const saveSoftProperties = (model, prevEffectiveProperties, effectiveProperties) => {
|
|
34809
|
+
if (!model) {
|
|
34810
|
+
return Promise.resolve();
|
|
34811
|
+
}
|
|
34812
|
+
let patches = JSONPatch.generate(prevEffectiveProperties, effectiveProperties);
|
|
34813
|
+
extend$2(true, prevEffectiveProperties, effectiveProperties);
|
|
34814
|
+
if (patches && patches.length) {
|
|
34815
|
+
patches = patches.map(p => ({
|
|
34816
|
+
qOp: p.op,
|
|
34817
|
+
qValue: JSON.stringify(p.value),
|
|
34818
|
+
qPath: p.path
|
|
34819
|
+
}));
|
|
34820
|
+
if (model.__snInterceptor) {
|
|
34821
|
+
return model.__snInterceptor.applyPatches.call(model, patches, true);
|
|
34822
|
+
}
|
|
34823
|
+
return model.applyPatches(patches, true);
|
|
34824
|
+
}
|
|
34825
|
+
return Promise.resolve();
|
|
34826
|
+
};
|
|
34827
|
+
|
|
34828
|
+
const noopi$1 = () => {};
|
|
34829
|
+
function viz() {
|
|
34830
|
+
let {
|
|
34831
|
+
model,
|
|
34832
|
+
halo,
|
|
34833
|
+
initialError,
|
|
34834
|
+
onDestroy = async () => {}
|
|
34835
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34836
|
+
let unmountCell = noopi$1;
|
|
34837
|
+
let cellRef = null;
|
|
34838
|
+
let mountedReference = null;
|
|
34839
|
+
let onMount = null;
|
|
34840
|
+
let onRender = null;
|
|
34841
|
+
const mounted = new Promise(resolve => {
|
|
34842
|
+
onMount = resolve;
|
|
34843
|
+
});
|
|
34844
|
+
const rendered = new Promise(resolve => {
|
|
34845
|
+
onRender = resolve;
|
|
34846
|
+
});
|
|
34847
|
+
const createOnInitialRender = override => () => {
|
|
34848
|
+
override && override();
|
|
34849
|
+
onRender();
|
|
34850
|
+
};
|
|
34851
|
+
let initialSnOptions = {};
|
|
34852
|
+
let initialSnPlugins = [];
|
|
34853
|
+
const emitter = new EventEmitter$1();
|
|
34854
|
+
const setSnOptions = async opts => {
|
|
34855
|
+
const override = opts.onInitialRender;
|
|
34856
|
+
if (mountedReference) {
|
|
34857
|
+
(async () => {
|
|
34858
|
+
await mounted;
|
|
34859
|
+
cellRef.current.setSnOptions(_objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
|
|
34860
|
+
onInitialRender: createOnInitialRender(override)
|
|
34861
|
+
}));
|
|
34862
|
+
})();
|
|
34863
|
+
} else {
|
|
34864
|
+
// Handle setting options before mount
|
|
34865
|
+
initialSnOptions = _objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
|
|
34866
|
+
onInitialRender: createOnInitialRender(override)
|
|
34867
|
+
});
|
|
34868
|
+
}
|
|
34869
|
+
};
|
|
34870
|
+
const setSnPlugins = async plugins => {
|
|
34871
|
+
validatePlugins(plugins);
|
|
34872
|
+
if (mountedReference) {
|
|
34873
|
+
(async () => {
|
|
34874
|
+
await mounted;
|
|
34875
|
+
cellRef.current.setSnPlugins(plugins);
|
|
34876
|
+
})();
|
|
34877
|
+
} else {
|
|
34878
|
+
// Handle setting plugins before mount
|
|
34879
|
+
initialSnPlugins = plugins;
|
|
34880
|
+
}
|
|
34881
|
+
};
|
|
34882
|
+
|
|
34883
|
+
/**
|
|
34884
|
+
* @class
|
|
34885
|
+
* @alias Viz
|
|
34886
|
+
* @classdesc A controller to further modify a visualization after it has been rendered.
|
|
34887
|
+
* @example
|
|
34888
|
+
* const viz = await embed(app).render({
|
|
34889
|
+
* element,
|
|
34890
|
+
* type: 'barchart'
|
|
34891
|
+
* });
|
|
34892
|
+
* viz.destroy();
|
|
34893
|
+
*/
|
|
34894
|
+
const api = /** @lends Viz# */{
|
|
34895
|
+
/**
|
|
34896
|
+
* The id of this visualization's generic object.
|
|
34897
|
+
* @type {string}
|
|
34898
|
+
*/
|
|
34899
|
+
id: model.id,
|
|
34900
|
+
/**
|
|
34901
|
+
* This visualizations Enigma model, a representation of the generic object.
|
|
34902
|
+
* @type {EngineAPI.IGenericObject}
|
|
34903
|
+
*/
|
|
34904
|
+
model,
|
|
34905
|
+
/**
|
|
34906
|
+
* Destroys the visualization and removes it from the the DOM.
|
|
34907
|
+
* @example
|
|
34908
|
+
* const viz = await embed(app).render({
|
|
34909
|
+
* element,
|
|
34910
|
+
* id: 'abc'
|
|
34911
|
+
* });
|
|
34912
|
+
* viz.destroy();
|
|
34913
|
+
*/
|
|
34914
|
+
async destroy() {
|
|
34915
|
+
await onDestroy();
|
|
34916
|
+
unmountCell();
|
|
34917
|
+
unmountCell = noopi$1;
|
|
34918
|
+
},
|
|
34919
|
+
/**
|
|
34920
|
+
* Converts the visualization to a different registered type.
|
|
34921
|
+
*
|
|
34922
|
+
* Will update properties if permissions allow, else will patch (can be forced with forcePatch parameter)
|
|
34923
|
+
*
|
|
34924
|
+
* Not all chart types are compatible, similar structures are required.
|
|
34925
|
+
*
|
|
34926
|
+
* @since 1.1.0
|
|
34927
|
+
* @param {string} newType - Which registered type to convert to.
|
|
34928
|
+
* @param {boolean=} forceUpdate - Whether to apply the change or not, else simply returns the resulting properties, defaults to true.
|
|
34929
|
+
* @param {boolean=} forcePatch - Whether to always patch the change instead of making a permanent change
|
|
34930
|
+
* @throws {Error} Throws an error if the source or target chart does not support conversion
|
|
34931
|
+
* @returns {Promise<object>} Promise object that resolves to the full property tree of the converted visualization.
|
|
34932
|
+
* @example
|
|
34933
|
+
* const viz = await embed(app).render({
|
|
34934
|
+
* element,
|
|
34935
|
+
* id: 'abc'
|
|
34936
|
+
* });
|
|
34937
|
+
* await viz.convertTo('barChart');
|
|
34938
|
+
* // Change the barchart to a linechart, only in the current session
|
|
34939
|
+
* const newProperties = await viz.convertTo('lineChart', false, true);
|
|
34940
|
+
* // Remove the conversion by clearing the patches
|
|
34941
|
+
* await viz.model.clearSoftPatches();
|
|
34942
|
+
*/
|
|
34943
|
+
async convertTo(newType) {
|
|
34944
|
+
let forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
34945
|
+
let forcePatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
34946
|
+
if (forceUpdate) {
|
|
34947
|
+
const layout = await model.getLayout();
|
|
34948
|
+
if (canSetProperties(layout) && !forcePatch) {
|
|
34949
|
+
const propertyTree = await convertTo({
|
|
34950
|
+
halo,
|
|
34951
|
+
model,
|
|
34952
|
+
cellRef,
|
|
34953
|
+
newType
|
|
34954
|
+
});
|
|
34955
|
+
await setProperties(model, propertyTree.qProperty);
|
|
34956
|
+
return propertyTree;
|
|
34957
|
+
}
|
|
34958
|
+
const oldProperties = await model.getEffectiveProperties();
|
|
34959
|
+
const propertyTree = await convertTo({
|
|
34960
|
+
halo,
|
|
34961
|
+
model,
|
|
34962
|
+
cellRef,
|
|
34963
|
+
newType,
|
|
34964
|
+
properties: oldProperties
|
|
34965
|
+
});
|
|
34966
|
+
const newProperties = propertyTree.qProperty;
|
|
34967
|
+
await saveSoftProperties(model, oldProperties, newProperties);
|
|
34968
|
+
return propertyTree;
|
|
34969
|
+
}
|
|
34970
|
+
const propertyTree = await convertTo({
|
|
34971
|
+
halo,
|
|
34972
|
+
model,
|
|
34973
|
+
cellRef,
|
|
34974
|
+
newType
|
|
34975
|
+
});
|
|
34976
|
+
return propertyTree;
|
|
34977
|
+
},
|
|
34978
|
+
/**
|
|
34979
|
+
* Listens to custom events from inside the visualization. See useEmitter
|
|
34980
|
+
* @experimental
|
|
34981
|
+
* @param {string} eventName Event name to listen to
|
|
34982
|
+
* @param {Function} listener Callback function to invoke
|
|
34983
|
+
*/
|
|
34984
|
+
addListener(eventName, listener) {
|
|
34985
|
+
emitter.addListener(eventName, listener);
|
|
34986
|
+
},
|
|
34987
|
+
/**
|
|
34988
|
+
* Removes a listener
|
|
34989
|
+
* @experimental
|
|
34990
|
+
* @param {string} eventName Event name to remove from
|
|
34991
|
+
* @param {Function} listener Callback function to remove
|
|
34992
|
+
*/
|
|
34993
|
+
removeListener(eventName, listener) {
|
|
34994
|
+
emitter.removeListener(eventName, listener);
|
|
34995
|
+
},
|
|
34996
|
+
/**
|
|
34997
|
+
* Gets the specific api that a Viz exposes.
|
|
34998
|
+
* @returns {Promise<object>} object that contains the internal Viz api.
|
|
34999
|
+
*/
|
|
35000
|
+
async getImperativeHandle() {
|
|
35001
|
+
await rendered;
|
|
35002
|
+
return cellRef.current.getImperativeHandle();
|
|
35003
|
+
},
|
|
35004
|
+
// ===== unexposed experimental API - use at own risk ======
|
|
35005
|
+
__DO_NOT_USE__: {
|
|
35006
|
+
mount(element) {
|
|
35007
|
+
if (mountedReference) {
|
|
35008
|
+
throw new Error('Already mounted');
|
|
35009
|
+
}
|
|
35010
|
+
if (!(element instanceof HTMLElement)) {
|
|
35011
|
+
throw new Error('Provided element is not a proper HTMLElement');
|
|
35012
|
+
}
|
|
35013
|
+
mountedReference = element;
|
|
35014
|
+
[unmountCell, cellRef] = glue$1({
|
|
35015
|
+
halo,
|
|
35016
|
+
element,
|
|
35017
|
+
model,
|
|
35018
|
+
initialSnOptions,
|
|
35019
|
+
initialSnPlugins,
|
|
35020
|
+
initialError,
|
|
35021
|
+
onMount,
|
|
35022
|
+
emitter
|
|
35023
|
+
});
|
|
35024
|
+
return mounted;
|
|
35025
|
+
},
|
|
35026
|
+
async applyProperties(props) {
|
|
35027
|
+
const current = await model.getEffectiveProperties();
|
|
35028
|
+
const patches = getPatches('/', props, current);
|
|
35029
|
+
if (patches.length) {
|
|
35030
|
+
return model.applyPatches(patches, true);
|
|
35031
|
+
}
|
|
35032
|
+
return undefined;
|
|
35033
|
+
},
|
|
35034
|
+
options(opts) {
|
|
35035
|
+
setSnOptions(opts);
|
|
35036
|
+
},
|
|
35037
|
+
plugins(plugins) {
|
|
35038
|
+
setSnPlugins(plugins);
|
|
35039
|
+
},
|
|
35040
|
+
exportImage() {
|
|
35041
|
+
return cellRef.current.exportImage();
|
|
35042
|
+
},
|
|
35043
|
+
takeSnapshot() {
|
|
35044
|
+
return cellRef.current.takeSnapshot();
|
|
35045
|
+
},
|
|
35046
|
+
getModel() {
|
|
35047
|
+
return model;
|
|
35048
|
+
},
|
|
35049
|
+
/**
|
|
35050
|
+
* Contains functionality related to conversions between types in the current session
|
|
35051
|
+
* @memberof Viz#
|
|
35052
|
+
* @ignore
|
|
35053
|
+
* @since 4.5.0
|
|
35054
|
+
*/
|
|
35055
|
+
convert: {
|
|
35056
|
+
/**
|
|
35057
|
+
* Converts the visualization to a different registered type using a patch. Only persists in session
|
|
35058
|
+
* @since 4.5.0
|
|
35059
|
+
* @ignore
|
|
35060
|
+
* @memberof Viz.convert
|
|
35061
|
+
* @param {string} newType - Which registered type to convert to.
|
|
35062
|
+
* @throws {Error} Throws an error if the source or target chart does not support conversion
|
|
35063
|
+
* @returns {Promise<object>} Promise object that resolves to the full property tree of the converted visualization.
|
|
35064
|
+
* @example
|
|
35065
|
+
* const viz = await embed(app).render({
|
|
35066
|
+
* element,
|
|
35067
|
+
* id: 'abc'
|
|
35068
|
+
* });
|
|
35069
|
+
* viz.convert.toType('barChart');
|
|
35070
|
+
*/
|
|
35071
|
+
async toType(newType) {
|
|
35072
|
+
const oldProperties = await model.getEffectiveProperties();
|
|
35073
|
+
const propertyTree = await convertTo({
|
|
35074
|
+
halo,
|
|
35075
|
+
model,
|
|
35076
|
+
cellRef,
|
|
35077
|
+
newType,
|
|
35078
|
+
properties: oldProperties
|
|
35079
|
+
});
|
|
35080
|
+
const newProperties = propertyTree.qProperty;
|
|
35081
|
+
await saveSoftProperties(model, oldProperties, newProperties);
|
|
35082
|
+
return propertyTree;
|
|
35083
|
+
},
|
|
35084
|
+
/**
|
|
35085
|
+
* Reverts any conversion done on the visualization
|
|
35086
|
+
* @since 4.5.0
|
|
35087
|
+
* @ignore
|
|
35088
|
+
* @memberof Viz.convert
|
|
35089
|
+
* @returns {Promise<object>} Promise object that resolves when the conversion is undone, returns result.
|
|
35090
|
+
* @example
|
|
35091
|
+
* const viz = await embed(app).render({
|
|
35092
|
+
* element,
|
|
35093
|
+
* id: 'abc'
|
|
35094
|
+
* });
|
|
35095
|
+
* viz.convert.toType('barChart');
|
|
35096
|
+
* viz.convert.revert();
|
|
35097
|
+
*/
|
|
35098
|
+
async revert() {
|
|
35099
|
+
await model.clearSoftPatches();
|
|
35100
|
+
}
|
|
35101
|
+
}
|
|
35102
|
+
}
|
|
35103
|
+
|
|
35104
|
+
// old QVisualization API
|
|
35105
|
+
// close() {},
|
|
35106
|
+
// exportData() {},
|
|
35107
|
+
// exportImg() {},
|
|
35108
|
+
// exportPdf() {},
|
|
35109
|
+
// setOptions() {}, // applied soft patch
|
|
35110
|
+
// resize() {},
|
|
35111
|
+
// show() {},
|
|
35112
|
+
// toggleDataView() {},
|
|
35113
|
+
};
|
|
35114
|
+
|
|
35115
|
+
return api;
|
|
35116
|
+
}
|
|
35117
|
+
|
|
35118
|
+
/* eslint no-underscore-dangle:0 */
|
|
35119
|
+
async function init(model, optional, halo, initialError) {
|
|
35120
|
+
let onDestroy = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : async () => {};
|
|
35121
|
+
const api = viz({
|
|
35122
|
+
model,
|
|
35123
|
+
halo,
|
|
35124
|
+
initialError,
|
|
35125
|
+
onDestroy
|
|
35126
|
+
});
|
|
35127
|
+
if (optional.options) {
|
|
35128
|
+
api.__DO_NOT_USE__.options(optional.options);
|
|
35129
|
+
}
|
|
35130
|
+
if (optional.plugins) {
|
|
35131
|
+
api.__DO_NOT_USE__.plugins(optional.plugins);
|
|
35132
|
+
}
|
|
35133
|
+
if (optional.element) {
|
|
35134
|
+
await api.__DO_NOT_USE__.mount(optional.element);
|
|
35135
|
+
}
|
|
35136
|
+
return api;
|
|
35137
|
+
}
|
|
35138
|
+
|
|
35139
|
+
/**
|
|
35140
|
+
* @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
|
|
35141
|
+
*/
|
|
35142
|
+
|
|
35143
|
+
/**
|
|
35144
|
+
* @interface RenderConfig
|
|
35145
|
+
* @description Configuration for rendering a visualisation, either creating or fetching an existing object.
|
|
35146
|
+
* @property {HTMLElement} element Target html element to render in to
|
|
35147
|
+
* @property {object=} options Options passed into the visualisation
|
|
35148
|
+
* @property {Plugin[]} [plugins] plugins passed into the visualisation
|
|
35149
|
+
* @property {string=} id For existing objects: Engine identifier of object to render
|
|
35150
|
+
* @property {string=} type For creating objects: Type of visualisation to render
|
|
35151
|
+
* @property {string=} version For creating objects: Version of visualization to render
|
|
35152
|
+
* @property {(Field[])=} fields For creating objects: Data fields to use
|
|
35153
|
+
* @property {boolean=} [extendProperties=false] For creating objects: Whether to deeply extend properties or not. If false then subtrees will be overwritten.
|
|
35154
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties For creating objects: Explicit properties to set
|
|
35155
|
+
* @example
|
|
35156
|
+
* // A config for Creating objects:
|
|
35157
|
+
* const createConfig = {
|
|
35158
|
+
* type: 'bar',
|
|
35159
|
+
* element: document.querySelector('.bar'),
|
|
35160
|
+
* extendProperties: true,
|
|
35161
|
+
* fields: ['[Country names]', '=Sum(Sales)'],
|
|
35162
|
+
* properties: {
|
|
35163
|
+
* legend: {
|
|
35164
|
+
* show: false,
|
|
35165
|
+
* },
|
|
35166
|
+
* }
|
|
35167
|
+
* };
|
|
35168
|
+
* nebbie.render(createConfig);
|
|
35169
|
+
* // A config for rendering an existing object:
|
|
35170
|
+
* const createConfig = {
|
|
35171
|
+
* id: 'jG5LP',
|
|
35172
|
+
* element: document.querySelector('.line'),
|
|
35173
|
+
* };
|
|
35174
|
+
* nebbie.render(createConfig);
|
|
35175
|
+
*/
|
|
35176
|
+
async function createSessionObject(_ref, halo) {
|
|
35177
|
+
let {
|
|
35178
|
+
type,
|
|
35179
|
+
version,
|
|
35180
|
+
fields,
|
|
35181
|
+
properties,
|
|
35182
|
+
options,
|
|
35183
|
+
plugins,
|
|
35184
|
+
element,
|
|
35185
|
+
extendProperties
|
|
35186
|
+
} = _ref;
|
|
35187
|
+
let mergedProps = {};
|
|
35188
|
+
const children = [];
|
|
35189
|
+
let error;
|
|
35190
|
+
try {
|
|
35191
|
+
const t = halo.types.get({
|
|
35192
|
+
name: type,
|
|
35193
|
+
version
|
|
35194
|
+
});
|
|
35195
|
+
mergedProps = await t.initialProperties(properties, extendProperties);
|
|
35196
|
+
const sn = await t.supernova();
|
|
35197
|
+
if (fields) {
|
|
35198
|
+
await populateData({
|
|
35199
|
+
sn,
|
|
35200
|
+
properties: mergedProps,
|
|
35201
|
+
fields,
|
|
35202
|
+
children
|
|
35203
|
+
}, halo);
|
|
35204
|
+
}
|
|
35205
|
+
if (properties && sn && sn.qae.properties.onChange) {
|
|
35206
|
+
sn.qae.properties.onChange.call({}, mergedProps);
|
|
35207
|
+
}
|
|
35208
|
+
} catch (e) {
|
|
35209
|
+
error = e;
|
|
35210
|
+
// minimal dummy object properties to allow it to be created
|
|
35211
|
+
// and rendered with the error
|
|
35212
|
+
mergedProps = {
|
|
35213
|
+
qInfo: {
|
|
35214
|
+
qType: type
|
|
35215
|
+
},
|
|
35216
|
+
visualization: type
|
|
35217
|
+
};
|
|
35218
|
+
// console.error(e); // eslint-disable-line
|
|
35219
|
+
}
|
|
35220
|
+
|
|
35221
|
+
const model = await halo.app.createSessionObject(mergedProps);
|
|
35222
|
+
if (children.length > 0) {
|
|
35223
|
+
await model.setFullPropertyTree({
|
|
35224
|
+
qProperty: mergedProps,
|
|
35225
|
+
qChildren: children
|
|
35226
|
+
});
|
|
35227
|
+
}
|
|
35228
|
+
modelStore.set(model.id, model);
|
|
35229
|
+
const unsubscribe = subscribe(model);
|
|
35230
|
+
const onDestroy = async () => {
|
|
35231
|
+
await halo.app.destroySessionObject(model.id);
|
|
35232
|
+
unsubscribe();
|
|
35233
|
+
};
|
|
35234
|
+
return init(model, {
|
|
35235
|
+
options,
|
|
35236
|
+
plugins,
|
|
35237
|
+
element
|
|
35238
|
+
}, halo, error, onDestroy);
|
|
35239
|
+
}
|
|
35240
|
+
|
|
35241
|
+
/**
|
|
35242
|
+
* @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
|
|
35243
|
+
*/
|
|
35244
|
+
|
|
35245
|
+
/**
|
|
35246
|
+
* @interface CreateConfig
|
|
35247
|
+
* @description Rendering configuration for creating and rendering a new object
|
|
35248
|
+
* @property {string} type
|
|
35249
|
+
* @property {string=} version
|
|
35250
|
+
* @property {(Field[])=} fields
|
|
35251
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
35252
|
+
*/
|
|
35253
|
+
|
|
35254
|
+
async function createObject(_ref, halo, generateOnly) {
|
|
35255
|
+
let {
|
|
35256
|
+
type,
|
|
35257
|
+
version,
|
|
35258
|
+
fields,
|
|
35259
|
+
properties,
|
|
35260
|
+
extendProperties /* , options, plugins, element */
|
|
35261
|
+
} = _ref;
|
|
35262
|
+
let mergedProps = {};
|
|
35263
|
+
const children = [];
|
|
35264
|
+
// let error;
|
|
35265
|
+
try {
|
|
35266
|
+
const t = halo.types.get({
|
|
35267
|
+
name: type,
|
|
35268
|
+
version
|
|
35269
|
+
});
|
|
35270
|
+
mergedProps = await t.initialProperties(properties, extendProperties);
|
|
35271
|
+
const sn = await t.supernova();
|
|
35272
|
+
if (fields) {
|
|
35273
|
+
await populateData({
|
|
35274
|
+
sn,
|
|
35275
|
+
properties: mergedProps,
|
|
35276
|
+
fields,
|
|
35277
|
+
children
|
|
35278
|
+
}, halo);
|
|
35279
|
+
}
|
|
35280
|
+
if (properties && sn && sn.qae.properties.onChange) {
|
|
35281
|
+
sn.qae.properties.onChange.call({}, mergedProps);
|
|
35414
35282
|
}
|
|
35415
|
-
|
|
35283
|
+
} catch (e) {
|
|
35284
|
+
// error = e;
|
|
35285
|
+
// minimal dummy object properties to allow it to be created
|
|
35286
|
+
// and rendered with the error
|
|
35287
|
+
if (!generateOnly) {
|
|
35288
|
+
mergedProps = {
|
|
35289
|
+
qInfo: {
|
|
35290
|
+
qType: type
|
|
35291
|
+
},
|
|
35292
|
+
visualization: type
|
|
35293
|
+
};
|
|
35294
|
+
} else {
|
|
35295
|
+
mergedProps = null;
|
|
35296
|
+
}
|
|
35297
|
+
// console.error(e); // eslint-disable-line
|
|
35416
35298
|
}
|
|
35417
|
-
|
|
35418
|
-
|
|
35419
|
-
|
|
35420
|
-
|
|
35421
|
-
|
|
35422
|
-
|
|
35423
|
-
|
|
35424
|
-
|
|
35299
|
+
|
|
35300
|
+
if (!generateOnly) {
|
|
35301
|
+
const model = await halo.app.createObject(mergedProps);
|
|
35302
|
+
if (children.length > 0) {
|
|
35303
|
+
await model.setFullPropertyTree({
|
|
35304
|
+
qProperty: mergedProps,
|
|
35305
|
+
qChildren: children
|
|
35306
|
+
});
|
|
35307
|
+
}
|
|
35308
|
+
modelStore.set(model.id, model);
|
|
35309
|
+
return model;
|
|
35425
35310
|
}
|
|
35426
|
-
return
|
|
35427
|
-
propertyPath,
|
|
35428
|
-
layoutPath,
|
|
35429
|
-
resolveLayout: layout => resolveValue(layout, layoutPath, {}),
|
|
35430
|
-
dimensions: defFn(def.dimensions),
|
|
35431
|
-
measures: defFn(def.measures)
|
|
35432
|
-
};
|
|
35311
|
+
return mergedProps;
|
|
35433
35312
|
}
|
|
35434
|
-
|
|
35435
|
-
|
|
35436
|
-
let
|
|
35437
|
-
|
|
35438
|
-
|
|
35439
|
-
|
|
35440
|
-
|
|
35313
|
+
|
|
35314
|
+
async function getObject$1(_ref, halo) {
|
|
35315
|
+
let {
|
|
35316
|
+
id,
|
|
35317
|
+
options,
|
|
35318
|
+
plugins,
|
|
35319
|
+
element
|
|
35320
|
+
} = _ref;
|
|
35321
|
+
const key = "".concat(id);
|
|
35322
|
+
let rpc = rpcRequestModelStore.get(key);
|
|
35323
|
+
if (!rpc) {
|
|
35324
|
+
rpc = halo.app.getObject(id);
|
|
35325
|
+
rpcRequestModelStore.set(key, rpc);
|
|
35441
35326
|
}
|
|
35442
|
-
const
|
|
35443
|
-
|
|
35444
|
-
|
|
35445
|
-
|
|
35446
|
-
|
|
35447
|
-
|
|
35448
|
-
|
|
35449
|
-
},
|
|
35450
|
-
exportProperties: def.exportProperties,
|
|
35451
|
-
importProperties: def.importProperties
|
|
35452
|
-
};
|
|
35453
|
-
return q;
|
|
35327
|
+
const model = await rpc;
|
|
35328
|
+
modelStore.set(key, model);
|
|
35329
|
+
return init(model, {
|
|
35330
|
+
options,
|
|
35331
|
+
plugins,
|
|
35332
|
+
element
|
|
35333
|
+
}, halo);
|
|
35454
35334
|
}
|
|
35455
35335
|
|
|
35456
35336
|
/**
|
|
35457
|
-
*
|
|
35458
|
-
* @
|
|
35459
|
-
* @
|
|
35460
|
-
* @
|
|
35461
|
-
* @example
|
|
35462
|
-
* import { useElement, useLayout } from '@nebula.js/stardust';
|
|
35463
|
-
*
|
|
35464
|
-
* export default function() {
|
|
35465
|
-
* return {
|
|
35466
|
-
* qae: {
|
|
35467
|
-
* properties: {
|
|
35468
|
-
* dude: 'Heisenberg',
|
|
35469
|
-
* }
|
|
35470
|
-
* },
|
|
35471
|
-
* component() {
|
|
35472
|
-
* const el = useElement();
|
|
35473
|
-
* const layout = useLayout();
|
|
35474
|
-
* el.innerHTML = `What's my name? ${layout.dude}!!!`;
|
|
35475
|
-
* }
|
|
35476
|
-
* };
|
|
35477
|
-
* }
|
|
35337
|
+
* @interface
|
|
35338
|
+
* @extends HTMLElement
|
|
35339
|
+
* @experimental
|
|
35340
|
+
* @since 3.1.0
|
|
35478
35341
|
*/
|
|
35342
|
+
const SheetElement = {
|
|
35343
|
+
/** @type {'njs-sheet'} */
|
|
35344
|
+
className: 'njs-sheet'
|
|
35345
|
+
};
|
|
35346
|
+
function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount) {
|
|
35347
|
+
const {
|
|
35348
|
+
x,
|
|
35349
|
+
y,
|
|
35350
|
+
width,
|
|
35351
|
+
height
|
|
35352
|
+
} = cell.bounds;
|
|
35353
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35354
|
+
style: {
|
|
35355
|
+
left: "".concat(x, "%"),
|
|
35356
|
+
top: "".concat(y, "%"),
|
|
35357
|
+
width: "".concat(width, "%"),
|
|
35358
|
+
height: "".concat(height, "%"),
|
|
35359
|
+
position: 'absolute'
|
|
35360
|
+
}
|
|
35361
|
+
}, /*#__PURE__*/React.createElement(Cell, {
|
|
35362
|
+
ref: cell.cellRef,
|
|
35363
|
+
halo: halo,
|
|
35364
|
+
model: cell.model,
|
|
35365
|
+
currentId: cell.currentId,
|
|
35366
|
+
initialSnOptions: initialSnOptions,
|
|
35367
|
+
initialSnPlugins: initialSnPlugins,
|
|
35368
|
+
initialError: initialError,
|
|
35369
|
+
onMount: onMount
|
|
35370
|
+
}));
|
|
35371
|
+
}
|
|
35372
|
+
function Sheet(_ref) {
|
|
35373
|
+
let {
|
|
35374
|
+
model,
|
|
35375
|
+
halo,
|
|
35376
|
+
initialSnOptions,
|
|
35377
|
+
initialSnPlugins,
|
|
35378
|
+
initialError,
|
|
35379
|
+
onMount
|
|
35380
|
+
} = _ref;
|
|
35381
|
+
const {
|
|
35382
|
+
root
|
|
35383
|
+
} = halo;
|
|
35384
|
+
const [layout] = useLayout$1(model);
|
|
35385
|
+
const {
|
|
35386
|
+
theme: themeName
|
|
35387
|
+
} = reactExports.useContext(InstanceContext);
|
|
35388
|
+
const [cells, setCells] = reactExports.useState([]);
|
|
35389
|
+
const [bgColor, setBgColor] = reactExports.useState(undefined);
|
|
35390
|
+
const [bgImage, setBgImage] = reactExports.useState(undefined);
|
|
35391
|
+
const [deepHash, setDeepHash] = reactExports.useState('');
|
|
35479
35392
|
|
|
35480
|
-
|
|
35481
|
-
|
|
35482
|
-
|
|
35483
|
-
|
|
35484
|
-
|
|
35393
|
+
/// For each object
|
|
35394
|
+
reactExports.useEffect(() => {
|
|
35395
|
+
if (layout) {
|
|
35396
|
+
const hash = JSON.stringify(layout.cells);
|
|
35397
|
+
if (hash === deepHash) {
|
|
35398
|
+
return;
|
|
35399
|
+
}
|
|
35400
|
+
setDeepHash(hash);
|
|
35401
|
+
const fetchObjects = async () => {
|
|
35402
|
+
/*
|
|
35403
|
+
Need to always fetch and evaluate everything as the sheet need to support multiple instances of the same object?
|
|
35404
|
+
No, there is no way to add the same chart twice, so the optimization should be worth it.
|
|
35405
|
+
*/
|
|
35485
35406
|
|
|
35486
|
-
|
|
35487
|
-
|
|
35488
|
-
|
|
35489
|
-
|
|
35490
|
-
|
|
35491
|
-
|
|
35492
|
-
|
|
35493
|
-
|
|
35494
|
-
|
|
35407
|
+
// Clear the cell list
|
|
35408
|
+
cells.forEach(c => {
|
|
35409
|
+
root.removeCell(c.currentId);
|
|
35410
|
+
});
|
|
35411
|
+
const lCells = layout.cells;
|
|
35412
|
+
// TODO - should try reuse existing objects on subsequent renders
|
|
35413
|
+
// Non-id updates should only change the "css"
|
|
35414
|
+
const cs = await Promise.all(lCells.map(async c => {
|
|
35415
|
+
let mounted;
|
|
35416
|
+
const mountedPromise = new Promise(resolve => {
|
|
35417
|
+
mounted = resolve;
|
|
35418
|
+
});
|
|
35419
|
+
const cell = cells.find(ce => ce.id === c.name);
|
|
35420
|
+
if (cell) {
|
|
35421
|
+
cell.bounds = c.bounds;
|
|
35422
|
+
delete cell.mountedPromise;
|
|
35423
|
+
return cell;
|
|
35424
|
+
}
|
|
35425
|
+
const vs = await getObject$1({
|
|
35426
|
+
id: c.name
|
|
35427
|
+
}, halo);
|
|
35428
|
+
return {
|
|
35429
|
+
model: vs.model,
|
|
35430
|
+
id: c.name,
|
|
35431
|
+
bounds: c.bounds,
|
|
35432
|
+
cellRef: React.createRef(),
|
|
35433
|
+
currentId: uid(),
|
|
35434
|
+
mounted,
|
|
35435
|
+
mountedPromise
|
|
35436
|
+
};
|
|
35437
|
+
}));
|
|
35438
|
+
cs.forEach(c => root.addCell(c.currentId, c.cellRef));
|
|
35439
|
+
setCells(cs);
|
|
35440
|
+
};
|
|
35441
|
+
fetchObjects();
|
|
35442
|
+
}
|
|
35443
|
+
}, [layout]);
|
|
35444
|
+
const cellRenderers = reactExports.useMemo(() => cells ? cells.map(c => getCellRenderer(c, halo, initialSnOptions, initialSnPlugins, initialError, c.mounted)) : [], [cells]);
|
|
35445
|
+
reactExports.useEffect(() => {
|
|
35446
|
+
const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
|
|
35447
|
+
setBgColor(resolveBgColor(bgComp, halo.public.theme));
|
|
35448
|
+
setBgImage(resolveBgImage(bgComp, halo.app));
|
|
35449
|
+
}, [layout, halo.public.theme, halo.app, themeName]);
|
|
35495
35450
|
|
|
35496
|
-
|
|
35451
|
+
/* TODO
|
|
35452
|
+
- sheet title + bg + logo etc + as option
|
|
35453
|
+
- sheet exposed classnames for theming
|
|
35454
|
+
*/
|
|
35497
35455
|
|
|
35498
|
-
|
|
35499
|
-
|
|
35500
|
-
|
|
35501
|
-
|
|
35456
|
+
const height = !layout || Number.isNaN(layout.height) ? '100%' : "".concat(Number(layout.height), "%");
|
|
35457
|
+
const promises = cells.map(c => c.mountedPromise);
|
|
35458
|
+
const ps = promises.filter(p => !!p);
|
|
35459
|
+
if (ps.length) {
|
|
35460
|
+
Promise.all(promises).then(() => {
|
|
35461
|
+
// TODO - correct? Currently called each time a new cell is mounted?
|
|
35462
|
+
onMount();
|
|
35463
|
+
});
|
|
35502
35464
|
}
|
|
35465
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35466
|
+
className: SheetElement.className,
|
|
35467
|
+
style: {
|
|
35468
|
+
width: "100%",
|
|
35469
|
+
height,
|
|
35470
|
+
position: 'relative',
|
|
35471
|
+
backgroundColor: bgColor,
|
|
35472
|
+
backgroundImage: bgImage && bgImage.url ? "url(".concat(bgImage.url, ")") : undefined,
|
|
35473
|
+
backgroundRepeat: 'no-repeat',
|
|
35474
|
+
backgroundSize: bgImage && bgImage.size,
|
|
35475
|
+
backgroundPosition: bgImage && bgImage.pos
|
|
35476
|
+
}
|
|
35477
|
+
}, cellRenderers);
|
|
35478
|
+
}
|
|
35479
|
+
|
|
35480
|
+
function glue(_ref) {
|
|
35481
|
+
let {
|
|
35482
|
+
halo,
|
|
35483
|
+
element,
|
|
35484
|
+
model,
|
|
35485
|
+
initialSnOptions,
|
|
35486
|
+
initialSnPlugins,
|
|
35487
|
+
onMount,
|
|
35488
|
+
initialError
|
|
35489
|
+
} = _ref;
|
|
35490
|
+
const {
|
|
35491
|
+
root
|
|
35492
|
+
} = halo;
|
|
35493
|
+
const sheetRef = React.createRef();
|
|
35494
|
+
const portal = ReactDOM.createPortal( /*#__PURE__*/React.createElement(Sheet, {
|
|
35495
|
+
ref: sheetRef,
|
|
35496
|
+
halo: halo,
|
|
35497
|
+
model: model,
|
|
35498
|
+
initialSnOptions: initialSnOptions,
|
|
35499
|
+
initialSnPlugins: initialSnPlugins,
|
|
35500
|
+
initialError: initialError,
|
|
35501
|
+
onMount: onMount
|
|
35502
|
+
}), element, model.id);
|
|
35503
|
+
const unmount = () => {
|
|
35504
|
+
root.remove(portal);
|
|
35505
|
+
model.removeListener('closed', unmount);
|
|
35506
|
+
};
|
|
35507
|
+
model.on('closed', unmount);
|
|
35508
|
+
root.add(portal);
|
|
35509
|
+
return [unmount, sheetRef];
|
|
35510
|
+
}
|
|
35511
|
+
|
|
35512
|
+
const noopi = () => {};
|
|
35513
|
+
function sheet() {
|
|
35514
|
+
let {
|
|
35515
|
+
model,
|
|
35516
|
+
halo,
|
|
35517
|
+
initialError,
|
|
35518
|
+
onDestroy = async () => {}
|
|
35519
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35520
|
+
let unmountSheet = noopi;
|
|
35521
|
+
let sheetRef = null;
|
|
35522
|
+
let mountedReference = null;
|
|
35523
|
+
let onMount = null;
|
|
35524
|
+
const mounted = new Promise(resolve => {
|
|
35525
|
+
onMount = resolve;
|
|
35526
|
+
});
|
|
35527
|
+
let initialSnOptions = {};
|
|
35528
|
+
let initialSnPlugins = [];
|
|
35529
|
+
const setSnOptions = async opts => {
|
|
35530
|
+
if (mountedReference) {
|
|
35531
|
+
(async () => {
|
|
35532
|
+
await mounted;
|
|
35533
|
+
sheetRef.current.setSnOptions(_objectSpread2(_objectSpread2({}, initialSnOptions), opts));
|
|
35534
|
+
})();
|
|
35535
|
+
} else {
|
|
35536
|
+
// Handle setting options before mount
|
|
35537
|
+
initialSnOptions = _objectSpread2(_objectSpread2({}, initialSnOptions), opts);
|
|
35538
|
+
}
|
|
35539
|
+
};
|
|
35540
|
+
const setSnPlugins = async plugins => {
|
|
35541
|
+
validatePlugins(plugins);
|
|
35542
|
+
if (mountedReference) {
|
|
35543
|
+
(async () => {
|
|
35544
|
+
await mounted;
|
|
35545
|
+
sheetRef.current.setSnPlugins(plugins);
|
|
35546
|
+
})();
|
|
35547
|
+
} else {
|
|
35548
|
+
// Handle setting plugins before mount
|
|
35549
|
+
initialSnPlugins = plugins;
|
|
35550
|
+
}
|
|
35551
|
+
};
|
|
35503
35552
|
|
|
35504
35553
|
/**
|
|
35505
|
-
* @
|
|
35506
|
-
* @
|
|
35554
|
+
* @class
|
|
35555
|
+
* @alias Sheet
|
|
35556
|
+
* @classdesc A controller to further modify a visualization after it has been rendered.
|
|
35557
|
+
* @experimental
|
|
35558
|
+
* @since 3.1.0
|
|
35559
|
+
* @example
|
|
35560
|
+
* const sheet = await embed(app).render({
|
|
35561
|
+
* element,
|
|
35562
|
+
* id: "jD5Gd"
|
|
35563
|
+
* });
|
|
35564
|
+
* sheet.destroy();
|
|
35507
35565
|
*/
|
|
35508
|
-
const
|
|
35566
|
+
const api = /** @lends Sheet# */{
|
|
35509
35567
|
/**
|
|
35510
|
-
*
|
|
35568
|
+
* The id of this sheets's generic object.
|
|
35569
|
+
* @type {string}
|
|
35511
35570
|
*/
|
|
35512
|
-
|
|
35571
|
+
id: model.id,
|
|
35513
35572
|
/**
|
|
35514
|
-
*
|
|
35573
|
+
* This sheets Enigma model, a representation of the generic object.
|
|
35574
|
+
* @type {string}
|
|
35515
35575
|
*/
|
|
35516
|
-
|
|
35576
|
+
model,
|
|
35517
35577
|
/**
|
|
35518
|
-
*
|
|
35519
|
-
* @
|
|
35520
|
-
*
|
|
35521
|
-
*
|
|
35578
|
+
* Destroys the sheet and removes it from the the DOM.
|
|
35579
|
+
* @example
|
|
35580
|
+
* const sheet = await embed(app).render({
|
|
35581
|
+
* element,
|
|
35582
|
+
* id: "jD5Gd"
|
|
35583
|
+
* });
|
|
35584
|
+
* sheet.destroy();
|
|
35522
35585
|
*/
|
|
35523
|
-
|
|
35524
|
-
|
|
35525
|
-
|
|
35586
|
+
async destroy() {
|
|
35587
|
+
await onDestroy();
|
|
35588
|
+
unmountSheet();
|
|
35589
|
+
unmountSheet = noopi;
|
|
35526
35590
|
},
|
|
35527
|
-
|
|
35528
|
-
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
|
|
35591
|
+
// ===== unexposed experimental API - use at own risk ======
|
|
35592
|
+
__DO_NOT_USE__: {
|
|
35593
|
+
mount(element) {
|
|
35594
|
+
if (mountedReference) {
|
|
35595
|
+
throw new Error('Already mounted');
|
|
35596
|
+
}
|
|
35597
|
+
if (!(element instanceof HTMLElement)) {
|
|
35598
|
+
throw new Error('Provided element is not a proper HTMLElement');
|
|
35599
|
+
}
|
|
35600
|
+
mountedReference = element;
|
|
35601
|
+
[unmountSheet, sheetRef] = glue({
|
|
35602
|
+
halo,
|
|
35603
|
+
element,
|
|
35604
|
+
model,
|
|
35605
|
+
initialSnOptions,
|
|
35606
|
+
initialSnPlugins,
|
|
35607
|
+
initialError,
|
|
35608
|
+
onMount
|
|
35609
|
+
});
|
|
35610
|
+
return mounted;
|
|
35611
|
+
},
|
|
35612
|
+
async applyProperties(props) {
|
|
35613
|
+
const current = await model.getEffectiveProperties();
|
|
35614
|
+
const patches = getPatches('/', props, current);
|
|
35615
|
+
if (patches.length) {
|
|
35616
|
+
return model.applyPatches(patches, true);
|
|
35617
|
+
}
|
|
35618
|
+
return undefined;
|
|
35619
|
+
},
|
|
35620
|
+
options(opts) {
|
|
35621
|
+
setSnOptions(opts);
|
|
35622
|
+
},
|
|
35623
|
+
plugins(plugins) {
|
|
35624
|
+
setSnPlugins(plugins);
|
|
35625
|
+
},
|
|
35626
|
+
exportImage() {
|
|
35627
|
+
throw new Error('Not implemented');
|
|
35628
|
+
},
|
|
35629
|
+
takeSnapshot() {
|
|
35630
|
+
throw new Error('Not implemented');
|
|
35631
|
+
},
|
|
35632
|
+
getModel() {
|
|
35633
|
+
return model;
|
|
35634
|
+
}
|
|
35532
35635
|
}
|
|
35636
|
+
};
|
|
35637
|
+
return api;
|
|
35638
|
+
}
|
|
35639
|
+
|
|
35640
|
+
/* eslint no-underscore-dangle:0 */
|
|
35641
|
+
async function initSheet(model, optional, halo, initialError) {
|
|
35642
|
+
let onDestroy = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : async () => {};
|
|
35643
|
+
const api = sheet({
|
|
35644
|
+
model,
|
|
35645
|
+
halo,
|
|
35646
|
+
initialError,
|
|
35647
|
+
onDestroy
|
|
35533
35648
|
});
|
|
35534
|
-
|
|
35649
|
+
if (optional.options) {
|
|
35650
|
+
api.__DO_NOT_USE__.options(optional.options);
|
|
35651
|
+
}
|
|
35652
|
+
if (optional.plugins) {
|
|
35653
|
+
api.__DO_NOT_USE__.plugins(optional.plugins);
|
|
35654
|
+
}
|
|
35655
|
+
if (optional.element) {
|
|
35656
|
+
await api.__DO_NOT_USE__.mount(optional.element);
|
|
35657
|
+
}
|
|
35658
|
+
return api;
|
|
35659
|
+
}
|
|
35660
|
+
|
|
35661
|
+
async function getObject(_ref, halo) {
|
|
35662
|
+
let {
|
|
35663
|
+
id,
|
|
35664
|
+
options,
|
|
35665
|
+
plugins,
|
|
35666
|
+
element
|
|
35667
|
+
} = _ref;
|
|
35668
|
+
const key = "".concat(id);
|
|
35669
|
+
let rpc = rpcRequestModelStore.get(key);
|
|
35670
|
+
if (!rpc) {
|
|
35671
|
+
rpc = halo.app.getObject(id);
|
|
35672
|
+
rpcRequestModelStore.set(key, rpc);
|
|
35673
|
+
}
|
|
35674
|
+
const model = await rpc;
|
|
35675
|
+
modelStore.set(key, model);
|
|
35676
|
+
if (model.genericType === 'sheet') {
|
|
35677
|
+
return initSheet(model, {
|
|
35678
|
+
options,
|
|
35679
|
+
plugins,
|
|
35680
|
+
element
|
|
35681
|
+
}, halo);
|
|
35682
|
+
}
|
|
35683
|
+
return init(model, {
|
|
35684
|
+
options,
|
|
35685
|
+
plugins,
|
|
35686
|
+
element
|
|
35687
|
+
}, halo);
|
|
35688
|
+
}
|
|
35689
|
+
|
|
35690
|
+
function flagsFn () {
|
|
35691
|
+
let flags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35692
|
+
/**
|
|
35693
|
+
* @interface Flags
|
|
35694
|
+
*/
|
|
35695
|
+
|
|
35696
|
+
return (/** @lends Flags */{
|
|
35697
|
+
/**
|
|
35698
|
+
* Checks whether the specified flag is enabled.
|
|
35699
|
+
* @param {string} flag - The value flag to check.
|
|
35700
|
+
* @returns {boolean} True if the specified flag is enabled, false otherwise.
|
|
35701
|
+
*/
|
|
35702
|
+
isEnabled: f => flags[f] === true
|
|
35703
|
+
}
|
|
35704
|
+
);
|
|
35535
35705
|
}
|
|
35536
35706
|
|
|
35537
35707
|
var iterator;
|
|
@@ -37695,7 +37865,10 @@
|
|
|
37695
37865
|
language: 'en-US',
|
|
37696
37866
|
/** @type {string=} */
|
|
37697
37867
|
deviceType: 'auto',
|
|
37698
|
-
/**
|
|
37868
|
+
/**
|
|
37869
|
+
* @type {Constraints=}
|
|
37870
|
+
* @deprecated
|
|
37871
|
+
* */
|
|
37699
37872
|
constraints: {},
|
|
37700
37873
|
/** @type {Interactions=} */
|
|
37701
37874
|
interactions: {},
|
|
@@ -38246,6 +38419,7 @@
|
|
|
38246
38419
|
getLayout: () => Promise.resolve(layout),
|
|
38247
38420
|
getProperties: () => Promise.resolve(properties),
|
|
38248
38421
|
getEffectiveProperties: () => Promise.resolve(properties),
|
|
38422
|
+
removeListener: () => {},
|
|
38249
38423
|
id: properties.qInfo.qId
|
|
38250
38424
|
}, properties));
|
|
38251
38425
|
};
|