@j2inn/fin5-ui-utils 1.0.6 → 1.0.7
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/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/react/app/{Fin5AppContainer.jsx → Fin5AppContainer.js} +8 -16
- package/dist/react/app/Fin5AppContainer.js.map +1 -0
- package/dist/react/components/{ErrorBoundary.jsx → ErrorBoundary.js} +23 -49
- package/dist/react/components/ErrorBoundary.js.map +1 -0
- package/dist/react/components/{ErrorDisplayer.jsx → ErrorDisplayer.js} +8 -15
- package/dist/react/components/ErrorDisplayer.js.map +1 -0
- package/dist/react/components/{Loader.jsx → Loader.js} +2 -2
- package/dist/react/components/Loader.js.map +1 -0
- package/dist/react/components/{LoadingSpinner.jsx → LoadingSpinner.js} +3 -4
- package/dist/react/components/LoadingSpinner.js.map +1 -0
- package/dist/react/components/graphics/{GraphicViewer.jsx → GraphicViewer.js} +2 -2
- package/dist/react/components/graphics/GraphicViewer.js.map +1 -0
- package/dist/react/components/graphics/{GraphicsTabViewer.jsx → GraphicsTabViewer.js} +3 -5
- package/dist/react/components/graphics/GraphicsTabViewer.js.map +1 -0
- package/dist/react/components/navigation/{BasicLayout.jsx → BasicLayout.js} +27 -34
- package/dist/react/components/navigation/BasicLayout.js.map +1 -0
- package/dist/react/components/navigation/{MenuPage.jsx → MenuPage.js} +1 -1
- package/dist/react/components/navigation/MenuPage.js.map +1 -0
- package/dist/react/components/navigation/{Router.jsx → Router.js} +4 -4
- package/dist/react/components/navigation/Router.js.map +1 -0
- package/dist/react/components/resolvable/configurationForm/ConfigurationForm.d.ts +27 -0
- package/dist/react/components/resolvable/configurationForm/ConfigurationForm.js +96 -0
- package/dist/react/components/resolvable/configurationForm/ConfigurationForm.js.map +1 -0
- package/dist/react/components/resolvable/configurationForm/ConfigurationFormEntry.d.ts +16 -0
- package/dist/react/components/resolvable/configurationForm/ConfigurationFormEntry.js +89 -0
- package/dist/react/components/resolvable/configurationForm/ConfigurationFormEntry.js.map +1 -0
- package/dist/react/components/resolvable/configurationForm/getSectionDefault.d.ts +16 -0
- package/dist/react/components/resolvable/configurationForm/getSectionDefault.js +100 -0
- package/dist/react/components/resolvable/configurationForm/getSectionDefault.js.map +1 -0
- package/dist_es/index.d.ts +3 -0
- package/dist_es/index.js +3 -0
- package/dist_es/index.js.map +1 -1
- package/dist_es/react/app/Fin5AppContainer.js +74 -0
- package/dist_es/react/app/Fin5AppContainer.js.map +1 -0
- package/dist_es/react/components/ErrorBoundary.js +124 -0
- package/dist_es/react/components/ErrorBoundary.js.map +1 -0
- package/dist_es/react/components/ErrorDisplayer.js +29 -0
- package/dist_es/react/components/ErrorDisplayer.js.map +1 -0
- package/dist_es/react/components/Loader.js +13 -0
- package/dist_es/react/components/Loader.js.map +1 -0
- package/dist_es/react/components/LoadingSpinner.js +21 -0
- package/dist_es/react/components/LoadingSpinner.js.map +1 -0
- package/dist_es/react/components/graphics/GraphicViewer.js +23 -0
- package/dist_es/react/components/graphics/GraphicViewer.js.map +1 -0
- package/dist_es/react/components/graphics/GraphicsTabViewer.js +61 -0
- package/dist_es/react/components/graphics/GraphicsTabViewer.js.map +1 -0
- package/dist_es/react/components/navigation/BasicLayout.js +126 -0
- package/dist_es/react/components/navigation/BasicLayout.js.map +1 -0
- package/dist_es/react/components/navigation/MenuPage.js +31 -0
- package/dist_es/react/components/navigation/MenuPage.js.map +1 -0
- package/dist_es/react/components/navigation/Router.js +19 -0
- package/dist_es/react/components/navigation/Router.js.map +1 -0
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationForm.d.ts +27 -0
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationForm.js +65 -0
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationForm.js.map +1 -0
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationFormEntry.d.ts +16 -0
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationFormEntry.js +59 -0
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationFormEntry.js.map +1 -0
- package/dist_es/react/components/resolvable/configurationForm/getSectionDefault.d.ts +16 -0
- package/dist_es/react/components/resolvable/configurationForm/getSectionDefault.js +95 -0
- package/dist_es/react/components/resolvable/configurationForm/getSectionDefault.js.map +1 -0
- package/package.json +3 -5
- package/dist/react/app/Fin5AppContainer.jsx.map +0 -1
- package/dist/react/components/ErrorBoundary.jsx.map +0 -1
- package/dist/react/components/ErrorDisplayer.jsx.map +0 -1
- package/dist/react/components/Loader.jsx.map +0 -1
- package/dist/react/components/LoadingSpinner.jsx.map +0 -1
- package/dist/react/components/graphics/GraphicViewer.jsx.map +0 -1
- package/dist/react/components/graphics/GraphicsTabViewer.jsx.map +0 -1
- package/dist/react/components/navigation/BasicLayout.jsx.map +0 -1
- package/dist/react/components/navigation/MenuPage.jsx.map +0 -1
- package/dist/react/components/navigation/Router.jsx.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023, J2 Innovations. All Rights Reserved
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.ConfigurationFormEntry = void 0;
|
|
33
|
+
const ui_1 = require("@j2inn/ui");
|
|
34
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
35
|
+
const haystack_core_1 = require("haystack-core");
|
|
36
|
+
const react_1 = __importStar(require("react"));
|
|
37
|
+
const react_jss_1 = require("react-jss");
|
|
38
|
+
const useStyles = (0, react_jss_1.createUseStyles)((theme) => ({
|
|
39
|
+
formEntry: {
|
|
40
|
+
[`& .${ui_1.ant_prefix}-input`]: {
|
|
41
|
+
height: 32,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
entryTitle: {
|
|
45
|
+
fontWeight: 600,
|
|
46
|
+
fontSize: '1em',
|
|
47
|
+
color: theme.textColorSecondary,
|
|
48
|
+
},
|
|
49
|
+
select: {
|
|
50
|
+
width: '100%',
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
const getHValFromSelectValue = (selectValue, initialHVal) => {
|
|
54
|
+
if ((0, haystack_core_1.valueIsKind)(initialHVal, haystack_core_1.Kind.Number)) {
|
|
55
|
+
return haystack_core_1.HNum.make(selectValue, initialHVal.unit);
|
|
56
|
+
}
|
|
57
|
+
else if ((0, haystack_core_1.valueIsKind)(initialHVal, haystack_core_1.Kind.Ref)) {
|
|
58
|
+
return haystack_core_1.HRef.make(selectValue);
|
|
59
|
+
}
|
|
60
|
+
return haystack_core_1.HStr.make(selectValue);
|
|
61
|
+
};
|
|
62
|
+
const ConfigurationFormEntry = ({ name, value, onChange, disabled, options, className, }) => {
|
|
63
|
+
const classes = useStyles();
|
|
64
|
+
if (!(0, haystack_core_1.isHVal)(value)) {
|
|
65
|
+
return react_1.default.createElement(react_1.default.Fragment, null, `${name} = ${value}`);
|
|
66
|
+
}
|
|
67
|
+
const [showedVal, setShowedVal] = (0, react_1.useState)(value);
|
|
68
|
+
(0, react_1.useEffect)(() => {
|
|
69
|
+
setShowedVal(value);
|
|
70
|
+
}, [value]);
|
|
71
|
+
const selectOptions = (0, react_1.useMemo)(() => options?.getRows().map((cfeOpt) => ({
|
|
72
|
+
value: cfeOpt.value.value,
|
|
73
|
+
label: cfeOpt.label.value,
|
|
74
|
+
})), [options]);
|
|
75
|
+
const onInputChange = (0, react_1.useCallback)((val) => {
|
|
76
|
+
setShowedVal(val);
|
|
77
|
+
onChange?.(val);
|
|
78
|
+
}, [onChange]);
|
|
79
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(classes.formEntry, className) },
|
|
80
|
+
react_1.default.createElement("div", { className: classes.entryTitle }, name),
|
|
81
|
+
selectOptions ? (react_1.default.createElement(ui_1.Select, { showSearch: true, className: classes.select, value: showedVal.value, options: selectOptions, disabled: disabled, onChange: (val) => {
|
|
82
|
+
if (val != null) {
|
|
83
|
+
const newVal = getHValFromSelectValue(val, value);
|
|
84
|
+
onInputChange(newVal);
|
|
85
|
+
}
|
|
86
|
+
} })) : !disabled ? (react_1.default.createElement(ui_1.HInput, { val: showedVal, editable: true, onChange: onInputChange })) : (react_1.default.createElement(ui_1.Input, { disabled: true, value: showedVal.toString() }))));
|
|
87
|
+
};
|
|
88
|
+
exports.ConfigurationFormEntry = ConfigurationFormEntry;
|
|
89
|
+
//# sourceMappingURL=ConfigurationFormEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurationFormEntry.js","sourceRoot":"","sources":["../../../../../src/react/components/resolvable/configurationForm/ConfigurationFormEntry.tsx"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kCAAuE;AACvE,4DAA2B;AAC3B,iDAUsB;AACtB,+CAAwE;AACxE,yCAA2C;AAE3C,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,CAAC,KAAe,EAAE,EAAE,CAAC,CAAC;IACvD,SAAS,EAAE;QACV,CAAC,MAAM,eAAU,QAAQ,CAAC,EAAE;YAC3B,MAAM,EAAE,EAAE;SACV;KACD;IACD,UAAU,EAAE;QACX,UAAU,EAAE,GAAG;QACf,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,KAAK,CAAC,kBAAkB;KAC/B;IACD,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;KACb;CACD,CAAC,CAAC,CAAA;AAgBH,MAAM,sBAAsB,GAAG,CAAC,WAAoB,EAAE,WAAiB,EAAE,EAAE;IAC1E,IAAI,IAAA,2BAAW,EAAC,WAAW,EAAE,oBAAI,CAAC,MAAM,CAAC,EAAE;QAC1C,OAAO,oBAAI,CAAC,IAAI,CAAC,WAAqB,EAAG,WAAoB,CAAC,IAAI,CAAC,CAAA;KACnE;SAAM,IAAI,IAAA,2BAAW,EAAC,WAAW,EAAE,oBAAI,CAAC,GAAG,CAAC,EAAE;QAC9C,OAAO,oBAAI,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAA;KACvC;IAED,OAAO,oBAAI,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAA;AACxC,CAAC,CAAA;AAEM,MAAM,sBAAsB,GAAG,CAAC,EACtC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,GACoB,EAAE,EAAE;IACjC,MAAM,OAAO,GAAG,SAAS,EAAE,CAAA;IAE3B,IAAI,CAAC,IAAA,sBAAM,EAAC,KAAK,CAAC,EAAE;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AAC,CAAA;oBACjD,aAAa,CAAC,MAAM,CAAC,CAAA;iBACrB;YACF,CAAC,GACA,CACF,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,8BAAC,WAAM,IAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,QAAC,QAAQ,EAAE,aAAa,GAAI,CAC5D,CAAC,CAAC,CAAC,CACH,8BAAC,UAAK,IAAC,QAAQ,QAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,EAAE,GAAI,CAC/C,CACI,CACN,CAAA;AACF,CAAC,CAAA;AA7DY,QAAA,sBAAsB,0BA6DlC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UiElementData } from '@j2inn/resolvable-ui-elements';
|
|
2
|
+
import { HVal } from 'haystack-core';
|
|
3
|
+
/**
|
|
4
|
+
* Get default values for all elements that should resolve into an HVal.
|
|
5
|
+
* @param section a section element
|
|
6
|
+
* @returns an object containing as key the section element name and as value the default HVal.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getSectionDefault: (section: UiElementData) => {
|
|
9
|
+
[key: string]: HVal;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Get a default for a specific kind of HVal.
|
|
13
|
+
* @param kind can be expressed as new or old Hayson, or alternatively the haystack-core type name
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const getDefaultHVal: (kind?: string) => HVal | undefined;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023, J2 Innovations. All Rights Reserved
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDefaultHVal = exports.getSectionDefault = void 0;
|
|
7
|
+
const haystack_core_1 = require("haystack-core");
|
|
8
|
+
/**
|
|
9
|
+
* Get default values for all elements that should resolve into an HVal.
|
|
10
|
+
* @param section a section element
|
|
11
|
+
* @returns an object containing as key the section element name and as value the default HVal.
|
|
12
|
+
*/
|
|
13
|
+
const getSectionDefault = (section) => {
|
|
14
|
+
const result = {};
|
|
15
|
+
Object.entries(section).forEach(([key, element]) => {
|
|
16
|
+
const elementData = element;
|
|
17
|
+
const defaultValue = (0, exports.getDefaultHVal)(elementData?._meta?.resolvedType);
|
|
18
|
+
if (defaultValue) {
|
|
19
|
+
result[key] = defaultValue;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
exports.getSectionDefault = getSectionDefault;
|
|
25
|
+
/**
|
|
26
|
+
* Get a default for a specific kind of HVal.
|
|
27
|
+
* @param kind can be expressed as new or old Hayson, or alternatively the haystack-core type name
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
const getDefaultHVal = (kind) => {
|
|
31
|
+
switch (kind) {
|
|
32
|
+
case haystack_core_1.Kind.Marker:
|
|
33
|
+
case 'Marker':
|
|
34
|
+
case 'HMarker':
|
|
35
|
+
return haystack_core_1.HMarker.make();
|
|
36
|
+
case haystack_core_1.Kind.Remove:
|
|
37
|
+
case 'Remove':
|
|
38
|
+
case 'HRemove':
|
|
39
|
+
return haystack_core_1.HRemove.make();
|
|
40
|
+
case haystack_core_1.Kind.NA:
|
|
41
|
+
case 'NA':
|
|
42
|
+
case 'HNa':
|
|
43
|
+
return haystack_core_1.HNa.make();
|
|
44
|
+
case haystack_core_1.Kind.Coord:
|
|
45
|
+
case 'Coord':
|
|
46
|
+
case 'HCoord':
|
|
47
|
+
return haystack_core_1.HCoord.make({ latitude: 0, longitude: 0 });
|
|
48
|
+
case haystack_core_1.Kind.XStr:
|
|
49
|
+
case 'XStr':
|
|
50
|
+
case 'HXStr':
|
|
51
|
+
return haystack_core_1.HXStr.make('');
|
|
52
|
+
case haystack_core_1.Kind.Date:
|
|
53
|
+
case 'Date':
|
|
54
|
+
case 'HDate':
|
|
55
|
+
return haystack_core_1.HDate.make(new Date());
|
|
56
|
+
case haystack_core_1.Kind.DateTime:
|
|
57
|
+
case 'DateTime':
|
|
58
|
+
case 'HDateTime':
|
|
59
|
+
return haystack_core_1.HDateTime.make(new Date());
|
|
60
|
+
case haystack_core_1.Kind.Number:
|
|
61
|
+
case 'Number':
|
|
62
|
+
case 'HNum':
|
|
63
|
+
return haystack_core_1.HNum.make(0);
|
|
64
|
+
case haystack_core_1.Kind.Bool:
|
|
65
|
+
case 'Bool':
|
|
66
|
+
case 'HBool':
|
|
67
|
+
return haystack_core_1.HBool.make(false);
|
|
68
|
+
case 'Str':
|
|
69
|
+
case 'HStr':
|
|
70
|
+
return haystack_core_1.HStr.make('');
|
|
71
|
+
case haystack_core_1.Kind.Ref:
|
|
72
|
+
case 'Ref':
|
|
73
|
+
case 'HRef':
|
|
74
|
+
return haystack_core_1.HRef.make('');
|
|
75
|
+
case haystack_core_1.Kind.Symbol:
|
|
76
|
+
case 'Symbol':
|
|
77
|
+
case 'HSymbol':
|
|
78
|
+
return haystack_core_1.HSymbol.make('');
|
|
79
|
+
case haystack_core_1.Kind.Time:
|
|
80
|
+
case 'Time':
|
|
81
|
+
case 'HTime':
|
|
82
|
+
return haystack_core_1.HTime.make(new Date());
|
|
83
|
+
case haystack_core_1.Kind.Uri:
|
|
84
|
+
case 'Uri':
|
|
85
|
+
case 'HUri':
|
|
86
|
+
return haystack_core_1.HUri.make('');
|
|
87
|
+
case haystack_core_1.Kind.Dict:
|
|
88
|
+
case 'Dict':
|
|
89
|
+
case 'HDict':
|
|
90
|
+
return haystack_core_1.HDict.make();
|
|
91
|
+
case haystack_core_1.Kind.Grid:
|
|
92
|
+
case 'Grid':
|
|
93
|
+
case 'HGrid':
|
|
94
|
+
return haystack_core_1.HGrid.make();
|
|
95
|
+
default:
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
exports.getDefaultHVal = getDefaultHVal;
|
|
100
|
+
//# sourceMappingURL=getSectionDefault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSectionDefault.js","sourceRoot":"","sources":["../../../../../src/react/components/resolvable/configurationForm/getSectionDefault.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,iDAmBsB;AAEtB;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAChC,OAAsB,EACI,EAAE;IAC5B,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE;QAClD,MAAM,WAAW,GAAG,OAAoD,CAAA;QACxE,MAAM,YAAY,GAAG,IAAA,sBAAc,EAAC,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;QAErE,IAAI,YAAY,EAAE;YACjB,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAA;SAC1B;IACF,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACd,CAAC,CAAA;AAdY,QAAA,iBAAiB,qBAc7B;AAED;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,IAAa,EAAoB,EAAE;IACjE,QAAQ,IAAI,EAAE;QACb,KAAK,oBAAI,CAAC,MAAM,CAAC;QACjB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACb,OAAO,uBAAO,CAAC,IAAI,EAAE,CAAA;QACtB,KAAK,oBAAI,CAAC,MAAM,CAAC;QACjB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACb,OAAO,uBAAO,CAAC,IAAI,EAAE,CAAA;QACtB,KAAK,oBAAI,CAAC,EAAE,CAAC;QACb,KAAK,IAAI,CAAC;QACV,KAAK,KAAK;YACT,OAAO,mBAAG,CAAC,IAAI,EAAE,CAAA;QAClB,KAAK,oBAAI,CAAC,KAAK,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ;YACZ,OAAO,sBAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,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AAA;QAC9B,KAAK,oBAAI,CAAC,GAAG,CAAC;QACd,KAAK,KAAK,CAAC;QACX,KAAK,MAAM;YACV,OAAO,oBAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACrB,KAAK,oBAAI,CAAC,IAAI,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACX,OAAO,qBAAK,CAAC,IAAI,EAAE,CAAA;QACpB,KAAK,oBAAI,CAAC,IAAI,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACX,OAAO,qBAAK,CAAC,IAAI,EAAE,CAAA;QACpB;YACC,OAAO,SAAS,CAAA;KACjB;AACF,CAAC,CAAA;AApEY,QAAA,cAAc,kBAoE1B"}
|
package/dist_es/index.d.ts
CHANGED
|
@@ -12,5 +12,8 @@ export * from './react/components/navigation/MenuPage';
|
|
|
12
12
|
export * from './react/components/navigation/Router';
|
|
13
13
|
export * from './react/components/graphics/GraphicsTabViewer';
|
|
14
14
|
export * from './react/components/graphics/GraphicViewer';
|
|
15
|
+
export * from './react/components/resolvable/configurationForm/ConfigurationForm';
|
|
16
|
+
export * from './react/components/resolvable/configurationForm/ConfigurationFormEntry';
|
|
17
|
+
export * from './react/components/resolvable/configurationForm/getSectionDefault';
|
|
15
18
|
export * from './react/app/Fin5AppContainer';
|
|
16
19
|
export * from './react/app/Fin5AppRootStore';
|
package/dist_es/index.js
CHANGED
|
@@ -21,6 +21,9 @@ export * from './react/components/navigation/MenuPage';
|
|
|
21
21
|
export * from './react/components/navigation/Router';
|
|
22
22
|
export * from './react/components/graphics/GraphicsTabViewer';
|
|
23
23
|
export * from './react/components/graphics/GraphicViewer';
|
|
24
|
+
export * from './react/components/resolvable/configurationForm/ConfigurationForm';
|
|
25
|
+
export * from './react/components/resolvable/configurationForm/ConfigurationFormEntry';
|
|
26
|
+
export * from './react/components/resolvable/configurationForm/getSectionDefault';
|
|
24
27
|
//////////////////////////////////////////////////////////////////////////
|
|
25
28
|
// j2inn/app support for FIN5
|
|
26
29
|
//////////////////////////////////////////////////////////////////////////
|
package/dist_es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,0EAA0E;AAC1E,4BAA4B;AAC5B,0EAA0E;AAE1E,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sCAAsC,CAAA;AAEpD,0EAA0E;AAC1E,mBAAmB;AACnB,0EAA0E;AAE1E,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,mCAAmC,CAAA;AACjD,cAAc,2CAA2C,CAAA;AACzD,cAAc,wCAAwC,CAAA;AACtD,cAAc,sCAAsC,CAAA;AACpD,cAAc,+CAA+C,CAAA;AAC7D,cAAc,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,0EAA0E;AAC1E,4BAA4B;AAC5B,0EAA0E;AAE1E,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sCAAsC,CAAA;AAEpD,0EAA0E;AAC1E,mBAAmB;AACnB,0EAA0E;AAE1E,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,mCAAmC,CAAA;AACjD,cAAc,2CAA2C,CAAA;AACzD,cAAc,wCAAwC,CAAA;AACtD,cAAc,sCAAsC,CAAA;AACpD,cAAc,+CAA+C,CAAA;AAC7D,cAAc,2CAA2C,CAAA;AACzD,cAAc,mEAAmE,CAAA;AACjF,cAAc,wEAAwE,CAAA;AACtF,cAAc,mEAAmE,CAAA;AAEjF,0EAA0E;AAC1E,6BAA6B;AAC7B,0EAA0E;AAE1E,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022, J2 Innovations. All Rights Reserved
|
|
3
|
+
*/
|
|
4
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { AppRootStoreContext, AppStoreContext } from '@j2inn/app';
|
|
6
|
+
import { observer } from 'mobx-react-lite';
|
|
7
|
+
import { Fin5AppRootStore } from './Fin5AppRootStore';
|
|
8
|
+
import { Client, } from 'haystack-nclient';
|
|
9
|
+
import { ClientContext } from 'haystack-react';
|
|
10
|
+
import { I18NProvider } from '@j2inn/utils';
|
|
11
|
+
import { ThemeProvider } from 'react-jss';
|
|
12
|
+
import { DEFAULT_THEME, GenerateTheme } from '@j2inn/ui';
|
|
13
|
+
import { fin5Top } from '../../fin5Top/fin5Top';
|
|
14
|
+
import { useFin5AppURLHashParameter } from '../../fin5Top/useFin5AppURLHashParameter';
|
|
15
|
+
import { HRef } from 'haystack-core';
|
|
16
|
+
import { ErrorBoundary } from '../components/ErrorBoundary';
|
|
17
|
+
import Loader from '../components/Loader';
|
|
18
|
+
const PATH_PREFIX = 'finApp';
|
|
19
|
+
const getServiceUrl = ({ origin, path }) => `${origin}/${PATH_PREFIX}/api/${path}`;
|
|
20
|
+
const getOpUrl = ({ origin, project, op }) => `${origin}/api/${project}/${op}`;
|
|
21
|
+
const getHaystackServiceUrl = ({ origin, project, path, }) => `${origin}/${PATH_PREFIX}/api/haystack${project ? `/${project}` : ''}/${path}`;
|
|
22
|
+
const getHostServiceUrl = ({ origin, path, }) => `${origin}/${PATH_PREFIX}/api/host/${path}`;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a basic application container environment to run a view in FIN5.
|
|
25
|
+
*/
|
|
26
|
+
export const Fin5AppContainer = observer(({ children, appStore, client, project, theme = GenerateTheme(DEFAULT_THEME).light, }) => {
|
|
27
|
+
const [loading, setLoading] = useState(true);
|
|
28
|
+
const [loadingi18n, setLoadingi18n] = useState(true);
|
|
29
|
+
const rootStoreRef = useRef(null);
|
|
30
|
+
const rootStore = rootStoreRef.current ??
|
|
31
|
+
(rootStoreRef.current = new Fin5AppRootStore());
|
|
32
|
+
const [hashProjName] = useFin5AppURLHashParameter('projectName');
|
|
33
|
+
const containerProject = project || hashProjName || fin5Top?.finstack?.projectName || '';
|
|
34
|
+
const locale = fin5Top?.languageManager?.currentLang ?? navigator?.language;
|
|
35
|
+
rootStore.locale = locale;
|
|
36
|
+
if (!rootStore.allLocales.includes(locale)) {
|
|
37
|
+
rootStore.allLocales.push(locale);
|
|
38
|
+
}
|
|
39
|
+
const target = fin5Top?.app?.TargetRef?.() || '';
|
|
40
|
+
rootStore.target = target ? HRef.make(target).value : '';
|
|
41
|
+
const getClient = () => client ??
|
|
42
|
+
new Client({
|
|
43
|
+
base: new URL(window.location.href),
|
|
44
|
+
project: containerProject,
|
|
45
|
+
options: { headers: { accept: 'text/zinc' } },
|
|
46
|
+
getServiceUrl,
|
|
47
|
+
getOpUrl,
|
|
48
|
+
getHaystackServiceUrl,
|
|
49
|
+
getHostServiceUrl,
|
|
50
|
+
});
|
|
51
|
+
const [containerClient, setContainerClient] = useState(getClient);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
setLoading(true);
|
|
54
|
+
const newClient = getClient();
|
|
55
|
+
setContainerClient(newClient);
|
|
56
|
+
// Load everything network wise before we load
|
|
57
|
+
// the application.
|
|
58
|
+
Promise.all([
|
|
59
|
+
newClient.ext.eval('finGetCurrentUser()'),
|
|
60
|
+
newClient.ext.loadDefs(),
|
|
61
|
+
]).then(([userGrid]) => {
|
|
62
|
+
rootStore.currentUser = userGrid.first;
|
|
63
|
+
setLoading(false);
|
|
64
|
+
});
|
|
65
|
+
}, [client, containerProject]);
|
|
66
|
+
return (React.createElement(AppRootStoreContext.Provider, { value: rootStore },
|
|
67
|
+
React.createElement(AppStoreContext.Provider, { value: appStore },
|
|
68
|
+
React.createElement(ClientContext.Provider, { value: containerClient },
|
|
69
|
+
React.createElement(I18NProvider, { locale: locale, setLoading: setLoadingi18n },
|
|
70
|
+
React.createElement(ThemeProvider, { theme: theme },
|
|
71
|
+
React.createElement(Loader, { loading: loading || loadingi18n },
|
|
72
|
+
React.createElement(ErrorBoundary, { mode: "global" /* ErrorBoundaryMode.global */ }, children))))))));
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=Fin5AppContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fin5AppContainer.js","sourceRoot":"","sources":["../../../src/react/app/Fin5AppContainer.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAY,eAAe,EAAE,MAAM,YAAY,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EACN,MAAM,GAKN,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAY,MAAM,WAAW,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAA;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,aAAa,EAAqB,MAAM,6BAA6B,CAAA;AAC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,CAAC;YACX,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC;YACzC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE;SACxB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE;YACtB,SAAS,CAAC,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAA;YACtC,UAAU,CAAC,KAAK,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAA;IAE9B,OAAO,CACN,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS;QAC7C,oBAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ;YACxC,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe;gBAC7C,oBAAC,YAAY,IACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,cAAc;oBAC1B,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK;wBAC1B,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,IAAI,WAAW;4BACtC,oBAAC,aAAa,IACb,IAAI,6CACH,QAAQ,CACM,CACR,CACM,CACF,CACS,CACC,CACG,CAC/B,CAAA;AACF,CAAC,CACD,CAAA"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022, J2 Innovations. All Rights Reserved
|
|
3
|
+
*/
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { Button, Checkbox, Divider, Message, Container, ColorVals, } from '@j2inn/ui';
|
|
6
|
+
import { usei18n } from '@j2inn/utils';
|
|
7
|
+
import { createUseStyles, useTheme } from 'react-jss';
|
|
8
|
+
const boundryStyles = createUseStyles((theme) => ({
|
|
9
|
+
errorBoundry: {
|
|
10
|
+
backgroundColor: theme.bodyBg,
|
|
11
|
+
flex: `1 1 auto`,
|
|
12
|
+
},
|
|
13
|
+
boundryContainer: {
|
|
14
|
+
margin: '0 auto',
|
|
15
|
+
flex: `1 1 auto`,
|
|
16
|
+
padding: `2rem`,
|
|
17
|
+
maxWidth: 1024,
|
|
18
|
+
backgroundColor: theme.bgColor,
|
|
19
|
+
[`& h1, & h3`]: {
|
|
20
|
+
paddingBottom: `1rem`,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
errorDetails: {
|
|
24
|
+
[`& pre`]: {
|
|
25
|
+
overflow: 'auto',
|
|
26
|
+
marginTop: '1rem',
|
|
27
|
+
backgroundColor: ColorVals.Black,
|
|
28
|
+
color: ColorVals.White,
|
|
29
|
+
padding: '0.3rem',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
function get(i18n, key, fallback) {
|
|
34
|
+
return i18n.has(key) ? i18n.get(key) : fallback;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Format an error message into something more useful for the clipboard.
|
|
38
|
+
*/
|
|
39
|
+
function formatErrorMessage(error, appId) {
|
|
40
|
+
return JSON.stringify({
|
|
41
|
+
timestamp: new Date().toISOString(),
|
|
42
|
+
appId: appId ?? '',
|
|
43
|
+
location: location.href,
|
|
44
|
+
navigator: {
|
|
45
|
+
cookieEnabled: navigator.cookieEnabled,
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
deviceMemory: navigator.deviceMemory,
|
|
48
|
+
language: navigator.language,
|
|
49
|
+
languages: navigator.languages,
|
|
50
|
+
onLine: navigator.onLine,
|
|
51
|
+
userAgent: navigator.userAgent,
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
+
userAgentData: navigator.userAgentData,
|
|
54
|
+
vendor: navigator.vendor,
|
|
55
|
+
},
|
|
56
|
+
error: String(error.stack),
|
|
57
|
+
}, null, 2);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Shows the internal error details to a user.
|
|
61
|
+
*/
|
|
62
|
+
const ErrorDetails = ({ showDetails, setShowDetails, error, appId, }) => {
|
|
63
|
+
const i18n = usei18n();
|
|
64
|
+
const classes = boundryStyles();
|
|
65
|
+
const theme = useTheme();
|
|
66
|
+
const copyToClipboard = () => {
|
|
67
|
+
navigator.clipboard.writeText(formatErrorMessage(error, appId));
|
|
68
|
+
Message.success(theme, get(i18n, 'finUi.errorBoundary.copiedErrorToClipboard', 'Copied error to clipboard'));
|
|
69
|
+
};
|
|
70
|
+
return (React.createElement("div", { className: classes.errorDetails },
|
|
71
|
+
React.createElement(Checkbox, { onChange: (e) => {
|
|
72
|
+
setShowDetails(e.target.checked);
|
|
73
|
+
}, defaultChecked: showDetails, value: showDetails }, get(i18n, 'finUi.errorBoundary.showDetails', 'Show details')),
|
|
74
|
+
showDetails && (React.createElement(React.Fragment, null,
|
|
75
|
+
React.createElement("pre", null, error.stack),
|
|
76
|
+
React.createElement(Container, { horizontal: true, middle: true, right: true },
|
|
77
|
+
React.createElement(Button, { onClick: copyToClipboard }, get(i18n, 'finUi.errorBoundary.copyToClipboard', 'Copy to clipboard')))))));
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The inner error boundary component. This is required so
|
|
81
|
+
* we can use hooks that can't be used in a normal class component.
|
|
82
|
+
*/
|
|
83
|
+
const ErrorBoundaryInner = ({ error, mode, appId, showReportDialog, }) => {
|
|
84
|
+
const i18n = usei18n();
|
|
85
|
+
const [showDetails, setShowDetails] = useState(true);
|
|
86
|
+
const classes = boundryStyles();
|
|
87
|
+
const title = `finUi.errorBoundary.${mode}.title`;
|
|
88
|
+
const appName = `${appId}.name`;
|
|
89
|
+
const header = get(i18n, title, mode === 'global' ? 'Error' : 'Application error') +
|
|
90
|
+
(appId ? `: ${get(i18n, appName, appName)}` : '');
|
|
91
|
+
const continueMsg = get(i18n, `finUi.errorBoundary.${mode}.continue`, mode === 'global'
|
|
92
|
+
? 'To continue, please reload or navigate to the home page.'
|
|
93
|
+
: 'To continue, please reload, navigate to the home page or another application.');
|
|
94
|
+
return (React.createElement(Container, { vertical: true, top: true, center: true, className: classes.errorBoundry },
|
|
95
|
+
React.createElement("div", { className: classes.boundryContainer, style: { gap: `1rem` } },
|
|
96
|
+
React.createElement("h1", null, header),
|
|
97
|
+
React.createElement("h3", null, get(i18n, 'finUi.errorBoundary.description', 'The application has encountered an error when trying to display some content.')),
|
|
98
|
+
React.createElement("p", null, continueMsg),
|
|
99
|
+
React.createElement("div", null,
|
|
100
|
+
React.createElement(ErrorDetails, { showDetails: showDetails, setShowDetails: setShowDetails, error: error, appId: appId })),
|
|
101
|
+
React.createElement(Divider, null),
|
|
102
|
+
React.createElement(Container, { horizontal: true, middle: true, left: true, style: { gap: `1rem` } },
|
|
103
|
+
React.createElement(Button, { onClick: () => window.location.reload(), type: 'primary' }, get(i18n, 'finUi.common.reload', 'Reload')),
|
|
104
|
+
React.createElement(Button, { onClick: () => window.location.assign('/') }, get(i18n, 'finUi.common.home', 'Home'))),
|
|
105
|
+
showReportDialog && (React.createElement("div", { style: { marginTop: `0.5rem` } },
|
|
106
|
+
React.createElement("small", { onClick: showReportDialog }, get(i18n, 'finUi.errorBoundary.additionalDetails', 'If you’d like, click here to include an additional error report to our team. Any details you provide will be helpful.')))))));
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* A common error boundary used to capture errors.
|
|
110
|
+
*/
|
|
111
|
+
export class ErrorBoundary extends React.Component {
|
|
112
|
+
state = {};
|
|
113
|
+
componentDidCatch(error, info) {
|
|
114
|
+
this.props.onError?.(error);
|
|
115
|
+
console.error(error, info);
|
|
116
|
+
}
|
|
117
|
+
static getDerivedStateFromError(error) {
|
|
118
|
+
return { error };
|
|
119
|
+
}
|
|
120
|
+
render() {
|
|
121
|
+
return this.state.error ? (React.createElement(ErrorBoundaryInner, { error: this.state.error, mode: this.props.mode, appId: this.props.appId, showReportDialog: this.props.showReportDialog })) : (this.props.children);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../src/react/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAwB,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EAEP,SAAS,EACT,SAAS,GACT,MAAM,WAAW,CAAA;AAElB,OAAO,EAAQ,OAAO,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAErD,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,KAAe,EAAE,EAAE,CAAC,CAAC;IAC3D,YAAY,EAAE;QACb,eAAe,EAAE,KAAK,CAAC,MAAM;QAC7B,IAAI,EAAE,UAAU;KAChB;IACD,gBAAgB,EAAE;QACjB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,KAAK,CAAC,OAAO;QAC9B,CAAC,YAAY,CAAC,EAAE;YACf,aAAa,EAAE,MAAM;SACrB;KACD;IACD,YAAY,EAAE;QACb,CAAC,OAAO,CAAC,EAAE;YACV,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,MAAM;YACjB,eAAe,EAAE,SAAS,CAAC,KAAK;YAChC,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,OAAO,EAAE,QAAQ;SACjB;KACD;CACD,CAAC,CAAC,CAAA;AAEH,SAAS,GAAG,CAAC,IAAU,EAAE,GAAW,EAAE,QAAgB;IACrD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AAChD,CA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CAAA;AA0CD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAGxC;IACS,KAAK,GAAsB,EAAE,CAAA;IAE7B,iBAAiB,CAAC,KAAY,EAAE,IAAe;QACvD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;QAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC3C,OAAO,EAAE,KAAK,EAAE,CAAA;IACjB,CAAC;IAEQ,MAAM;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACzB,oBAAC,kBAAkB,IAClB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAC5C,CACF,CAAC,CAAC,CAAC,CACH,IAAI,CAAC,KAAK,CAAC,QAAQ,CACnB,CAAA;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Button, Collapse, Container, Result, Typography } from '@j2inn/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export class DefaultErrorBoundary extends React.Component {
|
|
4
|
+
state = {};
|
|
5
|
+
static getDerivedStateFromError(error) {
|
|
6
|
+
// Update state so the next render will show the fallback UI.
|
|
7
|
+
return { error: error };
|
|
8
|
+
}
|
|
9
|
+
componentDidCatch(error, errorInfo) {
|
|
10
|
+
// You can also log the error to an error reporting service
|
|
11
|
+
console.error(error, errorInfo);
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
if (this.state.error) {
|
|
15
|
+
// You can render any custom fallback UI
|
|
16
|
+
return (React.createElement(ErrorDisplayer, { error: this.state.error, extra: [
|
|
17
|
+
React.createElement(Button, { type: 'primary', key: 'refresh', onClick: () => window.location.reload() }, "Refresh The Page"),
|
|
18
|
+
] }));
|
|
19
|
+
}
|
|
20
|
+
return this.props.children;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const ErrorDisplayer = ({ error, extra, }) => {
|
|
24
|
+
return (React.createElement(Result, { status: 'error', title: 'Ouch... Something Went Wrong', subTitle: React.createElement(Container, { center: true },
|
|
25
|
+
React.createElement(Collapse, { style: { width: 600, textAlign: 'left' } },
|
|
26
|
+
React.createElement(Collapse.Panel, { header: `${error.toString()}`, key: '1' },
|
|
27
|
+
React.createElement(Typography.Text, { style: { width: 400 } }, error.stack)))), extra: extra }));
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=ErrorDisplayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorDisplayer.js","sourceRoot":"","sources":["../../../src/react/components/ErrorDisplayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3E,OAAO,KAA+B,MAAM,OAAO,CAAA;AAUnD,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAA6B;IACnE,KAAK,GAAuB,EAAE,CAAA;IAEvC,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC3C,6DAA6D;QAC7D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACxB,CAAC;IAEQ,iBAAiB,CAAC,KAAY,EAAE,SAAoB;QAC5D,2DAA2D;QAC3D,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAChC,CAAC;IAEQ,MAAM;QACd,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACrB,wCAAwC;YACxC,OAAO,CACN,oBAAC,cAAc,IACd,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,KAAK,EAAE;oBACN,oBAAC,MAAM,IACN,IAAI,EAAC,SAAS,EACd,GAAG,EAAC,SAAS,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,uBAE/B;iBACT,GACA,CACF,CAAA;SACD;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;IAC3B,CAAC;CACD;AAOD,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAC7D,KAAK,EACL,KAAK,GACL,EAAE,EAAE;IACJ,OAAO,CACN,oBAAC,MAAM,IACN,MAAM,EAAC,OAAO,EACd,KAAK,EAAC,8BAA8B,EACpC,QAAQ,EACP,oBAAC,SAAS,IAAC,MAAM;YAChB,oBAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE;gBACjD,oBAAC,QAAQ,CAAC,KAAK,IAAC,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAC,GAAG;oBACrD,oBAAC,UAAU,CAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IACpC,KAAK,CAAC,KAAK,CACK,CACF,CACP,CACA,EAEb,KAAK,EAAE,KAAK,GACX,CACF,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022, J2 Innovations. All Rights Reserved
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { LoadingSpinner } from './LoadingSpinner';
|
|
6
|
+
/**
|
|
7
|
+
* A simple UI loader.
|
|
8
|
+
*/
|
|
9
|
+
const Loader = ({ loading, children, }) => {
|
|
10
|
+
return loading ? React.createElement(LoadingSpinner, null) : React.createElement(React.Fragment, null, children);
|
|
11
|
+
};
|
|
12
|
+
export default Loader;
|
|
13
|
+
//# sourceMappingURL=Loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../../src/react/components/Loader.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,EACf,OAAO,EACP,QAAQ,GAIR,EAAe,EAAE;IACjB,OAAO,OAAO,CAAC,CAAC,CAAC,oBAAC,cAAc,OAAG,CAAC,CAAC,CAAC,0CAAG,QAAQ,CAAI,CAAA;AACtD,CAAC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022, J2 Innovations. All Rights Reserved
|
|
3
|
+
*/
|
|
4
|
+
import { Spin } from '@j2inn/ui';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { createUseStyles } from 'react-jss';
|
|
7
|
+
const useStyles = createUseStyles({
|
|
8
|
+
container: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
height: '100%',
|
|
13
|
+
width: '100%',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const LoadingSpinner = () => {
|
|
17
|
+
const classes = useStyles();
|
|
18
|
+
return (React.createElement("div", { className: classes.container },
|
|
19
|
+
React.createElement(Spin, { size: 'large' })));
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=LoadingSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingSpinner.js","sourceRoot":"","sources":["../../../src/react/components/LoadingSpinner.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,SAAS,GAAG,eAAe,CAAC;IACjC,SAAS,EAAE;QACV,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACb;CACD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAAa,GAAG,EAAE;IAC5C,MAAM,OAAO,GAAG,SAAS,EAAE,CAAA;IAC3B,OAAO,CACN,6BAAK,SAAS,EAAE,OAAO,CAAC,SAAS;QAChC,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAQ,CACrB,CACN,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022, J2 Innovations. All Rights Reserved
|
|
3
|
+
*/
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { createUseStyles } from 'react-jss';
|
|
7
|
+
import { fin5Top } from '../../../fin5Top/fin5Top';
|
|
8
|
+
const useStyles = createUseStyles({
|
|
9
|
+
iframe: {
|
|
10
|
+
width: '100%',
|
|
11
|
+
height: '100%',
|
|
12
|
+
border: 0,
|
|
13
|
+
overflow: 'hidden',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const GraphicViewer = ({ projectName = fin5Top?.finstack?.projectName ?? '', graphicId, targetRef, className, }) => {
|
|
17
|
+
const classes = useStyles();
|
|
18
|
+
const url = new URL(`${window.location.protocol}//${window.location.host}/fin5/${projectName}`);
|
|
19
|
+
url.hash = `targetRef=${targetRef.toAxon()}`;
|
|
20
|
+
url.searchParams.set('projectRef', graphicId.toAxon());
|
|
21
|
+
return (React.createElement("iframe", { id: graphicId.toAxon(), className: cn(classes.iframe, className), src: url.toString() }));
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=GraphicViewer.js.map
|
|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
|
|
2
|
+
* Copyright (c) 2022, J2 Innovations. All Rights Reserved
|
|
3
|
+
*/
|
|
4
|
+
import { ant_prefix, Tabs } from '@j2inn/ui';
|
|
5
|
+
import cn from 'classnames';
|
|
6
|
+
import { useClient } from 'haystack-react';
|
|
7
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { createUseStyles } from 'react-jss';
|
|
9
|
+
import { fin5Top } from '../../../fin5Top/fin5Top';
|
|
10
|
+
import { LoadingSpinner } from '../LoadingSpinner';
|
|
11
|
+
import { GraphicViewer } from './GraphicViewer';
|
|
12
|
+
const useStyles = createUseStyles({
|
|
13
|
+
tabs: {
|
|
14
|
+
height: '100%',
|
|
15
|
+
[`& .${ant_prefix}-tabs-content-holder`]: {
|
|
16
|
+
height: '100%',
|
|
17
|
+
[`& .${ant_prefix}-tabs-content`]: {
|
|
18
|
+
height: '100%',
|
|
19
|
+
[`& .${ant_prefix}-tabs-tabpane`]: {
|
|
20
|
+
height: '100%',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
fallback: {
|
|
26
|
+
height: '100%',
|
|
27
|
+
display: 'flex',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
fontSize: '1.1em',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const GraphicsTabViewer = ({ projectName = fin5Top?.finstack?.projectName, targetRef, className, queryRelated = false, fallbackText = 'No graphics found.', fallbackClassName, }) => {
|
|
34
|
+
const client = useClient();
|
|
35
|
+
const classes = useStyles();
|
|
36
|
+
const [loading, setLoading] = useState(true);
|
|
37
|
+
const [graphicsList, setGraphicsList] = useState([]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (targetRef) {
|
|
40
|
+
client.ext
|
|
41
|
+
.eval(`readById(${targetRef.toAxon()}).finGraphicOn(${queryRelated})`)
|
|
42
|
+
.then((grid) => {
|
|
43
|
+
setGraphicsList(grid.getRows());
|
|
44
|
+
})
|
|
45
|
+
.finally(() => setLoading(false));
|
|
46
|
+
}
|
|
47
|
+
}, [targetRef]);
|
|
48
|
+
const tabs = useMemo(() => {
|
|
49
|
+
return graphicsList
|
|
50
|
+
.sort((g1, g2) => g1.toDis().localeCompare(g2.toDis()))
|
|
51
|
+
.map((graphic) => {
|
|
52
|
+
return {
|
|
53
|
+
label: graphic.toDis(),
|
|
54
|
+
key: graphic.id.toAxon(),
|
|
55
|
+
children: (React.createElement(GraphicViewer, { projectName: projectName ?? '', targetRef: targetRef, graphicId: graphic.id })),
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}, [graphicsList]);
|
|
59
|
+
return loading ? (React.createElement(LoadingSpinner, null)) : tabs.length > 0 ? (React.createElement(Tabs, { className: cn(classes.tabs, className), items: tabs })) : (React.createElement("div", { className: cn(classes.fallback, fallbackClassName) }, fallbackText));
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=GraphicsTabViewer.js.map
|