dh_ackergaul
vor 3 Tagen 5bbf43c1b146439ab882815c12ed6292f1d7b4df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { a as __decorate, _ as __awaiter } from './tslib.es6-b53fb3ce.js';
import { ProgPropertyModel } from './prog-property.model.js';
import { PPPropertyComponent } from './pp-property.component.js';
import { PPPropertyValuesComponent } from './pp-property-values.component.js';
import { PPTheme } from './pp-container.component.js';
import { CacheService } from './cache.service.js';
import { PPUtilClass } from './pp-util.class.js';
import { PPLayerComponent } from './pp-layer.component.js';
import { e } from './custom-element-30fc6381.js';
import { i, r } from './query-assigned-elements-fea1f631.js';
 
var css_248z = i`:host{align-content:flex-start;display:flex;flex-flow:wrap}`;
 
var ProgPropertyFurnviewAccordionLayer_1;
let ProgPropertyFurnviewAccordionLayer = ProgPropertyFurnviewAccordionLayer_1 = class ProgPropertyFurnviewAccordionLayer extends PPLayerComponent {
    static propertyCallback(layer, keyLists, componentsBuffer) {
        const menuComponents = CacheService.get("progproperty_menu");
        const itemsComponents = CacheService.get("progproperty_items");
        let lastMenu = null;
        let lastItems = null;
        const containerComponent = layer.PPContainer;
        return (manufacturerModel, programModel, progPropertyModel, progPropertyValueList, currentValue) => {
            if (!progPropertyModel.name) {
                return false;
            }
            const ppMenu = menuComponents[progPropertyModel.key] || new PPPropertyComponent({
                title: progPropertyModel.name,
                hideItemCount: containerComponent.hideItemCount || (containerComponent.disableNotSettable && progPropertyValueList.length === 1),
                halfSize: containerComponent.halfSize
            });
            menuComponents[progPropertyModel.key] = ppMenu;
            const menuKeyIndex = keyLists.menuKeys.indexOf(progPropertyModel.key);
            if (menuKeyIndex !== -1)
                keyLists.menuKeys.splice(menuKeyIndex, 1);
            let currentPropertyValue = currentValue;
            if (!currentValue) {
                currentPropertyValue = progPropertyValueList.find((c) => {
                    return c.propertyKey === progPropertyModel.currentValue;
                });
            }
            if (progPropertyValueList.length === 1) {
                if (containerComponent.hideNotSettable) {
                    return false;
                }
                else if (containerComponent.disableNotSettable) {
                    ppMenu.setAttribute("disabled", "true");
                }
                currentPropertyValue = progPropertyValueList[0];
            }
            ppMenu.transparentPlaceholder = +containerComponent.theme === +PPTheme.FURNVIEW;
            if (currentPropertyValue) {
                ppMenu.currentName = currentPropertyValue.name;
                ppMenu.currentImage = currentPropertyValue.alternativeImageUrl;
            }
            const ppItems = itemsComponents[progPropertyModel.key] || new PPPropertyValuesComponent();
            itemsComponents[progPropertyModel.key] = ppItems;
            const itemsKeyIndex = keyLists.itemsKeys.indexOf(progPropertyModel.key);
            if (itemsKeyIndex !== -1)
                keyLists.itemsKeys.splice(itemsKeyIndex, 1);
            ppItems.id = "item_" + progPropertyModel.id;
            if (!layer.contains(ppMenu)) {
                ppMenu.addEventListener("click", (e) => {
                    e.stopPropagation();
                    e.preventDefault();
                    layer.querySelectorAll("fv-pp-property")
                        .forEach((property) => {
                        if (ppMenu !== property) {
                            property.classList[!ppMenu.active ? "add" : "remove"]("hidden");
                        }
                    });
                    ppMenu.active = !ppMenu.active;
                    ppItems.active = ppMenu.active;
                });
            }
            if (lastItems && lastItems) {
                componentsBuffer.splice(componentsBuffer.indexOf(lastItems) + 1, 0, ppMenu);
            }
            else {
                componentsBuffer.push(ppMenu);
            }
            lastMenu = ppMenu;
            if (lastMenu && lastMenu) {
                componentsBuffer.splice(componentsBuffer.indexOf(lastMenu) + 1, 0, ppItems);
            }
            else {
                componentsBuffer.push(ppItems);
            }
            lastItems = ppItems;
            PPUtilClass.addItems({
                menu: ppMenu,
                items: ppItems,
                containerComponent: containerComponent,
                itemKeys: keyLists.itemKeys,
                manufacturerModel: manufacturerModel,
                programModel: programModel,
                progPropertyModel: progPropertyModel,
                progPropertyValueList: progPropertyValueList,
                currentValue: currentValue,
                currentPropertyValue: currentPropertyValue
            });
        };
    }
    getAccordionItems() {
        return __awaiter(this, void 0, void 0, function* () {
            const menuComponentsKeys = Object.keys(CacheService.get("progproperty_menu"));
            const itemsComponentsKeys = Object.keys(CacheService.get("progproperty_items"));
            const itemComponentsKeys = Object.keys(CacheService.get("progproperty_item"));
            const componentsBuffer = [];
            yield ProgPropertyModel.traverse({
                propertyCallback: ProgPropertyFurnviewAccordionLayer_1.propertyCallback(this, {
                    menuKeys: menuComponentsKeys,
                    itemsKeys: itemsComponentsKeys,
                    itemKeys: itemComponentsKeys
                }, componentsBuffer)
            });
            PPUtilClass.cleanup(this, menuComponentsKeys, "progproperty_menu");
            PPUtilClass.cleanup(this, itemsComponentsKeys, "progproperty_items", "progproperty_menu");
            PPUtilClass.cleanup(this, itemComponentsKeys, "progproperty_item");
            return componentsBuffer;
        });
    }
};
ProgPropertyFurnviewAccordionLayer.styles = [(void 0).styles || [], r(css_248z)];
ProgPropertyFurnviewAccordionLayer = ProgPropertyFurnviewAccordionLayer_1 = __decorate([
    e("fv-prog-property-furnview-accordion-layer")
], ProgPropertyFurnviewAccordionLayer);
const PpFurnviewAccordionLayerComponent = new ProgPropertyFurnviewAccordionLayer();
 
export { ProgPropertyFurnviewAccordionLayer as P, PpFurnviewAccordionLayerComponent as a, css_248z as c };