Migrating to version 1.3
Background
Version 1.3 of the SDK brings support for Catalogue Stretch.
If your Catalogue makes use of Stretch, you might need to add UI-support for this.
tip
If you only use GUI components from web-ui or your catalogue does not use Catalogue Stretch, simply upgrading the packages should be enough.
Stretch lengths (measurements) are driven by Options. An Option can have one or more fixed numeric value for stretch. They can also have ranges of allowed values.
Example:
- Option Long Table has the numeric value 2 meters.
- Option Short Table has the numeric value 1 meter.
- Option Side Board has the numeric value 0.2, 0.4 and 0.6 meters.
- Option Very Long Table has the range 4 to 10 meters.
If you have written your own GUI code or customized our GUI components and you catalogue implements Catalogue Stretch using Options with multiple distinct values or ranges of values you will have to update your GUI code.
An example
Based on upgrading our example-app.
The GUI components included in the SDK only support stretch on "Select One"-Options, so we only need to modify CfgDropdownOptionView.tsx below.
Old version
<li>
...
<CfgOptionFeaturesView option={option} {...forwardProps(props)} />
</li>
New version
<li>
...
{selected && <CfgOptionNumericView option={option} />}
<CfgOptionFeaturesView option={option} {...forwardProps(props)} />;
</li>
It's as simple as that. :)
If you need to create your own GUI
Look into CfgOptionNumericView.tsx for inspiration. The code is written to support all ways to numeric value ranges and distinct values can be used. For your purposes a more lightweight version might be enough.
Some tips
When using Catalogue Stretch, you connect your Feature to a so called Measure. Under the hood, a Measure represents a stretch line (SymMeasure) in CmSym which allows your model to stretch along that line.
The Feature in turn has one or more selectable Options. These Options then have one or more discrete values or value ranges which defines the numeric domain for that Option. The union of all the Option's domains defines which values are allowed to be applied to the Measure.
This means that not only is an Option selected when using Catalogue Stretch, but also a Numeric Value. This value must be inside the Domain for the selected Option.
We have a shortcut method in CfgFeature called setNumericValue. Setting a numeric value here will look for the first Option in the Feature that includes the supplied value in it's domain, and then select it. This effectively does both the Option selection and Numeric value selection in one go.
Note: There is nothing stopping you from creating two Options with overlapping Numerical values. The shortcut method above will always select the first Option it finds. If this does not meet your needs, you will need to dive deeper.