mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add iron-list
This commit is contained in:
parent
396b125d66
commit
da7c9a4899
47 changed files with 36356 additions and 0 deletions
40
dashboard-ui/bower_components/iron-scroll-target-behavior/.bower.json
vendored
Normal file
40
dashboard-ui/bower_components/iron-scroll-target-behavior/.bower.json
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "iron-scroll-target-behavior",
|
||||
"version": "1.0.6",
|
||||
"description": "Allows to define a scroller target",
|
||||
"private": true,
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"main": "iron-scroll-target-behavior.html",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"scroll"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/iron-scroll-target-behavior.git"
|
||||
},
|
||||
"homepage": "https://github.com/PolymerElements/iron-scroll-target-behavior",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.6",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.6",
|
||||
"commit": "33d5864e0557212eb530dbac280bfc4b4d923880"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-scroll-target-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-scroll-target-behavior"
|
||||
}
|
33
dashboard-ui/bower_components/iron-scroll-target-behavior/.github/ISSUE_TEMPLATE.md
vendored
Normal file
33
dashboard-ui/bower_components/iron-scroll-target-behavior/.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!-- Instructions: https://github.com/PolymerElements/iron-scroll-target-behavior/CONTRIBUTING.md#filing-issues -->
|
||||
### Description
|
||||
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
|
||||
|
||||
### Expected outcome
|
||||
|
||||
<!-- Example: The page stays the same color. -->
|
||||
|
||||
### Actual outcome
|
||||
|
||||
<!-- Example: The page turns pink. -->
|
||||
|
||||
### Live Demo
|
||||
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
<!-- Example
|
||||
1. Put a `paper-foo` element in the page.
|
||||
2. Open the page in a web browser.
|
||||
3. Click the `paper-foo` element.
|
||||
-->
|
||||
|
||||
### Browsers Affected
|
||||
<!-- Check all that apply -->
|
||||
- [ ] Chrome
|
||||
- [ ] Firefox
|
||||
- [ ] Safari 9
|
||||
- [ ] Safari 8
|
||||
- [ ] Safari 7
|
||||
- [ ] Edge
|
||||
- [ ] IE 11
|
||||
- [ ] IE 10
|
2
dashboard-ui/bower_components/iron-scroll-target-behavior/.gitignore
vendored
Normal file
2
dashboard-ui/bower_components/iron-scroll-target-behavior/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
bower_components
|
||||
|
24
dashboard-ui/bower_components/iron-scroll-target-behavior/.travis.yml
vendored
Normal file
24
dashboard-ui/bower_components/iron-scroll-target-behavior/.travis.yml
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
language: node_js
|
||||
node_js: stable
|
||||
addons:
|
||||
firefox: latest
|
||||
sauce_connect: true
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- google-chrome-stable
|
||||
- g++-4.8
|
||||
before_script:
|
||||
- npm install -g bower polylint web-component-tester
|
||||
- bower install
|
||||
- polylint
|
||||
script:
|
||||
- xvfb-run wct
|
||||
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct -s 'default'; fi
|
||||
env:
|
||||
global:
|
||||
- CXX=g++-4.8
|
||||
- secure: V9/FfFlrGgmgHI8icv3zjSn2bupGJs3FG2KlCqBwK5irWVU3Kcshl8XnXordLIfu2UF4Q/Aa4PkD2jKNuX/jSgGPpAfAi7aOruURSMZCzPErzKTQRg8iqHovhqDyJ2d5TypCRPCYDp+nO1ZQdPT5GQ1/8EZgilZFNVNTZ9twUJIYqPEcyQ7eAlxynDgjKxhMLa04UnUXzHVZ200x09gqGXByAK6tHvzf/W3BtjmjX7BZp0CWWk7tBgiH9gBsqwaYwHG7hg+hCVsnywN6G2WsUpPM4tBu3iyiVuNDuhY07MrV1uxEW9NCjyK8GUpHuCVN9A4CxeeDJM4xR8A3JUaVvWRwhES6KJ4YEdjfU6W759o2e05Sw3q3k4YQD96xiRz5YXYrnqLvm75trLY75pWqzIQkh+6g/C/ZBxRndh/n1VrV35GtAN+KEPE733PLvE8+yUWSiSAo052GyiYqt82joZv8+a1E38jg+bWRAYGuKcYxB5zS7xCEfkoztCuBT80yR+daQGyv0q61jmDrCUgl4B2m3xNf0+C08hYhR7KPHrMzIov3LTgJhHt6oonFs21Oa9cO8moMgaXP7Az8Y4c4Bg/BXaUe6lKkZ19kyzuDbF7hFKY0ABt1SwwkHZkEJ/Bk95CJigauFOuR3rq4TW4+M1DyqebvoyzjF4H1rHBY+lo=
|
||||
- secure: x0Lq3topCMeNImNyY7nKiVPUEaQHjmywaen23pqH5/slsYrmMEFUEME+2sigGDuSacmhfka7DZuXs7jZuk6DlZN5HoueW+xwF6MxnGJRibTw6yFj6g3MJ0dDD6wu3w9TVERNiWCJ5drnTH41QwvUjGMtBrJuHw6qaiCuuLzbwqCxkRynEjssOXzsYY4JlC3EgM2/BVZQ1H2lyWH+elmRXOGDADzm8BVGQkJWCj644HROvGc45j2cOP+vq5MvL1SEA4IDdRRYGOhcc9lGZUY/qOfsai2K0LzgIvMQbjAdt8kbcvz8cnCVJHreIJKQfNe7VAWFiXhNbbzGrYH4DGe52MRSM6c22oLWqzgctqF1YDYAPAoF+6Cj6HqzHmMyNAe4RkpAGnXw5V4HjX013BFYCdImMHF6Am8I2RW2q+buWWW9fZVFjKGD0woz3ay5W4jw6Z//V73J6p/jDiVgq0MT2S4Q8hCEh8QaqK69v9eS+Vxbh1KRUvFaBJvgDYfTnTQ4niuT/Y7TV0ZQ/DMAZ/kBfyMLAmyU5XWuGAnmg6uydE5JtHJHKYb+BKyZ++uImhyfM+bQkp6PxWRNxKsgNt8dcYn50/ppNnkHjXpoQxAlR5kjjiHsVmo4ZLOxkckjyr074Kb/nmDOqMxbRzdTlsBBqycJZjKtm4YX+GkrQXsEbg8=
|
77
dashboard-ui/bower_components/iron-scroll-target-behavior/CONTRIBUTING.md
vendored
Normal file
77
dashboard-ui/bower_components/iron-scroll-target-behavior/CONTRIBUTING.md
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
|
||||
<!--
|
||||
This file is autogenerated based on
|
||||
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
|
||||
|
||||
If you edit that file, it will get updated everywhere else.
|
||||
If you edit this file, your changes will get overridden :)
|
||||
|
||||
You can however override the jsbin link with one that's customized to this
|
||||
specific element:
|
||||
|
||||
jsbin=https://jsbin.com/cagaye/edit?html,output
|
||||
-->
|
||||
# Polymer Elements
|
||||
## Guide for Contributors
|
||||
|
||||
Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
|
||||
|
||||
### Filing Issues
|
||||
|
||||
**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
|
||||
|
||||
1. **Who will use the feature?** _“As someone filling out a form…”_
|
||||
2. **When will they use the feature?** _“When I enter an invalid value…”_
|
||||
3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_
|
||||
|
||||
**If you are filing an issue to report a bug**, please provide:
|
||||
|
||||
1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
|
||||
|
||||
```markdown
|
||||
The `paper-foo` element causes the page to turn pink when clicked.
|
||||
|
||||
## Expected outcome
|
||||
|
||||
The page stays the same color.
|
||||
|
||||
## Actual outcome
|
||||
|
||||
The page turns pink.
|
||||
|
||||
## Steps to reproduce
|
||||
|
||||
1. Put a `paper-foo` element in the page.
|
||||
2. Open the page in a web browser.
|
||||
3. Click the `paper-foo` element.
|
||||
```
|
||||
|
||||
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
|
||||
|
||||
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
|
||||
|
||||
### Submitting Pull Requests
|
||||
|
||||
**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
|
||||
|
||||
When submitting pull requests, please provide:
|
||||
|
||||
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
|
||||
|
||||
```markdown
|
||||
(For a single issue)
|
||||
Fixes #20
|
||||
|
||||
(For multiple issues)
|
||||
Fixes #32, fixes #40
|
||||
```
|
||||
|
||||
2. **A succinct description of the design** used to fix any related issues. For example:
|
||||
|
||||
```markdown
|
||||
This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
|
||||
```
|
||||
|
||||
3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
|
||||
|
||||
If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that!
|
31
dashboard-ui/bower_components/iron-scroll-target-behavior/bower.json
vendored
Normal file
31
dashboard-ui/bower_components/iron-scroll-target-behavior/bower.json
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "iron-scroll-target-behavior",
|
||||
"version": "1.0.6",
|
||||
"description": "Allows to define a scroller target",
|
||||
"private": true,
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"main": "iron-scroll-target-behavior.html",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"scroll"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/iron-scroll-target-behavior.git"
|
||||
},
|
||||
"homepage": "https://github.com/PolymerElements/iron-scroll-target-behavior",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
}
|
||||
}
|
39
dashboard-ui/bower_components/iron-scroll-target-behavior/demo/document.html
vendored
Normal file
39
dashboard-ui/bower_components/iron-scroll-target-behavior/demo/document.html
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<title>iron-scroll-target-behavior using the document scrolling</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../iron-scroll-target-behavior.html">
|
||||
<link rel="import" href="x-scrollable.html">
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<x-scrollable scroll-target="document"></x-scrollable>
|
||||
|
||||
</body>
|
||||
</html>
|
51
dashboard-ui/bower_components/iron-scroll-target-behavior/demo/scrolling-region.html
vendored
Normal file
51
dashboard-ui/bower_components/iron-scroll-target-behavior/demo/scrolling-region.html
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<title>iron-scroll-target-behavior using a scrolling region</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../iron-scroll-target-behavior.html">
|
||||
<link rel="import" href="x-scrollable.html">
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#region {
|
||||
height: 50vh;
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
top: 25vh;
|
||||
left: 25vh;
|
||||
right: 25vh;
|
||||
box-shadow: 0 0 60px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<div id="region">
|
||||
<x-scrollable scroll-target="region"></x-scrollable>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
105
dashboard-ui/bower_components/iron-scroll-target-behavior/demo/x-scrollable.html
vendored
Normal file
105
dashboard-ui/bower_components/iron-scroll-target-behavior/demo/x-scrollable.html
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-scroll-target-behavior.html">
|
||||
|
||||
<dom-module id="x-scrollable">
|
||||
|
||||
<style>
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
font: 14px arial;
|
||||
}
|
||||
|
||||
.scrollState {
|
||||
border-left: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
font-weight: bold;
|
||||
background-color: #eee;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: calc(50% - 100px);
|
||||
padding: 10px;
|
||||
width: 220px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.item {
|
||||
border-bottom: 1px solid #ccc;
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
width: 200%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
|
||||
<div class="scrollState">scrollTop: [[xScrollTop]] - scrollLeft: [[xScrollLeft]]</div>
|
||||
|
||||
<template is="dom-repeat" items="[[_getItems(itemCount)]]">
|
||||
<div class="item">[[index]]</div>
|
||||
</template>
|
||||
|
||||
</template>
|
||||
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
|
||||
is: 'x-scrollable',
|
||||
|
||||
properties: {
|
||||
|
||||
xScrollTop: {
|
||||
type: Number,
|
||||
readOnly: true,
|
||||
value: 0
|
||||
},
|
||||
|
||||
xScrollLeft: {
|
||||
type: Number,
|
||||
readOnly: true,
|
||||
value: 0
|
||||
},
|
||||
|
||||
itemCount: {
|
||||
type: Number,
|
||||
value: 200
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronScrollTargetBehavior
|
||||
],
|
||||
|
||||
attached: function() {
|
||||
this._scrollHandler();
|
||||
},
|
||||
|
||||
_scrollHandler: function() {
|
||||
this._setXScrollTop(this._scrollTop);
|
||||
this._setXScrollLeft(this._scrollLeft);
|
||||
},
|
||||
|
||||
_getItems: function(itemCount) {
|
||||
var items = new Array(itemCount);
|
||||
while (itemCount > 0) {
|
||||
items[--itemCount] = true;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
});
|
||||
</script>
|
28
dashboard-ui/bower_components/iron-scroll-target-behavior/index.html
vendored
Normal file
28
dashboard-ui/bower_components/iron-scroll-target-behavior/index.html
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<title>iron-scroll-target-behavior</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<link rel="import" href="../iron-component-page/iron-component-page.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iron-component-page></iron-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
234
dashboard-ui/bower_components/iron-scroll-target-behavior/iron-scroll-target-behavior.html
vendored
Normal file
234
dashboard-ui/bower_components/iron-scroll-target-behavior/iron-scroll-target-behavior.html
vendored
Normal file
|
@ -0,0 +1,234 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* `Polymer.IronScrollTargetBehavior` allows an element to respond to scroll events from a
|
||||
* designated scroll target.
|
||||
*
|
||||
* Elements that consume this behavior can override the `_scrollHandler`
|
||||
* method to add logic on the scroll event.
|
||||
*
|
||||
* @demo demo/scrolling-region.html Scrolling Region
|
||||
* @demo demo/document.html Document Element
|
||||
* @polymerBehavior
|
||||
*/
|
||||
Polymer.IronScrollTargetBehavior = {
|
||||
|
||||
properties: {
|
||||
|
||||
/**
|
||||
* Specifies the element that will handle the scroll event
|
||||
* on the behalf of the current element. This is typically a reference to an element,
|
||||
* but there are a few more posibilities:
|
||||
*
|
||||
* ### Elements id
|
||||
*
|
||||
*```html
|
||||
* <div id="scrollable-element" style="overflow: auto;">
|
||||
* <x-element scroll-target="scrollable-element">
|
||||
* <!-- Content-->
|
||||
* </x-element>
|
||||
* </div>
|
||||
*```
|
||||
* In this case, the `scrollTarget` will point to the outer div element.
|
||||
*
|
||||
* ### Document scrolling
|
||||
*
|
||||
* For document scrolling, you can use the reserved word `document`:
|
||||
*
|
||||
*```html
|
||||
* <x-element scroll-target="document">
|
||||
* <!-- Content -->
|
||||
* </x-element>
|
||||
*```
|
||||
*
|
||||
* ### Elements reference
|
||||
*
|
||||
*```js
|
||||
* appHeader.scrollTarget = document.querySelector('#scrollable-element');
|
||||
*```
|
||||
*
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
scrollTarget: {
|
||||
type: HTMLElement,
|
||||
value: function() {
|
||||
return this._defaultScrollTarget;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_scrollTargetChanged(scrollTarget, isAttached)'
|
||||
],
|
||||
|
||||
_scrollTargetChanged: function(scrollTarget, isAttached) {
|
||||
var eventTarget;
|
||||
|
||||
if (this._oldScrollTarget) {
|
||||
eventTarget = this._oldScrollTarget === this._doc ? window : this._oldScrollTarget;
|
||||
eventTarget.removeEventListener('scroll', this._boundScrollHandler);
|
||||
this._oldScrollTarget = null;
|
||||
}
|
||||
|
||||
if (!isAttached) {
|
||||
return;
|
||||
}
|
||||
// Support element id references
|
||||
if (scrollTarget === 'document') {
|
||||
|
||||
this.scrollTarget = this._doc;
|
||||
|
||||
} else if (typeof scrollTarget === 'string') {
|
||||
|
||||
this.scrollTarget = this.domHost ? this.domHost.$[scrollTarget] :
|
||||
Polymer.dom(this.ownerDocument).querySelector('#' + scrollTarget);
|
||||
|
||||
} else if (this._isValidScrollTarget()) {
|
||||
|
||||
eventTarget = scrollTarget === this._doc ? window : scrollTarget;
|
||||
this._boundScrollHandler = this._boundScrollHandler || this._scrollHandler.bind(this);
|
||||
this._oldScrollTarget = scrollTarget;
|
||||
|
||||
eventTarget.addEventListener('scroll', this._boundScrollHandler);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs on every scroll event. Consumer of this behavior may override this method.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
_scrollHandler: function scrollHandler() {},
|
||||
|
||||
/**
|
||||
* The default scroll target. Consumers of this behavior may want to customize
|
||||
* the default scroll target.
|
||||
*
|
||||
* @type {Element}
|
||||
*/
|
||||
get _defaultScrollTarget() {
|
||||
return this._doc;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shortcut for the document element
|
||||
*
|
||||
* @type {Element}
|
||||
*/
|
||||
get _doc() {
|
||||
return this.ownerDocument.documentElement;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the number of pixels that the content of an element is scrolled upward.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
get _scrollTop() {
|
||||
if (this._isValidScrollTarget()) {
|
||||
return this.scrollTarget === this._doc ? window.pageYOffset : this.scrollTarget.scrollTop;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the number of pixels that the content of an element is scrolled to the left.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
get _scrollLeft() {
|
||||
if (this._isValidScrollTarget()) {
|
||||
return this.scrollTarget === this._doc ? window.pageXOffset : this.scrollTarget.scrollLeft;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the number of pixels that the content of an element is scrolled upward.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
set _scrollTop(top) {
|
||||
if (this.scrollTarget === this._doc) {
|
||||
window.scrollTo(window.pageXOffset, top);
|
||||
} else if (this._isValidScrollTarget()) {
|
||||
this.scrollTarget.scrollTop = top;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the number of pixels that the content of an element is scrolled to the left.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
set _scrollLeft(left) {
|
||||
if (this.scrollTarget === this._doc) {
|
||||
window.scrollTo(left, window.pageYOffset);
|
||||
} else if (this._isValidScrollTarget()) {
|
||||
this.scrollTarget.scrollLeft = left;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Scrolls the content to a particular place.
|
||||
*
|
||||
* @method scroll
|
||||
* @param {number} left The left position
|
||||
* @param {number} top The top position
|
||||
*/
|
||||
scroll: function(left, top) {
|
||||
if (this.scrollTarget === this._doc) {
|
||||
window.scrollTo(left, top);
|
||||
} else if (this._isValidScrollTarget()) {
|
||||
this.scrollTarget.scrollLeft = left;
|
||||
this.scrollTarget.scrollTop = top;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the width of the scroll target.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
get _scrollTargetWidth() {
|
||||
if (this._isValidScrollTarget()) {
|
||||
return this.scrollTarget === this._doc ? window.innerWidth : this.scrollTarget.offsetWidth;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the height of the scroll target.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
get _scrollTargetHeight() {
|
||||
if (this._isValidScrollTarget()) {
|
||||
return this.scrollTarget === this._doc ? window.innerHeight : this.scrollTarget.offsetHeight;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the scroll target is a valid HTMLElement.
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
_isValidScrollTarget: function() {
|
||||
return this.scrollTarget instanceof HTMLElement;
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
298
dashboard-ui/bower_components/iron-scroll-target-behavior/test/basic.html
vendored
Normal file
298
dashboard-ui/bower_components/iron-scroll-target-behavior/test/basic.html
vendored
Normal file
|
@ -0,0 +1,298 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>iron-scroll-target-behavior test</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
<link rel="import" href="x-scrollable.html">
|
||||
<link rel="import" href="x-nested-scrollable.html">
|
||||
|
||||
<style>
|
||||
#temporaryScrollingRegion,
|
||||
#region {
|
||||
overflow: auto;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<test-fixture id="trivialScrollable">
|
||||
<template>
|
||||
<div id="temporaryScrollingRegion">
|
||||
<x-scrollable></x-scrollable>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="trivialScrollingRegion">
|
||||
<template>
|
||||
<div id="region">
|
||||
<x-scrollable scroll-target="region"></x-scrollable>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="trivialNestedScrollingRegion">
|
||||
<template>
|
||||
<x-nested-scrollable id="nestedScrollingRegion"></x-nested-scrollable>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
|
||||
<test-fixture id="trivialDocumentScroll">
|
||||
<template>
|
||||
<x-scrollable scroll-target="document"></x-scrollable>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
|
||||
suite('basic features', function() {
|
||||
var scrollingRegion, xScroll;
|
||||
|
||||
setup(function() {
|
||||
scrollingRegion = fixture('trivialScrollable');
|
||||
xScroll = Polymer.dom(scrollingRegion).querySelector('x-scrollable');
|
||||
});
|
||||
|
||||
test('default', function() {
|
||||
assert.equal(xScroll._scrollTop, 0, '_scrollTop');
|
||||
assert.equal(xScroll._scrollLeft, 0, '_scrollLeft');
|
||||
assert.equal(xScroll._scrollTargetWidth, 0, '_scrollTargetWidth');
|
||||
assert.equal(xScroll._scrollTargetHeight, 0, '_scrollTargetHeight');
|
||||
assert.equal(xScroll.scrollTarget, null, 'scrollTarget');
|
||||
assert.equal(xScroll._defaultScrollTarget, xScroll.scrollTarget, '_defaultScrollTarget');
|
||||
});
|
||||
|
||||
test('invalid `scrollTarget` selector', function(done) {
|
||||
flush(function() {
|
||||
xScroll.scrollTarget = 'invalid-id';
|
||||
assert.equal(xScroll.scrollTarget, null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('valid `scrollTarget` selector', function(done) {
|
||||
flush(function() {
|
||||
xScroll.scrollTarget = 'temporaryScrollingRegion';
|
||||
assert.equal(xScroll.scrollTarget, scrollingRegion);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
suite('scrolling region', function() {
|
||||
var scrollingRegion, xScrollable;
|
||||
|
||||
setup(function() {
|
||||
scrollingRegion = fixture('trivialScrollingRegion');
|
||||
xScrollable = Polymer.dom(scrollingRegion).querySelector('x-scrollable');
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
xScrollable._scrollTop = 0;
|
||||
xScrollable._scrollLeft = 0;
|
||||
});
|
||||
|
||||
test('scrollTarget reference', function(done) {
|
||||
flush(function() {
|
||||
assert.equal(xScrollable.scrollTarget, scrollingRegion);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('invalid scrollTarget', function(done) {
|
||||
flush(function() {
|
||||
assert.equal(xScrollable.scrollTarget, scrollingRegion);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('setters', function(done) {
|
||||
flush(function() {
|
||||
xScrollable._scrollTop = 100;
|
||||
xScrollable._scrollLeft = 100;
|
||||
|
||||
assert.equal(scrollingRegion.scrollTop, 100);
|
||||
assert.equal(scrollingRegion.scrollLeft, 100);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('getters', function(done) {
|
||||
flush(function() {
|
||||
scrollingRegion.scrollTop = 50;
|
||||
scrollingRegion.scrollLeft = 50;
|
||||
|
||||
assert.equal(xScrollable._scrollTop, 50, '_scrollTop');
|
||||
assert.equal(xScrollable._scrollLeft, 50, '_scrollLeft');
|
||||
assert.equal(xScrollable._scrollTargetWidth, scrollingRegion.offsetWidth, '_scrollTargetWidth');
|
||||
assert.equal(xScrollable._scrollTargetHeight, scrollingRegion.offsetHeight, '_scrollTargetHeight');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('scroll method', function(done) {
|
||||
flush(function() {
|
||||
xScrollable.scroll(110, 110);
|
||||
|
||||
assert.equal(xScrollable._scrollTop, 110);
|
||||
assert.equal(xScrollable._scrollLeft, 110);
|
||||
|
||||
xScrollable.scroll(0, 0);
|
||||
|
||||
assert.equal(xScrollable._scrollTop, 0);
|
||||
assert.equal(xScrollable._scrollLeft, 0);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
suite('document scroll', function() {
|
||||
var xScrollable;
|
||||
|
||||
setup(function() {
|
||||
xScrollable = fixture('trivialDocumentScroll');
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
xScrollable._scrollTop = 0;
|
||||
xScrollable._scrollLeft = 0;
|
||||
});
|
||||
|
||||
test('scrollTarget reference', function(done) {
|
||||
flush(function() {
|
||||
assert.equal(xScrollable.scrollTarget, document.documentElement);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('setters', function(done) {
|
||||
flush(function() {
|
||||
xScrollable._scrollTop = 100;
|
||||
xScrollable._scrollLeft = 100;
|
||||
|
||||
assert.equal(window.pageXOffset, 100);
|
||||
assert.equal(window.pageYOffset, 100);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('getters', function(done) {
|
||||
flush(function() {
|
||||
window.scrollTo(50, 50);
|
||||
|
||||
assert.equal(xScrollable._scrollTop, 50, '_scrollTop');
|
||||
assert.equal(xScrollable._scrollLeft, 50, '_scrollLeft');
|
||||
assert.equal(xScrollable._scrollTargetWidth, window.innerWidth, '_scrollTargetWidth');
|
||||
assert.equal(xScrollable._scrollTargetHeight, window.innerHeight, '_scrollTargetHeight');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('scroll method', function(done) {
|
||||
flush(function() {
|
||||
|
||||
xScrollable.scroll(1, 2);
|
||||
|
||||
assert.equal(xScrollable._scrollLeft, 1);
|
||||
assert.equal(xScrollable._scrollTop, 2);
|
||||
|
||||
xScrollable.scroll(3, 4);
|
||||
|
||||
assert.equal(xScrollable._scrollLeft, 3);
|
||||
assert.equal(xScrollable._scrollTop, 4);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
suite('nested scrolling region', function() {
|
||||
var xScrollingRegion;
|
||||
var xScrollable;
|
||||
|
||||
setup(function() {
|
||||
var nestedScrollingRegion = fixture('trivialNestedScrollingRegion');
|
||||
xScrollable = nestedScrollingRegion.$.xScrollable;
|
||||
xScrollingRegion = nestedScrollingRegion.$.xRegion;
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
xScrollable._scrollTop = 0;
|
||||
xScrollable._scrollLeft = 0;
|
||||
});
|
||||
|
||||
test('scrollTarget reference', function(done) {
|
||||
flush(function() {
|
||||
assert.equal(xScrollable.scrollTarget, xScrollingRegion);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('setters', function(done) {
|
||||
flush(function() {
|
||||
xScrollable._scrollTop = 10;
|
||||
xScrollable._scrollLeft = 20;
|
||||
|
||||
assert.equal(xScrollingRegion.scrollTop, 10);
|
||||
assert.equal(xScrollingRegion.scrollLeft, 20);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('getters', function(done) {
|
||||
flush(function() {
|
||||
xScrollable._scrollTop = 10;
|
||||
xScrollable._scrollLeft = 20;
|
||||
|
||||
assert.equal(xScrollable._scrollTop, 10, '_scrollTop');
|
||||
assert.equal(xScrollable._scrollLeft, 20, '_scrollLeft');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('scroll method', function(done) {
|
||||
flush(function() {
|
||||
|
||||
xScrollable.scroll(1, 2);
|
||||
|
||||
assert.equal(xScrollable._scrollLeft, 1);
|
||||
assert.equal(xScrollable._scrollTop, 2);
|
||||
|
||||
xScrollable.scroll(3, 4);
|
||||
|
||||
assert.equal(xScrollable._scrollLeft, 3);
|
||||
assert.equal(xScrollable._scrollTop, 4);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
32
dashboard-ui/bower_components/iron-scroll-target-behavior/test/index.html
vendored
Normal file
32
dashboard-ui/bower_components/iron-scroll-target-behavior/test/index.html
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Tests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
|
||||
WCT.loadSuites([
|
||||
'basic.html',
|
||||
'basic.html?dom=shadow'
|
||||
]);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
42
dashboard-ui/bower_components/iron-scroll-target-behavior/test/x-nested-scrollable.html
vendored
Normal file
42
dashboard-ui/bower_components/iron-scroll-target-behavior/test/x-nested-scrollable.html
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="x-scrollable.html">
|
||||
|
||||
<dom-module id="x-nested-scrollable">
|
||||
|
||||
<style>
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#xRegion {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div id="xRegion">
|
||||
<x-scrollable id="xScrollable" scroll-target="xRegion"></x-scrollable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'x-nested-scrollable'
|
||||
});
|
||||
</script>
|
68
dashboard-ui/bower_components/iron-scroll-target-behavior/test/x-scrollable.html
vendored
Normal file
68
dashboard-ui/bower_components/iron-scroll-target-behavior/test/x-scrollable.html
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-scroll-target-behavior.html">
|
||||
|
||||
<dom-module id="x-scrollable">
|
||||
|
||||
<style>
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
font: 14px arial;
|
||||
}
|
||||
|
||||
.item {
|
||||
border-bottom: 1px solid #ccc;
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
width: 200%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<template is="dom-repeat" items="[[_getItems(itemCount)]]">
|
||||
<div class="item">[[index]]</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
|
||||
is: 'x-scrollable',
|
||||
|
||||
properties: {
|
||||
|
||||
itemCount: {
|
||||
type: Number,
|
||||
value: 200
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronScrollTargetBehavior
|
||||
],
|
||||
|
||||
_defaultScrollTarget: null,
|
||||
|
||||
_getItems: function(itemCount) {
|
||||
var items = new Array(itemCount);
|
||||
while (itemCount > 0) {
|
||||
items[--itemCount] = true;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue