Neues Initialrelease mit IonicMaterial
This commit is contained in:
8
www/lib/angular-material/modules/js/switch/bower.json
Normal file
8
www/lib/angular-material/modules/js/switch/bower.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "angular-material-switch",
|
||||
"version": "0.10.0",
|
||||
"dependencies": {
|
||||
"angular-material-core": "0.10.0",
|
||||
"angular-material-checkbox": "0.10.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v0.10.0
|
||||
*/
|
||||
/* mixin definition ; sets LTR and RTL within the same style call */
|
||||
md-switch.md-THEME_NAME-theme .md-thumb {
|
||||
background-color: '{{background-50}}'; }
|
||||
md-switch.md-THEME_NAME-theme .md-bar {
|
||||
background-color: '{{background-500}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked .md-thumb {
|
||||
background-color: '{{accent-color}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked .md-bar {
|
||||
background-color: '{{accent-color-0.5}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked.md-focused .md-thumb:before {
|
||||
background-color: '{{accent-color-0.26}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked.md-primary .md-thumb {
|
||||
background-color: '{{primary-color}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked.md-primary .md-bar {
|
||||
background-color: '{{primary-color-0.5}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked.md-primary.md-focused .md-thumb:before {
|
||||
background-color: '{{primary-color-0.26}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked.md-warn .md-thumb {
|
||||
background-color: '{{warn-color}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked.md-warn .md-bar {
|
||||
background-color: '{{warn-color-0.5}}'; }
|
||||
md-switch.md-THEME_NAME-theme.md-checked.md-warn.md-focused .md-thumb:before {
|
||||
background-color: '{{warn-color-0.26}}'; }
|
||||
md-switch.md-THEME_NAME-theme[disabled] .md-thumb {
|
||||
background-color: '{{background-400}}'; }
|
||||
md-switch.md-THEME_NAME-theme[disabled] .md-bar {
|
||||
background-color: '{{foreground-4}}'; }
|
||||
6
www/lib/angular-material/modules/js/switch/switch-default-theme.min.css
vendored
Normal file
6
www/lib/angular-material/modules/js/switch/switch-default-theme.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v0.10.0
|
||||
*/md-switch.md-THEME_NAME-theme .md-thumb{background-color:'{{background-50}}'}md-switch.md-THEME_NAME-theme .md-bar{background-color:'{{background-500}}'}md-switch.md-THEME_NAME-theme.md-checked .md-thumb{background-color:'{{accent-color}}'}md-switch.md-THEME_NAME-theme.md-checked .md-bar{background-color:'{{accent-color-0.5}}'}md-switch.md-THEME_NAME-theme.md-checked.md-focused .md-thumb:before{background-color:'{{accent-color-0.26}}'}md-switch.md-THEME_NAME-theme.md-checked.md-primary .md-thumb{background-color:'{{primary-color}}'}md-switch.md-THEME_NAME-theme.md-checked.md-primary .md-bar{background-color:'{{primary-color-0.5}}'}md-switch.md-THEME_NAME-theme.md-checked.md-primary.md-focused .md-thumb:before{background-color:'{{primary-color-0.26}}'}md-switch.md-THEME_NAME-theme.md-checked.md-warn .md-thumb{background-color:'{{warn-color}}'}md-switch.md-THEME_NAME-theme.md-checked.md-warn .md-bar{background-color:'{{warn-color-0.5}}'}md-switch.md-THEME_NAME-theme.md-checked.md-warn.md-focused .md-thumb:before{background-color:'{{warn-color-0.26}}'}md-switch.md-THEME_NAME-theme[disabled] .md-thumb{background-color:'{{background-400}}'}md-switch.md-THEME_NAME-theme[disabled] .md-bar{background-color:'{{foreground-4}}'}
|
||||
110
www/lib/angular-material/modules/js/switch/switch.css
Normal file
110
www/lib/angular-material/modules/js/switch/switch.css
Normal file
@@ -0,0 +1,110 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v0.10.0
|
||||
*/
|
||||
/* mixin definition ; sets LTR and RTL within the same style call */
|
||||
md-switch {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-align-items: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
margin: 15px;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none; }
|
||||
md-switch .md-container {
|
||||
cursor: -webkit-grab;
|
||||
cursor: grab;
|
||||
width: 36px;
|
||||
height: 24px;
|
||||
position: relative;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
margin-right: 8px; }
|
||||
md-switch:not([disabled]) .md-dragging, md-switch:not([disabled]).md-dragging .md-container {
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: grabbing; }
|
||||
md-switch.md-focused:not([disabled]) .md-thumb:before {
|
||||
left: -8px;
|
||||
top: -8px;
|
||||
right: -8px;
|
||||
bottom: -8px; }
|
||||
md-switch.md-focused:not([disabled]):not(.md-checked) .md-thumb:before {
|
||||
background-color: rgba(0, 0, 0, 0.12); }
|
||||
md-switch .md-label {
|
||||
border-color: transparent;
|
||||
border-width: 0; }
|
||||
md-switch .md-bar {
|
||||
left: 1px;
|
||||
width: 34px;
|
||||
top: 5px;
|
||||
height: 14px;
|
||||
border-radius: 8px;
|
||||
position: absolute; }
|
||||
md-switch .md-thumb-container {
|
||||
top: 2px;
|
||||
left: 0;
|
||||
width: 16px;
|
||||
position: absolute;
|
||||
-webkit-transform: translate3d(0, 0, 0);
|
||||
transform: translate3d(0, 0, 0);
|
||||
z-index: 1; }
|
||||
md-switch.md-checked .md-thumb-container {
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0); }
|
||||
md-switch .md-thumb {
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
outline: none;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.14), 0px 2px 2px 0px rgba(0, 0, 0, 0.098), 0px 1px 5px 0px rgba(0, 0, 0, 0.084); }
|
||||
md-switch .md-thumb:before {
|
||||
background-color: transparent;
|
||||
border-radius: 50%;
|
||||
content: '';
|
||||
position: absolute;
|
||||
display: block;
|
||||
height: auto;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transition: all 0.5s;
|
||||
width: auto; }
|
||||
md-switch .md-thumb .md-ripple-container {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: auto;
|
||||
height: auto;
|
||||
left: -20px;
|
||||
top: -20px;
|
||||
right: -20px;
|
||||
bottom: -20px; }
|
||||
md-switch:not(.md-dragging) .md-bar, md-switch:not(.md-dragging) .md-thumb-container, md-switch:not(.md-dragging) .md-thumb {
|
||||
transition: all 0.5s cubic-bezier(0.35, 0, 0.25, 1);
|
||||
transition-property: -webkit-transform, background-color;
|
||||
transition-property: transform, background-color; }
|
||||
md-switch:not(.md-dragging) .md-bar, md-switch:not(.md-dragging) .md-thumb {
|
||||
transition-delay: 0.05s; }
|
||||
|
||||
@media screen and (-ms-high-contrast: active) {
|
||||
md-switch.md-default-theme .md-bar {
|
||||
background-color: #666; }
|
||||
md-switch.md-default-theme.md-checked .md-bar {
|
||||
background-color: #9E9E9E; }
|
||||
md-switch.md-default-theme .md-thumb {
|
||||
background-color: #fff; } }
|
||||
169
www/lib/angular-material/modules/js/switch/switch.js
vendored
Normal file
169
www/lib/angular-material/modules/js/switch/switch.js
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v0.10.0
|
||||
*/
|
||||
(function( window, angular, undefined ){
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @ngdoc module
|
||||
* @name material.components.switch
|
||||
*/
|
||||
|
||||
angular.module('material.components.switch', [
|
||||
'material.core',
|
||||
'material.components.checkbox'
|
||||
])
|
||||
.directive('mdSwitch', MdSwitch);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @ngdoc directive
|
||||
* @module material.components.switch
|
||||
* @name mdSwitch
|
||||
* @restrict E
|
||||
*
|
||||
* The switch directive is used very much like the normal [angular checkbox](https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D).
|
||||
*
|
||||
* As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
|
||||
* the switch is in the accent color by default. The primary color palette may be used with
|
||||
* the `md-primary` class.
|
||||
*
|
||||
* @param {string} ng-model Assignable angular expression to data-bind to.
|
||||
* @param {string=} name Property name of the form under which the control is published.
|
||||
* @param {expression=} ng-true-value The value to which the expression should be set when selected.
|
||||
* @param {expression=} ng-false-value The value to which the expression should be set when not selected.
|
||||
* @param {string=} ng-change Angular expression to be executed when input changes due to user interaction with the input element.
|
||||
* @param {boolean=} md-no-ink Use of attribute indicates use of ripple ink effects.
|
||||
* @param {string=} aria-label Publish the button label used by screen-readers for accessibility. Defaults to the switch's text.
|
||||
*
|
||||
* @usage
|
||||
* <hljs lang="html">
|
||||
* <md-switch ng-model="isActive" aria-label="Finished?">
|
||||
* Finished ?
|
||||
* </md-switch>
|
||||
*
|
||||
* <md-switch md-no-ink ng-model="hasInk" aria-label="No Ink Effects">
|
||||
* No Ink Effects
|
||||
* </md-switch>
|
||||
*
|
||||
* <md-switch ng-disabled="true" ng-model="isDisabled" aria-label="Disabled">
|
||||
* Disabled
|
||||
* </md-switch>
|
||||
*
|
||||
* </hljs>
|
||||
*/
|
||||
function MdSwitch(mdCheckboxDirective, $mdTheming, $mdUtil, $document, $mdConstant, $parse, $$rAF, $mdGesture) {
|
||||
var checkboxDirective = mdCheckboxDirective[0];
|
||||
|
||||
return {
|
||||
restrict: 'E',
|
||||
priority:210, // Run before ngAria
|
||||
transclude: true,
|
||||
template:
|
||||
'<div class="md-container">' +
|
||||
'<div class="md-bar"></div>' +
|
||||
'<div class="md-thumb-container">' +
|
||||
'<div class="md-thumb" md-ink-ripple md-ink-ripple-checkbox></div>' +
|
||||
'</div>'+
|
||||
'</div>' +
|
||||
'<div ng-transclude class="md-label">' +
|
||||
'</div>',
|
||||
require: '?ngModel',
|
||||
compile: compile
|
||||
};
|
||||
|
||||
function compile(element, attr) {
|
||||
var checkboxLink = checkboxDirective.compile(element, attr);
|
||||
// no transition on initial load
|
||||
element.addClass('md-dragging');
|
||||
|
||||
return function (scope, element, attr, ngModel) {
|
||||
ngModel = ngModel || $mdUtil.fakeNgModel();
|
||||
var disabledGetter = $parse(attr.ngDisabled);
|
||||
var thumbContainer = angular.element(element[0].querySelector('.md-thumb-container'));
|
||||
var switchContainer = angular.element(element[0].querySelector('.md-container'));
|
||||
|
||||
// no transition on initial load
|
||||
$$rAF(function() {
|
||||
element.removeClass('md-dragging');
|
||||
});
|
||||
|
||||
checkboxLink(scope, element, attr, ngModel);
|
||||
|
||||
if (angular.isDefined(attr.ngDisabled)) {
|
||||
scope.$watch(disabledGetter, function(isDisabled) {
|
||||
element.attr('tabindex', isDisabled ? -1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
// These events are triggered by setup drag
|
||||
$mdGesture.register(switchContainer, 'drag');
|
||||
switchContainer
|
||||
.on('$md.dragstart', onDragStart)
|
||||
.on('$md.drag', onDrag)
|
||||
.on('$md.dragend', onDragEnd);
|
||||
|
||||
var drag;
|
||||
function onDragStart(ev) {
|
||||
// Don't go if ng-disabled===true
|
||||
if (disabledGetter(scope)) return;
|
||||
ev.stopPropagation();
|
||||
|
||||
element.addClass('md-dragging');
|
||||
drag = {
|
||||
width: thumbContainer.prop('offsetWidth')
|
||||
};
|
||||
element.removeClass('transition');
|
||||
}
|
||||
|
||||
function onDrag(ev) {
|
||||
if (!drag) return;
|
||||
ev.stopPropagation();
|
||||
ev.srcEvent && ev.srcEvent.preventDefault();
|
||||
|
||||
var percent = ev.pointer.distanceX / drag.width;
|
||||
|
||||
//if checked, start from right. else, start from left
|
||||
var translate = ngModel.$viewValue ? 1 + percent : percent;
|
||||
// Make sure the switch stays inside its bounds, 0-1%
|
||||
translate = Math.max(0, Math.min(1, translate));
|
||||
|
||||
thumbContainer.css($mdConstant.CSS.TRANSFORM, 'translate3d(' + (100*translate) + '%,0,0)');
|
||||
drag.translate = translate;
|
||||
}
|
||||
|
||||
function onDragEnd(ev) {
|
||||
if (!drag) return;
|
||||
ev.stopPropagation();
|
||||
|
||||
element.removeClass('md-dragging');
|
||||
thumbContainer.css($mdConstant.CSS.TRANSFORM, '');
|
||||
|
||||
// We changed if there is no distance (this is a click a click),
|
||||
// or if the drag distance is >50% of the total.
|
||||
var isChanged = ngModel.$viewValue ? drag.translate < 0.5 : drag.translate > 0.5;
|
||||
if (isChanged) {
|
||||
applyModelValue(!ngModel.$viewValue);
|
||||
}
|
||||
drag = null;
|
||||
}
|
||||
|
||||
function applyModelValue(newValue) {
|
||||
scope.$apply(function() {
|
||||
ngModel.$setViewValue(newValue);
|
||||
ngModel.$render();
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
MdSwitch.$inject = ["mdCheckboxDirective", "$mdTheming", "$mdUtil", "$document", "$mdConstant", "$parse", "$$rAF", "$mdGesture"];
|
||||
|
||||
})(window, window.angular);
|
||||
6
www/lib/angular-material/modules/js/switch/switch.min.css
vendored
Normal file
6
www/lib/angular-material/modules/js/switch/switch.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v0.10.0
|
||||
*/md-switch{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;margin:15px;white-space:nowrap;cursor:pointer;outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}md-switch .md-container{cursor:-webkit-grab;cursor:grab;width:36px;height:24px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:8px}md-switch:not([disabled]) .md-dragging,md-switch:not([disabled]).md-dragging .md-container{cursor:-webkit-grabbing;cursor:grabbing}md-switch.md-focused:not([disabled]) .md-thumb:before{left:-8px;top:-8px;right:-8px;bottom:-8px}md-switch.md-focused:not([disabled]):not(.md-checked) .md-thumb:before{background-color:rgba(0,0,0,.12)}md-switch .md-label{border-color:transparent;border-width:0}md-switch .md-bar{left:1px;width:34px;top:5px;height:14px;border-radius:8px;position:absolute}md-switch .md-thumb-container{top:2px;left:0;width:16px;position:absolute;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);z-index:1}md-switch.md-checked .md-thumb-container{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}md-switch .md-thumb{position:absolute;margin:0;left:0;top:0;outline:0;height:20px;width:20px;border-radius:50%;box-shadow:0 3px 1px -2px rgba(0,0,0,.14),0 2px 2px 0 rgba(0,0,0,.098),0 1px 5px 0 rgba(0,0,0,.084)}md-switch .md-thumb:before{background-color:transparent;border-radius:50%;content:'';position:absolute;display:block;height:auto;left:0;top:0;right:0;bottom:0;transition:all .5s;width:auto}md-switch .md-thumb .md-ripple-container{position:absolute;display:block;width:auto;height:auto;left:-20px;top:-20px;right:-20px;bottom:-20px}md-switch:not(.md-dragging) .md-bar,md-switch:not(.md-dragging) .md-thumb,md-switch:not(.md-dragging) .md-thumb-container{transition:all .5s cubic-bezier(.35,0,.25,1);transition-property:-webkit-transform,background-color;transition-property:transform,background-color}md-switch:not(.md-dragging) .md-bar,md-switch:not(.md-dragging) .md-thumb{transition-delay:.05s}@media screen and (-ms-high-contrast:active){md-switch.md-default-theme .md-bar{background-color:#666}md-switch.md-default-theme.md-checked .md-bar{background-color:#9E9E9E}md-switch.md-default-theme .md-thumb{background-color:#fff}}
|
||||
7
www/lib/angular-material/modules/js/switch/switch.min.js
vendored
Normal file
7
www/lib/angular-material/modules/js/switch/switch.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v0.10.0
|
||||
*/
|
||||
!function(e,t,n){"use strict";function a(e,n,a,i,r,d,o,s){function c(e,n){var i=l.compile(e,n);return e.addClass("md-dragging"),function(e,n,c,l){function m(t){p(e)||(t.stopPropagation(),n.addClass("md-dragging"),h={width:$.prop("offsetWidth")},n.removeClass("transition"))}function u(e){if(h){e.stopPropagation(),e.srcEvent&&e.srcEvent.preventDefault();var t=e.pointer.distanceX/h.width,n=l.$viewValue?1+t:t;n=Math.max(0,Math.min(1,n)),$.css(r.CSS.TRANSFORM,"translate3d("+100*n+"%,0,0)"),h.translate=n}}function g(e){if(h){e.stopPropagation(),n.removeClass("md-dragging"),$.css(r.CSS.TRANSFORM,"");var t=l.$viewValue?h.translate<.5:h.translate>.5;t&&v(!l.$viewValue),h=null}}function v(t){e.$apply(function(){l.$setViewValue(t),l.$render()})}l=l||a.fakeNgModel();var p=d(c.ngDisabled),$=t.element(n[0].querySelector(".md-thumb-container")),f=t.element(n[0].querySelector(".md-container"));o(function(){n.removeClass("md-dragging")}),i(e,n,c,l),t.isDefined(c.ngDisabled)&&e.$watch(p,function(e){n.attr("tabindex",e?-1:0)}),s.register(f,"drag"),f.on("$md.dragstart",m).on("$md.drag",u).on("$md.dragend",g);var h}}var l=e[0];return{restrict:"E",priority:210,transclude:!0,template:'<div class="md-container"><div class="md-bar"></div><div class="md-thumb-container"><div class="md-thumb" md-ink-ripple md-ink-ripple-checkbox></div></div></div><div ng-transclude class="md-label"></div>',require:"?ngModel",compile:c}}t.module("material.components.switch",["material.core","material.components.checkbox"]).directive("mdSwitch",a),a.$inject=["mdCheckboxDirective","$mdTheming","$mdUtil","$document","$mdConstant","$parse","$$rAF","$mdGesture"]}(window,window.angular);
|
||||
Reference in New Issue
Block a user