@configura/debug-react 1.6.0-rc.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { SelectionType } from "@configura/web-api";
2
2
  import React, { useContext } from "react";
3
3
  import { DebugContext, DebugMode } from "./DebugProductConfigurationView.js";
4
- import { debugRowsFactory } from "./DebugRowsFactory.js";
4
+ import { DebugRow, debugRowsFactory } from "./DebugRowsFactory.js";
5
5
  import { DebugTable } from "./DebugTable.js";
6
6
  const limitedKeys = ["code", "groupCode"];
7
7
  const extendedKeys = [
@@ -12,20 +12,23 @@ const extendedKeys = [
12
12
  "unit",
13
13
  "visible",
14
14
  ];
15
- const DebugRowsFeature = debugRowsFactory();
15
+ const syncGroupKeys = ["syncGroupCode", "syncMethod"];
16
16
  const includeAttribute = (option, attribute) => {
17
17
  if (attribute === "numericValue") {
18
18
  return option.selectionType === SelectionType.SelectOne;
19
19
  }
20
20
  return true;
21
21
  };
22
+ const DebugRowsFeature = debugRowsFactory(includeAttribute);
23
+ const DebugRowsSyncGroup = debugRowsFactory();
22
24
  export const DebugFeatureCommon = (props) => {
23
25
  var _a;
24
26
  const { feature, heading, tooltip, markAsHidden } = props;
27
+ const syncGroup = feature._internal.syncGroup;
25
28
  const debugContext = useContext(DebugContext);
26
29
  const debugMode = (_a = debugContext === null || debugContext === void 0 ? void 0 : debugContext.debugState) !== null && _a !== void 0 ? _a : DebugMode.DebugOff;
27
30
  return (React.createElement(DebugTable, { heading: heading, tooltip: tooltip, markAsHidden: markAsHidden || !feature.visible },
28
- React.createElement(DebugRowsFeature, { target: feature, attributes: debugMode === DebugMode.DebugExtended
29
- ? [...limitedKeys, ...extendedKeys]
30
- : limitedKeys, includeFunc: includeAttribute })));
31
+ React.createElement(DebugRowsFeature, { target: feature, attributes: limitedKeys }),
32
+ syncGroup ? (React.createElement(DebugRowsSyncGroup, { target: syncGroup, attributes: syncGroupKeys })) : (React.createElement(DebugRow, { label: "syncGroup", value: "-" })),
33
+ debugMode === DebugMode.DebugExtended && (React.createElement(DebugRowsFeature, { target: feature, attributes: extendedKeys }))));
31
34
  };
@@ -17,15 +17,14 @@ const includeAttribute = (option, attribute) => {
17
17
  }
18
18
  return true;
19
19
  };
20
- const DebugRowsOptions = debugRowsFactory();
20
+ const DebugRowsOptions = debugRowsFactory(includeAttribute);
21
21
  export const DebugOptionCommon = (props) => {
22
22
  var _a;
23
23
  const { option, heading, tooltip, markAsHidden } = props;
24
24
  const debugContext = useContext(DebugContext);
25
25
  const debugMode = (_a = debugContext === null || debugContext === void 0 ? void 0 : debugContext.debugState) !== null && _a !== void 0 ? _a : DebugMode.DebugOff;
26
26
  return (React.createElement(DebugTable, { heading: heading, tooltip: tooltip, markAsHidden: markAsHidden || !option._internal.parent.visible },
27
- React.createElement(React.Fragment, null,
28
- React.createElement(DebugRowsOptions, { target: option, attributes: debugMode === DebugMode.DebugExtended
29
- ? [...limitedKeys, ...extendedKeys]
30
- : limitedKeys, includeFunc: includeAttribute }))));
27
+ React.createElement(DebugRowsOptions, { target: option, attributes: debugMode === DebugMode.DebugExtended
28
+ ? [...limitedKeys, ...extendedKeys]
29
+ : limitedKeys })));
31
30
  };
@@ -1,7 +1,10 @@
1
1
  import React from "react";
2
- export declare const debugRowsFactory: <T>() => React.FC<{
2
+ export declare const DebugRow: React.FC<{
3
+ label: string;
4
+ value: unknown;
5
+ }>;
6
+ export declare const debugRowsFactory: <T>(includeFunc?: ((target: T, attribute: keyof T) => boolean) | undefined) => React.FC<{
3
7
  target: T;
4
8
  attributes: (keyof T)[];
5
- includeFunc?: ((target: T, attribute: keyof T) => boolean) | undefined;
6
9
  }>;
7
10
  //# sourceMappingURL=DebugRowsFactory.d.ts.map
@@ -15,14 +15,18 @@ const Formatted = (props) => {
15
15
  return React.createElement(React.Fragment, null, asString);
16
16
  }
17
17
  };
18
- export const debugRowsFactory = () => {
18
+ export const DebugRow = (props) => {
19
+ const { label, value } = props;
20
+ return (React.createElement("tr", null,
21
+ React.createElement("td", null, label),
22
+ React.createElement("td", null,
23
+ React.createElement(Formatted, { value: value }))));
24
+ };
25
+ export const debugRowsFactory = (includeFunc) => {
19
26
  return (props) => {
20
- const { target, attributes, includeFunc } = props;
27
+ const { target, attributes } = props;
21
28
  return (React.createElement(React.Fragment, null, attributes
22
29
  .filter((attribute) => includeFunc === undefined || includeFunc(target, attribute))
23
- .map((attribute) => (React.createElement("tr", { key: attribute.toString() },
24
- React.createElement("td", null, attribute),
25
- React.createElement("td", null,
26
- React.createElement(Formatted, { value: target[attribute] })))))));
30
+ .map((attribute) => (React.createElement(DebugRow, { key: attribute.toString(), label: attribute.toString(), value: target[attribute] })))));
27
31
  };
28
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/debug-react",
3
- "version": "1.6.0-rc.0",
3
+ "version": "1.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,10 +19,10 @@
19
19
  "test": "echo \"Error: run tests from root\" && exit 1"
20
20
  },
21
21
  "dependencies": {
22
- "@configura/babylon-view": "1.6.0-rc.0",
23
- "@configura/babylon-view-react": "1.6.0-rc.0",
24
- "@configura/web-ui": "1.6.0-rc.0",
25
- "@configura/web-utilities": "1.6.0-rc.0",
22
+ "@configura/babylon-view": "1.6.0",
23
+ "@configura/babylon-view-react": "1.6.0",
24
+ "@configura/web-ui": "1.6.0",
25
+ "@configura/web-utilities": "1.6.0",
26
26
  "react": "17.x || ^16.12.0",
27
27
  "react-dom": "17.x || ^16.12.0",
28
28
  "react-router-dom": "^5.2.0"
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "0c932a04b2ef1dd3c5547adc8e4b0737aa78248a"
47
+ "gitHead": "ddfb00d506937c14e07dac2f51c2f0d06fab97a8"
48
48
  }