-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: convert order views as LitTemplate
- Loading branch information
1 parent
b163902
commit ccbdd1e
Showing
8 changed files
with
607 additions
and
423 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,37 +1,38 @@ | ||
import '@polymer/polymer/polymer-element.js'; | ||
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js'; | ||
/** | ||
* Adds the scroll-shadow attribute if there is a `#main` element with scrollsize | ||
* larger than its height, and there is hidden content at the bottom. | ||
*/ | ||
/* @polymerMixin */ | ||
window.ScrollShadowMixin = subclass => class extends subclass { | ||
static get properties() { | ||
return { | ||
noScroll: { | ||
type: Boolean, | ||
reflectToAttribute: true | ||
}, | ||
_main: Element, | ||
_boundContentScroll: Function | ||
}; | ||
} | ||
export const ScrollShadowMixin = (subclass) => | ||
class extends subclass { | ||
static get properties() { | ||
return { | ||
noScroll: { | ||
type: Boolean, | ||
reflect: true, | ||
attribute: 'no-scroll', | ||
}, | ||
_main: { | ||
attribute: false, | ||
}, | ||
}; | ||
} | ||
|
||
firstUpdated() { | ||
super.firstUpdated(); | ||
|
||
this._main = this.shadowRoot.querySelector('#main'); | ||
|
||
ready() { | ||
super.ready(); | ||
afterNextRender(this, () => { | ||
this._main = this.root.querySelector('#main'); | ||
if (this._main) { | ||
this._main.addEventListener('scroll', this._contentScroll.bind(this)); | ||
this._main.addEventListener('scroll', () => this._contentScroll()); | ||
this._contentScroll(); | ||
} | ||
}); | ||
this._boundContentScroll = this._contentScroll.bind(this); | ||
} | ||
} | ||
|
||
_contentScroll() { | ||
if (this._main) { | ||
this.noScroll = this._main.scrollHeight - this._main.scrollTop == this._main.clientHeight; | ||
_contentScroll() { | ||
if (this._main) { | ||
this.noScroll = | ||
this._main.scrollHeight - this._main.scrollTop == | ||
this._main.clientHeight; | ||
} | ||
} | ||
} | ||
}; | ||
}; |
Oops, something went wrong.