Skip to content

Commit

Permalink
fix: updating doc files
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisfalaska committed Dec 19, 2024
1 parent a820f19 commit 1c81d9c
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 126 deletions.
126 changes: 63 additions & 63 deletions components/menu/demo/api.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,86 +621,86 @@ class AuroMenu extends r {
});
}

/**
* Method to apply `selected` attribute to `menuoption` via `value`.
* @private
* @param {String} value - Must match a unique `menuoption` value.
*/
selectByValue(value) {
let valueMatch = false;
if (!this.items) {
this.initItems();
}
/**
* Method to apply `selected` attribute to `menuoption` via `value`.
* @private
* @param {String} value - Must match a unique `menuoption` value.
*/
selectByValue(value) {
let valueMatch = false;
if (!this.items) {
this.initItems();
}

this.index = undefined;
this.index = undefined;

if (!this.multiSelect) {
if (this.value && this.value.length > 0) {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === value) {
valueMatch = true;
this.index = index;
if (!this.multiSelect) {
if (this.value && this.value.length > 0) {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === value) {
valueMatch = true;
this.index = index;
}
}
}

if (!valueMatch) {
// reset the menu to no selection
this.index = undefined;

// this event needs to be removed after select and combobox are updated to use the new standard name
this.dispatchEvent(new CustomEvent('auroMenuSelectValueFailure', {
bubbles: true,
cancelable: false,
composed: true,
}));
if (!valueMatch) {
// reset the menu to no selection
this.index = undefined;

// this event needs to be removed after select and combobox are updated to use the new standard name
this.dispatchEvent(new CustomEvent('auroMenuSelectValueFailure', {
bubbles: true,
cancelable: false,
composed: true,
}));

this.dispatchEvent(new CustomEvent('auroMenu-selectValueFailure', {
bubbles: true,
cancelable: false,
composed: true,
}));
} else {
this.makeSelection();
}
} else {
this.resetOptionsStates();

this.dispatchEvent(new CustomEvent('auroMenu-selectValueFailure', {
this.dispatchEvent(new CustomEvent('auroMenu-selectValueReset', {
bubbles: true,
cancelable: false,
composed: true,
}));
} else {
this.makeSelection();
}
} else {
this.resetOptionsStates();

this.dispatchEvent(new CustomEvent('auroMenu-selectValueReset', {
bubbles: true,
cancelable: false,
composed: true,
}));
}
} else {
// handle multiSelect array values
if (!this.value || typeof this.value !== 'string') {
return;
}
// handle multiSelect array values
if (!this.value || typeof this.value !== 'string') {
return;
}

const trimmedValue = this.value.trim();
if (!trimmedValue.startsWith('[') || !trimmedValue.endsWith(']')) {
return;
}
const trimmedValue = this.value.trim();
if (!trimmedValue.startsWith('[') || !trimmedValue.endsWith(']')) {
return;
}

try {
const values = JSON.parse(trimmedValue);
if (Array.isArray(values)) {
values.forEach((val) => {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === val) {
this.index = index;
this.makeSelection();
break;
try {
const values = JSON.parse(trimmedValue);
if (Array.isArray(values)) {
values.forEach((val) => {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === val) {
this.index = index;
this.makeSelection();
break;
}
}
}
});
});
}
} catch (error) {
/* eslint-disable no-console */
console.error('Failed to parse multiSelect values:', error);
}
} catch (error) {
/* eslint-disable no-console */
console.error('Failed to parse multiSelect values:', error);
}
}
}

/**
* Used to make the active state for options follow mouseover.
Expand Down
126 changes: 63 additions & 63 deletions components/menu/demo/index.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,86 +581,86 @@ class AuroMenu extends r {
});
}

/**
* Method to apply `selected` attribute to `menuoption` via `value`.
* @private
* @param {String} value - Must match a unique `menuoption` value.
*/
selectByValue(value) {
let valueMatch = false;
if (!this.items) {
this.initItems();
}
/**
* Method to apply `selected` attribute to `menuoption` via `value`.
* @private
* @param {String} value - Must match a unique `menuoption` value.
*/
selectByValue(value) {
let valueMatch = false;
if (!this.items) {
this.initItems();
}

this.index = undefined;
this.index = undefined;

if (!this.multiSelect) {
if (this.value && this.value.length > 0) {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === value) {
valueMatch = true;
this.index = index;
if (!this.multiSelect) {
if (this.value && this.value.length > 0) {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === value) {
valueMatch = true;
this.index = index;
}
}
}

if (!valueMatch) {
// reset the menu to no selection
this.index = undefined;

// this event needs to be removed after select and combobox are updated to use the new standard name
this.dispatchEvent(new CustomEvent('auroMenuSelectValueFailure', {
bubbles: true,
cancelable: false,
composed: true,
}));
if (!valueMatch) {
// reset the menu to no selection
this.index = undefined;

// this event needs to be removed after select and combobox are updated to use the new standard name
this.dispatchEvent(new CustomEvent('auroMenuSelectValueFailure', {
bubbles: true,
cancelable: false,
composed: true,
}));

this.dispatchEvent(new CustomEvent('auroMenu-selectValueFailure', {
bubbles: true,
cancelable: false,
composed: true,
}));
} else {
this.makeSelection();
}
} else {
this.resetOptionsStates();

this.dispatchEvent(new CustomEvent('auroMenu-selectValueFailure', {
this.dispatchEvent(new CustomEvent('auroMenu-selectValueReset', {
bubbles: true,
cancelable: false,
composed: true,
}));
} else {
this.makeSelection();
}
} else {
this.resetOptionsStates();

this.dispatchEvent(new CustomEvent('auroMenu-selectValueReset', {
bubbles: true,
cancelable: false,
composed: true,
}));
}
} else {
// handle multiSelect array values
if (!this.value || typeof this.value !== 'string') {
return;
}
// handle multiSelect array values
if (!this.value || typeof this.value !== 'string') {
return;
}

const trimmedValue = this.value.trim();
if (!trimmedValue.startsWith('[') || !trimmedValue.endsWith(']')) {
return;
}
const trimmedValue = this.value.trim();
if (!trimmedValue.startsWith('[') || !trimmedValue.endsWith(']')) {
return;
}

try {
const values = JSON.parse(trimmedValue);
if (Array.isArray(values)) {
values.forEach((val) => {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === val) {
this.index = index;
this.makeSelection();
break;
try {
const values = JSON.parse(trimmedValue);
if (Array.isArray(values)) {
values.forEach((val) => {
for (let index = 0; index < this.items.length; index += 1) {
if (this.items[index].value === val) {
this.index = index;
this.makeSelection();
break;
}
}
}
});
});
}
} catch (error) {
/* eslint-disable no-console */
console.error('Failed to parse multiSelect values:', error);
}
} catch (error) {
/* eslint-disable no-console */
console.error('Failed to parse multiSelect values:', error);
}
}
}

/**
* Used to make the active state for options follow mouseover.
Expand Down

0 comments on commit 1c81d9c

Please sign in to comment.