import { LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities"; import { DtoFeature, DtoFeatureConf, DtoNote, DtoPartsConstrainedOption, DtoSelectedOption, DtoSyncGroup, DtoSyncGroupMethods } from "../CatalogueAPI.js"; import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js"; import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js"; import { SyncCode } from "../syncGroups/SyncGroupsHandler.js"; import { CfgOption, ProductConfigurationBubbleMode, _CfgOptionInternal } from "./CfgOption.js"; import { _CfgProductConfigurationInternal } from "./CfgProductConfiguration.js"; export declare enum SelectionType { /** * All options are permanently selected. In our ui-component for this we skip over this level, * and immediately show the children, but you could do this differently, like for instance * showing the group heading. */ Group = 0, /** * One and only one can be selected at a time. This normally corresponds to either a dropdown * menu or radio buttons. */ SelectOne = 1, /** Zero to all can be selected at a time. This normally corresponds to checkboxes. */ SelectMany = 2 } export declare type FeatureChangeNotification = { freshRef: CfgFeature; committed: boolean; }; /** * This class is meant to only be used through CfgFeature. It should * never be instantiated on its own. Normally the internal state of this class * should never be directly modified. CfgFeature is the class that * should be used and interacted with. */ export declare class _CfgFeatureInternal { readonly rawFeature: DtoFeature; private readonly rawFeatures; private _key; readonly parent: _CfgProductConfigurationInternal | _CfgOptionInternal; readonly parentConfiguration: _CfgProductConfigurationInternal; readonly parentProduct: _CfgProductInternal; readonly rootProduct: _CfgProductInternal; constructor(rawFeature: DtoFeature, rawFeatures: DtoFeature[], _key: string, // Unique amongst siblings parent: _CfgProductConfigurationInternal | _CfgOptionInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal); readonly selectionType: SelectionType; private _options; private readonly _selectedOptions; private readonly _constrainedOptions; private readonly _unresolvableOptions; private _mtrlApplications; readonly hasUpcharge: boolean; readonly changeObservable: Observable; get code(): string; get groupCode(): string | undefined; get key(): string; set key(k: string); get notes(): DtoNote[]; get isUseNumericValue(): boolean; get numericValue(): number | undefined; setNumericValue: (val: number) => Promise; get description(): string; get omitOnOrder(): boolean; get syncGroup(): DtoSyncGroup | undefined; /** * @return one of the following, in order: * - undefined if the Feature lacks a syncGroup. * - false if the syncGroup doesn't fulfill the optional mustSupport requirement. * - syncCode from the syncGroup. */ getSyncCode(mustSupport?: DtoSyncGroupMethods): undefined | false | SyncCode; /** * The DtoMeasureParam class is re-used for different purposes. In Features it is used * to indicate which stretch measures inside Models shall be affected by this state * of this Feature. Hence only the code property is used. */ get measureParamCodes(): string[] | undefined; get unit(): LengthUnit; get mtrlApplications(): CfgMtrlApplication[]; get selectedOptions(): CfgOption[]; get ancestorsSelected(): boolean; /** * If one option is selected or deselected this will potentially * affect all other Options on this Feature */ private get isAllOptionsAffectedByAnySelection(); get preview(): string | undefined; /** * Please note that this relates to the visibility in the Configuration tree. * It does not affect the visibility of anything in the 3D view at all. */ get visibleIfAdditionalProduct(): boolean; /** * Please note that this relates to the visibility in the Configuration tree. * It does not affect the visibility of anything in the 3D view at all. */ get visibleIfMainProduct(): boolean; /** * Please note that this relates to the visibility in the Configuration tree. * It does not affect the visibility of anything in the 3D view at all. */ get visible(): boolean; get options(): CfgOption[]; private _notifyAllOfChange; /** * Called by child to tell its parent that it has changed. * @throws Will throw if options have not yet been generated. This should be impossible * as nonexisting children can not call their parent. */ _childHasChanged: (childOption: _CfgOptionInternal, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise; getDtoConf: (includeExtendedData: boolean) => DtoFeatureConf; setApiSelection: (apiOptionSelectionMap: { [index: string]: DtoSelectedOption; } | undefined, apiOptionConstraintMap: { [index: string]: DtoPartsConstrainedOption; } | undefined) => Promise; addForApiConstrained: (next: { [key: string]: DtoPartsConstrainedOption; }) => void; /** Pushes to refresh stretch. Does not cause validation. */ pushStretch: () => Promise; structureCompare: (other: _CfgFeatureInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean; tryMatchSelection: (other: _CfgFeatureInternal, descriptionMatch?: boolean) => Promise; /** * Normally this is used through methods on CfgFeature and CfgOption. Use this internal version * if you need to control the bubbleMode. * * Using a validate bubbleMode will cause validation calls to the server. */ selectOption: (optionInternal: _CfgOptionInternal, on: boolean, bubbleMode: ProductConfigurationBubbleMode) => Promise; isSelected: (option: _CfgOptionInternal) => boolean; isDisabled: (option: _CfgOptionInternal) => boolean; /** * An option is unresolvable when it is constrained from any possible value. */ isUnresolvable: (option: _CfgOptionInternal) => boolean; keyMatch: (other: _CfgFeatureInternal, descriptionMatch?: boolean) => boolean; /** Only in selected options */ _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[]; /** * Make fresh references to all options on this feature. * Also includes currently selected options. * @throws Will throw if options have not yet been generated. */ private _freshRefAllOptions; } export declare class CfgFeature { readonly _internal: _CfgFeatureInternal; static make(rawFeature: DtoFeature, rawFeatures: DtoFeature[], key: string, parent: _CfgProductConfigurationInternal | _CfgOptionInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgFeature; /** * Makes an object wrapping the passed object. This is not a clone method, * it is a method to make a new outer reference. Like a shallow copy. * We use this to help frameworks that are built around using equals to detect change. */ static _makeNewRefFrom(internal: _CfgFeatureInternal): CfgFeature; /** * Private constructor and make-method because make new ref requires the constructor to * take an internal and we don't want those who instantiate CfgFeature to have to be aware * of the internal. */ private constructor(); isBackedBySame: (other: CfgFeature) => boolean; get parentProduct(): CfgProduct; get rootProduct(): CfgProduct; get selectionType(): SelectionType; get key(): string; get code(): string; get groupCode(): string | undefined; get notes(): DtoNote[]; /** * If true the options in the feature is selected by both sending its code and numeric value * when selecting. */ get isUseNumericValue(): boolean; /** This will read the numeric value of the selected option. */ get numericValue(): number | undefined; /** * This will find the first option allowing the value, set the value on it and select it. * This is an implicit option-select. */ setNumericValue: (val: number) => Promise; get unit(): LengthUnit; get description(): string; get omitOnOrder(): boolean; get hasUpcharge(): boolean | undefined; get selectedOptions(): CfgOption[]; /** Are all ancestors up to the CfgProductConfiguration selected? */ get ancestorsSelected(): boolean; get preview(): string | undefined; get options(): CfgOption[]; /** * Please note that this relates to the visibility in the Configuration tree. * It does not affect the visibility of anything in the 3D view at all. * Visibility is not inherited. If this is hidden the children * of this Feature might still be visible, depending on their settings. */ get visible(): boolean; /** * Selects the passed Option. * Only Options belonging to Features that are "select many" can be deselected. * Calling this will cause a validation call to the server. */ selectOption: (option: CfgOption, on: boolean) => Promise; isSelected: (option: CfgOption) => boolean; listenForChange: (l: SingleArgCallback) => void; stopListenForChange: (l: SingleArgCallback) => void; } //# sourceMappingURL=CfgFeature.d.ts.map