@j2inn/fin5-ui-utils 1.0.2-beta.3 → 1.0.2-beta.5
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 +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/react/components/graphics/GraphicViewer.d.ts +10 -0
- package/dist/react/components/graphics/GraphicViewer.jsx +25 -0
- package/dist/react/components/graphics/GraphicViewer.jsx.map +1 -0
- package/dist/react/components/graphics/GraphicsTabViewer.d.ts +9 -0
- package/dist/react/components/graphics/GraphicsTabViewer.jsx +80 -0
- package/dist/react/components/graphics/GraphicsTabViewer.jsx.map +1 -0
- package/dist_es/index.d.ts +2 -0
- package/dist_es/index.js +2 -0
- package/dist_es/index.js.map +1 -1
- package/dist_es/react/components/graphics/GraphicViewer.d.ts +10 -0
- package/dist_es/react/components/graphics/GraphicViewer.jsx +20 -0
- package/dist_es/react/components/graphics/GraphicViewer.jsx.map +1 -0
- package/dist_es/react/components/graphics/GraphicsTabViewer.d.ts +9 -0
- package/dist_es/react/components/graphics/GraphicsTabViewer.jsx +52 -0
- package/dist_es/react/components/graphics/GraphicsTabViewer.jsx.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export * from './react/components/LoadingSpinner';
|
|
|
10
10
|
export * from './react/components/navigation/BasicLayout';
|
|
11
11
|
export * from './react/components/navigation/MenuPage';
|
|
12
12
|
export * from './react/components/navigation/Router';
|
|
13
|
+
export * from './react/components/graphics/GraphicsTabViewer';
|
|
14
|
+
export * from './react/components/graphics/GraphicViewer';
|
|
13
15
|
export * from './react/app/Fin5AppContainer';
|
|
14
16
|
export * from './react/app/Fin5AppRootStore';
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,8 @@ __exportStar(require("./react/components/LoadingSpinner"), exports);
|
|
|
35
35
|
__exportStar(require("./react/components/navigation/BasicLayout"), exports);
|
|
36
36
|
__exportStar(require("./react/components/navigation/MenuPage"), exports);
|
|
37
37
|
__exportStar(require("./react/components/navigation/Router"), exports);
|
|
38
|
+
__exportStar(require("./react/components/graphics/GraphicsTabViewer"), exports);
|
|
39
|
+
__exportStar(require("./react/components/graphics/GraphicViewer"), exports);
|
|
38
40
|
//////////////////////////////////////////////////////////////////////////
|
|
39
41
|
// j2inn/app support for FIN5
|
|
40
42
|
//////////////////////////////////////////////////////////////////////////
|
package/dist/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,oDAAiC;AACjC,0DAAuC;AACvC,0DAAuC;AACvC,8DAA2C;AAC3C,uEAAoD;AAEpD,0EAA0E;AAC1E,mBAAmB;AACnB,0EAA0E;AAE1E,oEAAiD;AACjD,mEAAgD;AAChD,4DAAyC;AACzC,oEAAiD;AACjD,4EAAyD;AACzD,yEAAsD;AACtD,uEAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,0EAA0E;AAC1E,4BAA4B;AAC5B,0EAA0E;AAE1E,oDAAiC;AACjC,0DAAuC;AACvC,0DAAuC;AACvC,8DAA2C;AAC3C,uEAAoD;AAEpD,0EAA0E;AAC1E,mBAAmB;AACnB,0EAA0E;AAE1E,oEAAiD;AACjD,mEAAgD;AAChD,4DAAyC;AACzC,oEAAiD;AACjD,4EAAyD;AACzD,yEAAsD;AACtD,uEAAoD;AACpD,gFAA6D;AAC7D,4EAAyD;AAEzD,0EAA0E;AAC1E,6BAA6B;AAC7B,0EAA0E;AAE1E,+DAA4C;AAC5C,+DAA4C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HRef } from 'haystack-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface GraphicViewer {
|
|
4
|
+
projectName: string;
|
|
5
|
+
graphicId: HRef;
|
|
6
|
+
targetRef: HRef;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const GraphicViewer: React.FC<GraphicViewer>;
|
|
10
|
+
export default GraphicViewer;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_jss_1 = require("react-jss");
|
|
9
|
+
const useStyles = (0, react_jss_1.createUseStyles)({
|
|
10
|
+
iframe: {
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100%',
|
|
13
|
+
border: 0,
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const GraphicViewer = ({ projectName, graphicId, targetRef, className, }) => {
|
|
18
|
+
const classes = useStyles();
|
|
19
|
+
const url = new URL(`${window.location.protocol}//${window.location.host}/fin5/${projectName}`);
|
|
20
|
+
url.hash = `targetRef=${targetRef.toAxon()}`;
|
|
21
|
+
url.searchParams.set('projectRef', graphicId.toAxon());
|
|
22
|
+
return (<iframe id={graphicId.toAxon()} className={(0, classnames_1.default)(classes.iframe, className)} src={url.toString()}/>);
|
|
23
|
+
};
|
|
24
|
+
exports.default = GraphicViewer;
|
|
25
|
+
//# sourceMappingURL=GraphicViewer.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicViewer.jsx","sourceRoot":"","sources":["../../../../src/react/components/graphics/GraphicViewer.tsx"],"names":[],"mappings":";;;;;AAAA,4DAA2B;AAE3B,kDAAyB;AACzB,yCAA2C;AAE3C,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC;IACjC,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,QAAQ;KAClB;CACD,CAAC,CAAA;AASF,MAAM,aAAa,GAA4B,CAAC,EAC/C,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,GACT,EAAE,EAAE;IACJ,MAAM,OAAO,GAAG,SAAS,EAAE,CAAA;IAE3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAClB,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,WAAW,EAAE,CAC1E,CAAA;IACD,GAAG,CAAC,IAAI,GAAG,aAAa,SAAS,CAAC,MAAM,EAAE,EAAE,CAAA;IAC5C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAA;IAEtD,OAAO,CACN,CAAC,MAAM,CACN,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CACvB,SAAS,CAAC,CAAC,IAAA,oBAAE,EAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CACzC,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EACnB,CACF,CAAA;AACF,CAAC,CAAA;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HRef } from 'haystack-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface GraphicsTabViewer {
|
|
4
|
+
projectName?: string;
|
|
5
|
+
targetRef: HRef;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const GraphicsTabViewer: React.FC<GraphicsTabViewer>;
|
|
9
|
+
export default GraphicsTabViewer;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const ui_1 = require("@j2inn/ui");
|
|
30
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
31
|
+
const fin5Top_1 = require("fin5Top/fin5Top");
|
|
32
|
+
const haystack_react_1 = require("haystack-react");
|
|
33
|
+
const react_1 = __importStar(require("react"));
|
|
34
|
+
const react_jss_1 = require("react-jss");
|
|
35
|
+
const LoadingSpinner_1 = __importDefault(require("../LoadingSpinner"));
|
|
36
|
+
const GraphicViewer_1 = __importDefault(require("./GraphicViewer"));
|
|
37
|
+
const useStyles = (0, react_jss_1.createUseStyles)({
|
|
38
|
+
tabs: {
|
|
39
|
+
height: '100%',
|
|
40
|
+
[`& .${ui_1.ant_prefix}-tabs-content-holder`]: {
|
|
41
|
+
height: '100%',
|
|
42
|
+
[`& .${ui_1.ant_prefix}-tabs-content`]: {
|
|
43
|
+
height: '100%',
|
|
44
|
+
[`& .${ui_1.ant_prefix}-tabs-tabpane`]: {
|
|
45
|
+
height: '100%',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const GraphicsTabViewer = ({ projectName = fin5Top_1.fin5Top?.finstack?.projectName, targetRef, className, }) => {
|
|
52
|
+
const client = (0, haystack_react_1.useClient)();
|
|
53
|
+
const classes = useStyles();
|
|
54
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
55
|
+
const [graphicsList, setGraphicsList] = (0, react_1.useState)([]);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
if (targetRef) {
|
|
58
|
+
client.ext
|
|
59
|
+
.eval(`readById(${targetRef.toAxon()}).finGraphicOn(true)`)
|
|
60
|
+
.then((grid) => {
|
|
61
|
+
setGraphicsList(grid.getRows());
|
|
62
|
+
})
|
|
63
|
+
.finally(() => setLoading(false));
|
|
64
|
+
}
|
|
65
|
+
}, [targetRef]);
|
|
66
|
+
const tabs = (0, react_1.useMemo)(() => {
|
|
67
|
+
return graphicsList
|
|
68
|
+
.sort((g1, g2) => g1.toDis().localeCompare(g2.toDis()))
|
|
69
|
+
.map((graphic) => {
|
|
70
|
+
return {
|
|
71
|
+
label: graphic.toDis(),
|
|
72
|
+
key: graphic.id.toAxon(),
|
|
73
|
+
children: (<GraphicViewer_1.default projectName={projectName ?? ''} targetRef={targetRef} graphicId={graphic.id}/>),
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}, [graphicsList]);
|
|
77
|
+
return loading ? (<LoadingSpinner_1.default />) : (<ui_1.Tabs className={(0, classnames_1.default)(classes.tabs, className)} items={tabs}/>);
|
|
78
|
+
};
|
|
79
|
+
exports.default = GraphicsTabViewer;
|
|
80
|
+
//# sourceMappingURL=GraphicsTabViewer.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicsTabViewer.jsx","sourceRoot":"","sources":["../../../../src/react/components/graphics/GraphicsTabViewer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAA4C;AAC5C,4DAA2B;AAC3B,6CAAyC;AAEzC,mDAA0C;AAC1C,+CAA2D;AAC3D,yCAA2C;AAC3C,uEAA8C;AAC9C,oEAA2C;AAE3C,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC;IACjC,IAAI,EAAE;QACL,MAAM,EAAE,MAAM;QACd,CAAC,MAAM,eAAU,sBAAsB,CAAC,EAAE;YACzC,MAAM,EAAE,MAAM;YACd,CAAC,MAAM,eAAU,eAAe,CAAC,EAAE;gBAClC,MAAM,EAAE,MAAM;gBACd,CAAC,MAAM,eAAU,eAAe,CAAC,EAAE;oBAClC,MAAM,EAAE,MAAM;iBACd;aACD;SACD;KACD;CACD,CAAC,CAAA;AAYF,MAAM,iBAAiB,GAAgC,CAAC,EACvD,WAAW,GAAG,iBAAO,EAAE,QAAQ,EAAE,WAAW,EAC5C,SAAS,EACT,SAAS,GACT,EAAE,EAAE;IACJ,MAAM,MAAM,GAAG,IAAA,0BAAS,GAAE,CAAA;IAC1B,MAAM,OAAO,GAAG,SAAS,EAAE,CAAA;IAC3B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAA;IAC5C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAkB,EAAE,CAAC,CAAA;IAErE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACd,IAAI,SAAS,EAAE;YACd,MAA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AAiB,CAAA"}
|
package/dist_es/index.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export * from './react/components/LoadingSpinner';
|
|
|
10
10
|
export * from './react/components/navigation/BasicLayout';
|
|
11
11
|
export * from './react/components/navigation/MenuPage';
|
|
12
12
|
export * from './react/components/navigation/Router';
|
|
13
|
+
export * from './react/components/graphics/GraphicsTabViewer';
|
|
14
|
+
export * from './react/components/graphics/GraphicViewer';
|
|
13
15
|
export * from './react/app/Fin5AppContainer';
|
|
14
16
|
export * from './react/app/Fin5AppRootStore';
|
package/dist_es/index.js
CHANGED
|
@@ -19,6 +19,8 @@ export * from './react/components/LoadingSpinner';
|
|
|
19
19
|
export * from './react/components/navigation/BasicLayout';
|
|
20
20
|
export * from './react/components/navigation/MenuPage';
|
|
21
21
|
export * from './react/components/navigation/Router';
|
|
22
|
+
export * from './react/components/graphics/GraphicsTabViewer';
|
|
23
|
+
export * from './react/components/graphics/GraphicViewer';
|
|
22
24
|
//////////////////////////////////////////////////////////////////////////
|
|
23
25
|
// j2inn/app support for FIN5
|
|
24
26
|
//////////////////////////////////////////////////////////////////////////
|
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;
|
|
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;AAEzD,0EAA0E;AAC1E,6BAA6B;AAC7B,0EAA0E;AAE1E,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HRef } from 'haystack-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface GraphicViewer {
|
|
4
|
+
projectName: string;
|
|
5
|
+
graphicId: HRef;
|
|
6
|
+
targetRef: HRef;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const GraphicViewer: React.FC<GraphicViewer>;
|
|
10
|
+
export default GraphicViewer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createUseStyles } from 'react-jss';
|
|
4
|
+
const useStyles = createUseStyles({
|
|
5
|
+
iframe: {
|
|
6
|
+
width: '100%',
|
|
7
|
+
height: '100%',
|
|
8
|
+
border: 0,
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
const GraphicViewer = ({ projectName, graphicId, targetRef, className, }) => {
|
|
13
|
+
const classes = useStyles();
|
|
14
|
+
const url = new URL(`${window.location.protocol}//${window.location.host}/fin5/${projectName}`);
|
|
15
|
+
url.hash = `targetRef=${targetRef.toAxon()}`;
|
|
16
|
+
url.searchParams.set('projectRef', graphicId.toAxon());
|
|
17
|
+
return (<iframe id={graphicId.toAxon()} className={cn(classes.iframe, className)} src={url.toString()}/>);
|
|
18
|
+
};
|
|
19
|
+
export default GraphicViewer;
|
|
20
|
+
//# sourceMappingURL=GraphicViewer.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicViewer.jsx","sourceRoot":"","sources":["../../../../src/react/components/graphics/GraphicViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,SAAS,GAAG,eAAe,CAAC;IACjC,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,QAAQ;KAClB;CACD,CAAC,CAAA;AASF,MAAM,aAAa,GAA4B,CAAC,EAC/C,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,GACT,EAAE,EAAE;IACJ,MAAM,OAAO,GAAG,SAAS,EAAE,CAAA;IAE3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAClB,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,WAAW,EAAE,CAC1E,CAAA;IACD,GAAG,CAAC,IAAI,GAAG,aAAa,SAAS,CAAC,MAAM,EAAE,EAAE,CAAA;IAC5C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAA;IAEtD,OAAO,CACN,CAAC,MAAM,CACN,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CACvB,SAAS,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CACzC,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EACnB,CACF,CAAA;AACF,CAAC,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HRef } from 'haystack-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface GraphicsTabViewer {
|
|
4
|
+
projectName?: string;
|
|
5
|
+
targetRef: HRef;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const GraphicsTabViewer: React.FC<GraphicsTabViewer>;
|
|
9
|
+
export default GraphicsTabViewer;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ant_prefix, Tabs } from '@j2inn/ui';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { fin5Top } from 'fin5Top/fin5Top';
|
|
4
|
+
import { useClient } from 'haystack-react';
|
|
5
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import { createUseStyles } from 'react-jss';
|
|
7
|
+
import LoadingSpinner from '../LoadingSpinner';
|
|
8
|
+
import GraphicViewer from './GraphicViewer';
|
|
9
|
+
const useStyles = createUseStyles({
|
|
10
|
+
tabs: {
|
|
11
|
+
height: '100%',
|
|
12
|
+
[`& .${ant_prefix}-tabs-content-holder`]: {
|
|
13
|
+
height: '100%',
|
|
14
|
+
[`& .${ant_prefix}-tabs-content`]: {
|
|
15
|
+
height: '100%',
|
|
16
|
+
[`& .${ant_prefix}-tabs-tabpane`]: {
|
|
17
|
+
height: '100%',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const GraphicsTabViewer = ({ projectName = fin5Top?.finstack?.projectName, targetRef, className, }) => {
|
|
24
|
+
const client = useClient();
|
|
25
|
+
const classes = useStyles();
|
|
26
|
+
const [loading, setLoading] = useState(true);
|
|
27
|
+
const [graphicsList, setGraphicsList] = useState([]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (targetRef) {
|
|
30
|
+
client.ext
|
|
31
|
+
.eval(`readById(${targetRef.toAxon()}).finGraphicOn(true)`)
|
|
32
|
+
.then((grid) => {
|
|
33
|
+
setGraphicsList(grid.getRows());
|
|
34
|
+
})
|
|
35
|
+
.finally(() => setLoading(false));
|
|
36
|
+
}
|
|
37
|
+
}, [targetRef]);
|
|
38
|
+
const tabs = useMemo(() => {
|
|
39
|
+
return graphicsList
|
|
40
|
+
.sort((g1, g2) => g1.toDis().localeCompare(g2.toDis()))
|
|
41
|
+
.map((graphic) => {
|
|
42
|
+
return {
|
|
43
|
+
label: graphic.toDis(),
|
|
44
|
+
key: graphic.id.toAxon(),
|
|
45
|
+
children: (<GraphicViewer projectName={projectName ?? ''} targetRef={targetRef} graphicId={graphic.id}/>),
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}, [graphicsList]);
|
|
49
|
+
return loading ? (<LoadingSpinner />) : (<Tabs className={cn(classes.tabs, className)} items={tabs}/>);
|
|
50
|
+
};
|
|
51
|
+
export default GraphicsTabViewer;
|
|
52
|
+
//# sourceMappingURL=GraphicsTabViewer.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicsTabViewer.jsx","sourceRoot":"","sources":["../../../../src/react/components/graphics/GraphicsTabViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ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