import './accordion.component.js';
|
import { AccordionItemComponent } from './accordion-item.component.js';
|
import './accordion-layer.component.js';
|
import { TitledImageComponent } from './titled-image.component.js';
|
import { PropertyListComponent } from './property-list.component.js';
|
import { RadioComponent } from './radio.component.js';
|
import { FilterService } from './filter.service.js';
|
import { DragType } from './interface.js';
|
import { CachedLayerComponent } from './cached-layer.component.js';
|
import './query-assigned-elements-fea1f631.js';
|
import './custom-element-30fc6381.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 './info.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 './filter-container.component.js';
|
import './prog-property.model.js';
|
import './filter-list.component.js';
|
import './label.component.js';
|
import './sass.default-1ca9b57f.js';
|
import './single-color.component.js';
|
import './pp-layer.component.js';
|
import './cache.service.js';
|
import './pp-util.class.js';
|
|
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());
|
});
|
};
|
class BaseAccordionTheme extends CachedLayerComponent {
|
constructor() {
|
super(...arguments);
|
this._blockInstance = 0;
|
this._updateInstance = -1e10;
|
this.currentProgram = "";
|
}
|
buildAccordionPropertyHeader(program, header, additionalClasses) {
|
return __async(this, null, function* () {
|
const ppMenu = this.getCache("menu")[header.key] || new AccordionItemComponent({
|
header: (header == null ? void 0 : header.name) || "Undefined",
|
image: ""
|
});
|
if (additionalClasses.length > 0) {
|
ppMenu.classList.add(...additionalClasses);
|
}
|
this.getCache("menu")[header.key] = ppMenu;
|
const menuKeyIndex = this.getCacheKeys("menu").indexOf(header.key);
|
if (menuKeyIndex !== -1)
|
this.getCacheKeys("menu").splice(menuKeyIndex, 1);
|
if (this.currentProgram === program.programID) {
|
if (ppMenu.isActive)
|
this.parentAccordion.ActiveItem = ppMenu;
|
} else {
|
this.currentProgram = program.programID;
|
if (this.parentAccordion.ActiveItem)
|
this.parentAccordion.ActiveItem.isActive = false;
|
this.parentAccordion.ActiveItem = void 0;
|
}
|
return ppMenu;
|
});
|
}
|
buildAccordionFlexContent(menu, handle, programModel, property) {
|
return __async(this, null, function* () {
|
const flexContent = this.getCache("flex")[property.key] || new PropertyListComponent();
|
flexContent.setZoomImage();
|
flexContent.setAttribute("id", property.id);
|
const filterContainer = flexContent.appendChild(yield FilterService.generateFilter(handle.manufacturerName, programModel.programName, "" + property.key, flexContent, this.getCache("items")));
|
if (!filterContainer.dataset["filterEventAdded"]) {
|
filterContainer.dataset["filterEventAdded"] = "true";
|
filterContainer.addEventListener("filterChanged", () => {
|
if (menu)
|
menu.requestHeightUpdate();
|
});
|
}
|
return flexContent;
|
});
|
}
|
buildLabel(propertyModel) {
|
let label = this.getCache("labels")[propertyModel.key];
|
if (!label) {
|
label = document.createElement("label");
|
this.getCache("labels")[propertyModel.key] = label;
|
}
|
label.textContent = propertyModel.name;
|
return label;
|
}
|
buildImageProperty(ppMenu, ppList, handle, programModel, propertyModel, propertyValue, current, overrides) {
|
let ppItem = this.getCache("items")[propertyValue.propertyKey];
|
if (!ppItem) {
|
ppItem = new TitledImageComponent();
|
const modifyProperty = this.getModifyParameters(handle, programModel, propertyModel, propertyValue);
|
DragDropHelperService.addElement(ppItem, {
|
extData: modifyProperty,
|
id: propertyModel.id,
|
type: DragType.PROGPROPERTY
|
}, void 0, false);
|
ppItem.addEventListener("click", (e) => {
|
const selectedItem = ppList.querySelector(".selected");
|
if (selectedItem) {
|
selectedItem.classList.remove("selected");
|
}
|
Object.values(this.getCache("flex")).forEach((content) => {
|
content.hideColorPicker();
|
});
|
ppItem.classList.add("selected");
|
e.stopPropagation();
|
CommunicationMessageService.modifyProperty(JSON.stringify([modifyProperty]), this.PPContainer.PPOptions);
|
});
|
this.getCache("items")[propertyValue.propertyKey] = ppItem;
|
}
|
ppItem.text = propertyValue.name;
|
ppItem.image = propertyValue.alternativeImageUrl;
|
ppItem.infoData = propertyValue.toolTipData;
|
ppItem.infoType = propertyValue.toolTipType;
|
ppItem.manufacturer = handle.manufacturerName;
|
ppItem.IsActive = false;
|
const isCurrent = this.setHeaderImage(ppMenu, propertyModel, propertyValue, current, overrides);
|
if (isCurrent) {
|
ppItem.classList.add("selected");
|
} else {
|
ppItem.classList.remove("selected");
|
}
|
return ppItem;
|
}
|
buildColorPickerProperty(ppMenu, ppList, handle, programModel, propertyModel, propertyValue, current, overrides) {
|
let ppItem = this.getCache("items")[propertyValue.propertyKey];
|
if (!ppItem) {
|
ppItem = new TitledImageComponent();
|
ppItem.addEventListener("click", (e) => {
|
++this._blockInstance;
|
const selectedItem = ppList.querySelector(".selected");
|
if (selectedItem) {
|
selectedItem.classList.remove("selected");
|
}
|
ppItem.classList.add("selected");
|
e.stopPropagation();
|
ppList.showColorPicker(propertyValue.colorPicker);
|
});
|
this.getCache("items")[propertyValue.propertyKey] = ppItem;
|
}
|
ppItem.text = propertyValue.name;
|
ppItem.image = propertyValue.alternativeImageUrl;
|
ppItem.infoData = propertyValue.toolTipData;
|
ppItem.infoType = propertyValue.toolTipType;
|
ppItem.manufacturer = handle.manufacturerName;
|
if (propertyValue.colorPicker) {
|
ppList.addColorPicker(propertyValue.colorPicker, (e) => {
|
const detail = e.detail;
|
ppItem.Image = `${detail.rgba.r},${detail.rgba.g},${detail.rgba.b},${detail.rgba.a}`;
|
ppMenu.Image = `${detail.rgba.r},${detail.rgba.g},${detail.rgba.b},${detail.rgba.a}`;
|
CommunicationMessageService.modifyProperty(JSON.stringify([this.getModifyParameters(handle, programModel, propertyModel, propertyValue)]), Object.assign({
|
modifyColorPicker: {
|
code: detail.code,
|
rgb: `${detail.rgba.r},${detail.rgba.g},${detail.rgba.b}`,
|
key: propertyValue.propertyKey,
|
id: propertyModel.id
|
}
|
}, this.PPContainer.PPOptions));
|
});
|
}
|
ppItem.IsActive = this.setHeaderImage(ppMenu, propertyModel, propertyValue, current, overrides);
|
if (ppItem.IsActive) {
|
ppList.showColorPicker(current == null ? void 0 : current.colorPicker, Object.keys(propertyModel.children).length === 1);
|
ppItem.classList.add("selected");
|
} else {
|
ppItem.classList.remove("selected");
|
}
|
return ppItem;
|
}
|
buildRadioProperty(ppMenu, ppList, handle, programModel, propertyModel, propertyValue, current, overrides) {
|
ppList.classList.add("radioList");
|
let ppItem = this.getCache("items")[propertyValue.propertyKey];
|
if (!ppItem) {
|
ppItem = new RadioComponent();
|
ppItem.classList.add("top-radio");
|
ppItem.addEventListener("click", (e) => {
|
e.stopPropagation();
|
CommunicationMessageService.modifyProperty(JSON.stringify([this.getModifyParameters(handle, programModel, propertyModel, propertyValue)]), this.PPContainer.PPOptions);
|
});
|
this.getCache("items")[propertyValue.propertyKey] = ppItem;
|
}
|
ppItem.textContent = propertyValue.name;
|
ppItem.name = propertyModel.key;
|
ppItem.checked = this.setHeaderImage(ppMenu, propertyModel, propertyValue, current, overrides);
|
return ppItem;
|
}
|
getModifyParameters(handle, programModel, propertyModel, propertyValue) {
|
return {
|
manufacturer: handle.manufacturerName.toLowerCase(),
|
program: programModel.programName.toLowerCase(),
|
key: propertyModel.id,
|
property: propertyValue.key,
|
propertyKey: propertyValue.propertyKey,
|
contextId: "contextId" in handle ? handle.contextId : void 0
|
};
|
}
|
setHeaderImage(ppMenu, propertyModel, propertyValue, current, overrides) {
|
var _a;
|
if (current && current.propertyKey === propertyValue.propertyKey) {
|
ppMenu.Image = (overrides == null ? void 0 : overrides.image) || (current == null ? void 0 : current.alternativeImageUrl) || ((_a = current == null ? void 0 : current.colorPicker) == null ? void 0 : _a.rgb) || ppMenu.Image;
|
return true;
|
}
|
return false;
|
}
|
getCacheKeyPrefix() {
|
return "_";
|
}
|
}
|
|
export { BaseAccordionTheme };
|