@configura/debug-react 1.6.1 → 2.0.0-alpha.2
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/.postcssrc.json +8 -8
- package/LICENSE +201 -201
- package/dist/LogMessageView.d.ts +5 -5
- package/dist/LogMessageView.js +8 -8
- package/dist/LogMessagesView.d.ts +5 -5
- package/dist/LogMessagesView.js +10 -10
- package/dist/TextualConfigurationView.d.ts +8 -0
- package/dist/TextualConfigurationView.js +41 -0
- package/dist/css/debug.css +1 -1
- package/dist/css/debug.css.map +1 -1
- package/dist/exerciser/Exerciser.d.ts +37 -37
- package/dist/exerciser/Exerciser.js +155 -154
- package/dist/exerciser/ExerciserReportFilterView.d.ts +9 -9
- package/dist/exerciser/ExerciserReportFilterView.js +205 -205
- package/dist/exerciser/ExerciserReportItem.d.ts +10 -10
- package/dist/exerciser/ExerciserReportItem.js +1 -1
- package/dist/exerciser/ExerciserReportItemView.d.ts +5 -5
- package/dist/exerciser/ExerciserReportItemView.js +53 -53
- package/dist/exerciser/ExerciserReportView.d.ts +7 -7
- package/dist/exerciser/ExerciserReportView.js +8 -8
- package/dist/exerciser/ExerciserRun.d.ts +19 -19
- package/dist/exerciser/ExerciserRun.js +144 -144
- package/dist/exerciser/ExerciserSetup.d.ts +14 -14
- package/dist/exerciser/ExerciserSetup.js +54 -54
- package/dist/exerciser/FilterSelect.d.ts +8 -8
- package/dist/exerciser/FilterSelect.js +40 -40
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +7 -7
- package/dist/index.d.ts +12 -11
- package/dist/index.js +12 -11
- package/dist/productConfiguration/DebugAdditionalProductView.d.ts +3 -3
- package/dist/productConfiguration/DebugAdditionalProductView.js +6 -6
- package/dist/productConfiguration/DebugFeatureCommon.d.ts +10 -10
- package/dist/productConfiguration/DebugFeatureCommon.js +34 -34
- package/dist/productConfiguration/DebugFeatureGroupView.d.ts +4 -4
- package/dist/productConfiguration/DebugFeatureGroupView.js +20 -20
- package/dist/productConfiguration/DebugFeatureView.d.ts +4 -4
- package/dist/productConfiguration/DebugFeatureView.js +8 -8
- package/dist/productConfiguration/DebugOptionCommon.d.ts +10 -10
- package/dist/productConfiguration/DebugOptionCommon.js +30 -30
- package/dist/productConfiguration/DebugOptionView.d.ts +4 -4
- package/dist/productConfiguration/DebugOptionView.js +8 -8
- package/dist/productConfiguration/DebugProductCommon.d.ts +9 -9
- package/dist/productConfiguration/DebugProductCommon.js +40 -40
- package/dist/productConfiguration/DebugProductConfigurationView.d.ts +16 -16
- package/dist/productConfiguration/DebugProductConfigurationView.js +26 -26
- package/dist/productConfiguration/DebugRowsFactory.d.ts +9 -9
- package/dist/productConfiguration/DebugRowsFactory.js +32 -32
- package/dist/productConfiguration/DebugTable.d.ts +8 -8
- package/dist/productConfiguration/DebugTable.js +8 -8
- package/dist/productConfiguration/debugComponentsHelper.d.ts +3 -3
- package/dist/productConfiguration/debugComponentsHelper.js +28 -28
- package/dist/productConfiguration/index.d.ts +6 -6
- package/dist/productConfiguration/index.js +6 -6
- package/package.json +6 -6
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { SingleProductViewPhase, } from "@configura/babylon-view";
|
|
11
|
-
import { BabylonView } from "@configura/babylon-view-react";
|
|
12
|
-
import { degToRad, loadImage, LogObservable, toError, } from "@configura/web-utilities";
|
|
13
|
-
import React, { useEffect, useState } from "react";
|
|
14
|
-
/**
|
|
15
|
-
* This configures the Babylon view, for example the camera configuration and detail levels used.
|
|
16
|
-
*
|
|
17
|
-
* To change the detail levels, just add allowedDetailLevels.
|
|
18
|
-
* For example, the line below will load the lowest available detail level for each product:
|
|
19
|
-
* allowedDetailLevels: [DetailLevel.low, DetailLevel.medium, DetailLevel.high, DetailLevel.base],
|
|
20
|
-
*/
|
|
21
|
-
const viewConfiguration = {
|
|
22
|
-
camera: {
|
|
23
|
-
yaw: degToRad(110),
|
|
24
|
-
pitch: degToRad(70),
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
function snapImage(scheduleRerender) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const url = yield new Promise((resolve) => scheduleRerender(resolve));
|
|
30
|
-
const image = yield loadImage(url);
|
|
31
|
-
return { image, url };
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export function ExerciserRunner(props) {
|
|
35
|
-
const { addErrorReportItem, addReportItem, generateExerciserUrl, loadingObservable, productIterator, } = props;
|
|
36
|
-
const [viewPhase, setViewPhase] = useState();
|
|
37
|
-
const [renderEnv, setRenderEnv] = useState();
|
|
38
|
-
const [startLoading, setStartLoading] = useState(performance.now());
|
|
39
|
-
const [productResult, setProductResult] = useState();
|
|
40
|
-
const [product, setProduct] = useState();
|
|
41
|
-
const [snapshotResult, setSnapshotResult] = useState();
|
|
42
|
-
const loadNext = () => {
|
|
43
|
-
setSnapshotResult(undefined);
|
|
44
|
-
setViewStateReachedIdleOrError(undefined);
|
|
45
|
-
setStartLoading(performance.now());
|
|
46
|
-
};
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
let canceled = false;
|
|
49
|
-
LogObservable.clear();
|
|
50
|
-
const token = loadingObservable.startChildLoading();
|
|
51
|
-
productIterator
|
|
52
|
-
.next()
|
|
53
|
-
.then((result) => !canceled && setProductResult(result))
|
|
54
|
-
.catch((err) => !canceled && setProductResult(toError(err)))
|
|
55
|
-
.then(() => loadingObservable.stopChildLoading(token));
|
|
56
|
-
return () => {
|
|
57
|
-
canceled = true;
|
|
58
|
-
loadingObservable.stopChildLoading(token);
|
|
59
|
-
};
|
|
60
|
-
}, [startLoading, loadingObservable, productIterator]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
let token;
|
|
63
|
-
if (productResult === undefined) {
|
|
64
|
-
// done or not started
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
else if (productResult instanceof Error) {
|
|
68
|
-
addErrorReportItem(productResult);
|
|
69
|
-
loadNext();
|
|
70
|
-
}
|
|
71
|
-
else if (productResult.done) {
|
|
72
|
-
setProduct(undefined);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const v = productResult.value;
|
|
76
|
-
if (v instanceof Error) {
|
|
77
|
-
addErrorReportItem(v);
|
|
78
|
-
loadNext();
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
token = loadingObservable.startChildLoading();
|
|
82
|
-
setProduct(v);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return () => loadingObservable.stopChildLoading(token);
|
|
86
|
-
}, [addErrorReportItem, loadingObservable, productResult]);
|
|
87
|
-
const [viewStateReachedIdleOrError, setViewStateReachedIdleOrError] = useState();
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
if (viewPhase === undefined ||
|
|
90
|
-
(viewPhase.current !== SingleProductViewPhase.Idle &&
|
|
91
|
-
viewPhase.current !== SingleProductViewPhase.Error)) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
setViewStateReachedIdleOrError({});
|
|
95
|
-
}, [viewPhase]);
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (product === undefined ||
|
|
98
|
-
renderEnv === undefined ||
|
|
99
|
-
viewStateReachedIdleOrError === undefined) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
let canceled = false;
|
|
103
|
-
const token = loadingObservable.startChildLoading();
|
|
104
|
-
snapImage(renderEnv.scheduleRerender)
|
|
105
|
-
.then((url) => !canceled && setSnapshotResult(url))
|
|
106
|
-
.catch((err) => !canceled && setSnapshotResult(toError(err)))
|
|
107
|
-
.then(() => loadingObservable.stopChildLoading(token));
|
|
108
|
-
return () => {
|
|
109
|
-
canceled = true;
|
|
110
|
-
loadingObservable.stopChildLoading(token);
|
|
111
|
-
};
|
|
112
|
-
}, [product, viewStateReachedIdleOrError, renderEnv, loadingObservable]);
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (product === undefined || snapshotResult === undefined) {
|
|
115
|
-
// done or loading
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
else if (snapshotResult instanceof Error) {
|
|
119
|
-
addErrorReportItem(snapshotResult);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
addReportItem({
|
|
123
|
-
duration: performance.now() - startLoading,
|
|
124
|
-
imageDataUrl: snapshotResult.image && snapshotResult.url,
|
|
125
|
-
logMessages: LogObservable.allMessages,
|
|
126
|
-
productWithConfiguration: product,
|
|
127
|
-
productUrl: generateExerciserUrl("run", product.product.lang, Object.assign(Object.assign({}, product.product.catId), { partNumber: product.product.partNumber })),
|
|
128
|
-
randId: Math.random(),
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
loadNext();
|
|
132
|
-
}, [
|
|
133
|
-
addErrorReportItem,
|
|
134
|
-
addReportItem,
|
|
135
|
-
generateExerciserUrl,
|
|
136
|
-
product,
|
|
137
|
-
snapshotResult,
|
|
138
|
-
startLoading,
|
|
139
|
-
]);
|
|
140
|
-
if (!product) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
return (React.createElement(BabylonView, { errorCallback: setProductResult, applicationAreas: product.applicationAreasResponse.applicationAreas, product: product.product, width: 500, height: 500, viewPhaseCallback: setViewPhase, renderEnvironmentCallback: setRenderEnv, configuration: viewConfiguration }));
|
|
144
|
-
}
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { SingleProductViewPhase, } from "@configura/babylon-view";
|
|
11
|
+
import { BabylonView } from "@configura/babylon-view-react";
|
|
12
|
+
import { degToRad, loadImage, LogObservable, toError, } from "@configura/web-utilities";
|
|
13
|
+
import React, { useEffect, useState } from "react";
|
|
14
|
+
/**
|
|
15
|
+
* This configures the Babylon view, for example the camera configuration and detail levels used.
|
|
16
|
+
*
|
|
17
|
+
* To change the detail levels, just add allowedDetailLevels.
|
|
18
|
+
* For example, the line below will load the lowest available detail level for each product:
|
|
19
|
+
* allowedDetailLevels: [DetailLevel.low, DetailLevel.medium, DetailLevel.high, DetailLevel.base],
|
|
20
|
+
*/
|
|
21
|
+
const viewConfiguration = {
|
|
22
|
+
camera: {
|
|
23
|
+
yaw: degToRad(110),
|
|
24
|
+
pitch: degToRad(70),
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
function snapImage(scheduleRerender) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const url = yield new Promise((resolve) => scheduleRerender(resolve));
|
|
30
|
+
const image = yield loadImage(url);
|
|
31
|
+
return { image, url };
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function ExerciserRunner(props) {
|
|
35
|
+
const { addErrorReportItem, addReportItem, generateExerciserUrl, loadingObservable, productIterator, } = props;
|
|
36
|
+
const [viewPhase, setViewPhase] = useState();
|
|
37
|
+
const [renderEnv, setRenderEnv] = useState();
|
|
38
|
+
const [startLoading, setStartLoading] = useState(performance.now());
|
|
39
|
+
const [productResult, setProductResult] = useState();
|
|
40
|
+
const [product, setProduct] = useState();
|
|
41
|
+
const [snapshotResult, setSnapshotResult] = useState();
|
|
42
|
+
const loadNext = () => {
|
|
43
|
+
setSnapshotResult(undefined);
|
|
44
|
+
setViewStateReachedIdleOrError(undefined);
|
|
45
|
+
setStartLoading(performance.now());
|
|
46
|
+
};
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
let canceled = false;
|
|
49
|
+
LogObservable.clear();
|
|
50
|
+
const token = loadingObservable.startChildLoading();
|
|
51
|
+
productIterator
|
|
52
|
+
.next()
|
|
53
|
+
.then((result) => !canceled && setProductResult(result))
|
|
54
|
+
.catch((err) => !canceled && setProductResult(toError(err)))
|
|
55
|
+
.then(() => loadingObservable.stopChildLoading(token));
|
|
56
|
+
return () => {
|
|
57
|
+
canceled = true;
|
|
58
|
+
loadingObservable.stopChildLoading(token);
|
|
59
|
+
};
|
|
60
|
+
}, [startLoading, loadingObservable, productIterator]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
let token;
|
|
63
|
+
if (productResult === undefined) {
|
|
64
|
+
// done or not started
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
else if (productResult instanceof Error) {
|
|
68
|
+
addErrorReportItem(productResult);
|
|
69
|
+
loadNext();
|
|
70
|
+
}
|
|
71
|
+
else if (productResult.done) {
|
|
72
|
+
setProduct(undefined);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const v = productResult.value;
|
|
76
|
+
if (v instanceof Error) {
|
|
77
|
+
addErrorReportItem(v);
|
|
78
|
+
loadNext();
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
token = loadingObservable.startChildLoading();
|
|
82
|
+
setProduct(v);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return () => loadingObservable.stopChildLoading(token);
|
|
86
|
+
}, [addErrorReportItem, loadingObservable, productResult]);
|
|
87
|
+
const [viewStateReachedIdleOrError, setViewStateReachedIdleOrError] = useState();
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (viewPhase === undefined ||
|
|
90
|
+
(viewPhase.current !== SingleProductViewPhase.Idle &&
|
|
91
|
+
viewPhase.current !== SingleProductViewPhase.Error)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
setViewStateReachedIdleOrError({});
|
|
95
|
+
}, [viewPhase]);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (product === undefined ||
|
|
98
|
+
renderEnv === undefined ||
|
|
99
|
+
viewStateReachedIdleOrError === undefined) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let canceled = false;
|
|
103
|
+
const token = loadingObservable.startChildLoading();
|
|
104
|
+
snapImage(renderEnv.scheduleRerender)
|
|
105
|
+
.then((url) => !canceled && setSnapshotResult(url))
|
|
106
|
+
.catch((err) => !canceled && setSnapshotResult(toError(err)))
|
|
107
|
+
.then(() => loadingObservable.stopChildLoading(token));
|
|
108
|
+
return () => {
|
|
109
|
+
canceled = true;
|
|
110
|
+
loadingObservable.stopChildLoading(token);
|
|
111
|
+
};
|
|
112
|
+
}, [product, viewStateReachedIdleOrError, renderEnv, loadingObservable]);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (product === undefined || snapshotResult === undefined) {
|
|
115
|
+
// done or loading
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
else if (snapshotResult instanceof Error) {
|
|
119
|
+
addErrorReportItem(snapshotResult);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
addReportItem({
|
|
123
|
+
duration: performance.now() - startLoading,
|
|
124
|
+
imageDataUrl: snapshotResult.image && snapshotResult.url,
|
|
125
|
+
logMessages: LogObservable.allMessages,
|
|
126
|
+
productWithConfiguration: product,
|
|
127
|
+
productUrl: generateExerciserUrl("run", product.product.lang, Object.assign(Object.assign({}, product.product.catId), { partNumber: product.product.partNumber })),
|
|
128
|
+
randId: Math.random(),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
loadNext();
|
|
132
|
+
}, [
|
|
133
|
+
addErrorReportItem,
|
|
134
|
+
addReportItem,
|
|
135
|
+
generateExerciserUrl,
|
|
136
|
+
product,
|
|
137
|
+
snapshotResult,
|
|
138
|
+
startLoading,
|
|
139
|
+
]);
|
|
140
|
+
if (!product) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return (React.createElement(BabylonView, { errorCallback: setProductResult, applicationAreas: product.applicationAreasResponse.applicationAreas, product: product.product, width: 500, height: 500, viewPhaseCallback: setViewPhase, renderEnvironmentCallback: setRenderEnv, configuration: viewConfiguration }));
|
|
144
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { CatalogueAPI,
|
|
2
|
-
import { AggregatedLoadingObservable } from "@configura/web-utilities";
|
|
3
|
-
import { ExerciserAction, ExerciserState } from "./Exerciser.js";
|
|
4
|
-
interface Props {
|
|
5
|
-
api: CatalogueAPI;
|
|
6
|
-
exerciserState: ExerciserState;
|
|
7
|
-
generateExerciserUrl: (action: ExerciserAction, lang: string, params: Partial<
|
|
8
|
-
loadingObservable: AggregatedLoadingObservable;
|
|
9
|
-
setError: (err: unknown) => void;
|
|
10
|
-
setExerciserState: (next: ExerciserState) => void;
|
|
11
|
-
setProductIterator: (next: AsyncIterableIterator<GeneratedProductConfiguration | Error>) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function ExerciserSetup(props: Props): JSX.Element;
|
|
14
|
-
export {};
|
|
1
|
+
import { CatalogueAPI, DtoProductParams, GeneratedProductConfiguration } from "@configura/web-api";
|
|
2
|
+
import { AggregatedLoadingObservable } from "@configura/web-utilities";
|
|
3
|
+
import { ExerciserAction, ExerciserState } from "./Exerciser.js";
|
|
4
|
+
interface Props {
|
|
5
|
+
api: CatalogueAPI;
|
|
6
|
+
exerciserState: ExerciserState;
|
|
7
|
+
generateExerciserUrl: (action: ExerciserAction, lang: string, params: Partial<DtoProductParams>) => string;
|
|
8
|
+
loadingObservable: AggregatedLoadingObservable;
|
|
9
|
+
setError: (err: unknown) => void;
|
|
10
|
+
setExerciserState: (next: ExerciserState) => void;
|
|
11
|
+
setProductIterator: (next: AsyncIterableIterator<GeneratedProductConfiguration | Error>) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function ExerciserSetup(props: Props): JSX.Element;
|
|
14
|
+
export {};
|
|
15
15
|
//# sourceMappingURL=ExerciserSetup.d.ts.map
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { applyCatalogueFilters, applyProductRefFilters, makeCatalogueKey, } from "@configura/web-api";
|
|
2
|
-
import { Loading } from "@configura/web-ui";
|
|
3
|
-
import React, { useEffect } from "react";
|
|
4
|
-
import { Link } from "react-router-dom";
|
|
5
|
-
import { useMemoized, useMemoized2 } from "../hooks.js";
|
|
6
|
-
import { flattenCataloguePermissions, useCatalogueFilters, useProductConfigurationIterator, useProductFilters, useToc, } from "./Exerciser.js";
|
|
7
|
-
import { FilterSelect } from "./FilterSelect.js";
|
|
8
|
-
export function ExerciserSetup(props) {
|
|
9
|
-
var _a;
|
|
10
|
-
const { loadingObservable, exerciserState, setProductIterator, api, setError } = props;
|
|
11
|
-
const { action, lang } = exerciserState;
|
|
12
|
-
const next = action === "run" ? "setup" : "run";
|
|
13
|
-
const catalogues = useMemoized(flattenCataloguePermissions, ((_a = api.auth) === null || _a === void 0 ? void 0 : _a.apiSession.permissions) || []);
|
|
14
|
-
const catalogueFilters = useCatalogueFilters(exerciserState);
|
|
15
|
-
const [catalogueMatches, filteredCatalogues] = useMemoized2(applyCatalogueFilters, catalogueFilters, catalogues);
|
|
16
|
-
const tocParams = filteredCatalogues.length === 1 ? filteredCatalogues[0] : undefined;
|
|
17
|
-
const toc = useToc(api, tocParams, lang, setError, loadingObservable);
|
|
18
|
-
const productRefs = (toc === null || toc === void 0 ? void 0 : toc.prdRefs) || [];
|
|
19
|
-
const productFilters = useProductFilters(exerciserState);
|
|
20
|
-
const [productMatches, filteredProducts] = useMemoized2(applyProductRefFilters, productFilters, productRefs);
|
|
21
|
-
const productIterator = useProductConfigurationIterator(api, lang, filteredCatalogues, productFilters);
|
|
22
|
-
useEffect(() => setProductIterator(productIterator), [setProductIterator, productIterator]);
|
|
23
|
-
function updateUrl(key, val) {
|
|
24
|
-
props.setExerciserState(Object.assign(Object.assign({}, exerciserState), { [key]: val }));
|
|
25
|
-
}
|
|
26
|
-
return (React.createElement("div", { className: "cfgExerciserSetup" },
|
|
27
|
-
React.createElement("div", { className: "cfgExerciserView cfgExerciserSetup__select" },
|
|
28
|
-
React.createElement("h2", { className: "cfgExerciserHeader" }, "Product Setup"),
|
|
29
|
-
React.createElement("h3", { className: "cfgExerciserHeader" }, "Filter Catalogues"),
|
|
30
|
-
React.createElement(FilterSelect, { name: "enterprise", filter: catalogueFilters.enterprise, values: catalogueMatches.enterprise.values, updateUrl: updateUrl }),
|
|
31
|
-
React.createElement(FilterSelect, { name: "prdCat", filter: catalogueFilters.prdCat, values: catalogueMatches.prdCat.values, updateUrl: updateUrl }),
|
|
32
|
-
React.createElement(FilterSelect, { name: "prdCatVersion", filter: catalogueFilters.prdCatVersion, values: catalogueMatches.prdCatVersion.values, updateUrl: updateUrl }),
|
|
33
|
-
React.createElement(FilterSelect, { name: "vendor", filter: catalogueFilters.vendor, values: catalogueMatches.vendor.values, updateUrl: updateUrl }),
|
|
34
|
-
React.createElement(FilterSelect, { name: "priceList", filter: catalogueFilters.priceList, values: catalogueMatches.priceList.values, updateUrl: updateUrl }),
|
|
35
|
-
React.createElement("h3", { className: "cfgExerciserHeader" }, "Filter Products"),
|
|
36
|
-
React.createElement(FilterSelect, { name: "partNr", filter: productFilters.partNr, values: productMatches.partNr.values, updateUrl: updateUrl }),
|
|
37
|
-
React.createElement("button", { className: "cfgButton cfgExerciserButton", onClick: (e) => updateUrl("action", next) }, next === "run" ? "Start" : "Stop")),
|
|
38
|
-
action === "setup" && (React.createElement("div", { className: "cfgExerciserView cfgExerciserSetup__preview" },
|
|
39
|
-
React.createElement("h2", { className: "cfgExerciserHeader" }, "Catalogues Preview"),
|
|
40
|
-
React.createElement("ol", null, filteredCatalogues.map((p) => (React.createElement("li", { key: makeCatalogueKey(p) },
|
|
41
|
-
React.createElement(Link, { className: "cfgExerciserLink", to: props.generateExerciserUrl(action, lang, p) },
|
|
42
|
-
p.enterprise,
|
|
43
|
-
" / ",
|
|
44
|
-
p.prdCat,
|
|
45
|
-
" / ",
|
|
46
|
-
p.prdCatVersion,
|
|
47
|
-
" / ",
|
|
48
|
-
p.vendor,
|
|
49
|
-
" /",
|
|
50
|
-
" ",
|
|
51
|
-
p.priceList))))),
|
|
52
|
-
React.createElement("h2", { className: "cfgExerciserHeader" }, "Products Preview"),
|
|
53
|
-
toc !== undefined ? (React.createElement("ol", null, filteredProducts.map((p) => (React.createElement("li", { key: p.partNr }, p.partNr))))) : filteredCatalogues.length === 1 ? (React.createElement(Loading, { small: true })) : (React.createElement("p", null, "Product preview is only available if a single catalogue is selected"))))));
|
|
54
|
-
}
|
|
1
|
+
import { applyCatalogueFilters, applyProductRefFilters, makeCatalogueKey, } from "@configura/web-api";
|
|
2
|
+
import { Loading } from "@configura/web-ui";
|
|
3
|
+
import React, { useEffect } from "react";
|
|
4
|
+
import { Link } from "react-router-dom";
|
|
5
|
+
import { useMemoized, useMemoized2 } from "../hooks.js";
|
|
6
|
+
import { flattenCataloguePermissions, useCatalogueFilters, useProductConfigurationIterator, useProductFilters, useToc, } from "./Exerciser.js";
|
|
7
|
+
import { FilterSelect } from "./FilterSelect.js";
|
|
8
|
+
export function ExerciserSetup(props) {
|
|
9
|
+
var _a;
|
|
10
|
+
const { loadingObservable, exerciserState, setProductIterator, api, setError } = props;
|
|
11
|
+
const { action, lang } = exerciserState;
|
|
12
|
+
const next = action === "run" ? "setup" : "run";
|
|
13
|
+
const catalogues = useMemoized(flattenCataloguePermissions, ((_a = api.auth) === null || _a === void 0 ? void 0 : _a.apiSession.permissions) || []);
|
|
14
|
+
const catalogueFilters = useCatalogueFilters(exerciserState);
|
|
15
|
+
const [catalogueMatches, filteredCatalogues] = useMemoized2(applyCatalogueFilters, catalogueFilters, catalogues);
|
|
16
|
+
const tocParams = filteredCatalogues.length === 1 ? filteredCatalogues[0] : undefined;
|
|
17
|
+
const toc = useToc(api, tocParams, lang, setError, loadingObservable);
|
|
18
|
+
const productRefs = (toc === null || toc === void 0 ? void 0 : toc.prdRefs) || [];
|
|
19
|
+
const productFilters = useProductFilters(exerciserState);
|
|
20
|
+
const [productMatches, filteredProducts] = useMemoized2(applyProductRefFilters, productFilters, productRefs);
|
|
21
|
+
const productIterator = useProductConfigurationIterator(api, lang, filteredCatalogues, productFilters);
|
|
22
|
+
useEffect(() => setProductIterator(productIterator), [setProductIterator, productIterator]);
|
|
23
|
+
function updateUrl(key, val) {
|
|
24
|
+
props.setExerciserState(Object.assign(Object.assign({}, exerciserState), { [key]: val }));
|
|
25
|
+
}
|
|
26
|
+
return (React.createElement("div", { className: "cfgExerciserSetup" },
|
|
27
|
+
React.createElement("div", { className: "cfgExerciserView cfgExerciserSetup__select" },
|
|
28
|
+
React.createElement("h2", { className: "cfgExerciserHeader" }, "Product Setup"),
|
|
29
|
+
React.createElement("h3", { className: "cfgExerciserHeader" }, "Filter Catalogues"),
|
|
30
|
+
React.createElement(FilterSelect, { name: "enterprise", filter: catalogueFilters.enterprise, values: catalogueMatches.enterprise.values, updateUrl: updateUrl }),
|
|
31
|
+
React.createElement(FilterSelect, { name: "prdCat", filter: catalogueFilters.prdCat, values: catalogueMatches.prdCat.values, updateUrl: updateUrl }),
|
|
32
|
+
React.createElement(FilterSelect, { name: "prdCatVersion", filter: catalogueFilters.prdCatVersion, values: catalogueMatches.prdCatVersion.values, updateUrl: updateUrl }),
|
|
33
|
+
React.createElement(FilterSelect, { name: "vendor", filter: catalogueFilters.vendor, values: catalogueMatches.vendor.values, updateUrl: updateUrl }),
|
|
34
|
+
React.createElement(FilterSelect, { name: "priceList", filter: catalogueFilters.priceList, values: catalogueMatches.priceList.values, updateUrl: updateUrl }),
|
|
35
|
+
React.createElement("h3", { className: "cfgExerciserHeader" }, "Filter Products"),
|
|
36
|
+
React.createElement(FilterSelect, { name: "partNr", filter: productFilters.partNr, values: productMatches.partNr.values, updateUrl: updateUrl }),
|
|
37
|
+
React.createElement("button", { className: "cfgButton cfgExerciserButton", onClick: (e) => updateUrl("action", next) }, next === "run" ? "Start" : "Stop")),
|
|
38
|
+
action === "setup" && (React.createElement("div", { className: "cfgExerciserView cfgExerciserSetup__preview" },
|
|
39
|
+
React.createElement("h2", { className: "cfgExerciserHeader" }, "Catalogues Preview"),
|
|
40
|
+
React.createElement("ol", null, filteredCatalogues.map((p) => (React.createElement("li", { key: makeCatalogueKey(p) },
|
|
41
|
+
React.createElement(Link, { className: "cfgExerciserLink", to: props.generateExerciserUrl(action, lang, p) },
|
|
42
|
+
p.enterprise,
|
|
43
|
+
" / ",
|
|
44
|
+
p.prdCat,
|
|
45
|
+
" / ",
|
|
46
|
+
p.prdCatVersion,
|
|
47
|
+
" / ",
|
|
48
|
+
p.vendor,
|
|
49
|
+
" /",
|
|
50
|
+
" ",
|
|
51
|
+
p.priceList))))),
|
|
52
|
+
React.createElement("h2", { className: "cfgExerciserHeader" }, "Products Preview"),
|
|
53
|
+
toc !== undefined ? (React.createElement("ol", null, filteredProducts.map((p) => (React.createElement("li", { key: p.partNr }, p.partNr))))) : filteredCatalogues.length === 1 ? (React.createElement(Loading, { small: true })) : (React.createElement("p", null, "Product preview is only available if a single catalogue is selected"))))));
|
|
54
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Filter } from "@configura/web-utilities";
|
|
2
|
-
export interface FilterSelectProps<K extends string> {
|
|
3
|
-
filter: Filter;
|
|
4
|
-
name: K;
|
|
5
|
-
updateUrl: (key: K, val: Filter) => void;
|
|
6
|
-
values: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare function FilterSelect<K extends string>(props: FilterSelectProps<K>): JSX.Element;
|
|
1
|
+
import { Filter } from "@configura/web-utilities";
|
|
2
|
+
export interface FilterSelectProps<K extends string> {
|
|
3
|
+
filter: Filter;
|
|
4
|
+
name: K;
|
|
5
|
+
updateUrl: (key: K, val: Filter) => void;
|
|
6
|
+
values: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function FilterSelect<K extends string>(props: FilterSelectProps<K>): JSX.Element;
|
|
9
9
|
//# sourceMappingURL=FilterSelect.d.ts.map
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export function FilterSelect(props) {
|
|
3
|
-
const { filter, name, updateUrl, values } = props;
|
|
4
|
-
const invalidValue = filter.mode === "exact" && filter.value !== "-" && values.indexOf(filter.value) === -1;
|
|
5
|
-
const { mode, value } = filter;
|
|
6
|
-
return (React.createElement("div", { className: "cfgExerciserControl" },
|
|
7
|
-
React.createElement("label", { className: "cfgExerciserControl__label", htmlFor: name }, name),
|
|
8
|
-
React.createElement("div", { className: "cfgExerciserControl__selectWrapper" },
|
|
9
|
-
React.createElement("select", { className: "cfgExerciserControl__select--operator", onChange: (e) => {
|
|
10
|
-
const newMode = e.target.value;
|
|
11
|
-
if (newMode === mode) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
else if (newMode === "exact" || newMode === "all") {
|
|
15
|
-
updateUrl(name, { mode: newMode, value: "-" });
|
|
16
|
-
}
|
|
17
|
-
else if (newMode === "random" || newMode === "first") {
|
|
18
|
-
updateUrl(name, {
|
|
19
|
-
mode: newMode,
|
|
20
|
-
value: typeof value === "number" ? value : 1,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
console.error("invalid mode", newMode);
|
|
25
|
-
}
|
|
26
|
-
}, value: value === "-" ? "all" : mode },
|
|
27
|
-
React.createElement("option", { value: "all" }, "all"),
|
|
28
|
-
React.createElement("option", { value: "exact" }, "exact"),
|
|
29
|
-
React.createElement("option", { value: "random" }, "random"),
|
|
30
|
-
React.createElement("option", { value: "first" }, "first")),
|
|
31
|
-
" ",
|
|
32
|
-
mode === "all" || mode === "exact" ? (React.createElement("select", { className: "cfgExerciserControl__select--full", id: name, onChange: (e) => {
|
|
33
|
-
const newValue = e.target.value;
|
|
34
|
-
const newMode = newValue === "-" ? "all" : "exact";
|
|
35
|
-
updateUrl(name, { mode: newMode, value: newValue });
|
|
36
|
-
}, value: value, style: { borderColor: invalidValue ? "red" : undefined } },
|
|
37
|
-
React.createElement("option", { value: "-" }, "-"),
|
|
38
|
-
invalidValue && React.createElement("option", { value: value }, value),
|
|
39
|
-
values.map((e) => (React.createElement("option", { key: e, value: e }, e))))) : (React.createElement("input", { type: "number", value: value, onChange: (e) => updateUrl(name, { mode, value: parseInt(e.target.value) }) })))));
|
|
40
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
export function FilterSelect(props) {
|
|
3
|
+
const { filter, name, updateUrl, values } = props;
|
|
4
|
+
const invalidValue = filter.mode === "exact" && filter.value !== "-" && values.indexOf(filter.value) === -1;
|
|
5
|
+
const { mode, value } = filter;
|
|
6
|
+
return (React.createElement("div", { className: "cfgExerciserControl" },
|
|
7
|
+
React.createElement("label", { className: "cfgExerciserControl__label", htmlFor: name }, name),
|
|
8
|
+
React.createElement("div", { className: "cfgExerciserControl__selectWrapper" },
|
|
9
|
+
React.createElement("select", { className: "cfgExerciserControl__select--operator", onChange: (e) => {
|
|
10
|
+
const newMode = e.target.value;
|
|
11
|
+
if (newMode === mode) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
else if (newMode === "exact" || newMode === "all") {
|
|
15
|
+
updateUrl(name, { mode: newMode, value: "-" });
|
|
16
|
+
}
|
|
17
|
+
else if (newMode === "random" || newMode === "first") {
|
|
18
|
+
updateUrl(name, {
|
|
19
|
+
mode: newMode,
|
|
20
|
+
value: typeof value === "number" ? value : 1,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.error("invalid mode", newMode);
|
|
25
|
+
}
|
|
26
|
+
}, value: value === "-" ? "all" : mode },
|
|
27
|
+
React.createElement("option", { value: "all" }, "all"),
|
|
28
|
+
React.createElement("option", { value: "exact" }, "exact"),
|
|
29
|
+
React.createElement("option", { value: "random" }, "random"),
|
|
30
|
+
React.createElement("option", { value: "first" }, "first")),
|
|
31
|
+
" ",
|
|
32
|
+
mode === "all" || mode === "exact" ? (React.createElement("select", { className: "cfgExerciserControl__select--full", id: name, onChange: (e) => {
|
|
33
|
+
const newValue = e.target.value;
|
|
34
|
+
const newMode = newValue === "-" ? "all" : "exact";
|
|
35
|
+
updateUrl(name, { mode: newMode, value: newValue });
|
|
36
|
+
}, value: value, style: { borderColor: invalidValue ? "red" : undefined } },
|
|
37
|
+
React.createElement("option", { value: "-" }, "-"),
|
|
38
|
+
invalidValue && React.createElement("option", { value: value }, value),
|
|
39
|
+
values.map((e) => (React.createElement("option", { key: e, value: e }, e))))) : (React.createElement("input", { type: "number", value: value, onChange: (e) => updateUrl(name, { mode, value: parseInt(e.target.value) }) })))));
|
|
40
|
+
}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function useMemoized<T, V>(func: (value: V) => T, value: V): T;
|
|
2
|
-
export declare function useMemoized2<T, V, U>(func: (first: V, second: U) => T, first: V, second: U): T;
|
|
1
|
+
export declare function useMemoized<T, V>(func: (value: V) => T, value: V): T;
|
|
2
|
+
export declare function useMemoized2<T, V, U>(func: (first: V, second: U) => T, first: V, second: U): T;
|
|
3
3
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
export function useMemoized(func, value) {
|
|
3
|
-
return useMemo(() => func(value), [func, value]);
|
|
4
|
-
}
|
|
5
|
-
export function useMemoized2(func, first, second) {
|
|
6
|
-
return useMemo(() => func(first, second), [func, first, second]);
|
|
7
|
-
}
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
export function useMemoized(func, value) {
|
|
3
|
+
return useMemo(() => func(value), [func, value]);
|
|
4
|
+
}
|
|
5
|
+
export function useMemoized2(func, first, second) {
|
|
6
|
+
return useMemo(() => func(first, second), [func, first, second]);
|
|
7
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export * from "./exerciser/Exerciser.js";
|
|
2
|
-
export * from "./exerciser/ExerciserReportFilterView.js";
|
|
3
|
-
export * from "./exerciser/ExerciserReportItem.js";
|
|
4
|
-
export * from "./exerciser/ExerciserReportItemView.js";
|
|
5
|
-
export * from "./exerciser/ExerciserReportView.js";
|
|
6
|
-
export * from "./exerciser/ExerciserRun.js";
|
|
7
|
-
export * from "./exerciser/ExerciserSetup.js";
|
|
8
|
-
export * from "./hooks.js";
|
|
9
|
-
export * from "./LogMessagesView.js";
|
|
10
|
-
export * from "./LogMessageView.js";
|
|
11
|
-
export * from "./productConfiguration/index.js";
|
|
1
|
+
export * from "./exerciser/Exerciser.js";
|
|
2
|
+
export * from "./exerciser/ExerciserReportFilterView.js";
|
|
3
|
+
export * from "./exerciser/ExerciserReportItem.js";
|
|
4
|
+
export * from "./exerciser/ExerciserReportItemView.js";
|
|
5
|
+
export * from "./exerciser/ExerciserReportView.js";
|
|
6
|
+
export * from "./exerciser/ExerciserRun.js";
|
|
7
|
+
export * from "./exerciser/ExerciserSetup.js";
|
|
8
|
+
export * from "./hooks.js";
|
|
9
|
+
export * from "./LogMessagesView.js";
|
|
10
|
+
export * from "./LogMessageView.js";
|
|
11
|
+
export * from "./productConfiguration/index.js";
|
|
12
|
+
export * from "./TextualConfigurationView.js";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export * from "./exerciser/Exerciser.js";
|
|
2
|
-
export * from "./exerciser/ExerciserReportFilterView.js";
|
|
3
|
-
export * from "./exerciser/ExerciserReportItem.js";
|
|
4
|
-
export * from "./exerciser/ExerciserReportItemView.js";
|
|
5
|
-
export * from "./exerciser/ExerciserReportView.js";
|
|
6
|
-
export * from "./exerciser/ExerciserRun.js";
|
|
7
|
-
export * from "./exerciser/ExerciserSetup.js";
|
|
8
|
-
export * from "./hooks.js";
|
|
9
|
-
export * from "./LogMessagesView.js";
|
|
10
|
-
export * from "./LogMessageView.js";
|
|
11
|
-
export * from "./productConfiguration/index.js";
|
|
1
|
+
export * from "./exerciser/Exerciser.js";
|
|
2
|
+
export * from "./exerciser/ExerciserReportFilterView.js";
|
|
3
|
+
export * from "./exerciser/ExerciserReportItem.js";
|
|
4
|
+
export * from "./exerciser/ExerciserReportItemView.js";
|
|
5
|
+
export * from "./exerciser/ExerciserReportView.js";
|
|
6
|
+
export * from "./exerciser/ExerciserRun.js";
|
|
7
|
+
export * from "./exerciser/ExerciserSetup.js";
|
|
8
|
+
export * from "./hooks.js";
|
|
9
|
+
export * from "./LogMessagesView.js";
|
|
10
|
+
export * from "./LogMessageView.js";
|
|
11
|
+
export * from "./productConfiguration/index.js";
|
|
12
|
+
export * from "./TextualConfigurationView.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CfgAdditionalProductViewProps } from "@configura/web-ui";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export declare const getDebugAdditionalProductView: (Original: React.ComponentType<CfgAdditionalProductViewProps>) => React.ComponentType<CfgAdditionalProductViewProps>;
|
|
1
|
+
import { CfgAdditionalProductViewProps } from "@configura/web-ui";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const getDebugAdditionalProductView: (Original: React.ComponentType<CfgAdditionalProductViewProps>) => React.ComponentType<CfgAdditionalProductViewProps>;
|
|
4
4
|
//# sourceMappingURL=DebugAdditionalProductView.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DebugProductCommon } from "./DebugProductCommon.js";
|
|
3
|
-
export const getDebugAdditionalProductView = (Original) => (props) => (React.createElement("li", null,
|
|
4
|
-
React.createElement(DebugProductCommon, Object.assign({ heading: "Additional Product" }, props)),
|
|
5
|
-
React.createElement("ul", { className: "debug-wrapper" },
|
|
6
|
-
React.createElement(Original, Object.assign({}, props)))));
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DebugProductCommon } from "./DebugProductCommon.js";
|
|
3
|
+
export const getDebugAdditionalProductView = (Original) => (props) => (React.createElement("li", null,
|
|
4
|
+
React.createElement(DebugProductCommon, Object.assign({ heading: "Additional Product" }, props)),
|
|
5
|
+
React.createElement("ul", { className: "debug-wrapper" },
|
|
6
|
+
React.createElement(Original, Object.assign({}, props)))));
|