@shoper/phoenix_design_system 1.18.12-2 → 1.18.12-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -354,20 +354,20 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
354
354
|
}
|
|
355
355
|
_setupMutationObserver() {
|
|
356
356
|
this._optionsMutationObserver = new MutationObserver((mutations) => {
|
|
357
|
+
let shouldUpdate = false;
|
|
357
358
|
let newlySelectedValue = null;
|
|
358
|
-
const
|
|
359
|
+
for (const mutation of mutations) {
|
|
359
360
|
const target = mutation.target;
|
|
360
361
|
if (mutation.type === 'attributes' &&
|
|
361
362
|
mutation.attributeName === 'selected' &&
|
|
362
363
|
target.tagName &&
|
|
363
364
|
target.tagName.toLowerCase() === 'h-option') {
|
|
365
|
+
shouldUpdate = true;
|
|
364
366
|
if (target.hasAttribute('selected')) {
|
|
365
367
|
newlySelectedValue = target.getAttribute('value');
|
|
366
368
|
}
|
|
367
|
-
return true;
|
|
368
369
|
}
|
|
369
|
-
|
|
370
|
-
});
|
|
370
|
+
}
|
|
371
371
|
if (shouldUpdate) {
|
|
372
372
|
const options = Array.from(this._$options.values()).map(($el) => select_option_mapper.SelectOptionMapper.toModel($el));
|
|
373
373
|
if (!this.multiple && newlySelectedValue !== null) {
|
|
@@ -378,7 +378,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
378
378
|
this._selectController.options$.notify(options);
|
|
379
379
|
let selectedOptions = options.filter((opt) => opt.selected);
|
|
380
380
|
if (selectedOptions.length === 0) {
|
|
381
|
-
const placeholder = options.find((opt) => opt.isPlaceholder
|
|
381
|
+
const placeholder = options.find((opt) => opt.isPlaceholder);
|
|
382
382
|
if (placeholder) {
|
|
383
383
|
placeholder.selected = true;
|
|
384
384
|
const $placeholderHtml = this._$options.get(placeholder.value);
|
|
@@ -350,20 +350,20 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
350
350
|
}
|
|
351
351
|
_setupMutationObserver() {
|
|
352
352
|
this._optionsMutationObserver = new MutationObserver((mutations) => {
|
|
353
|
+
let shouldUpdate = false;
|
|
353
354
|
let newlySelectedValue = null;
|
|
354
|
-
const
|
|
355
|
+
for (const mutation of mutations) {
|
|
355
356
|
const target = mutation.target;
|
|
356
357
|
if (mutation.type === 'attributes' &&
|
|
357
358
|
mutation.attributeName === 'selected' &&
|
|
358
359
|
target.tagName &&
|
|
359
360
|
target.tagName.toLowerCase() === 'h-option') {
|
|
361
|
+
shouldUpdate = true;
|
|
360
362
|
if (target.hasAttribute('selected')) {
|
|
361
363
|
newlySelectedValue = target.getAttribute('value');
|
|
362
364
|
}
|
|
363
|
-
return true;
|
|
364
365
|
}
|
|
365
|
-
|
|
366
|
-
});
|
|
366
|
+
}
|
|
367
367
|
if (shouldUpdate) {
|
|
368
368
|
const options = Array.from(this._$options.values()).map(($el) => SelectOptionMapper.toModel($el));
|
|
369
369
|
if (!this.multiple && newlySelectedValue !== null) {
|
|
@@ -374,7 +374,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
374
374
|
this._selectController.options$.notify(options);
|
|
375
375
|
let selectedOptions = options.filter((opt) => opt.selected);
|
|
376
376
|
if (selectedOptions.length === 0) {
|
|
377
|
-
const placeholder = options.find((opt) => opt.isPlaceholder
|
|
377
|
+
const placeholder = options.find((opt) => opt.isPlaceholder);
|
|
378
378
|
if (placeholder) {
|
|
379
379
|
placeholder.selected = true;
|
|
380
380
|
const $placeholderHtml = this._$options.get(placeholder.value);
|