dh_ackergaul
vor 3 Tagen bb80cdf5a6157ca1f3a276e12e9faae9a4739cb7
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
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 };