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
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
import { BaseCardDataAppConnection } from './base.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 { ManuProgService } from './manu-prog.service.js';
import { ProgContextModel, ContextFilterStrategy } from './prog-context.model.js';
import { U as UtilService } from './modal.component-7c440789.js';
import { CardDataService } from './card.data.service.js';
import './catalog.service.js';
import './prog-property.model.js';
import './query-assigned-elements-fea1f631.js';
import './custom-element-30fc6381.js';
import './base.component-813fc7cf.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 './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-1ca9b57f.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 './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());
  });
};
const _PropertyContextValueSelectionCardAppConnection = class extends BaseCardDataAppConnection {
  constructor() {
    super();
    this.Method = CardFetchMethod.PropertyContextValueSelection;
  }
  CheckUpdate(event, eventParameters, context) {
    return __async(this, null, function* () {
      if (event == CardDataUpdateEvent.RefreshPropertyPanel) {
        const now = Date.now();
        const diff = now - (_PropertyContextValueSelectionCardAppConnection.lastRefreshProperyPanelTimestamp || 0);
        if (diff > 250) {
          _PropertyContextValueSelectionCardAppConnection.lastRefreshProperyPanelTimestamp = now;
        }
      }
      if (event == CardDataUpdateEvent.LastPOLoaded || event == CardDataUpdateEvent.RefreshPropertyPanel || event == CardDataUpdateEvent.CardContainerVisible) {
        return CardContainerUpdate.FETCH;
      }
      return CardContainerUpdate.NONE;
    });
  }
  Find(manufacturer, program, useSelection, useRelevant, instanceIdents) {
    return __async(this, null, function* () {
      const cacheKey = manufacturer + program + (useSelection ? "Selection" : "NoSelection") + (useRelevant ? "Relevant" : "NotRelevant") + (instanceIdents != void 0 ? instanceIdents.toString() : "[]") + (_PropertyContextValueSelectionCardAppConnection.lastRefreshProperyPanelTimestamp ? _PropertyContextValueSelectionCardAppConnection.lastRefreshProperyPanelTimestamp.toString() : "");
      const cachedResult = _PropertyContextValueSelectionCardAppConnection.propertiesCache.get(cacheKey);
      if (cachedResult != void 0) {
        if (cachedResult.then != void 0) {
          return yield cachedResult;
        } else {
          return cachedResult;
        }
      }
      const fetchPromise = ProgContextModel.findAll(useSelection, useRelevant, instanceIdents, ContextFilterStrategy.ALL);
      _PropertyContextValueSelectionCardAppConnection.propertiesCache.set(cacheKey, fetchPromise);
      const fetchedResult = yield fetchPromise;
      _PropertyContextValueSelectionCardAppConnection.propertiesCache.set(cacheKey, fetchedResult);
      return fetchedResult;
    });
  }
  Fetch(context) {
    return __async(this, null, function* () {
      const useSelection = context.settings.Fetch.parameters["use-selection"] != void 0 ? context.settings.Fetch.parameters["use-selection"] : false;
      const useRelevant = context.settings.Fetch.parameters["use-relevant"] != void 0 ? context.settings.Fetch.parameters["use-relevant"] : true;
      const ignoreSingleValueProperties = context.settings.Fetch.parameters["ignore-single-value-properties"] != void 0 ? context.settings.Fetch.parameters["ignore-single-value-properties"] : false;
      const manufacturer = context.settings.Fetch.manufacturer && context.settings.Fetch.manufacturer.length > 0 ? context.settings.Fetch.manufacturer : yield ManuProgService.getManufacturer();
      const program = context.settings.Fetch.program ? context.settings.Fetch.program : yield ManuProgService.getProgram();
      const propertiesHierarchy = yield this.Find(manufacturer, program, useSelection, useRelevant);
      const contexts = Object.values(propertiesHierarchy.children).flatMap((x) => this.getContextProperties(x, (value) => ignoreSingleValueProperties ? Object.keys(value.children).length >= 2 : true));
      return {
        "manufacturer": manufacturer,
        "program": program,
        "contexts": contexts
      };
    });
  }
  Filter(unfiltered, context, active) {
    const filteredContexts = [];
    if (unfiltered.contexts == void 0)
      return {
        "manufacturer": unfiltered["manufacturer"],
        "program": unfiltered["program"],
        "contexts": filteredContexts
      };
    for (const propertyContext of unfiltered.contexts) {
      const allowedProperties = new Array();
      const allowedPropertyKeys = context.settings.Fetch.filter["property-keys"];
      if (allowedPropertyKeys && allowedPropertyKeys.keys && allowedPropertyKeys.keys.length > 0) {
        const hasToInclude = allowedPropertyKeys["prohibit-listed"] == void 0 ? true : allowedPropertyKeys["prohibit-listed"] == false;
        for (const property of propertyContext.properties) {
          if (allowedPropertyKeys.keys.includes(property.id) == hasToInclude) {
            allowedProperties.push(property);
          } else if (allowedPropertyKeys.keys.includes(parseInt(property.id)) == hasToInclude) {
            allowedProperties.push(property);
          }
        }
      } else {
        allowedProperties.push(...propertyContext.properties);
      }
      if (context.states.SelectedFilters && context.states.SelectedFilters.length > 0) {
        const sorted = context.states.SelectedFilters.sort((a, b) => (a.priority ? a.priority : 0) - (b.priority ? b.priority : 0));
        let anyFiltersApplied = false;
        for (const filterEntry of sorted) {
          if (filterEntry.strategy == FilterSelectionStrategy.OR) {
            anyFiltersApplied = true;
            for (const property of allowedProperties) {
              if (filterEntry.filter.includes(property.id)) {
                filteredContexts.push({
                  contextId: propertyContext.contextId,
                  properties: allowedProperties
                });
              }
            }
          }
        }
        if (anyFiltersApplied == false) {
          filteredContexts.push({ contextId: propertyContext.contextId, properties: allowedProperties });
        }
      } else {
        filteredContexts.push({ contextId: propertyContext.contextId, properties: allowedProperties });
      }
    }
    return {
      "manufacturer": unfiltered["manufacturer"],
      "program": unfiltered["program"],
      "contexts": filteredContexts
    };
  }
  CreateCards(filtered, context) {
    const result = new Map();
    if (filtered.contexts == void 0 || filtered.manufacturer == void 0 || filtered.program == void 0)
      return result;
    for (const propertyContext of filtered.contexts) {
      for (const property of propertyContext.properties) {
        const level = { title: property.name, cards: [] };
        if (property.children == void 0)
          continue;
        const propertyValueKeys = Object.keys(property.children);
        for (const propertyValueKey of propertyValueKeys) {
          const propertyValue = property.children[propertyValueKey];
          level.cards.push({
            txt: {
              title: UtilService.ncrToUTF8(propertyValue.name),
              tooltip: propertyValue.toolTipType == "text" ? propertyValue.toolTipData : ""
            },
            image: { prefix: "", file: propertyValue.alternativeImageUrl },
            click: {
              "modify-property-request": {
                manufacturer: filtered.manufacturer,
                program: filtered.program,
                key: property.id,
                property: propertyValue.key,
                propertyKey: propertyValue.propertyKey,
                contextId: propertyContext.contextId
              },
              "previous-level-key": context.settings.Fetch["root-level"],
              "level-key": property.id,
              "next-level-key": ""
            },
            active: property.currentValue == propertyValueKey
          });
        }
        result.set(property.id, level);
      }
    }
    return result;
  }
  Click(card, context) {
    return __async(this, null, function* () {
      if (card.click && card.click["modify-property-request"]) {
        yield CommunicationMessageService.modifyProperty(JSON.stringify(card.click["modify-property-request"]), card.click["modify-property-options"]);
      }
    });
  }
  getContextProperties(context, exportCondition) {
    const properties = Object.values(context.children).flatMap((programs) => {
      return Object.values(programs.children).filter((property) => exportCondition && exportCondition(property)).flatMap((property) => {
        return property;
      });
    });
    return {
      contextId: context.contextId,
      properties
    };
  }
};
let PropertyContextValueSelectionCardAppConnection = _PropertyContextValueSelectionCardAppConnection;
PropertyContextValueSelectionCardAppConnection.lastRefreshProperyPanelTimestamp = void 0;
PropertyContextValueSelectionCardAppConnection.propertiesCache = new Map();
CardDataService.RegisterAppConnection(new PropertyContextValueSelectionCardAppConnection());
 
export { PropertyContextValueSelectionCardAppConnection };