dh_ackergaul
2026-06-03 a25433795ec239654db2ef31af6d3f4e84b3b8dc
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
import { ArticlesByCategoriesCardAppConnection, ArticleDimension } from './articles-by-categories.card.app.connection.js';
import { CardFetchMethod, FilterSelectionStrategy, CardContainerUpdate } from './card-container-definitions.js';
import './card-container-events.js';
import { CardDataUpdateEvent } from './card-data-service-update-events.js';
import { C as ComponentService } from './base.component-813fc7cf.js';
import { E as EventHandlerService } from './modal.component-db51742e.js';
import { CardDataService } from './card.data.service.js';
import { DimensionHelper } from './dimension-helper.class.js';
import './old-generated-catalog-base.card.app.connection.js';
import './base.card.app.connection.js';
import './catalog.service.js';
import './manu-prog.service.js';
import './query-assigned-elements-fea1f631.js';
import './custom-element-30fc6381.js';
import '@dh-software/furnview-icons';
import './class-map-a0fb5d87.js';
import './event.handler.model.js';
import './loading.component.js';
import './dimmer.component.js';
import './query-1c86d710.js';
import './dot-flashing-loader.component.js';
import './rotating-dots-loader.component.js';
import './key-frame-effect.service.js';
import './toolbar.component.js';
import './toggle-toolbar.component.js';
import './style.helper.js';
import './image.service.js';
import './svg-icon.component.js';
import './popup.component.js';
import './popup-closer.component.js';
import './hr-item.component.js';
import './hr-list.component.js';
import './query-all-828de4b2.js';
import './hr-theme.model.js';
import './configurator.form.component.js';
import './configurator.form.base.element.component.js';
import './scene-helper.service.js';
import './async.base.component.js';
import './card-container-settings.js';
import './card-container-states.js';
import './card-container-additional-data.js';
import './card-containers-shared-data.js';
import './input.mask.component.js';
import './mask.component.js';
import './information.mask.component.js';
import './open-cloud-id.mask.component.js';
import './share-link-per-mail.component.js';
import './request-appointment.component.js';
import './prog-property.model.js';
import './interface.js';
import './reset.mask.component.js';
import './configuration.service.js';
import './step-based.mask.component.js';
import './container-mask.component.js';
import './messageNoCalc.mask.component.js';
import './button.component.js';
import './iwoFurn.mask.component.js';
import './input.component.js';
import './base-input.js';
import './save-dialog.mask.component.js';
import './cloud-id.service.js';
import './send-offer-request-mask.component.js';
import './file-upload-mask.component.js';
import './label.component.js';
import './sass.default-d943b107.js';
import './accordion.component.js';
import './accordion-item.component.js';
import './accordion-layer.component.js';
import './slider.component.js';
import './equipment-list.component.js';
import './state-7ee0cf4f.js';
import './confirming-button.component.js';
import './fitting-item.component.js';
import './proptrans-item.component.js';
import './shoppingcart-item.component.js';
import './prog-context.model.js';
import './step-child.component.js';
import './clock.controller.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 ArticlesByCategoriesDimensionCardAppConnection extends ArticlesByCategoriesCardAppConnection {
  constructor() {
    super();
    this.clickActive = false;
    this.Method = CardFetchMethod.ArticlesByCategoriesDimensions;
  }
  getFetchDimension(context) {
    const dimension = context.settings.Fetch.parameters["dimension"];
    const dimensionIndex = context.settings.Fetch.parameters["automatic-dimension-order-index"];
    if (dimension) {
      return dimension;
    }
    if (dimensionIndex !== void 0) {
      return DimensionHelper.getDimensionNameFromIndex(dimensionIndex);
    }
    return void 0;
  }
  CheckUpdate(event, eventParameters, context) {
    return __async(this, null, function* () {
      if (event == CardDataUpdateEvent.LastPOLoaded) {
        return CardContainerUpdate.FILTER;
      }
      if (event == CardDataUpdateEvent.CardContainerVisible) {
        return CardContainerUpdate.FETCH;
      }
      return CardContainerUpdate.NONE;
    });
  }
  GetDisabledDimensions(fetch, articleDimensions) {
    return __async(this, null, function* () {
      const cardContainerDisableSource = fetch.parameters ? fetch.parameters["card-container-disable-source-selector"] : void 0;
      if (cardContainerDisableSource != void 0) {
        const filteredArticleDimensionValues = new Array();
        const disableSource = ComponentService.find(cardContainerDisableSource.tag, cardContainerDisableSource.query);
        if (disableSource != void 0) {
          yield disableSource.CheckFetchPromise();
          if (disableSource.FilteredFetchResult != void 0) {
            const articles = disableSource.FilteredFetchResult.articles;
            for (const article of articles) {
              const articleDimension = new ArticleDimension(article, "width");
              filteredArticleDimensionValues.push([
                articleDimension.All.width,
                articleDimension.All.depth,
                articleDimension.All.height
              ]);
            }
          }
        }
        const result = new Array();
        for (const articleDimension of articleDimensions) {
          let any = false;
          for (const value of filteredArticleDimensionValues) {
            if (value.includes(articleDimension.Value)) {
              any = true;
              break;
            }
          }
          if (any == false) {
            result.push(articleDimension.Value);
          }
        }
        return result;
      }
      const disablePrecheckSelectors = fetch.parameters ? fetch.parameters["disable-precheck-selectors"] : void 0;
      if (disablePrecheckSelectors != void 0) {
        const result = new Array();
        for (const selector of disablePrecheckSelectors) {
          const disablePrecheckElements = ComponentService.findAll(selector.tag, selector.query);
          for (const element of disablePrecheckElements) {
            yield element.CheckFetchPromise();
            if (element.CardData) {
              for (const level of element.CardData) {
                for (const articleDimension of articleDimensions) {
                  if (level[1].additional && level[1].additional.articles) {
                    const filterResult = this.FilterByButtons([{
                      filter: [articleDimension.Value],
                      strategy: FilterSelectionStrategy.AND,
                      "additional-params": { "filter-type": "dimension", "dimension": articleDimension.Dimension }
                    }], level[1].additional.articles);
                    if (filterResult.length < 1 && result.includes(articleDimension.Value) == false) {
                      result.push(articleDimension.Value);
                    }
                  }
                }
              }
            }
          }
        }
        return result;
      }
      return new Array();
    });
  }
  Fetch(context) {
    var __superGet = (key) => super[key];
    return __async(this, null, function* () {
      const dimension = this.getFetchDimension(context);
      if (dimension == void 0) {
        console.error("articles-by-categories-dimension.card.app.connection> Fetch failed! No dimension provided in fetch.parameters.dimension");
        return {};
      }
      let result = yield __superGet("Fetch").call(this, context);
      result = __superGet("Filter").call(this, result, context, []);
      if (result.articles) {
        result["article-dimensions"] = new Array();
        for (const article of result.articles) {
          result["article-dimensions"].push(new ArticleDimension(article, dimension));
        }
        if (context.states.SuspendDisableSource) {
          result["disabled-dimensions"] = new Array();
        } else {
          result["disabled-dimensions"] = yield this.GetDisabledDimensions(context.settings.Fetch, result["article-dimensions"]);
        }
        const dimensions = new Array();
        for (const articleDimension of result["article-dimensions"]) {
          if (dimensions.includes(articleDimension.Value) == false) {
            dimensions.push(articleDimension.Value);
          }
        }
        result["dimensions"] = dimensions;
      }
      return result;
    });
  }
  Filter(unfiltered, context, active) {
    const filtered = unfiltered;
    const options = active;
    for (const option of options) {
      if (typeof option == "number") {
        if (filtered.dimensions.includes(option) == false) {
          const index = active.indexOf(option);
          active = active.splice(index, 1);
        }
      }
    }
    filtered["active"] = active;
    return filtered;
  }
  CreateCards(filtered, context) {
    const fetchResult = filtered;
    const rootLevel = { title: "", cards: [] };
    const groupings = new Map();
    if (fetchResult.dimensions) {
      if (fetchResult.dimensions.length > 0) {
        fetchResult.dimensions.sort((a, b) => {
          return a - b;
        });
        const dimensionScale = fetchResult["dimension-scale"];
        let fractionDigits = context.settings.Fetch.parameters["fraction-digits"] ? context.settings.Fetch.parameters["fraction-digits"] : 1;
        if (typeof fractionDigits != "number") {
          fractionDigits = 1;
        }
        const valueGroupRange = context.settings.Fetch.parameters["value-group-range"] ? context.settings.Fetch.parameters["value-group-range"] : 1e3;
        const disabledDimensions = fetchResult["disabled-dimensions"];
        const active = fetchResult["active"];
        const rangeGroups = new Array();
        let currentGroup = new Array();
        let groupRangeMax = valueGroupRange;
        for (const dimension of fetchResult.dimensions) {
          if (dimension > groupRangeMax + 1e-3) {
            rangeGroups.push(currentGroup);
            currentGroup = new Array();
            groupRangeMax += valueGroupRange;
          }
          currentGroup.push(dimension);
        }
        if (rangeGroups.includes(currentGroup) == false) {
          rangeGroups.push(currentGroup);
        }
        const maxSizeAdjustedGroups = new Array();
        const valueGroupMaxSize = context.settings.Fetch.parameters["value-group-max-size"];
        if (valueGroupMaxSize != void 0) {
          for (const group of rangeGroups) {
            if (group.length > valueGroupMaxSize) {
              const leftHalf = group.splice(0, Math.ceil(group.length * 0.5));
              maxSizeAdjustedGroups.push(leftHalf);
            }
            maxSizeAdjustedGroups.push(group);
          }
        } else {
          maxSizeAdjustedGroups.push(...rangeGroups);
        }
        const groups = new Array();
        const valueGroupMinSplitSize = context.settings.Fetch.parameters["value-group-min-split-size"];
        if (valueGroupMinSplitSize != void 0 && valueGroupMinSplitSize > maxSizeAdjustedGroups.length) {
          let mergedGroup = void 0;
          for (const group of maxSizeAdjustedGroups) {
            if (mergedGroup != void 0) {
              mergedGroup.push(...group);
              if (mergedGroup.length > valueGroupMinSplitSize) {
                groups.push(mergedGroup);
                mergedGroup = void 0;
              }
              continue;
            }
            if (group.length < valueGroupMinSplitSize) {
              mergedGroup = new Array();
              mergedGroup.push(...group);
              continue;
            }
            groups.push(group);
          }
        } else {
          groups.push(...maxSizeAdjustedGroups);
        }
        if (groups.length == 1) {
          const group = groups.at(0);
          if (group && group.length > 0) {
            for (const option of group) {
              const optionDisabled = disabledDimensions.includes(option);
              let optionActive = false;
              if (active.includes(option)) {
                optionActive = true;
              }
              rootLevel.cards.push({
                txt: { title: (option * dimensionScale).toFixed(fractionDigits) },
                click: {
                  "previous-level-key": context.settings.Fetch["root-level"],
                  "level-key": option,
                  "next-level-key": ""
                },
                active: optionActive,
                disabled: optionDisabled
              });
            }
          }
        } else {
          for (const group of groups) {
            if (group.length > 0) {
              const first = group.at(0) * dimensionScale;
              const last = group.at(group.length - 1) * dimensionScale;
              const groupLevelKey = `${first.toFixed(fractionDigits)} - ${last.toFixed(fractionDigits)}`;
              rootLevel.cards.push({
                txt: { title: groupLevelKey },
                click: {
                  "previous-level-key": "",
                  "level-key": context.settings.Fetch["root-level"],
                  "next-level-key": groupLevelKey
                }
              });
              const groupLevel = { title: groupLevelKey, cards: [] };
              for (const option of group) {
                const optionDisabled = disabledDimensions.includes(option);
                let optionActive = false;
                if (active.includes(option)) {
                  optionActive = true;
                }
                groupLevel.cards.push({
                  txt: { title: (option * dimensionScale).toFixed(fractionDigits) },
                  click: {
                    "previous-level-key": groupLevelKey,
                    "level-key": option,
                    "next-level-key": ""
                  },
                  active: optionActive,
                  disabled: optionDisabled
                });
              }
              groupings.set(groupLevelKey, groupLevel);
            }
          }
        }
      }
    }
    if (context.settings.Fetch.parameters["force-single-option-as-empty"] == true) {
      if (rootLevel.cards.length < 2 && groupings.size < 1) {
        rootLevel.cards = [];
      }
    }
    if (groupings.size == 1) {
      rootLevel.cards = [];
      for (const grouping of groupings) {
        rootLevel.cards.push(...grouping[1].cards);
      }
      groupings.clear();
    }
    const result = new Map();
    result.set(context.settings.Fetch["root-level"], rootLevel);
    for (const group of groupings) {
      result.set(group[0], group[1]);
    }
    return result;
  }
  Click(card, context) {
    var __superGet = (key) => super[key];
    return __async(this, null, function* () {
      if (this.clickActive)
        return;
      this.clickActive = true;
      yield __superGet("Click").call(this, card, context);
      if (context.filter != void 0) {
        const dimension = this.getFetchDimension(context);
        if (dimension) {
          context.filter.AdditionalParams = {
            "filter-type": "dimension",
            "dimension": dimension
          };
        }
        context.filter.Strategy = FilterSelectionStrategy.OR;
        if (card.disabled == false && card.click != void 0) {
          if (typeof card.click["level-key"] == "number") {
            context.filter.Toggle(card.click["level-key"]);
          }
        }
        yield EventHandlerService.dispatchAsyncEvent("refresh-all-card-containers", {
          refetch: true,
          "include-hidden": false
        });
        yield CardDataService.WaitForAllCardContainerFetchPromises();
        if (context.settings.Fetch.parameters["disabled-reset-selection"]) {
          if (context.cards != void 0 && card.click != void 0) {
            for (const level of context.cards) {
              for (const cardInLevel of level[1].cards) {
                if (cardInLevel.click == void 0)
                  continue;
                if (cardInLevel.click["level-key"] == card.click["level-key"]) {
                  if (cardInLevel.disabled == false && cardInLevel.active == false) {
                    context.filter.Add(card.click["level-key"]);
                    break;
                  }
                }
              }
            }
          }
          yield EventHandlerService.dispatchAsyncEvent("refresh-all-card-containers", {
            refetch: true,
            "include-hidden": false
          });
          yield CardDataService.WaitForAllCardContainerFetchPromises();
        }
      }
      this.clickActive = false;
    });
  }
  InitFilterSelectionParams(context) {
    if (context.filter != void 0) {
      const dimension = this.getFetchDimension(context);
      if (dimension) {
        context.filter.AdditionalParams = {
          "filter-type": "dimension",
          "dimension": dimension
        };
      }
      context.settings.Filter["selection-strategy"] = FilterSelectionStrategy.OR;
    }
  }
}
CardDataService.RegisterAppConnection(new ArticlesByCategoriesDimensionCardAppConnection());
 
export { ArticlesByCategoriesDimensionCardAppConnection };