import { ProgPropertyModel } from './prog-property.model.js';
|
import './accordion.component.js';
|
import { AccordionItemComponent } from './accordion-item.component.js';
|
import './accordion-layer.component.js';
|
import { e } from './custom-element-30fc6381.js';
|
import { i, r } from './query-assigned-elements-fea1f631.js';
|
import { BaseAccordionTheme } from './base-accordion.theme.js';
|
import './base.component-813fc7cf.js';
|
import '@dh-software/furnview-icons';
|
import './query-1c86d710.js';
|
import './class-map-a0fb5d87.js';
|
import './style.helper.js';
|
import './event.handler.model.js';
|
import './image.service.js';
|
import './titled-image.component.js';
|
import './info.component.js';
|
import './property-list.component.js';
|
import './query-all-828de4b2.js';
|
import './sikkens-picker.component.js';
|
import './color-picker.model.js';
|
import './transition.helper.js';
|
import './ncs-picker.component.js';
|
import './ral-picker.component.js';
|
import './radio.component.js';
|
import './filter.service.js';
|
import './filter-container.component.js';
|
import './filter-list.component.js';
|
import './label.component.js';
|
import './sass.default-1ca9b57f.js';
|
import './single-color.component.js';
|
import './interface.js';
|
import './cached-layer.component.js';
|
import './pp-layer.component.js';
|
import './cache.service.js';
|
import './pp-util.class.js';
|
|
var css_248z = i`:host{margin-bottom:0}`;
|
|
var __defProp = Object.defineProperty;
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
var __getProtoOf = Object.getPrototypeOf;
|
var __reflectGet = Reflect.get;
|
var __decorateClass = (decorators, target, key, kind) => {
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
if (decorator = decorators[i])
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
if (kind && result)
|
__defProp(target, key, result);
|
return result;
|
};
|
var __superStaticGet = (obj, member) => __reflectGet(__getProtoOf(obj), member, obj);
|
var __async = (__this, __arguments, generator) => {
|
return new Promise((resolve, reject) => {
|
var fulfilled = (value) => {
|
try {
|
step(generator.next(value));
|
} catch (e) {
|
reject(e);
|
}
|
};
|
var rejected = (value) => {
|
try {
|
step(generator.throw(value));
|
} catch (e) {
|
reject(e);
|
}
|
};
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
step((generator = generator.apply(__this, __arguments)).next());
|
});
|
};
|
let ProgPropertyAccordionLayer = class extends BaseAccordionTheme {
|
constructor() {
|
super();
|
this.preventEmpty = true;
|
}
|
getAccordionItems() {
|
return __async(this, null, function* () {
|
const additionalClasses = this.PPContainer.accordionItemClasses;
|
const componentBuffer = [];
|
DragDropHelperService.cleanUp();
|
const result = yield ProgPropertyModel.traverse({
|
propertyGroupedCallback: (manufacturerModel, programModel, propertyGroup) => __async(this, null, function* () {
|
var _a, _b, _c;
|
if (this.PPContainer.hideSingleValueProperties) {
|
let noProgPropertyValueList = false;
|
let totalPropertiesCount = 0;
|
for (const item of propertyGroup.keys) {
|
if (item.progPropertyValueList) {
|
totalPropertiesCount += item.progPropertyValueList.length;
|
} else {
|
noProgPropertyValueList = true;
|
}
|
}
|
if (totalPropertiesCount < 2 && !noProgPropertyValueList) {
|
return;
|
}
|
}
|
if (!propertyGroup.title) {
|
propertyGroup.title = ((_a = propertyGroup.keys[0].progPropertyModel) == null ? void 0 : _a.name) || "";
|
}
|
let preventGroupAdd = true;
|
let cacheKey = "";
|
if (propertyGroup.title) {
|
cacheKey += `${propertyGroup.title}`;
|
}
|
if (propertyGroup == null ? void 0 : propertyGroup.id) {
|
cacheKey += `_${propertyGroup.id}`;
|
}
|
const overrides = { image: propertyGroup.imgSrc };
|
const propertyMenu = yield this.buildAccordionPropertyHeader(programModel, {
|
name: propertyGroup.title || "Undefined",
|
image: propertyGroup.imgSrc,
|
key: cacheKey
|
}, additionalClasses);
|
propertyMenu.replaceChildren();
|
for (const item of propertyGroup.keys) {
|
if (!((_b = item.progPropertyModel) == null ? void 0 : _b.name)) {
|
continue;
|
}
|
if (!(item.progPropertyValueList && (item.progPropertyValueList.length > 1 || !this.PPContainer.hideNotSettable))) {
|
continue;
|
}
|
const propertyFlexContent = yield this.buildAccordionFlexContent(propertyMenu, manufacturerModel, programModel, item.progPropertyModel);
|
propertyFlexContent.replaceChildren();
|
for (let ppVI = 0; ppVI < item.progPropertyValueList.length; ppVI++) {
|
const propertyValue = item.progPropertyValueList[ppVI];
|
let ppItem;
|
if (propertyValue.alternativeImageUrl) {
|
ppItem = this.buildImageProperty(propertyMenu, propertyFlexContent, manufacturerModel, programModel, item.progPropertyModel, propertyValue, item.currentValue, overrides);
|
} else if (propertyValue.colorPicker && propertyValue.colorPicker.type) {
|
ppItem = this.buildColorPickerProperty(propertyMenu, propertyFlexContent, manufacturerModel, programModel, item.progPropertyModel, propertyValue, item.currentValue, overrides);
|
} else {
|
ppItem = this.buildRadioProperty(propertyMenu, propertyFlexContent, manufacturerModel, programModel, item.progPropertyModel, propertyValue, item.currentValue, overrides);
|
}
|
if (ppItem) {
|
const itemKeyIndex = this.getCacheKeys("items").indexOf(propertyValue.propertyKey);
|
if (itemKeyIndex !== -1)
|
this.getCacheKeys("items").splice(itemKeyIndex, 1);
|
propertyFlexContent.appendChild(ppItem);
|
}
|
}
|
if (propertyFlexContent.children.length > 0) {
|
preventGroupAdd = false;
|
const label = this.buildLabel(item.progPropertyModel);
|
label.style.fontWeight = "bold";
|
const labelKeyIndex = this.getCacheKeys("labels").indexOf((_c = item.progPropertyModel) == null ? void 0 : _c.key);
|
if (labelKeyIndex !== -1)
|
this.getCacheKeys("labels").splice(labelKeyIndex, 1);
|
propertyMenu.append(label);
|
propertyMenu.append(propertyFlexContent);
|
this.getCache("flex")[item.progPropertyModel.key] = propertyFlexContent;
|
const flexKeyIndex = this.getCacheKeys("flex").indexOf(item.progPropertyModel.key);
|
if (flexKeyIndex !== -1)
|
this.getCacheKeys("flex").splice(flexKeyIndex, 1);
|
}
|
item.currentValue;
|
if (!item.currentValue) {
|
item.progPropertyValueList.find((c) => {
|
var _a2;
|
return c.propertyKey === ((_a2 = item.progPropertyModel) == null ? void 0 : _a2.currentValue);
|
});
|
}
|
}
|
if (!preventGroupAdd && propertyMenu.childElementCount > 0) {
|
componentBuffer.push(propertyMenu);
|
}
|
})
|
});
|
if (result) {
|
if (componentBuffer.length === 1) {
|
if (componentBuffer[0] instanceof AccordionItemComponent) {
|
componentBuffer[0].isSingular = true;
|
}
|
} else if (componentBuffer.length > 1) {
|
componentBuffer.forEach((item, index) => {
|
item.isSingular = false;
|
});
|
}
|
}
|
return componentBuffer;
|
});
|
}
|
getCacheKeyPrefix() {
|
return "progproperty";
|
}
|
};
|
ProgPropertyAccordionLayer.styles = [__superStaticGet(ProgPropertyAccordionLayer, "styles") || [], r(css_248z)];
|
ProgPropertyAccordionLayer = __decorateClass([
|
e("fv-prog-property-accordion-layer")
|
], ProgPropertyAccordionLayer);
|
|
export { ProgPropertyAccordionLayer };
|