Skip to content

Commit

Permalink
Add a new base element for Inputs that extends LitElement instead of …
Browse files Browse the repository at this point in the history
…Polymer
  • Loading branch information
rjcorwin committed Mar 15, 2022
1 parent 6c64e9c commit 7a7b0a5
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"dr-niels-sortable-list": "git://github.com/DrNiels/sortable-list.git#master",
"ethiopian-date": "0.0.6",
"image-blob-reduce": "^3.0.1",
"lit": "^2.2.0",
"lit-element": "^2.3.1",
"moment": "^2.24.0",
"redux": "^4.0.0",
Expand Down
26 changes: 26 additions & 0 deletions tangy-input-lit-base.js
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
}
}

}

0 comments on commit 7a7b0a5

Please sign in to comment.