@configura/web-ui 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ export const Configurator = (props) => {
|
|
|
6
6
|
const { exportStatus, handleExport, handleRender, product, renderStatus } = props;
|
|
7
7
|
return (React.createElement("div", { className: `cfgConfigurator ${props.className || ""}`, style: props.style }, product !== undefined && (React.createElement(React.Fragment, null,
|
|
8
8
|
React.createElement("div", { className: "cfgConfiguratorHeader" },
|
|
9
|
-
React.createElement(ProductInformation, { product: product }),
|
|
9
|
+
React.createElement(ProductInformation, { lang: product.lang, description: product.description, styleNr: product.styleNr, price: product.aggregatedPrice }),
|
|
10
10
|
(handleExport !== undefined || handleRender !== undefined) && (React.createElement("div", { className: "cfgConfiguratorHeader__actions" },
|
|
11
11
|
React.createElement(ConfigurationActionsButtonRow, { handleExport: handleExport, exportStatus: exportStatus, handleRender: handleRender, renderStatus: renderStatus })))),
|
|
12
12
|
React.createElement("div", { className: "cfgConfiguratorTree" },
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CfgPrice } from "@configura/web-api";
|
|
2
2
|
import { CssProps } from "../utilities.js";
|
|
3
3
|
interface Props {
|
|
4
|
-
|
|
4
|
+
description: string | undefined;
|
|
5
|
+
lang: string | undefined;
|
|
6
|
+
styleNr: string | undefined;
|
|
7
|
+
price: CfgPrice | undefined;
|
|
5
8
|
}
|
|
6
9
|
export declare function ProductInformation(props: Props & CssProps): JSX.Element;
|
|
7
10
|
export {};
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CurrencyPrice } from "./CurrencyPrice.js";
|
|
3
3
|
export function ProductInformation(props) {
|
|
4
|
-
const {
|
|
5
|
-
const { styleNr, aggregatedPrice, description, lang } = product;
|
|
6
|
-
const { listPrice, currency, fractionDigits } = aggregatedPrice;
|
|
4
|
+
const { styleNr, price, description, lang } = props;
|
|
7
5
|
return (React.createElement("div", { className: `cfgProductInfo ${props.className || ""}`, style: props.style },
|
|
8
6
|
React.createElement("div", { className: "cfgProductInfo__left" },
|
|
9
7
|
React.createElement("h2", { className: "cfgProductInfo__name cfgTextOverflow" }, description),
|
|
10
8
|
React.createElement("div", { className: "cfgProductInfo__number cfgTextOverflow" }, styleNr)),
|
|
11
|
-
React.createElement(
|
|
12
|
-
|
|
9
|
+
React.createElement(ProductInformationPrice, { price: price, lang: lang })));
|
|
10
|
+
}
|
|
11
|
+
function ProductInformationPrice(props) {
|
|
12
|
+
const { price, lang } = props;
|
|
13
|
+
if (price === undefined) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const { listPrice, currency, fractionDigits } = price;
|
|
17
|
+
if (listPrice === 0 || currency === "") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (React.createElement("div", { className: "cfgProductInfo__right" },
|
|
21
|
+
React.createElement("div", { className: "cfgProductInfo__name cfgProductInfo__name--right" },
|
|
22
|
+
React.createElement(CurrencyPrice, { currency: currency, language: lang, price: listPrice, fractionDigits: fractionDigits }))));
|
|
13
23
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./components/CanvasWrapper.js";
|
|
2
2
|
export * from "./components/Configurator.js";
|
|
3
3
|
export * from "./components/ConfiguratorWrapper.js";
|
|
4
|
+
export * from "./components/CurrencyPrice.js";
|
|
4
5
|
export * from "./components/ExpandableHeadingRow.js";
|
|
5
6
|
export * from "./components/icons/Checkmark.js";
|
|
6
7
|
export * from "./components/icons/Chevron.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./components/CanvasWrapper.js";
|
|
2
2
|
export * from "./components/Configurator.js";
|
|
3
3
|
export * from "./components/ConfiguratorWrapper.js";
|
|
4
|
+
export * from "./components/CurrencyPrice.js";
|
|
4
5
|
export * from "./components/ExpandableHeadingRow.js";
|
|
5
6
|
export * from "./components/icons/Checkmark.js";
|
|
6
7
|
export * from "./components/icons/Chevron.js";
|
package/dist/useResize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
function getSize(element) {
|
|
3
3
|
let { innerWidth, innerHeight } = window;
|
|
4
4
|
if (element) {
|
|
@@ -18,11 +18,30 @@ export function useResize(element) {
|
|
|
18
18
|
setSize(current);
|
|
19
19
|
}, [element, size.height, size.width]);
|
|
20
20
|
useEffect(refresh, [element, refresh]);
|
|
21
|
+
const resizeObserver = useMemo(() => {
|
|
22
|
+
if ("ResizeObserver" in window) {
|
|
23
|
+
return new ResizeObserver(refresh);
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}, [refresh]);
|
|
21
27
|
useEffect(() => {
|
|
22
|
-
|
|
28
|
+
if (element === undefined) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (resizeObserver === undefined) {
|
|
32
|
+
window.addEventListener("resize", refresh);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
resizeObserver.observe(element);
|
|
36
|
+
}
|
|
23
37
|
return () => {
|
|
24
|
-
|
|
38
|
+
if (resizeObserver === undefined) {
|
|
39
|
+
window.removeEventListener("resize", refresh);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
resizeObserver.unobserve(element);
|
|
43
|
+
}
|
|
25
44
|
};
|
|
26
|
-
}, [refresh]);
|
|
45
|
+
}, [resizeObserver, element, refresh]);
|
|
27
46
|
return [size, refresh];
|
|
28
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@configura/web-api": "^1.
|
|
35
|
+
"@configura/web-api": "^1.1.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@babel/preset-env": "^7.14.4",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "f016a6897c8653f27c9d5a335038c9acbde82f4a"
|
|
68
68
|
}
|