-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new base element for Inputs that extends LitElement instead of …
…Polymer
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { LitElement } from 'lit'; | ||
|
||
export class TangyInputLitBase extends LitElement { | ||
|
||
connectedCallback() { | ||
super.connectedCallback() | ||
this._initialProps = super.getProps() | ||
} | ||
|
||
getModProps() { | ||
const initialProps = this._initialProps | ||
const currentProps = super.getProps() | ||
const modifiedProps = {} | ||
for (const key of Object.keys(currentProps)) { | ||
if (typeof currentProps[key] === 'object' || initialProps[key] !== currentProps[key]) { | ||
modifiedProps[key] = currentProps[key] | ||
} | ||
} | ||
return { | ||
name: this.getAttribute('name'), | ||
value: this.value, | ||
...modifiedProps | ||
} | ||
} | ||
|
||
} |