Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-shellbar): do not duplicate popover menu items #1456

Merged
merged 2 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/base/src/UI5Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,22 @@ class UI5Element extends HTMLElement {
throw new Error(`"${prop}" is not a valid property name. Use a name that does not collide with DOM APIs`);
}

if (propData.type === "boolean" && propData.defaultValue) {
if (propData.type === Boolean && propData.defaultValue) {
throw new Error(`Cannot set a default value for property "${prop}". All booleans are false by default.`);
}

if (propData.type === Array) {
throw new Error(`Wrong type for property "${prop}". Properties cannot be of type Array - use "multiple: true" and set "type" to the single value type, such as "String", "Object", etc...`);
}

if (propData.type === Object && propData.defaultValue) {
throw new Error(`Cannot set a default value for property "${prop}". All properties of type "Object" are empty objects by default.`);
}

if (propData.multiple && propData.defaultValue) {
throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
}

Object.defineProperty(proto, prop, {
get() {
if (this._state[prop] !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions packages/fiori/src/ShellBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ const metadata = {
},

_menuPopoverItems: {
type: Array,
defaultValue: [],
type: String,
multiple: true,
},
},
managedSlots: true,
Expand Down