1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update polymer

This commit is contained in:
Luke Pulverenti 2015-09-14 21:17:19 -04:00
parent 571dd964e6
commit c526176a6a
23 changed files with 707 additions and 243 deletions

View file

@ -25,14 +25,14 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/polymerelements/iron-meta",
"homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
},
"_source": "git://github.com/polymerelements/iron-meta.git",
"_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta"
"_originalSource": "PolymerElements/iron-meta"
}

View file

@ -1,6 +1,6 @@
{
"name": "iron-selector",
"version": "1.0.2",
"version": "1.0.3",
"description": "Manages a set of elements that can be selected",
"private": true,
"license": "http://polymer.github.io/LICENSE.txt",
@ -19,21 +19,23 @@
"type": "git",
"url": "git://github.com/PolymerElements/iron-selector.git"
},
"homepage": "https://github.com/PolymerElements/iron-selector",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/iron-selector",
"_release": "1.0.2",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.2",
"commit": "ea22d91d11ba6f72c01faa952d5e600f9d1773cf"
"tag": "v1.0.3",
"commit": "d93b02871f790b6bcb1fff52f24757e9c2eb04a5"
},
"_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "iron-selector",
"version": "1.0.2",
"version": "1.0.3",
"description": "Manages a set of elements that can be selected",
"private": true,
"license": "http://polymer.github.io/LICENSE.txt",
@ -19,10 +19,13 @@
"type": "git",
"url": "git://github.com/PolymerElements/iron-selector.git"
},
"homepage": "https://github.com/PolymerElements/iron-selector",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",

View file

@ -17,50 +17,70 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../iron-selector.html">
<style>
<style is="custom-style">
iron-selector > * {
padding: 8px;
}
.horizontal-section {
padding: 0;
}
.iron-selected {
background-color: #ddd;
background-color: var(--google-blue-500);
color: white;
}
</style>
</head>
<body>
<body unresolved>
<h3>Basic</h3>
<div class="horizontal center-justified layout">
<div>
<h3>Basic</h3>
<div class="horizontal-section">
<iron-selector selected="0">
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
</div>
</div>
<iron-selector selected="0">
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
<div>
<h3>Multi-select</h3>
<div class="horizontal-section">
<iron-selector multi selected-values='[0,2]'>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
</div>
</div>
<h3>Multi-select</h3>
<iron-selector multi selected-values='[0,2]'>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
<h3>Example</h3>
<iron-selector selected="foo" attr-for-selected="name">
<div name="foo">Foo</div>
<div name="bar">Bar</div>
<div name="zot">Zot</div>
</iron-selector>
<div>
<h3>Example</h3>
<div class="horizontal-section">
<iron-selector selected="foo" attr-for-selected="name">
<div name="foo">Foo</div>
<div name="bar">Bar</div>
<div name="baz">Baz</div>
<div name="qux">Qux</div>
<div name="quux">Quux</div>
</iron-selector>
</div>
</div>
</div>
</body>
</html>

View file

@ -15,6 +15,27 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** @polymerBehavior */
Polymer.IronSelectableBehavior = {
/**
* Fired when iron-selector is activated (selected or deselected).
* It is fired before the selected items are changed.
* Cancel the event to abort selection.
*
* @event iron-activate
*
**/
/**
* Fired when an item is selected
*
* @event iron-select
*
**/
/**
* Fired when an item is deselected
*
* @event iron-deselect
*
**/
properties: {
/**
@ -68,7 +89,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
/**
* This is a CSS selector sting. If this is set, only items that matches the CSS selector
* This is a CSS selector string. If this is set, only items that match the CSS selector
* are selectable.
*
* @attribute selectable
@ -96,18 +117,30 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
selectedAttribute: {
type: String,
value: null
}
},
/**
* The set of excluded elements where the key is the `localName`
* of the element that will be ignored from the item list.
*
* @type {object}
* @default {template: 1}
*/
excludedLocalNames: {
type: Object,
value: function() {
return {
'template': 1
};
}
}
},
observers: [
'_updateSelected(attrForSelected, selected)'
],
excludedLocalNames: {
'template': 1
},
created: function() {
this._bindFilterItem = this._filterItem.bind(this);
this._selection = new Polymer.IronSelection(this._applySelection.bind(this));
@ -186,9 +219,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
_removeListener: function(eventName) {
// There is no unlisten yet...
// https://github.com/Polymer/polymer/issues/1639
//this.removeEventListener(eventName, this._bindActivateHandler);
this.unlisten(this, eventName, '_activateHandler');
},
_activateEventChanged: function(eventName, old) {
@ -277,11 +308,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
_activateHandler: function(e) {
// TODO: remove this when https://github.com/Polymer/polymer/issues/1639 is fixed so we
// can just remove the old event listener.
if (e.type !== this.activateEvent) {
return;
}
var t = e.target;
var items = this.items;
while (t && t != this) {

View file

@ -0,0 +1,90 @@
<!doctype html>
<!--
Copyright (c) 2015 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-selector-selected-attribute</title>
<meta charset="utf-8">
<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>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-selector.html">
</head>
<body>
<test-fixture id="test1">
<template>
<iron-selector>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<span>Item 3</span>
</iron-selector>
</template>
</test-fixture>
<test-fixture id="test2">
<template>
<iron-selector>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<p>Item 3</p>
</iron-selector>
</template>
</test-fixture>
<script>
suite('excluded local names', function() {
var test1, test2;
setup(function () {
test1 = fixture('test1');
test2 = fixture('test2');
});
test('default `excludedLocalNames`', function() {
assert.isTrue('template' in test1.excludedLocalNames);
assert.isTrue('template' in test2.excludedLocalNames);
});
test('custom `excludedLocalNames`', function() {
test1.excludedLocalNames.foo = 1;
assert.isTrue('foo' in test1.excludedLocalNames);
assert.isFalse('foo' in test2.excludedLocalNames);
});
test('items', function() {
test1.excludedLocalNames.span = 1;
test2.excludedLocalNames.div = 1;
var NOT_FOUND = -1;
var items1 = test1.items.map(function(el) { return el.localName; });
var items2 = test2.items.map(function(el) { return el.localName; });
assert.equal(items1.indexOf('span'), NOT_FOUND);
assert.equal(items2.indexOf('div'), NOT_FOUND);
});
});
</script>
</body>
</html>

View file

@ -27,7 +27,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'next-previous.html',
'selected-attribute.html',
'template-repeat.html',
'content.html'
'content.html',
'excluded-local-names.html'
]);
</script>

View file

@ -42,7 +42,7 @@
"tag": "v1.0.3",
"commit": "90b54de14264c19693601b9fc16af6b68a9d48e4"
},
"_source": "git://github.com/PolymerElements/paper-behaviors.git",
"_source": "git://github.com/polymerelements/paper-behaviors.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/paper-behaviors"
"_originalSource": "polymerelements/paper-behaviors"
}

View file

@ -1,6 +1,6 @@
{
"name": "paper-input",
"version": "1.0.13",
"version": "1.0.14",
"description": "Material design text fields",
"authors": [
"The Polymer Authors"
@ -36,7 +36,7 @@
},
"devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"web-component-tester": "*",
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-icon": "PolymerElements/iron-icon#^1.0.0",
@ -44,11 +44,11 @@
"iron-validator-behavior": "PolymerElements/iron-validator-behavior#^1.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0"
},
"_release": "1.0.13",
"_release": "1.0.14",
"_resolution": {
"type": "version",
"tag": "v1.0.13",
"commit": "3f3d09f47b77e33ea4a0c531a1b95567563528a0"
"tag": "v1.0.14",
"commit": "120a0610aca5c86194977e30f696b09716f93bbc"
},
"_source": "git://github.com/polymerelements/paper-input.git",
"_target": "^1.0.9",

View file

@ -1,6 +1,6 @@
{
"name": "paper-input",
"version": "1.0.13",
"version": "1.0.14",
"description": "Material design text fields",
"authors": [
"The Polymer Authors"
@ -36,7 +36,7 @@
},
"devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"web-component-tester": "*",
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-icon": "PolymerElements/iron-icon#^1.0.0",

View file

@ -25,6 +25,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
Polymer.PaperInputBehaviorImpl = {
properties: {
/**
* Fired when the input changes due to user interaction.
*
* @event change
*/
/**
* The label for this input. Bind this to `<paper-input-container>`'s `label` property.
@ -395,6 +400,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
label.id = labelledBy;
}
this._ariaLabelledBy = labelledBy;
},
_onChange:function(event) {
// In the Shadow DOM, the `change` event is not leaked into the
// ancestor tree, so we must do this manually.
// See https://w3c.github.io/webcomponents/spec/shadow/#events-that-are-not-leaked-into-ancestor-trees.
if (this.shadowRoot) {
this.fire(event.type, {sourceEvent: event}, {
node: this,
bubbles: event.bubbles,
cancelable: event.cancelable
});
}
}
};

View file

@ -105,7 +105,8 @@ style this element.
list$="[[list]]"
size$="[[size]]"
autocapitalize$="[[autocapitalize]]"
autocorrect$="[[autocorrect]]">
autocorrect$="[[autocorrect]]"
on-change="_onChange">
<content select="[suffix]"></content>

View file

@ -55,7 +55,8 @@ style this element.
maxlength$="[[maxlength]]"
autocapitalize$="[[autocapitalize]]"
rows$="[[rows]]"
max-rows$="[[maxRows]]"></iron-autogrow-textarea>
max-rows$="[[maxRows]]"
on-change="_onChange"></iron-autogrow-textarea>
<template is="dom-if" if="[[errorMessage]]">
<paper-input-error>[[errorMessage]]</paper-input-error>

View file

@ -1,6 +1,6 @@
{
"name": "paper-progress",
"version": "1.0.3",
"version": "1.0.4",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "A material design progress bar",
"authors": "The Polymer Authors",
@ -29,11 +29,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/paper-progress",
"_release": "1.0.3",
"_release": "1.0.4",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "a8ae3f94aa3727793d43396758a444a2e781e9a8"
"tag": "v1.0.4",
"commit": "3bef91b5f9479b8b85c4725b441acf8fb433e008"
},
"_source": "git://github.com/PolymerElements/paper-progress.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "paper-progress",
"version": "1.0.3",
"version": "1.0.4",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "A material design progress bar",
"authors": "The Polymer Authors",

View file

@ -10,8 +10,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-styles/paper-styles.html">
<link rel="import" href="../paper-styles/paper-styles-classes.html">
<link rel="import" href="../iron-range-behavior/iron-range-behavior.html">
<link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html">
<!--
The progress bars are for situations where the percentage completed can be
@ -60,14 +60,17 @@ the value changed. You can also customize the transition:
The following mixins are available for styling:
Custom property | Description | Default
--------------------------------------------|----------------------------------------|----------
--paper-progress-container-color | Mixin applied to container | --google-grey-300
--paper-progress-transition-duration | Duration of the transition | 0.008s
--paper-progress-transition-timing-function | The timing function for the transition | ease
--paper-progress-transition-delay | delay for the transition | 0s
--paper-progress-active-color | The color of the active bar | --google-green-500
--paper-progress-secondary-color | The color of the secondary bar | --google-green-100
Custom property | Description | Default
--------------------------------------------|---------------------------------------------|----------
--paper-progress-container-color | Mixin applied to container | --google-grey-300
--paper-progress-transition-duration | Duration of the transition | 0.008s
--paper-progress-transition-timing-function | The timing function for the transition | ease
--paper-progress-transition-delay | delay for the transition | 0s
--paper-progress-active-color | The color of the active bar | --google-green-500
--paper-progress-secondary-color | The color of the secondary bar | --google-green-100
--paper-progress-disabled-active-color | The color of the active bar if disabled | --google-grey-500
--paper-progress-disabled-secondary-color | The color of the secondary bar if disabled | --google-grey-300
--paper-progress-height | The height of the progress bar | 4px
@group Paper Elements
@element paper-progress
@ -80,21 +83,31 @@ Custom property | Description
:host {
display: block;
width: 200px;
height: 4px;
position: relative;
overflow: hidden;
}
:host,
#primaryProgress.indeterminate:after {
background-color: var(--paper-progress-container-color, --google-grey-300);
#progressContainer {
position: relative;
}
:host > *,
#primaryProgress.indeterminate:after {
#progressContainer,
/* the stripe for the indeterminate animation*/
.indeterminate:after {
height: var(--paper-progress-height, 4px);
}
#primaryProgress,
#secondaryProgress,
.indeterminate:after {
@apply(--layout-fit);
}
#progressContainer,
.indeterminate:after {
background-color: var(--paper-progress-container-color, --google-grey-300);
}
:host(.transiting) > * {
-webkit-transition-property: -webkit-transform;
transition-property: transform;
@ -114,10 +127,12 @@ Custom property | Description
#primaryProgress,
#secondaryProgress {
@apply(--layout-fit);
-webkit-transform-origin: left center;
transform-origin: left center;
-webkit-transform: scaleX(0);
transform: scaleX(0);
will-change: transform;
}
#primaryProgress {
@ -125,20 +140,27 @@ Custom property | Description
}
#secondaryProgress {
position: relative;
background-color: var(--paper-progress-secondary-color, --google-green-100);
}
#primaryProgress.indeterminate {
:host([disabled]) #primaryProgress {
background-color: var(--paper-progress-disabled-active-color, --google-grey-500);
}
:host([disabled]) #secondaryProgress {
background-color: var(--paper-progress-disabled-active-color, --google-grey-300);
}
:host(:not([disabled])) #primaryProgress.indeterminate {
-webkit-transform-origin: right center;
transform-origin: right center;
-webkit-animation: indeterminate-bar 2s linear infinite;
animation: indeterminate-bar 2s linear infinite;
}
#primaryProgress.indeterminate:after {
:host(:not([disabled])) #primaryProgress.indeterminate:after {
content: "";
width: 100%;
-webkit-transform-origin: center center;
transform-origin: center center;
@ -211,8 +233,10 @@ Custom property | Description
}
</style>
<template>
<div id="secondaryProgress" hidden$="[[!_hasSecondaryProgress(secondaryRatio)]]"></div>
<div id="primaryProgress"></div>
<div id="progressContainer">
<div id="secondaryProgress" hidden$="[[_hideSecondaryProgress(secondaryRatio)]]"></div>
<div id="primaryProgress"></div>
</div>
</template>
</dom-module>
@ -225,10 +249,6 @@ Custom property | Description
Polymer.IronRangeBehavior
],
hostAttributes: {
role: 'progressbar'
},
properties: {
/**
@ -253,15 +273,29 @@ Custom property | Description
*/
indeterminate: {
type: Boolean,
value: false
value: false,
observer: '_toggleIndeterminate'
},
/**
* True if the progress is disabled.
*/
disabled: {
type: Boolean,
value: false,
reflectToAttribute: true,
observer: '_disabledChanged'
}
},
observers: [
'_progressChanged(secondaryProgress, value, min, max)',
'_toggleIndeterminate(indeterminate)'
'_progressChanged(secondaryProgress, value, min, max)'
],
hostAttributes: {
role: 'progressbar'
},
_toggleIndeterminate: function(indeterminate) {
// If we use attribute/class binding, the animation sometimes doesn't translate properly
// on Safari 7.1. So instead, we toggle the class here in the update method.
@ -295,8 +329,12 @@ Custom property | Description
this.setAttribute('aria-valuemax', max);
},
_hasSecondaryProgress: function(secondaryRatio) {
return secondaryRatio > 0
_disabledChanged: function(disabled) {
this.$.progressContainer.setAttribute('aria-disabled', disabled ? 'true' : 'false');
},
_hideSecondaryProgress: function(secondaryRatio) {
return secondaryRatio === 0;
}
});

View file

@ -1,6 +1,6 @@
{
"name": "paper-slider",
"version": "1.0.5",
"version": "1.0.6",
"description": "A material design-style slider",
"license": "http://polymer.github.io/LICENSE.txt",
"authors": "The Polymer Authors",
@ -37,11 +37,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/paper-slider",
"_release": "1.0.5",
"_release": "1.0.6",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "8672cf9466fe8387f04ef5065ea83a4a18f8b06d"
"tag": "v1.0.6",
"commit": "4ae2e000dcbbfda4e12611f07c21fea3c0a9270d"
},
"_source": "git://github.com/PolymerElements/paper-slider.git",
"_target": "~1.0.3",

View file

@ -1,6 +1,6 @@
{
"name": "paper-slider",
"version": "1.0.5",
"version": "1.0.6",
"description": "A material design-style slider",
"license": "http://polymer.github.io/LICENSE.txt",
"authors": "The Polymer Authors",

View file

@ -64,7 +64,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<h4>Default</h4>
<div class="vertical-section">
<div>Oxygen</div>
<paper-slider value="21"></paper-slider><br><br>
<paper-slider value="21" id="test"></paper-slider><br><br>
<div>Argon</div>
<paper-slider value="1"></paper-slider><br><br>
<div>Hydrogen</div>
@ -111,6 +111,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
document.querySelector('#ratingsLabel').textContent = ratings.value;
});
test.addEventListener('value-changed', function(e) {
console.log(e);
});
</script>
</body>

View file

@ -17,24 +17,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
:host(:not([disabled])) #sliderBar {
--paper-progress-active-color: var(--paper-slider-active-color, --google-blue-700);
}
:host(:not([disabled])) #sliderBar {
--paper-progress-secondary-color: var(--paper-slider-secondary-color, --google-blue-300);
--paper-progress-disabled-active-color: var(--paper-slider-disabled-active-color, --google-grey-500);
--paper-progress-disabled-secondary-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
}
:host([disabled]) #sliderBar {
--paper-progress-active-color: var(--paper-slider-disabled-active-color, --google-grey-500);
}
:host([disabled]) #sliderBar {
--paper-progress-secondary-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
}
/* focus shows the ripple */
:host(:focus) {
outline: none;
}
@ -83,7 +72,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
padding: 8px 0;
margin: -8px 0;
background-color: var(--paper-slider-bar-color, transparent);
--paper-progress-height: 2px;
--paper-progress-height: var(--paper-slider-height, 2px);
}
.ring #sliderBar {
@ -234,7 +223,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
.slider-input {
--paper-input-container-input: {
text-align: center;
text-align: center;
};
}

View file

@ -52,6 +52,7 @@ Custom property | Description | Default
`--paper-slider-knob-start-color` | The fill color of the knob at the far left | `transparent`
`--paper-slider-knob-start-border-color` | The border color of the knob at the far left | `#c8c8c8`
`--paper-slider-pin-start-color` | The color of the pin at the far left | `#c8c8c8`
`--paper-slider-height` | Height of the progress bar | `2px`
@group Paper Elements
@element paper-slider
@ -69,7 +70,7 @@ Custom property | Description | Default
<div class="bar-container">
<paper-progress
class$="[[_getProgressClass(transiting)]]"
disabled$="[[disabled]]"
id="sliderBar"
aria-hidden="true"
min="[[min]]"
@ -103,7 +104,7 @@ Custom property | Description | Default
class="circle"
hidden$="[[!receivedFocusFromKeyboard]]">
</paper-ripple>
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
<div id="sliderKnobInner" value$="[[immediateValue]]"></div>
</div>
</div>
@ -180,7 +181,8 @@ Custom property | Description | Default
immediateValue: {
type: Number,
value: 0,
readOnly: true
readOnly: true,
notify: true
},
/**
@ -311,7 +313,6 @@ Custom property | Description | Default
_positionKnob: function(ratio) {
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
this._setPinValue(this.immediateValue);
this._setRatio(this._calcRatio(this.immediateValue));
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
@ -366,7 +367,6 @@ Custom property | Description | Default
// update knob's position
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
this._setPinValue(immediateValue);
},
_trackEnd: function() {
@ -443,23 +443,15 @@ Custom property | Description | Default
},
_getClassNames: function() {
var classes = {};
classes.disabled = this.disabled;
classes.pin = this.pin;
classes.snaps = this.snaps;
classes.ring = this.immediateValue <= this.min;
classes.expand = this.expand;
classes.dragging = this.dragging;
classes.transiting = this.transiting;
classes.editable = this.editable;
return this._mergeClasses(classes);
},
_getProgressClass: function() {
return this._mergeClasses({
transiting: this.transiting
disabled: this.disabled,
pin: this.pin,
snaps: this.snaps,
ring: this.immediateValue <= this.min,
expand: this.expand,
dragging: this.dragging,
transiting: this.transiting,
editable: this.editable
});
},
@ -479,9 +471,6 @@ Custom property | Description | Default
this.decrement();
}
this.fire('change');
},
_setPinValue: function (value) {
this.pinValue = value;
}
});

View file

@ -178,6 +178,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('value should notify', function(done) {
var targetValue = 10;
slider.addEventListener('value-changed', function(e) {
assert.equal(e.detail.value, targetValue);
done();
});
slider.min = 0;
slider.max = 100;
slider.value = targetValue;
});
test('immediateValue should notify', function(done) {
var targetValue = 50;
slider.addEventListener('immediate-value-changed', function(e) {
assert.equal(e.detail.value, targetValue);
assert.equal(slider.immediateValue, targetValue);
done();
});
var cursor = MockInteractions.topLeftOfNode(slider.$.sliderBar);
cursor.x += slider.$.sliderBar.getBoundingClientRect().width * targetValue/100;
slider.min = 0;
slider.max = 100;
MockInteractions.down(slider.$.sliderBar, cursor);
});
});
</script>