diff options
Diffstat (limited to 'vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select')
7 files changed, 2198 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/bower.json b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/bower.json new file mode 100644 index 00000000..ef55682a --- /dev/null +++ b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/bower.json @@ -0,0 +1,8 @@ +{ + "name": "angular-material-select", + "version": "1.1.2-master-a9ba340", + "dependencies": { + "angular-material-core": "1.1.2-master-a9ba340", + "angular-material-backdrop": "1.1.2-master-a9ba340" + } +}
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select-default-theme.css b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select-default-theme.css new file mode 100644 index 00000000..780ef770 --- /dev/null +++ b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select-default-theme.css @@ -0,0 +1,121 @@ +/*! + * Angular Material Design + * https://github.com/angular/material + * @license MIT + * v1.1.3 + */ +md-input-container md-select.md-THEME_NAME-theme .md-select-value span:first-child:after { + color: '{{warn-A700}}'; } + +md-input-container:not(.md-input-focused):not(.md-input-invalid) md-select.md-THEME_NAME-theme .md-select-value span:first-child:after { + color: '{{foreground-3}}'; } + +md-input-container.md-input-focused:not(.md-input-has-value) md-select.md-THEME_NAME-theme .md-select-value { + color: '{{primary-color}}'; } + md-input-container.md-input-focused:not(.md-input-has-value) md-select.md-THEME_NAME-theme .md-select-value.md-select-placeholder { + color: '{{primary-color}}'; } + +md-input-container.md-input-invalid md-select.md-THEME_NAME-theme .md-select-value { + color: '{{warn-A700}}' !important; + border-bottom-color: '{{warn-A700}}' !important; } + +md-input-container.md-input-invalid md-select.md-THEME_NAME-theme.md-no-underline .md-select-value { + border-bottom-color: transparent !important; } + +md-select.md-THEME_NAME-theme[disabled] .md-select-value { + border-bottom-color: transparent; + background-image: -webkit-linear-gradient(left, "{{foreground-3}}" 0%, "{{foreground-3}}" 33%, transparent 0%); + background-image: linear-gradient(to right, "{{foreground-3}}" 0%, "{{foreground-3}}" 33%, transparent 0%); + background-image: -ms-linear-gradient(left, transparent 0%, "{{foreground-3}}" 100%); } + +md-select.md-THEME_NAME-theme .md-select-value { + border-bottom-color: '{{foreground-4}}'; } + md-select.md-THEME_NAME-theme .md-select-value.md-select-placeholder { + color: '{{foreground-3}}'; } + md-select.md-THEME_NAME-theme .md-select-value span:first-child:after { + color: '{{warn-A700}}'; } + +md-select.md-THEME_NAME-theme.md-no-underline .md-select-value { + border-bottom-color: transparent !important; } + +md-select.md-THEME_NAME-theme.ng-invalid.ng-touched .md-select-value { + color: '{{warn-A700}}' !important; + border-bottom-color: '{{warn-A700}}' !important; } + +md-select.md-THEME_NAME-theme.ng-invalid.ng-touched.md-no-underline .md-select-value { + border-bottom-color: transparent !important; } + +md-select.md-THEME_NAME-theme:not([disabled]):focus .md-select-value { + border-bottom-color: '{{primary-color}}'; + color: '{{ foreground-1 }}'; } + md-select.md-THEME_NAME-theme:not([disabled]):focus .md-select-value.md-select-placeholder { + color: '{{ foreground-1 }}'; } + +md-select.md-THEME_NAME-theme:not([disabled]):focus.md-no-underline .md-select-value { + border-bottom-color: transparent !important; } + +md-select.md-THEME_NAME-theme:not([disabled]):focus.md-accent .md-select-value { + border-bottom-color: '{{accent-color}}'; } + +md-select.md-THEME_NAME-theme:not([disabled]):focus.md-warn .md-select-value { + border-bottom-color: '{{warn-color}}'; } + +md-select.md-THEME_NAME-theme[disabled] .md-select-value { + color: '{{foreground-3}}'; } + md-select.md-THEME_NAME-theme[disabled] .md-select-value.md-select-placeholder { + color: '{{foreground-3}}'; } + +md-select.md-THEME_NAME-theme[disabled] .md-select-icon { + color: '{{foreground-3}}'; } + +md-select.md-THEME_NAME-theme .md-select-icon { + color: '{{foreground-2}}'; } + +md-select-menu.md-THEME_NAME-theme md-content { + background: '{{background-A100}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-optgroup { + color: '{{background-600-0.87}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-option { + color: '{{background-900-0.87}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-option[disabled] .md-text { + color: '{{background-400-0.87}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-option:not([disabled]):focus, md-select-menu.md-THEME_NAME-theme md-content md-option:not([disabled]):hover { + background: '{{background-200}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-option[selected] { + color: '{{primary-500}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-option[selected]:focus { + color: '{{primary-600}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-option[selected].md-accent { + color: '{{accent-color}}'; } + md-select-menu.md-THEME_NAME-theme md-content md-option[selected].md-accent:focus { + color: '{{accent-A700}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme .md-ripple { + color: '{{primary-600}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-ripple { + color: '{{background-600}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme .md-ink-ripple { + color: '{{foreground-2}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-ink-ripple { + color: '{{primary-color-0.87}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme:not(.md-checked) .md-icon { + border-color: '{{foreground-2}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-icon { + background-color: '{{primary-color-0.87}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme[selected].md-focused .md-container:before { + background-color: '{{primary-color-0.26}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-icon:after { + border-color: '{{primary-contrast-0.87}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme .md-indeterminate[disabled] .md-container { + color: '{{foreground-3}}'; } + +.md-checkbox-enabled.md-THEME_NAME-theme md-option .md-text { + color: '{{background-900-0.87}}'; } diff --git a/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select-default-theme.min.css b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select-default-theme.min.css new file mode 100644 index 00000000..b9fd2682 --- /dev/null +++ b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select-default-theme.min.css @@ -0,0 +1,6 @@ +/*! + * Angular Material Design + * https://github.com/angular/material + * @license MIT + * v1.1.2-master-a9ba340 + */md-input-container md-select.md-THEME_NAME-theme .md-select-value span:first-child:after{color:"{{warn-A700}}"}md-input-container:not(.md-input-focused):not(.md-input-invalid) md-select.md-THEME_NAME-theme .md-select-value span:first-child:after{color:"{{foreground-3}}"}md-input-container.md-input-focused:not(.md-input-has-value) md-select.md-THEME_NAME-theme .md-select-value,md-input-container.md-input-focused:not(.md-input-has-value) md-select.md-THEME_NAME-theme .md-select-value.md-select-placeholder{color:"{{primary-color}}"}md-input-container.md-input-invalid md-select.md-THEME_NAME-theme .md-select-value{color:"{{warn-A700}}"!important;border-bottom-color:"{{warn-A700}}"!important}md-input-container.md-input-invalid md-select.md-THEME_NAME-theme.md-no-underline .md-select-value{border-bottom-color:transparent!important}md-select.md-THEME_NAME-theme[disabled] .md-select-value{border-bottom-color:transparent;background-image:-webkit-linear-gradient(left,"{{foreground-3}}","{{foreground-3}}" 33%,transparent 0);background-image:linear-gradient(90deg,"{{foreground-3}}" 0,"{{foreground-3}}" 33%,transparent 0);background-image:-ms-linear-gradient(left,transparent 0,"{{foreground-3}}" 100%)}md-select.md-THEME_NAME-theme .md-select-value{border-bottom-color:"{{foreground-4}}"}md-select.md-THEME_NAME-theme .md-select-value.md-select-placeholder{color:"{{foreground-3}}"}md-select.md-THEME_NAME-theme .md-select-value span:first-child:after{color:"{{warn-A700}}"}md-select.md-THEME_NAME-theme.md-no-underline .md-select-value{border-bottom-color:transparent!important}md-select.md-THEME_NAME-theme.ng-invalid.ng-touched .md-select-value{color:"{{warn-A700}}"!important;border-bottom-color:"{{warn-A700}}"!important}md-select.md-THEME_NAME-theme.ng-invalid.ng-touched.md-no-underline .md-select-value{border-bottom-color:transparent!important}md-select.md-THEME_NAME-theme:not([disabled]):focus .md-select-value{border-bottom-color:"{{primary-color}}";color:"{{ foreground-1 }}"}md-select.md-THEME_NAME-theme:not([disabled]):focus .md-select-value.md-select-placeholder{color:"{{ foreground-1 }}"}md-select.md-THEME_NAME-theme:not([disabled]):focus.md-no-underline .md-select-value{border-bottom-color:transparent!important}md-select.md-THEME_NAME-theme:not([disabled]):focus.md-accent .md-select-value{border-bottom-color:"{{accent-color}}"}md-select.md-THEME_NAME-theme:not([disabled]):focus.md-warn .md-select-value{border-bottom-color:"{{warn-color}}"}md-select.md-THEME_NAME-theme[disabled] .md-select-icon,md-select.md-THEME_NAME-theme[disabled] .md-select-value,md-select.md-THEME_NAME-theme[disabled] .md-select-value.md-select-placeholder{color:"{{foreground-3}}"}md-select.md-THEME_NAME-theme .md-select-icon{color:"{{foreground-2}}"}md-select-menu.md-THEME_NAME-theme md-content{background:"{{background-A100}}"}md-select-menu.md-THEME_NAME-theme md-content md-optgroup{color:"{{background-600-0.87}}"}md-select-menu.md-THEME_NAME-theme md-content md-option{color:"{{background-900-0.87}}"}md-select-menu.md-THEME_NAME-theme md-content md-option[disabled] .md-text{color:"{{background-400-0.87}}"}md-select-menu.md-THEME_NAME-theme md-content md-option:not([disabled]):focus,md-select-menu.md-THEME_NAME-theme md-content md-option:not([disabled]):hover{background:"{{background-200}}"}md-select-menu.md-THEME_NAME-theme md-content md-option[selected]{color:"{{primary-500}}"}md-select-menu.md-THEME_NAME-theme md-content md-option[selected]:focus{color:"{{primary-600}}"}md-select-menu.md-THEME_NAME-theme md-content md-option[selected].md-accent{color:"{{accent-color}}"}md-select-menu.md-THEME_NAME-theme md-content md-option[selected].md-accent:focus{color:"{{accent-A700}}"}.md-checkbox-enabled.md-THEME_NAME-theme .md-ripple{color:"{{primary-600}}"}.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-ripple{color:"{{background-600}}"}.md-checkbox-enabled.md-THEME_NAME-theme .md-ink-ripple{color:"{{foreground-2}}"}.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-ink-ripple{color:"{{primary-color-0.87}}"}.md-checkbox-enabled.md-THEME_NAME-theme:not(.md-checked) .md-icon{border-color:"{{foreground-2}}"}.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-icon{background-color:"{{primary-color-0.87}}"}.md-checkbox-enabled.md-THEME_NAME-theme[selected].md-focused .md-container:before{background-color:"{{primary-color-0.26}}"}.md-checkbox-enabled.md-THEME_NAME-theme[selected] .md-icon:after{border-color:"{{primary-contrast-0.87}}"}.md-checkbox-enabled.md-THEME_NAME-theme .md-indeterminate[disabled] .md-container{color:"{{foreground-3}}"}.md-checkbox-enabled.md-THEME_NAME-theme md-option .md-text{color:"{{background-900-0.87}}"}
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.css b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.css new file mode 100644 index 00000000..0f3440d0 --- /dev/null +++ b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.css @@ -0,0 +1,356 @@ +/*! + * Angular Material Design + * https://github.com/angular/material + * @license MIT + * v1.1.3 + */ +md-input-container:not([md-no-float]) .md-select-placeholder span:first-child { + -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); + transition: -webkit-transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); + transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); + transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), -webkit-transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); + -webkit-transform-origin: left top; + transform-origin: left top; } + [dir=rtl] md-input-container:not([md-no-float]) .md-select-placeholder span:first-child { + -webkit-transform-origin: right top; + transform-origin: right top; } + +md-input-container.md-input-focused:not([md-no-float]) .md-select-placeholder span:first-child { + -webkit-transform: translateY(-22px) translateX(-2px) scale(0.75); + transform: translateY(-22px) translateX(-2px) scale(0.75); } + +.md-select-menu-container { + position: fixed; + left: 0; + top: 0; + z-index: 90; + opacity: 0; + display: none; + -webkit-transform: translateY(-1px); + transform: translateY(-1px); } + .md-select-menu-container:not(.md-clickable) { + pointer-events: none; } + .md-select-menu-container md-progress-circular { + display: table; + margin: 24px auto !important; } + .md-select-menu-container.md-active { + display: block; + opacity: 1; } + .md-select-menu-container.md-active md-select-menu { + -webkit-transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); + transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); + -webkit-transition-duration: 150ms; + transition-duration: 150ms; } + .md-select-menu-container.md-active md-select-menu > * { + opacity: 1; + -webkit-transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2); + transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2); + -webkit-transition-duration: 150ms; + transition-duration: 150ms; + -webkit-transition-delay: 100ms; + transition-delay: 100ms; } + .md-select-menu-container.md-leave { + opacity: 0; + -webkit-transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2); + transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2); + -webkit-transition-duration: 250ms; + transition-duration: 250ms; } + +md-input-container > md-select { + margin: 0; + -webkit-box-ordinal-group: 3; + -webkit-order: 2; + order: 2; } + +md-input-container:not(.md-input-has-value) md-select[required]:not(.md-no-asterisk) .md-select-value span:first-child:after, md-input-container:not(.md-input-has-value) md-select.ng-required:not(.md-no-asterisk) .md-select-value span:first-child:after { + content: ' *'; + font-size: 13px; + vertical-align: top; } + +md-input-container.md-input-invalid md-select .md-select-value { + border-bottom-style: solid; + padding-bottom: 1px; } + +md-select { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 20px 0 26px 0; } + md-select[required].ng-invalid:not(.md-no-asterisk) .md-select-value span:first-child:after, md-select.ng-required.ng-invalid:not(.md-no-asterisk) .md-select-value span:first-child:after { + content: ' *'; + font-size: 13px; + vertical-align: top; } + md-select[disabled] .md-select-value { + background-position: 0 bottom; + background-size: 4px 1px; + background-repeat: repeat-x; + margin-bottom: -1px; } + md-select:focus { + outline: none; } + md-select[disabled]:hover { + cursor: default; } + md-select:not([disabled]):hover { + cursor: pointer; } + md-select:not([disabled]).ng-invalid.ng-touched .md-select-value { + border-bottom-style: solid; + padding-bottom: 1px; } + md-select:not([disabled]):focus .md-select-value { + border-bottom-width: 2px; + border-bottom-style: solid; + padding-bottom: 0; } + md-select:not([disabled]):focus.ng-invalid.ng-touched .md-select-value { + padding-bottom: 0; } + +md-input-container.md-input-has-value .md-select-value > span:not(.md-select-icon) { + -webkit-transform: translate3d(0, 1px, 0); + transform: translate3d(0, 1px, 0); } + +.md-select-value { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + padding: 2px 2px 1px; + border-bottom-width: 1px; + border-bottom-style: solid; + background-color: transparent; + position: relative; + box-sizing: content-box; + min-width: 64px; + min-height: 26px; + -webkit-box-flex: 1; + -webkit-flex-grow: 1; + flex-grow: 1; } + .md-select-value > span:not(.md-select-icon) { + max-width: 100%; + -webkit-box-flex: 1; + -webkit-flex: 1 1 auto; + flex: 1 1 auto; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } + .md-select-value > span:not(.md-select-icon) .md-text { + display: inline; } + .md-select-value .md-select-icon { + display: block; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; + text-align: end; + width: 24px; + margin: 0 4px; + -webkit-transform: translate3d(0, -2px, 0); + transform: translate3d(0, -2px, 0); + font-size: 1.2rem; } + .md-select-value .md-select-icon:after { + display: block; + content: '\25BC'; + position: relative; + top: 2px; + speak: none; + font-size: 13px; + -webkit-transform: scaleY(0.5) scaleX(1); + transform: scaleY(0.5) scaleX(1); } + .md-select-value.md-select-placeholder { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-ordinal-group: 2; + -webkit-order: 1; + order: 1; + pointer-events: none; + -webkit-font-smoothing: antialiased; + padding-left: 2px; + z-index: 1; } + +md-select-menu { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 2px 1px -1px rgba(0, 0, 0, 0.12); + max-height: 256px; + min-height: 48px; + overflow-y: hidden; + -webkit-transform-origin: left top; + transform-origin: left top; + -webkit-transform: scale(1); + transform: scale(1); } + md-select-menu.md-reverse { + -webkit-box-orient: vertical; + -webkit-box-direction: reverse; + -webkit-flex-direction: column-reverse; + flex-direction: column-reverse; } + md-select-menu:not(.md-overflow) md-content { + padding-top: 8px; + padding-bottom: 8px; } + [dir=rtl] md-select-menu { + -webkit-transform-origin: right top; + transform-origin: right top; } + md-select-menu md-content { + min-width: 136px; + min-height: 48px; + max-height: 256px; + overflow-y: auto; } + md-select-menu > * { + opacity: 0; } + +md-option { + cursor: pointer; + position: relative; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + width: auto; + -webkit-transition: background 0.15s linear; + transition: background 0.15s linear; + padding: 0 16px 0 16px; + height: 48px; } + md-option[disabled] { + cursor: default; } + md-option:focus { + outline: none; } + md-option .md-text { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + width: auto; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } + +md-optgroup { + display: block; } + md-optgroup label { + display: block; + font-size: 14px; + text-transform: uppercase; + padding: 16px; + font-weight: 500; } + md-optgroup md-option { + padding-left: 32px; + padding-right: 32px; } + +@media screen and (-ms-high-contrast: active) { + .md-select-backdrop { + background-color: transparent; } + md-select-menu { + border: 1px solid #fff; } } + +md-select-menu[multiple] md-option.md-checkbox-enabled { + padding-left: 40px; + padding-right: 16px; } + [dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled { + padding-left: 16px; } + [dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled { + padding-right: 40px; } + md-select-menu[multiple] md-option.md-checkbox-enabled .md-container { + position: absolute; + top: 50%; + -webkit-transform: translateY(-50%); + transform: translateY(-50%); + box-sizing: border-box; + display: inline-block; + width: 20px; + height: 20px; + left: 0; + right: auto; } + [dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled .md-container { + left: auto; } + [dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled .md-container { + right: 0; } + md-select-menu[multiple] md-option.md-checkbox-enabled .md-container:before { + box-sizing: border-box; + background-color: transparent; + border-radius: 50%; + content: ''; + position: absolute; + display: block; + height: auto; + left: 0; + top: 0; + right: 0; + bottom: 0; + -webkit-transition: all 0.5s; + transition: all 0.5s; + width: auto; } + md-select-menu[multiple] md-option.md-checkbox-enabled .md-container:after { + box-sizing: border-box; + content: ''; + position: absolute; + top: -10px; + right: -10px; + bottom: -10px; + left: -10px; } + md-select-menu[multiple] md-option.md-checkbox-enabled .md-container .md-ripple-container { + position: absolute; + display: block; + width: auto; + height: auto; + left: -15px; + top: -15px; + right: -15px; + bottom: -15px; } + md-select-menu[multiple] md-option.md-checkbox-enabled .md-icon { + box-sizing: border-box; + -webkit-transition: 240ms; + transition: 240ms; + position: absolute; + top: 0; + left: 0; + width: 20px; + height: 20px; + border-width: 2px; + border-style: solid; + border-radius: 2px; } + md-select-menu[multiple] md-option.md-checkbox-enabled[selected] .md-icon { + border-color: transparent; } + md-select-menu[multiple] md-option.md-checkbox-enabled[selected] .md-icon:after { + box-sizing: border-box; + -webkit-transform: rotate(45deg); + transform: rotate(45deg); + position: absolute; + left: 4.66667px; + top: 0.22222px; + display: table; + width: 6.66667px; + height: 13.33333px; + border-width: 2px; + border-style: solid; + border-top: 0; + border-left: 0; + content: ''; } + md-select-menu[multiple] md-option.md-checkbox-enabled[disabled] { + cursor: default; } + md-select-menu[multiple] md-option.md-checkbox-enabled.md-indeterminate .md-icon:after { + box-sizing: border-box; + position: absolute; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + display: table; + width: 12px; + height: 2px; + border-width: 2px; + border-style: solid; + border-top: 0; + border-left: 0; + content: ''; } + md-select-menu[multiple] md-option.md-checkbox-enabled .md-container { + margin-left: 10.66667px; + margin-right: auto; } + [dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled .md-container { + margin-left: auto; } + [dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled .md-container { + margin-right: 10.66667px; } diff --git a/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.js b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.js new file mode 100644 index 00000000..8da83ff5 --- /dev/null +++ b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.js @@ -0,0 +1,1694 @@ +/*! + * Angular Material Design + * https://github.com/angular/material + * @license MIT + * v1.1.3 + */ +(function( window, angular, undefined ){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.select + */ + +/*************************************************** + + ### TODO - POST RC1 ### + - [ ] Abstract placement logic in $mdSelect service to $mdMenu service + + ***************************************************/ + +SelectDirective['$inject'] = ["$mdSelect", "$mdUtil", "$mdConstant", "$mdTheming", "$mdAria", "$parse", "$sce", "$injector"]; +SelectMenuDirective['$inject'] = ["$parse", "$mdUtil", "$mdConstant", "$mdTheming"]; +OptionDirective['$inject'] = ["$mdButtonInkRipple", "$mdUtil"]; +SelectProvider['$inject'] = ["$$interimElementProvider"]; +var SELECT_EDGE_MARGIN = 8; +var selectNextId = 0; +var CHECKBOX_SELECTION_INDICATOR = + angular.element('<div class="md-container"><div class="md-icon"></div></div>'); + +angular.module('material.components.select', [ + 'material.core', + 'material.components.backdrop' + ]) + .directive('mdSelect', SelectDirective) + .directive('mdSelectMenu', SelectMenuDirective) + .directive('mdOption', OptionDirective) + .directive('mdOptgroup', OptgroupDirective) + .directive('mdSelectHeader', SelectHeaderDirective) + .provider('$mdSelect', SelectProvider); + +/** + * @ngdoc directive + * @name mdSelect + * @restrict E + * @module material.components.select + * + * @description Displays a select box, bound to an ng-model. + * + * When the select is required and uses a floating label, then the label will automatically contain + * an asterisk (`*`). This behavior can be disabled by using the `md-no-asterisk` attribute. + * + * By default, the select will display with an underline to match other form elements. This can be + * disabled by applying the `md-no-underline` CSS class. + * + * ### Option Params + * + * When applied, `md-option-empty` will mark the option as "empty" allowing the option to clear the + * select and put it back in it's default state. You may supply this attribute on any option you + * wish, however, it is automatically applied to an option whose `value` or `ng-value` are not + * defined. + * + * **Automatically Applied** + * + * - `<md-option>` + * - `<md-option value>` + * - `<md-option value="">` + * - `<md-option ng-value>` + * - `<md-option ng-value="">` + * + * **NOT Automatically Applied** + * + * - `<md-option ng-value="1">` + * - `<md-option ng-value="''">` + * - `<md-option ng-value="undefined">` + * - `<md-option value="undefined">` (this evaluates to the string `"undefined"`) + * - <code ng-non-bindable><md-option ng-value="{{someValueThatMightBeUndefined}}"></code> + * + * **Note:** A value of `undefined` ***is considered a valid value*** (and does not auto-apply this + * attribute) since you may wish this to be your "Not Available" or "None" option. + * + * **Note:** Using the `value` attribute (as opposed to `ng-value`) always evaluates to a string, so + * `value="null"` will require the test `ng-if="myValue != 'null'"` rather than `ng-if="!myValue"`. + * + * @param {expression} ng-model The model! + * @param {boolean=} multiple When set to true, allows for more than one option to be selected. The model is an array with the selected choices. + * @param {expression=} md-on-close Expression to be evaluated when the select is closed. + * @param {expression=} md-on-open Expression to be evaluated when opening the select. + * Will hide the select options and show a spinner until the evaluated promise resolves. + * @param {expression=} md-selected-text Expression to be evaluated that will return a string + * to be displayed as a placeholder in the select input box when it is closed. The value + * will be treated as *text* (not html). + * @param {expression=} md-selected-html Expression to be evaluated that will return a string + * to be displayed as a placeholder in the select input box when it is closed. The value + * will be treated as *html*. The value must either be explicitly marked as trustedHtml or + * the ngSanitize module must be loaded. + * @param {string=} placeholder Placeholder hint text. + * @param md-no-asterisk {boolean=} When set to true, an asterisk will not be appended to the + * floating label. **Note:** This attribute is only evaluated once; it is not watched. + * @param {string=} aria-label Optional label for accessibility. Only necessary if no placeholder or + * explicit label is present. + * @param {string=} md-container-class Class list to get applied to the `.md-select-menu-container` + * element (for custom styling). + * + * @usage + * With a placeholder (label and aria-label are added dynamically) + * <hljs lang="html"> + * <md-input-container> + * <md-select + * ng-model="someModel" + * placeholder="Select a state"> + * <md-option ng-value="opt" ng-repeat="opt in neighborhoods2">{{ opt }}</md-option> + * </md-select> + * </md-input-container> + * </hljs> + * + * With an explicit label + * <hljs lang="html"> + * <md-input-container> + * <label>State</label> + * <md-select + * ng-model="someModel"> + * <md-option ng-value="opt" ng-repeat="opt in neighborhoods2">{{ opt }}</md-option> + * </md-select> + * </md-input-container> + * </hljs> + * + * With a select-header + * + * When a developer needs to put more than just a text label in the + * md-select-menu, they should use the md-select-header. + * The user can put custom HTML inside of the header and style it to their liking. + * One common use case of this would be a sticky search bar. + * + * When using the md-select-header the labels that would previously be added to the + * OptGroupDirective are ignored. + * + * <hljs lang="html"> + * <md-input-container> + * <md-select ng-model="someModel"> + * <md-select-header> + * <span> Neighborhoods - </span> + * </md-select-header> + * <md-option ng-value="opt" ng-repeat="opt in neighborhoods2">{{ opt }}</md-option> + * </md-select> + * </md-input-container> + * </hljs> + * + * ## Selects and object equality + * When using a `md-select` to pick from a list of objects, it is important to realize how javascript handles + * equality. Consider the following example: + * <hljs lang="js"> + * angular.controller('MyCtrl', function($scope) { + * $scope.users = [ + * { id: 1, name: 'Bob' }, + * { id: 2, name: 'Alice' }, + * { id: 3, name: 'Steve' } + * ]; + * $scope.selectedUser = { id: 1, name: 'Bob' }; + * }); + * </hljs> + * <hljs lang="html"> + * <div ng-controller="MyCtrl"> + * <md-select ng-model="selectedUser"> + * <md-option ng-value="user" ng-repeat="user in users">{{ user.name }}</md-option> + * </md-select> + * </div> + * </hljs> + * + * At first one might expect that the select should be populated with "Bob" as the selected user. However, + * this is not true. To determine whether something is selected, + * `ngModelController` is looking at whether `$scope.selectedUser == (any user in $scope.users);`; + * + * Javascript's `==` operator does not check for deep equality (ie. that all properties + * on the object are the same), but instead whether the objects are *the same object in memory*. + * In this case, we have two instances of identical objects, but they exist in memory as unique + * entities. Because of this, the select will have no value populated for a selected user. + * + * To get around this, `ngModelController` provides a `track by` option that allows us to specify a different + * expression which will be used for the equality operator. As such, we can update our `html` to + * make use of this by specifying the `ng-model-options="{trackBy: '$value.id'}"` on the `md-select` + * element. This converts our equality expression to be + * `$scope.selectedUser.id == (any id in $scope.users.map(function(u) { return u.id; }));` + * which results in Bob being selected as desired. + * + * Working HTML: + * <hljs lang="html"> + * <div ng-controller="MyCtrl"> + * <md-select ng-model="selectedUser" ng-model-options="{trackBy: '$value.id'}"> + * <md-option ng-value="user" ng-repeat="user in users">{{ user.name }}</md-option> + * </md-select> + * </div> + * </hljs> + */ +function SelectDirective($mdSelect, $mdUtil, $mdConstant, $mdTheming, $mdAria, $parse, $sce, + $injector) { + var keyCodes = $mdConstant.KEY_CODE; + var NAVIGATION_KEYS = [keyCodes.SPACE, keyCodes.ENTER, keyCodes.UP_ARROW, keyCodes.DOWN_ARROW]; + + return { + restrict: 'E', + require: ['^?mdInputContainer', 'mdSelect', 'ngModel', '?^form'], + compile: compile, + controller: function() { + } // empty placeholder controller to be initialized in link + }; + + function compile(element, attr) { + // add the select value that will hold our placeholder or selected option value + var valueEl = angular.element('<md-select-value><span></span></md-select-value>'); + valueEl.append('<span class="md-select-icon" aria-hidden="true"></span>'); + valueEl.addClass('md-select-value'); + if (!valueEl[0].hasAttribute('id')) { + valueEl.attr('id', 'select_value_label_' + $mdUtil.nextUid()); + } + + // There's got to be an md-content inside. If there's not one, let's add it. + if (!element.find('md-content').length) { + element.append(angular.element('<md-content>').append(element.contents())); + } + + + // Add progress spinner for md-options-loading + if (attr.mdOnOpen) { + + // Show progress indicator while loading async + // Use ng-hide for `display:none` so the indicator does not interfere with the options list + element + .find('md-content') + .prepend(angular.element( + '<div>' + + ' <md-progress-circular md-mode="indeterminate" ng-if="$$loadingAsyncDone === false" md-diameter="25px"></md-progress-circular>' + + '</div>' + )); + + // Hide list [of item options] while loading async + element + .find('md-option') + .attr('ng-show', '$$loadingAsyncDone'); + } + + if (attr.name) { + var autofillClone = angular.element('<select class="md-visually-hidden">'); + autofillClone.attr({ + 'name': attr.name, + 'aria-hidden': 'true', + 'tabindex': '-1' + }); + var opts = element.find('md-option'); + angular.forEach(opts, function(el) { + var newEl = angular.element('<option>' + el.innerHTML + '</option>'); + if (el.hasAttribute('ng-value')) newEl.attr('ng-value', el.getAttribute('ng-value')); + else if (el.hasAttribute('value')) newEl.attr('value', el.getAttribute('value')); + autofillClone.append(newEl); + }); + + // Adds an extra option that will hold the selected value for the + // cases where the select is a part of a non-angular form. This can be done with a ng-model, + // however if the `md-option` is being `ng-repeat`-ed, Angular seems to insert a similar + // `option` node, but with a value of `? string: <value> ?` which would then get submitted. + // This also goes around having to prepend a dot to the name attribute. + autofillClone.append( + '<option ng-value="' + attr.ngModel + '" selected></option>' + ); + + element.parent().append(autofillClone); + } + + var isMultiple = $mdUtil.parseAttributeBoolean(attr.multiple); + + // Use everything that's left inside element.contents() as the contents of the menu + var multipleContent = isMultiple ? 'multiple' : ''; + var selectTemplate = '' + + '<div class="md-select-menu-container" aria-hidden="true">' + + '<md-select-menu {0}>{1}</md-select-menu>' + + '</div>'; + + selectTemplate = $mdUtil.supplant(selectTemplate, [multipleContent, element.html()]); + element.empty().append(valueEl); + element.append(selectTemplate); + + if(!attr.tabindex){ + attr.$set('tabindex', 0); + } + + return function postLink(scope, element, attr, ctrls) { + var untouched = true; + var isDisabled, ariaLabelBase; + + var containerCtrl = ctrls[0]; + var mdSelectCtrl = ctrls[1]; + var ngModelCtrl = ctrls[2]; + var formCtrl = ctrls[3]; + // grab a reference to the select menu value label + var valueEl = element.find('md-select-value'); + var isReadonly = angular.isDefined(attr.readonly); + var disableAsterisk = $mdUtil.parseAttributeBoolean(attr.mdNoAsterisk); + + if (disableAsterisk) { + element.addClass('md-no-asterisk'); + } + + if (containerCtrl) { + var isErrorGetter = containerCtrl.isErrorGetter || function() { + return ngModelCtrl.$invalid && (ngModelCtrl.$touched || (formCtrl && formCtrl.$submitted)); + }; + + if (containerCtrl.input) { + // We ignore inputs that are in the md-select-header (one + // case where this might be useful would be adding as searchbox) + if (element.find('md-select-header').find('input')[0] !== containerCtrl.input[0]) { + throw new Error("<md-input-container> can only have *one* child <input>, <textarea> or <select> element!"); + } + } + + containerCtrl.input = element; + if (!containerCtrl.label) { + $mdAria.expect(element, 'aria-label', element.attr('placeholder')); + } + + scope.$watch(isErrorGetter, containerCtrl.setInvalid); + } + + var selectContainer, selectScope, selectMenuCtrl; + + findSelectContainer(); + $mdTheming(element); + + if (formCtrl && angular.isDefined(attr.multiple)) { + $mdUtil.nextTick(function() { + var hasModelValue = ngModelCtrl.$modelValue || ngModelCtrl.$viewValue; + if (hasModelValue) { + formCtrl.$setPristine(); + } + }); + } + + var originalRender = ngModelCtrl.$render; + ngModelCtrl.$render = function() { + originalRender(); + syncLabelText(); + syncAriaLabel(); + inputCheckValue(); + }; + + attr.$observe('placeholder', ngModelCtrl.$render); + + if (containerCtrl && containerCtrl.label) { + attr.$observe('required', function (value) { + // Toggle the md-required class on the input containers label, because the input container is automatically + // applying the asterisk indicator on the label. + containerCtrl.label.toggleClass('md-required', value && !disableAsterisk); + }); + } + + mdSelectCtrl.setLabelText = function(text) { + mdSelectCtrl.setIsPlaceholder(!text); + + // Whether the select label has been given via user content rather than the internal + // template of <md-option> + var isSelectLabelFromUser = false; + + if (attr.mdSelectedText && attr.mdSelectedHtml) { + throw Error('md-select cannot have both `md-selected-text` and `md-selected-html`'); + } + + if (attr.mdSelectedText || attr.mdSelectedHtml) { + text = $parse(attr.mdSelectedText || attr.mdSelectedHtml)(scope); + isSelectLabelFromUser = true; + } else if (!text) { + // Use placeholder attribute, otherwise fallback to the md-input-container label + var tmpPlaceholder = attr.placeholder || + (containerCtrl && containerCtrl.label ? containerCtrl.label.text() : ''); + + text = tmpPlaceholder || ''; + isSelectLabelFromUser = true; + } + + var target = valueEl.children().eq(0); + + if (attr.mdSelectedHtml) { + // Using getTrustedHtml will run the content through $sanitize if it is not already + // explicitly trusted. If the ngSanitize module is not loaded, this will + // *correctly* throw an sce error. + target.html($sce.getTrustedHtml(text)); + } else if (isSelectLabelFromUser) { + target.text(text); + } else { + // If we've reached this point, the text is not user-provided. + target.html(text); + } + }; + + mdSelectCtrl.setIsPlaceholder = function(isPlaceholder) { + if (isPlaceholder) { + valueEl.addClass('md-select-placeholder'); + if (containerCtrl && containerCtrl.label) { + containerCtrl.label.addClass('md-placeholder'); + } + } else { + valueEl.removeClass('md-select-placeholder'); + if (containerCtrl && containerCtrl.label) { + containerCtrl.label.removeClass('md-placeholder'); + } + } + }; + + if (!isReadonly) { + element + .on('focus', function(ev) { + // Always focus the container (if we have one) so floating labels and other styles are + // applied properly + containerCtrl && containerCtrl.setFocused(true); + }); + + // Attach before ngModel's blur listener to stop propagation of blur event + // to prevent from setting $touched. + element.on('blur', function(event) { + if (untouched) { + untouched = false; + if (selectScope._mdSelectIsOpen) { + event.stopImmediatePropagation(); + } + } + + if (selectScope._mdSelectIsOpen) return; + containerCtrl && containerCtrl.setFocused(false); + inputCheckValue(); + }); + } + + mdSelectCtrl.triggerClose = function() { + $parse(attr.mdOnClose)(scope); + }; + + scope.$$postDigest(function() { + initAriaLabel(); + syncLabelText(); + syncAriaLabel(); + }); + + function initAriaLabel() { + var labelText = element.attr('aria-label') || element.attr('placeholder'); + if (!labelText && containerCtrl && containerCtrl.label) { + labelText = containerCtrl.label.text(); + } + ariaLabelBase = labelText; + $mdAria.expect(element, 'aria-label', labelText); + } + + scope.$watch(function() { + return selectMenuCtrl.selectedLabels(); + }, syncLabelText); + + function syncLabelText() { + if (selectContainer) { + selectMenuCtrl = selectMenuCtrl || selectContainer.find('md-select-menu').controller('mdSelectMenu'); + mdSelectCtrl.setLabelText(selectMenuCtrl.selectedLabels()); + } + } + + function syncAriaLabel() { + if (!ariaLabelBase) return; + var ariaLabels = selectMenuCtrl.selectedLabels({mode: 'aria'}); + element.attr('aria-label', ariaLabels.length ? ariaLabelBase + ': ' + ariaLabels : ariaLabelBase); + } + + var deregisterWatcher; + attr.$observe('ngMultiple', function(val) { + if (deregisterWatcher) deregisterWatcher(); + var parser = $parse(val); + deregisterWatcher = scope.$watch(function() { + return parser(scope); + }, function(multiple, prevVal) { + if (multiple === undefined && prevVal === undefined) return; // assume compiler did a good job + if (multiple) { + element.attr('multiple', 'multiple'); + } else { + element.removeAttr('multiple'); + } + element.attr('aria-multiselectable', multiple ? 'true' : 'false'); + if (selectContainer) { + selectMenuCtrl.setMultiple(multiple); + originalRender = ngModelCtrl.$render; + ngModelCtrl.$render = function() { + originalRender(); + syncLabelText(); + syncAriaLabel(); + inputCheckValue(); + }; + ngModelCtrl.$render(); + } + }); + }); + + attr.$observe('disabled', function(disabled) { + if (angular.isString(disabled)) { + disabled = true; + } + // Prevent click event being registered twice + if (isDisabled !== undefined && isDisabled === disabled) { + return; + } + isDisabled = disabled; + if (disabled) { + element + .attr({'aria-disabled': 'true'}) + .removeAttr('tabindex') + .off('click', openSelect) + .off('keydown', handleKeypress); + } else { + element + .attr({'tabindex': attr.tabindex, 'aria-disabled': 'false'}) + .on('click', openSelect) + .on('keydown', handleKeypress); + } + }); + + if (!attr.hasOwnProperty('disabled') && !attr.hasOwnProperty('ngDisabled')) { + element.attr({'aria-disabled': 'false'}); + element.on('click', openSelect); + element.on('keydown', handleKeypress); + } + + var ariaAttrs = { + role: 'listbox', + 'aria-expanded': 'false', + 'aria-multiselectable': isMultiple && !attr.ngMultiple ? 'true' : 'false' + }; + + if (!element[0].hasAttribute('id')) { + ariaAttrs.id = 'select_' + $mdUtil.nextUid(); + } + + var containerId = 'select_container_' + $mdUtil.nextUid(); + selectContainer.attr('id', containerId); + ariaAttrs['aria-owns'] = containerId; + element.attr(ariaAttrs); + + scope.$on('$destroy', function() { + $mdSelect + .destroy() + .finally(function() { + if (containerCtrl) { + containerCtrl.setFocused(false); + containerCtrl.setHasValue(false); + containerCtrl.input = null; + } + ngModelCtrl.$setTouched(); + }); + }); + + + + function inputCheckValue() { + // The select counts as having a value if one or more options are selected, + // or if the input's validity state says it has bad input (eg string in a number input) + containerCtrl && containerCtrl.setHasValue(selectMenuCtrl.selectedLabels().length > 0 || (element[0].validity || {}).badInput); + } + + function findSelectContainer() { + selectContainer = angular.element( + element[0].querySelector('.md-select-menu-container') + ); + selectScope = scope; + if (attr.mdContainerClass) { + var value = selectContainer[0].getAttribute('class') + ' ' + attr.mdContainerClass; + selectContainer[0].setAttribute('class', value); + } + selectMenuCtrl = selectContainer.find('md-select-menu').controller('mdSelectMenu'); + selectMenuCtrl.init(ngModelCtrl, attr.ngModel); + element.on('$destroy', function() { + selectContainer.remove(); + }); + } + + function handleKeypress(e) { + if ($mdConstant.isNavigationKey(e)) { + // prevent page scrolling on interaction + e.preventDefault(); + openSelect(e); + } else { + if ($mdConstant.isInputKey(e) || $mdConstant.isNumPadKey(e)) { + e.preventDefault(); + + var node = selectMenuCtrl.optNodeForKeyboardSearch(e); + if (!node || node.hasAttribute('disabled')) return; + var optionCtrl = angular.element(node).controller('mdOption'); + if (!selectMenuCtrl.isMultiple) { + selectMenuCtrl.deselect(Object.keys(selectMenuCtrl.selected)[0]); + } + selectMenuCtrl.select(optionCtrl.hashKey, optionCtrl.value); + selectMenuCtrl.refreshViewValue(); + } + } + } + + function openSelect() { + selectScope._mdSelectIsOpen = true; + element.attr('aria-expanded', 'true'); + + $mdSelect.show({ + scope: selectScope, + preserveScope: true, + skipCompile: true, + element: selectContainer, + target: element[0], + selectCtrl: mdSelectCtrl, + preserveElement: true, + hasBackdrop: true, + loadingAsync: attr.mdOnOpen ? scope.$eval(attr.mdOnOpen) || true : false + }).finally(function() { + selectScope._mdSelectIsOpen = false; + element.focus(); + element.attr('aria-expanded', 'false'); + ngModelCtrl.$setTouched(); + }); + } + + }; + } +} + +function SelectMenuDirective($parse, $mdUtil, $mdConstant, $mdTheming) { + // We want the scope to be set to 'false' so an isolated scope is not created + // which would interfere with the md-select-header's access to the + // parent scope. + SelectMenuController['$inject'] = ["$scope", "$attrs", "$element"]; + return { + restrict: 'E', + require: ['mdSelectMenu'], + scope: false, + controller: SelectMenuController, + link: {pre: preLink} + }; + + // We use preLink instead of postLink to ensure that the select is initialized before + // its child options run postLink. + function preLink(scope, element, attr, ctrls) { + var selectCtrl = ctrls[0]; + + element.addClass('_md'); // private md component indicator for styling + + $mdTheming(element); + element.on('click', clickListener); + element.on('keypress', keyListener); + + function keyListener(e) { + if (e.keyCode == 13 || e.keyCode == 32) { + clickListener(e); + } + } + + function clickListener(ev) { + var option = $mdUtil.getClosest(ev.target, 'md-option'); + var optionCtrl = option && angular.element(option).data('$mdOptionController'); + if (!option || !optionCtrl) return; + if (option.hasAttribute('disabled')) { + ev.stopImmediatePropagation(); + return false; + } + + var optionHashKey = selectCtrl.hashGetter(optionCtrl.value); + var isSelected = angular.isDefined(selectCtrl.selected[optionHashKey]); + + scope.$apply(function() { + if (selectCtrl.isMultiple) { + if (isSelected) { + selectCtrl.deselect(optionHashKey); + } else { + selectCtrl.select(optionHashKey, optionCtrl.value); + } + } else { + if (!isSelected) { + selectCtrl.deselect(Object.keys(selectCtrl.selected)[0]); + selectCtrl.select(optionHashKey, optionCtrl.value); + } + } + selectCtrl.refreshViewValue(); + }); + } + } + + function SelectMenuController($scope, $attrs, $element) { + var self = this; + self.isMultiple = angular.isDefined($attrs.multiple); + // selected is an object with keys matching all of the selected options' hashed values + self.selected = {}; + // options is an object with keys matching every option's hash value, + // and values matching every option's controller. + self.options = {}; + + $scope.$watchCollection(function() { + return self.options; + }, function() { + self.ngModel.$render(); + }); + + var deregisterCollectionWatch; + var defaultIsEmpty; + self.setMultiple = function(isMultiple) { + var ngModel = self.ngModel; + defaultIsEmpty = defaultIsEmpty || ngModel.$isEmpty; + + self.isMultiple = isMultiple; + if (deregisterCollectionWatch) deregisterCollectionWatch(); + + if (self.isMultiple) { + ngModel.$validators['md-multiple'] = validateArray; + ngModel.$render = renderMultiple; + + // watchCollection on the model because by default ngModel only watches the model's + // reference. This allowed the developer to also push and pop from their array. + $scope.$watchCollection(self.modelBinding, function(value) { + if (validateArray(value)) renderMultiple(value); + self.ngModel.$setPristine(); + }); + + ngModel.$isEmpty = function(value) { + return !value || value.length === 0; + }; + } else { + delete ngModel.$validators['md-multiple']; + ngModel.$render = renderSingular; + } + + function validateArray(modelValue, viewValue) { + // If a value is truthy but not an array, reject it. + // If value is undefined/falsy, accept that it's an empty array. + return angular.isArray(modelValue || viewValue || []); + } + }; + + var searchStr = ''; + var clearSearchTimeout, optNodes, optText; + var CLEAR_SEARCH_AFTER = 300; + + self.optNodeForKeyboardSearch = function(e) { + clearSearchTimeout && clearTimeout(clearSearchTimeout); + clearSearchTimeout = setTimeout(function() { + clearSearchTimeout = undefined; + searchStr = ''; + optText = undefined; + optNodes = undefined; + }, CLEAR_SEARCH_AFTER); + + // Support 1-9 on numpad + var keyCode = e.keyCode - ($mdConstant.isNumPadKey(e) ? 48 : 0); + + searchStr += String.fromCharCode(keyCode); + var search = new RegExp('^' + searchStr, 'i'); + if (!optNodes) { + optNodes = $element.find('md-option'); + optText = new Array(optNodes.length); + angular.forEach(optNodes, function(el, i) { + optText[i] = el.textContent.trim(); + }); + } + for (var i = 0; i < optText.length; ++i) { + if (search.test(optText[i])) { + return optNodes[i]; + } + } + }; + + self.init = function(ngModel, binding) { + self.ngModel = ngModel; + self.modelBinding = binding; + + // Setup a more robust version of isEmpty to ensure value is a valid option + self.ngModel.$isEmpty = function($viewValue) { + // We have to transform the viewValue into the hashKey, because otherwise the + // OptionCtrl may not exist. Developers may have specified a trackBy function. + return !self.options[self.hashGetter($viewValue)]; + }; + + // Allow users to provide `ng-model="foo" ng-model-options="{trackBy: 'foo.id'}"` so + // that we can properly compare objects set on the model to the available options + var trackByOption = $mdUtil.getModelOption(ngModel, 'trackBy'); + + if (trackByOption) { + var trackByLocals = {}; + var trackByParsed = $parse(trackByOption); + self.hashGetter = function(value, valueScope) { + trackByLocals.$value = value; + return trackByParsed(valueScope || $scope, trackByLocals); + }; + // If the user doesn't provide a trackBy, we automatically generate an id for every + // value passed in + } else { + self.hashGetter = function getHashValue(value) { + if (angular.isObject(value)) { + return 'object_' + (value.$$mdSelectId || (value.$$mdSelectId = ++selectNextId)); + } + return value; + }; + } + self.setMultiple(self.isMultiple); + }; + + self.selectedLabels = function(opts) { + opts = opts || {}; + var mode = opts.mode || 'html'; + var selectedOptionEls = $mdUtil.nodesToArray($element[0].querySelectorAll('md-option[selected]')); + if (selectedOptionEls.length) { + var mapFn; + + if (mode == 'html') { + // Map the given element to its innerHTML string. If the element has a child ripple + // container remove it from the HTML string, before returning the string. + mapFn = function(el) { + // If we do not have a `value` or `ng-value`, assume it is an empty option which clears the select + if (el.hasAttribute('md-option-empty')) { + return ''; + } + + var html = el.innerHTML; + + // Remove the ripple container from the selected option, copying it would cause a CSP violation. + var rippleContainer = el.querySelector('.md-ripple-container'); + if (rippleContainer) { + html = html.replace(rippleContainer.outerHTML, ''); + } + + // Remove the checkbox container, because it will cause the label to wrap inside of the placeholder. + // It should be not displayed inside of the label element. + var checkboxContainer = el.querySelector('.md-container'); + if (checkboxContainer) { + html = html.replace(checkboxContainer.outerHTML, ''); + } + + return html; + }; + } else if (mode == 'aria') { + mapFn = function(el) { return el.hasAttribute('aria-label') ? el.getAttribute('aria-label') : el.textContent; }; + } + + // Ensure there are no duplicates; see https://github.com/angular/material/issues/9442 + return $mdUtil.uniq(selectedOptionEls.map(mapFn)).join(', '); + } else { + return ''; + } + }; + + self.select = function(hashKey, hashedValue) { + var option = self.options[hashKey]; + option && option.setSelected(true); + self.selected[hashKey] = hashedValue; + }; + self.deselect = function(hashKey) { + var option = self.options[hashKey]; + option && option.setSelected(false); + delete self.selected[hashKey]; + }; + + self.addOption = function(hashKey, optionCtrl) { + if (angular.isDefined(self.options[hashKey])) { + throw new Error('Duplicate md-option values are not allowed in a select. ' + + 'Duplicate value "' + optionCtrl.value + '" found.'); + } + + self.options[hashKey] = optionCtrl; + + // If this option's value was already in our ngModel, go ahead and select it. + if (angular.isDefined(self.selected[hashKey])) { + self.select(hashKey, optionCtrl.value); + + // When the current $modelValue of the ngModel Controller is using the same hash as + // the current option, which will be added, then we can be sure, that the validation + // of the option has occurred before the option was added properly. + // This means, that we have to manually trigger a new validation of the current option. + if (angular.isDefined(self.ngModel.$modelValue) && self.hashGetter(self.ngModel.$modelValue) === hashKey) { + self.ngModel.$validate(); + } + + self.refreshViewValue(); + } + }; + self.removeOption = function(hashKey) { + delete self.options[hashKey]; + // Don't deselect an option when it's removed - the user's ngModel should be allowed + // to have values that do not match a currently available option. + }; + + self.refreshViewValue = function() { + var values = []; + var option; + for (var hashKey in self.selected) { + // If this hashKey has an associated option, push that option's value to the model. + if ((option = self.options[hashKey])) { + values.push(option.value); + } else { + // Otherwise, the given hashKey has no associated option, and we got it + // from an ngModel value at an earlier time. Push the unhashed value of + // this hashKey to the model. + // This allows the developer to put a value in the model that doesn't yet have + // an associated option. + values.push(self.selected[hashKey]); + } + } + var usingTrackBy = $mdUtil.getModelOption(self.ngModel, 'trackBy'); + + var newVal = self.isMultiple ? values : values[0]; + var prevVal = self.ngModel.$modelValue; + + if (usingTrackBy ? !angular.equals(prevVal, newVal) : (prevVal + '') !== newVal) { + self.ngModel.$setViewValue(newVal); + self.ngModel.$render(); + } + }; + + function renderMultiple() { + var newSelectedValues = self.ngModel.$modelValue || self.ngModel.$viewValue || []; + if (!angular.isArray(newSelectedValues)) return; + + var oldSelected = Object.keys(self.selected); + + var newSelectedHashes = newSelectedValues.map(self.hashGetter); + var deselected = oldSelected.filter(function(hash) { + return newSelectedHashes.indexOf(hash) === -1; + }); + + deselected.forEach(self.deselect); + newSelectedHashes.forEach(function(hashKey, i) { + self.select(hashKey, newSelectedValues[i]); + }); + } + + function renderSingular() { + var value = self.ngModel.$viewValue || self.ngModel.$modelValue; + Object.keys(self.selected).forEach(self.deselect); + self.select(self.hashGetter(value), value); + } + } + +} + +function OptionDirective($mdButtonInkRipple, $mdUtil) { + + OptionController['$inject'] = ["$element"]; + return { + restrict: 'E', + require: ['mdOption', '^^mdSelectMenu'], + controller: OptionController, + compile: compile + }; + + function compile(element, attr) { + // Manual transclusion to avoid the extra inner <span> that ng-transclude generates + element.append(angular.element('<div class="md-text">').append(element.contents())); + + element.attr('tabindex', attr.tabindex || '0'); + + if (!hasDefinedValue(attr)) { + element.attr('md-option-empty', ''); + } + + return postLink; + } + + function hasDefinedValue(attr) { + var value = attr.value; + var ngValue = attr.ngValue; + + return value || ngValue; + } + + function postLink(scope, element, attr, ctrls) { + var optionCtrl = ctrls[0]; + var selectCtrl = ctrls[1]; + + if (selectCtrl.isMultiple) { + element.addClass('md-checkbox-enabled'); + element.prepend(CHECKBOX_SELECTION_INDICATOR.clone()); + } + + if (angular.isDefined(attr.ngValue)) { + scope.$watch(attr.ngValue, setOptionValue); + } else if (angular.isDefined(attr.value)) { + setOptionValue(attr.value); + } else { + scope.$watch(function() { + return element.text().trim(); + }, setOptionValue); + } + + attr.$observe('disabled', function(disabled) { + if (disabled) { + element.attr('tabindex', '-1'); + } else { + element.attr('tabindex', '0'); + } + }); + + scope.$$postDigest(function() { + attr.$observe('selected', function(selected) { + if (!angular.isDefined(selected)) return; + if (typeof selected == 'string') selected = true; + if (selected) { + if (!selectCtrl.isMultiple) { + selectCtrl.deselect(Object.keys(selectCtrl.selected)[0]); + } + selectCtrl.select(optionCtrl.hashKey, optionCtrl.value); + } else { + selectCtrl.deselect(optionCtrl.hashKey); + } + selectCtrl.refreshViewValue(); + }); + }); + + $mdButtonInkRipple.attach(scope, element); + configureAria(); + + function setOptionValue(newValue, oldValue, prevAttempt) { + if (!selectCtrl.hashGetter) { + if (!prevAttempt) { + scope.$$postDigest(function() { + setOptionValue(newValue, oldValue, true); + }); + } + return; + } + var oldHashKey = selectCtrl.hashGetter(oldValue, scope); + var newHashKey = selectCtrl.hashGetter(newValue, scope); + + optionCtrl.hashKey = newHashKey; + optionCtrl.value = newValue; + + selectCtrl.removeOption(oldHashKey, optionCtrl); + selectCtrl.addOption(newHashKey, optionCtrl); + } + + scope.$on('$destroy', function() { + selectCtrl.removeOption(optionCtrl.hashKey, optionCtrl); + }); + + function configureAria() { + var ariaAttrs = { + 'role': 'option', + 'aria-selected': 'false' + }; + + if (!element[0].hasAttribute('id')) { + ariaAttrs.id = 'select_option_' + $mdUtil.nextUid(); + } + element.attr(ariaAttrs); + } + } + + function OptionController($element) { + this.selected = false; + this.setSelected = function(isSelected) { + if (isSelected && !this.selected) { + $element.attr({ + 'selected': 'selected', + 'aria-selected': 'true' + }); + } else if (!isSelected && this.selected) { + $element.removeAttr('selected'); + $element.attr('aria-selected', 'false'); + } + this.selected = isSelected; + }; + } + +} + +function OptgroupDirective() { + return { + restrict: 'E', + compile: compile + }; + function compile(el, attrs) { + // If we have a select header element, we don't want to add the normal label + // header. + if (!hasSelectHeader()) { + setupLabelElement(); + } + + function hasSelectHeader() { + return el.parent().find('md-select-header').length; + } + + function setupLabelElement() { + var labelElement = el.find('label'); + if (!labelElement.length) { + labelElement = angular.element('<label>'); + el.prepend(labelElement); + } + labelElement.addClass('md-container-ignore'); + if (attrs.label) labelElement.text(attrs.label); + } + } +} + +function SelectHeaderDirective() { + return { + restrict: 'E', + }; +} + +function SelectProvider($$interimElementProvider) { + selectDefaultOptions['$inject'] = ["$mdSelect", "$mdConstant", "$mdUtil", "$window", "$q", "$$rAF", "$animateCss", "$animate", "$document"]; + return $$interimElementProvider('$mdSelect') + .setDefaults({ + methods: ['target'], + options: selectDefaultOptions + }); + + /* ngInject */ + function selectDefaultOptions($mdSelect, $mdConstant, $mdUtil, $window, $q, $$rAF, $animateCss, $animate, $document) { + var ERROR_TARGET_EXPECTED = "$mdSelect.show() expected a target element in options.target but got '{0}'!"; + var animator = $mdUtil.dom.animator; + var keyCodes = $mdConstant.KEY_CODE; + + return { + parent: 'body', + themable: true, + onShow: onShow, + onRemove: onRemove, + hasBackdrop: true, + disableParentScroll: true + }; + + /** + * Interim-element onRemove logic.... + */ + function onRemove(scope, element, opts) { + opts = opts || { }; + opts.cleanupInteraction(); + opts.cleanupResizing(); + opts.hideBackdrop(); + + // For navigation $destroy events, do a quick, non-animated removal, + // but for normal closes (from clicks, etc) animate the removal + + return (opts.$destroy === true) ? cleanElement() : animateRemoval().then( cleanElement ); + + /** + * For normal closes (eg clicks), animate the removal. + * For forced closes (like $destroy events from navigation), + * skip the animations + */ + function animateRemoval() { + return $animateCss(element, {addClass: 'md-leave'}).start(); + } + + /** + * Restore the element to a closed state + */ + function cleanElement() { + + element.removeClass('md-active'); + element.attr('aria-hidden', 'true'); + element[0].style.display = 'none'; + + announceClosed(opts); + + if (!opts.$destroy && opts.restoreFocus) { + opts.target.focus(); + } + } + + } + + /** + * Interim-element onShow logic.... + */ + function onShow(scope, element, opts) { + + watchAsyncLoad(); + sanitizeAndConfigure(scope, opts); + + opts.hideBackdrop = showBackdrop(scope, element, opts); + + return showDropDown(scope, element, opts) + .then(function(response) { + element.attr('aria-hidden', 'false'); + opts.alreadyOpen = true; + opts.cleanupInteraction = activateInteraction(); + opts.cleanupResizing = activateResizing(); + + return response; + }, opts.hideBackdrop); + + // ************************************ + // Closure Functions + // ************************************ + + /** + * Attach the select DOM element(s) and animate to the correct positions + * and scalings... + */ + function showDropDown(scope, element, opts) { + opts.parent.append(element); + + return $q(function(resolve, reject) { + + try { + + $animateCss(element, {removeClass: 'md-leave', duration: 0}) + .start() + .then(positionAndFocusMenu) + .then(resolve); + + } catch (e) { + reject(e); + } + + }); + } + + /** + * Initialize container and dropDown menu positions/scale, then animate + * to show... and autoFocus. + */ + function positionAndFocusMenu() { + return $q(function(resolve) { + if (opts.isRemoved) return $q.reject(false); + + var info = calculateMenuPositions(scope, element, opts); + + info.container.element.css(animator.toCss(info.container.styles)); + info.dropDown.element.css(animator.toCss(info.dropDown.styles)); + + $$rAF(function() { + element.addClass('md-active'); + info.dropDown.element.css(animator.toCss({transform: ''})); + + autoFocus(opts.focusedNode); + resolve(); + }); + + }); + } + + /** + * Show modal backdrop element... + */ + function showBackdrop(scope, element, options) { + + // If we are not within a dialog... + if (options.disableParentScroll && !$mdUtil.getClosest(options.target, 'MD-DIALOG')) { + // !! DO this before creating the backdrop; since disableScrollAround() + // configures the scroll offset; which is used by mdBackDrop postLink() + options.restoreScroll = $mdUtil.disableScrollAround(options.element, options.parent); + } else { + options.disableParentScroll = false; + } + + if (options.hasBackdrop) { + // Override duration to immediately show invisible backdrop + options.backdrop = $mdUtil.createBackdrop(scope, "md-select-backdrop md-click-catcher"); + $animate.enter(options.backdrop, $document[0].body, null, {duration: 0}); + } + + /** + * Hide modal backdrop element... + */ + return function hideBackdrop() { + if (options.backdrop) options.backdrop.remove(); + if (options.disableParentScroll) options.restoreScroll(); + + delete options.restoreScroll; + }; + } + + /** + * + */ + function autoFocus(focusedNode) { + if (focusedNode && !focusedNode.hasAttribute('disabled')) { + focusedNode.focus(); + } + } + + /** + * Check for valid opts and set some sane defaults + */ + function sanitizeAndConfigure(scope, options) { + var selectEl = element.find('md-select-menu'); + + if (!options.target) { + throw new Error($mdUtil.supplant(ERROR_TARGET_EXPECTED, [options.target])); + } + + angular.extend(options, { + isRemoved: false, + target: angular.element(options.target), //make sure it's not a naked dom node + parent: angular.element(options.parent), + selectEl: selectEl, + contentEl: element.find('md-content'), + optionNodes: selectEl[0].getElementsByTagName('md-option') + }); + } + + /** + * Configure various resize listeners for screen changes + */ + function activateResizing() { + var debouncedOnResize = (function(scope, target, options) { + + return function() { + if (options.isRemoved) return; + + var updates = calculateMenuPositions(scope, target, options); + var container = updates.container; + var dropDown = updates.dropDown; + + container.element.css(animator.toCss(container.styles)); + dropDown.element.css(animator.toCss(dropDown.styles)); + }; + + })(scope, element, opts); + + var window = angular.element($window); + window.on('resize', debouncedOnResize); + window.on('orientationchange', debouncedOnResize); + + // Publish deactivation closure... + return function deactivateResizing() { + + // Disable resizing handlers + window.off('resize', debouncedOnResize); + window.off('orientationchange', debouncedOnResize); + }; + } + + /** + * If asynchronously loading, watch and update internal + * '$$loadingAsyncDone' flag + */ + function watchAsyncLoad() { + if (opts.loadingAsync && !opts.isRemoved) { + scope.$$loadingAsyncDone = false; + + $q.when(opts.loadingAsync) + .then(function() { + scope.$$loadingAsyncDone = true; + delete opts.loadingAsync; + }).then(function() { + $$rAF(positionAndFocusMenu); + }); + } + } + + /** + * + */ + function activateInteraction() { + if (opts.isRemoved) return; + + var dropDown = opts.selectEl; + var selectCtrl = dropDown.controller('mdSelectMenu') || {}; + + element.addClass('md-clickable'); + + // Close on backdrop click + opts.backdrop && opts.backdrop.on('click', onBackdropClick); + + // Escape to close + // Cycling of options, and closing on enter + dropDown.on('keydown', onMenuKeyDown); + dropDown.on('click', checkCloseMenu); + + return function cleanupInteraction() { + opts.backdrop && opts.backdrop.off('click', onBackdropClick); + dropDown.off('keydown', onMenuKeyDown); + dropDown.off('click', checkCloseMenu); + + element.removeClass('md-clickable'); + opts.isRemoved = true; + }; + + // ************************************ + // Closure Functions + // ************************************ + + function onBackdropClick(e) { + e.preventDefault(); + e.stopPropagation(); + opts.restoreFocus = false; + $mdUtil.nextTick($mdSelect.hide, true); + } + + function onMenuKeyDown(ev) { + ev.preventDefault(); + ev.stopPropagation(); + + switch (ev.keyCode) { + case keyCodes.UP_ARROW: + return focusPrevOption(); + case keyCodes.DOWN_ARROW: + return focusNextOption(); + case keyCodes.SPACE: + case keyCodes.ENTER: + var option = $mdUtil.getClosest(ev.target, 'md-option'); + if (option) { + dropDown.triggerHandler({ + type: 'click', + target: option + }); + ev.preventDefault(); + } + checkCloseMenu(ev); + break; + case keyCodes.TAB: + case keyCodes.ESCAPE: + ev.stopPropagation(); + ev.preventDefault(); + opts.restoreFocus = true; + $mdUtil.nextTick($mdSelect.hide, true); + break; + default: + if ($mdConstant.isInputKey(ev) || $mdConstant.isNumPadKey(ev)) { + var optNode = dropDown.controller('mdSelectMenu').optNodeForKeyboardSearch(ev); + opts.focusedNode = optNode || opts.focusedNode; + optNode && optNode.focus(); + } + } + } + + function focusOption(direction) { + var optionsArray = $mdUtil.nodesToArray(opts.optionNodes); + var index = optionsArray.indexOf(opts.focusedNode); + + var newOption; + + do { + if (index === -1) { + // We lost the previously focused element, reset to first option + index = 0; + } else if (direction === 'next' && index < optionsArray.length - 1) { + index++; + } else if (direction === 'prev' && index > 0) { + index--; + } + newOption = optionsArray[index]; + if (newOption.hasAttribute('disabled')) newOption = undefined; + } while (!newOption && index < optionsArray.length - 1 && index > 0); + + newOption && newOption.focus(); + opts.focusedNode = newOption; + } + + function focusNextOption() { + focusOption('next'); + } + + function focusPrevOption() { + focusOption('prev'); + } + + function checkCloseMenu(ev) { + if (ev && ( ev.type == 'click') && (ev.currentTarget != dropDown[0])) return; + if ( mouseOnScrollbar() ) return; + + var option = $mdUtil.getClosest(ev.target, 'md-option'); + if (option && option.hasAttribute && !option.hasAttribute('disabled')) { + ev.preventDefault(); + ev.stopPropagation(); + if (!selectCtrl.isMultiple) { + opts.restoreFocus = true; + + $mdUtil.nextTick(function () { + $mdSelect.hide(selectCtrl.ngModel.$viewValue); + }, true); + } + } + /** + * check if the mouseup event was on a scrollbar + */ + function mouseOnScrollbar() { + var clickOnScrollbar = false; + if (ev && (ev.currentTarget.children.length > 0)) { + var child = ev.currentTarget.children[0]; + var hasScrollbar = child.scrollHeight > child.clientHeight; + if (hasScrollbar && child.children.length > 0) { + var relPosX = ev.pageX - ev.currentTarget.getBoundingClientRect().left; + if (relPosX > child.querySelector('md-option').offsetWidth) + clickOnScrollbar = true; + } + } + return clickOnScrollbar; + } + } + } + + } + + /** + * To notify listeners that the Select menu has closed, + * trigger the [optional] user-defined expression + */ + function announceClosed(opts) { + var mdSelect = opts.selectCtrl; + if (mdSelect) { + var menuController = opts.selectEl.controller('mdSelectMenu'); + mdSelect.setLabelText(menuController ? menuController.selectedLabels() : ''); + mdSelect.triggerClose(); + } + } + + + /** + * Calculate the + */ + function calculateMenuPositions(scope, element, opts) { + var + containerNode = element[0], + targetNode = opts.target[0].children[0], // target the label + parentNode = $document[0].body, + selectNode = opts.selectEl[0], + contentNode = opts.contentEl[0], + parentRect = parentNode.getBoundingClientRect(), + targetRect = targetNode.getBoundingClientRect(), + shouldOpenAroundTarget = false, + bounds = { + left: parentRect.left + SELECT_EDGE_MARGIN, + top: SELECT_EDGE_MARGIN, + bottom: parentRect.height - SELECT_EDGE_MARGIN, + right: parentRect.width - SELECT_EDGE_MARGIN - ($mdUtil.floatingScrollbars() ? 16 : 0) + }, + spaceAvailable = { + top: targetRect.top - bounds.top, + left: targetRect.left - bounds.left, + right: bounds.right - (targetRect.left + targetRect.width), + bottom: bounds.bottom - (targetRect.top + targetRect.height) + }, + maxWidth = parentRect.width - SELECT_EDGE_MARGIN * 2, + selectedNode = selectNode.querySelector('md-option[selected]'), + optionNodes = selectNode.getElementsByTagName('md-option'), + optgroupNodes = selectNode.getElementsByTagName('md-optgroup'), + isScrollable = calculateScrollable(element, contentNode), + centeredNode; + + var loading = isPromiseLike(opts.loadingAsync); + if (!loading) { + // If a selected node, center around that + if (selectedNode) { + centeredNode = selectedNode; + // If there are option groups, center around the first option group + } else if (optgroupNodes.length) { + centeredNode = optgroupNodes[0]; + // Otherwise - if we are not loading async - center around the first optionNode + } else if (optionNodes.length) { + centeredNode = optionNodes[0]; + // In case there are no options, center on whatever's in there... (eg progress indicator) + } else { + centeredNode = contentNode.firstElementChild || contentNode; + } + } else { + // If loading, center on progress indicator + centeredNode = contentNode.firstElementChild || contentNode; + } + + if (contentNode.offsetWidth > maxWidth) { + contentNode.style['max-width'] = maxWidth + 'px'; + } else { + contentNode.style.maxWidth = null; + } + if (shouldOpenAroundTarget) { + contentNode.style['min-width'] = targetRect.width + 'px'; + } + + // Remove padding before we compute the position of the menu + if (isScrollable) { + selectNode.classList.add('md-overflow'); + } + + var focusedNode = centeredNode; + if ((focusedNode.tagName || '').toUpperCase() === 'MD-OPTGROUP') { + focusedNode = optionNodes[0] || contentNode.firstElementChild || contentNode; + centeredNode = focusedNode; + } + // Cache for autoFocus() + opts.focusedNode = focusedNode; + + // Get the selectMenuRect *after* max-width is possibly set above + containerNode.style.display = 'block'; + var selectMenuRect = selectNode.getBoundingClientRect(); + var centeredRect = getOffsetRect(centeredNode); + + if (centeredNode) { + var centeredStyle = $window.getComputedStyle(centeredNode); + centeredRect.paddingLeft = parseInt(centeredStyle.paddingLeft, 10) || 0; + centeredRect.paddingRight = parseInt(centeredStyle.paddingRight, 10) || 0; + } + + if (isScrollable) { + var scrollBuffer = contentNode.offsetHeight / 2; + contentNode.scrollTop = centeredRect.top + centeredRect.height / 2 - scrollBuffer; + + if (spaceAvailable.top < scrollBuffer) { + contentNode.scrollTop = Math.min( + centeredRect.top, + contentNode.scrollTop + scrollBuffer - spaceAvailable.top + ); + } else if (spaceAvailable.bottom < scrollBuffer) { + contentNode.scrollTop = Math.max( + centeredRect.top + centeredRect.height - selectMenuRect.height, + contentNode.scrollTop - scrollBuffer + spaceAvailable.bottom + ); + } + } + + var left, top, transformOrigin, minWidth, fontSize; + if (shouldOpenAroundTarget) { + left = targetRect.left; + top = targetRect.top + targetRect.height; + transformOrigin = '50% 0'; + if (top + selectMenuRect.height > bounds.bottom) { + top = targetRect.top - selectMenuRect.height; + transformOrigin = '50% 100%'; + } + } else { + left = (targetRect.left + centeredRect.left - centeredRect.paddingLeft) + 2; + top = Math.floor(targetRect.top + targetRect.height / 2 - centeredRect.height / 2 - + centeredRect.top + contentNode.scrollTop) + 2; + + transformOrigin = (centeredRect.left + targetRect.width / 2) + 'px ' + + (centeredRect.top + centeredRect.height / 2 - contentNode.scrollTop) + 'px 0px'; + + minWidth = Math.min(targetRect.width + centeredRect.paddingLeft + centeredRect.paddingRight, maxWidth); + + fontSize = window.getComputedStyle(targetNode)['font-size']; + } + + // Keep left and top within the window + var containerRect = containerNode.getBoundingClientRect(); + var scaleX = Math.round(100 * Math.min(targetRect.width / selectMenuRect.width, 1.0)) / 100; + var scaleY = Math.round(100 * Math.min(targetRect.height / selectMenuRect.height, 1.0)) / 100; + + return { + container: { + element: angular.element(containerNode), + styles: { + left: Math.floor(clamp(bounds.left, left, bounds.right - containerRect.width)), + top: Math.floor(clamp(bounds.top, top, bounds.bottom - containerRect.height)), + 'min-width': minWidth, + 'font-size': fontSize + } + }, + dropDown: { + element: angular.element(selectNode), + styles: { + transformOrigin: transformOrigin, + transform: !opts.alreadyOpen ? $mdUtil.supplant('scale({0},{1})', [scaleX, scaleY]) : "" + } + } + }; + + } + + } + + function isPromiseLike(obj) { + return obj && angular.isFunction(obj.then); + } + + function clamp(min, n, max) { + return Math.max(min, Math.min(n, max)); + } + + function getOffsetRect(node) { + return node ? { + left: node.offsetLeft, + top: node.offsetTop, + width: node.offsetWidth, + height: node.offsetHeight + } : {left: 0, top: 0, width: 0, height: 0}; + } + + function calculateScrollable(element, contentNode) { + var isScrollable = false; + + try { + var oldDisplay = element[0].style.display; + + // Set the element's display to block so that this calculation is correct + element[0].style.display = 'block'; + + isScrollable = contentNode.scrollHeight > contentNode.offsetHeight; + + // Reset it back afterwards + element[0].style.display = oldDisplay; + } finally { + // Nothing to do + } + return isScrollable; + } +} + +})(window, window.angular);
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.min.css b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.min.css new file mode 100644 index 00000000..24ddf066 --- /dev/null +++ b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.min.css @@ -0,0 +1,6 @@ +/*! + * Angular Material Design + * https://github.com/angular/material + * @license MIT + * v1.1.2-master-a9ba340 + */md-input-container:not([md-no-float]) .md-select-placeholder span:first-child{-webkit-transition:-webkit-transform .4s cubic-bezier(.25,.8,.25,1);transition:-webkit-transform .4s cubic-bezier(.25,.8,.25,1);transition:transform .4s cubic-bezier(.25,.8,.25,1);transition:transform .4s cubic-bezier(.25,.8,.25,1),-webkit-transform .4s cubic-bezier(.25,.8,.25,1);-webkit-transform-origin:left top;transform-origin:left top}[dir=rtl] md-input-container:not([md-no-float]) .md-select-placeholder span:first-child{-webkit-transform-origin:right top;transform-origin:right top}md-input-container.md-input-focused:not([md-no-float]) .md-select-placeholder span:first-child{-webkit-transform:translateY(-22px) translateX(-2px) scale(.75);transform:translateY(-22px) translateX(-2px) scale(.75)}.md-select-menu-container{position:fixed;left:0;top:0;z-index:90;opacity:0;display:none;-webkit-transform:translateY(-1px);transform:translateY(-1px)}.md-select-menu-container:not(.md-clickable){pointer-events:none}.md-select-menu-container md-progress-circular{display:table;margin:24px auto!important}.md-select-menu-container.md-active{display:block;opacity:1}.md-select-menu-container.md-active md-select-menu{-webkit-transition:all .4s cubic-bezier(.25,.8,.25,1);transition:all .4s cubic-bezier(.25,.8,.25,1);-webkit-transition-duration:.15s;transition-duration:.15s}.md-select-menu-container.md-active md-select-menu>*{opacity:1;-webkit-transition:all .3s cubic-bezier(.55,0,.55,.2);transition:all .3s cubic-bezier(.55,0,.55,.2);-webkit-transition-duration:.15s;transition-duration:.15s;-webkit-transition-delay:.1s;transition-delay:.1s}.md-select-menu-container.md-leave{opacity:0;-webkit-transition:all .3s cubic-bezier(.55,0,.55,.2);transition:all .3s cubic-bezier(.55,0,.55,.2);-webkit-transition-duration:.25s;transition-duration:.25s}md-input-container>md-select{margin:0;-webkit-box-ordinal-group:3;-webkit-order:2;order:2}md-input-container:not(.md-input-has-value) md-select.ng-required:not(.md-no-asterisk) .md-select-value span:first-child:after,md-input-container:not(.md-input-has-value) md-select[required]:not(.md-no-asterisk) .md-select-value span:first-child:after{content:" *";font-size:13px;vertical-align:top}md-input-container.md-input-invalid md-select .md-select-value{border-bottom-style:solid;padding-bottom:1px}md-select{display:-webkit-box;display:-webkit-flex;display:flex;margin:20px 0 26px}md-select.ng-required.ng-invalid:not(.md-no-asterisk) .md-select-value span:first-child:after,md-select[required].ng-invalid:not(.md-no-asterisk) .md-select-value span:first-child:after{content:" *";font-size:13px;vertical-align:top}md-select[disabled] .md-select-value{background-position:0 bottom;background-size:4px 1px;background-repeat:repeat-x;margin-bottom:-1px}md-select:focus{outline:none}md-select[disabled]:hover{cursor:default}md-select:not([disabled]):hover{cursor:pointer}md-select:not([disabled]).ng-invalid.ng-touched .md-select-value{border-bottom-style:solid;padding-bottom:1px}md-select:not([disabled]):focus .md-select-value{border-bottom-width:2px;border-bottom-style:solid;padding-bottom:0}md-select:not([disabled]):focus.ng-invalid.ng-touched .md-select-value{padding-bottom:0}md-input-container.md-input-has-value .md-select-value>span:not(.md-select-icon){-webkit-transform:translate3d(0,1px,0);transform:translate3d(0,1px,0)}.md-select-value{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:2px 2px 1px;border-bottom-width:1px;border-bottom-style:solid;background-color:transparent;position:relative;box-sizing:content-box;min-width:64px;min-height:26px;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.md-select-value>span:not(.md-select-icon){max-width:100%;-webkit-box-flex:1;-webkit-flex:1 1 auto;flex:1 1 auto;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.md-select-value>span:not(.md-select-icon) .md-text{display:inline}.md-select-value .md-select-icon{display:block;-webkit-box-align:end;-webkit-align-items:flex-end;align-items:flex-end;text-align:end;width:24px;margin:0 4px;-webkit-transform:translate3d(0,-2px,0);transform:translate3d(0,-2px,0);font-size:1.2rem}.md-select-value .md-select-icon:after{display:block;content:"\25BC";position:relative;top:2px;speak:none;font-size:13px;-webkit-transform:scaleY(.5) scaleX(1);transform:scaleY(.5) scaleX(1)}.md-select-value.md-select-placeholder{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-ordinal-group:2;-webkit-order:1;order:1;pointer-events:none;-webkit-font-smoothing:antialiased;padding-left:2px;z-index:1}md-select-menu{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);max-height:256px;min-height:48px;overflow-y:hidden;-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:scale(1);transform:scale(1)}md-select-menu.md-reverse{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-webkit-flex-direction:column-reverse;flex-direction:column-reverse}md-select-menu:not(.md-overflow) md-content{padding-top:8px;padding-bottom:8px}[dir=rtl] md-select-menu{-webkit-transform-origin:right top;transform-origin:right top}md-select-menu md-content{min-width:136px;min-height:48px;max-height:256px;overflow-y:auto}md-select-menu>*{opacity:0}md-option{cursor:pointer;position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;width:auto;-webkit-transition:background .15s linear;transition:background .15s linear;padding:0 16px;height:48px}md-option[disabled]{cursor:default}md-option:focus{outline:none}md-option .md-text{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}md-optgroup{display:block}md-optgroup label{display:block;font-size:14px;text-transform:uppercase;padding:16px;font-weight:500}md-optgroup md-option{padding-left:32px;padding-right:32px}@media screen and (-ms-high-contrast:active){.md-select-backdrop{background-color:transparent}md-select-menu{border:1px solid #fff}}md-select-menu[multiple] md-option.md-checkbox-enabled{padding-left:40px;padding-right:16px}[dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled{padding-left:16px;padding-right:40px}md-select-menu[multiple] md-option.md-checkbox-enabled .md-container{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);box-sizing:border-box;display:inline-block;width:20px;height:20px;left:0;right:auto}[dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled .md-container{left:auto;right:0}md-select-menu[multiple] md-option.md-checkbox-enabled .md-container:before{box-sizing:border-box;background-color:transparent;border-radius:50%;content:"";position:absolute;display:block;height:auto;left:0;top:0;right:0;bottom:0;-webkit-transition:all .5s;transition:all .5s;width:auto}md-select-menu[multiple] md-option.md-checkbox-enabled .md-container:after{box-sizing:border-box;content:"";position:absolute;top:-10px;right:-10px;bottom:-10px;left:-10px}md-select-menu[multiple] md-option.md-checkbox-enabled .md-container .md-ripple-container{position:absolute;display:block;width:auto;height:auto;left:-15px;top:-15px;right:-15px;bottom:-15px}md-select-menu[multiple] md-option.md-checkbox-enabled .md-icon{box-sizing:border-box;-webkit-transition:.24s;transition:.24s;position:absolute;top:0;left:0;width:20px;height:20px;border-width:2px;border-style:solid;border-radius:2px}md-select-menu[multiple] md-option.md-checkbox-enabled[selected] .md-icon{border-color:transparent}md-select-menu[multiple] md-option.md-checkbox-enabled[selected] .md-icon:after{box-sizing:border-box;-webkit-transform:rotate(45deg);transform:rotate(45deg);position:absolute;left:4.66667px;top:.22222px;display:table;width:6.66667px;height:13.33333px;border-width:2px;border-style:solid;border-top:0;border-left:0;content:""}md-select-menu[multiple] md-option.md-checkbox-enabled[disabled]{cursor:default}md-select-menu[multiple] md-option.md-checkbox-enabled.md-indeterminate .md-icon:after{box-sizing:border-box;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);display:table;width:12px;height:2px;border-width:2px;border-style:solid;border-top:0;border-left:0;content:""}md-select-menu[multiple] md-option.md-checkbox-enabled .md-container{margin-left:10.66667px;margin-right:auto}[dir=rtl] md-select-menu[multiple] md-option.md-checkbox-enabled .md-container{margin-left:auto;margin-right:10.66667px}
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.min.js b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.min.js new file mode 100644 index 00000000..aa6c6704 --- /dev/null +++ b/vnfmarket/src/main/webapp/common/thirdparty/angular-material/modules/js/select/select.min.js @@ -0,0 +1,7 @@ +/*! + * Angular Material Design + * https://github.com/angular/material + * @license MIT + * v1.1.2-master-a9ba340 + */ +!function(e,t,n){"use strict";function i(e,i,r,l,o,a,d,s){function c(s,c){var u=t.element("<md-select-value><span></span></md-select-value>");if(u.append('<span class="md-select-icon" aria-hidden="true"></span>'),u.addClass("md-select-value"),u[0].hasAttribute("id")||u.attr("id","select_value_label_"+i.nextUid()),s.find("md-content").length||s.append(t.element("<md-content>").append(s.contents())),c.mdOnOpen&&(s.find("md-content").prepend(t.element('<div> <md-progress-circular md-mode="indeterminate" ng-if="$$loadingAsyncDone === false" md-diameter="25px"></md-progress-circular></div>')),s.find("md-option").attr("ng-show","$$loadingAsyncDone")),c.name){var p=t.element('<select class="md-visually-hidden">');p.attr({name:c.name,"aria-hidden":"true",tabindex:"-1"});var f=s.find("md-option");t.forEach(f,function(e){var n=t.element("<option>"+e.innerHTML+"</option>");e.hasAttribute("ng-value")?n.attr("ng-value",e.getAttribute("ng-value")):e.hasAttribute("value")&&n.attr("value",e.getAttribute("value")),p.append(n)}),p.append('<option ng-value="'+c.ngModel+'" selected></option>'),s.parent().append(p)}var m=i.parseAttributeBoolean(c.multiple),h=m?"multiple":"",g='<div class="md-select-menu-container" aria-hidden="true"><md-select-menu {0}>{1}</md-select-menu></div>';return g=i.supplant(g,[h,s.html()]),s.empty().append(u),s.append(g),c.tabindex||c.$set("tabindex",0),function(s,c,u,p){function f(){var e=c.attr("aria-label")||c.attr("placeholder");!e&&k&&k.label&&(e=k.label.text()),C=e,o.expect(c,"aria-label",e)}function h(){R&&(V=V||R.find("md-select-menu").controller("mdSelectMenu"),S.setLabelText(V.selectedLabels()))}function g(){if(C){var e=V.selectedLabels({mode:"aria"});c.attr("aria-label",e.length?C+": "+e:C)}}function v(){k&&k.setHasValue(V.selectedLabels().length>0||(c[0].validity||{}).badInput)}function b(){if(R=t.element(c[0].querySelector(".md-select-menu-container")),P=s,u.mdContainerClass){var e=R[0].getAttribute("class")+" "+u.mdContainerClass;R[0].setAttribute("class",e)}V=R.find("md-select-menu").controller("mdSelectMenu"),V.init(x,u.ngModel),c.on("$destroy",function(){R.remove()})}function $(e){if(r.isNavigationKey(e))e.preventDefault(),y(e);else if(r.isInputKey(e)||r.isNumPadKey(e)){e.preventDefault();var n=V.optNodeForKeyboardSearch(e);if(!n||n.hasAttribute("disabled"))return;var i=t.element(n).controller("mdOption");V.isMultiple||V.deselect(Object.keys(V.selected)[0]),V.select(i.hashKey,i.value),V.refreshViewValue()}}function y(){P._mdSelectIsOpen=!0,c.attr("aria-expanded","true"),e.show({scope:P,preserveScope:!0,skipCompile:!0,element:R,target:c[0],selectCtrl:S,preserveElement:!0,hasBackdrop:!0,loadingAsync:!!u.mdOnOpen&&(s.$eval(u.mdOnOpen)||!0)})["finally"](function(){P._mdSelectIsOpen=!1,c.focus(),c.attr("aria-expanded","false"),x.$setTouched()})}var w,C,M=!0,k=p[0],S=p[1],x=p[2],A=p[3],O=c.find("md-select-value"),E=t.isDefined(u.readonly),T=i.parseAttributeBoolean(u.mdNoAsterisk);if(T&&c.addClass("md-no-asterisk"),k){var D=k.isErrorGetter||function(){return x.$invalid&&(x.$touched||A&&A.$submitted)};if(k.input&&c.find("md-select-header").find("input")[0]!==k.input[0])throw new Error("<md-input-container> can only have *one* child <input>, <textarea> or <select> element!");k.input=c,k.label||o.expect(c,"aria-label",c.attr("placeholder")),s.$watch(D,k.setInvalid)}var R,P,V;b(),l(c),A&&t.isDefined(u.multiple)&&i.nextTick(function(){var e=x.$modelValue||x.$viewValue;e&&A.$setPristine()});var N=x.$render;x.$render=function(){N(),h(),g(),v()},u.$observe("placeholder",x.$render),k&&k.label&&u.$observe("required",function(e){k.label.toggleClass("md-required",e&&!T)}),S.setLabelText=function(e){S.setIsPlaceholder(!e);var t=!1;if(u.mdSelectedText&&u.mdSelectedHtml)throw Error("md-select cannot have both `md-selected-text` and `md-selected-html`");if(u.mdSelectedText||u.mdSelectedHtml)e=a(u.mdSelectedText||u.mdSelectedHtml)(s),t=!0;else if(!e){var n=u.placeholder||(k&&k.label?k.label.text():"");e=n||"",t=!0}var i=O.children().eq(0);u.mdSelectedHtml?i.html(d.getTrustedHtml(e)):t?i.text(e):i.html(e)},S.setIsPlaceholder=function(e){e?(O.addClass("md-select-placeholder"),k&&k.label&&k.label.addClass("md-placeholder")):(O.removeClass("md-select-placeholder"),k&&k.label&&k.label.removeClass("md-placeholder"))},E||(c.on("focus",function(e){k&&k.setFocused(!0)}),c.on("blur",function(e){M&&(M=!1,P._mdSelectIsOpen&&e.stopImmediatePropagation()),P._mdSelectIsOpen||(k&&k.setFocused(!1),v())})),S.triggerClose=function(){a(u.mdOnClose)(s)},s.$$postDigest(function(){f(),h(),g()}),s.$watch(function(){return V.selectedLabels()},h);var B;u.$observe("ngMultiple",function(e){B&&B();var t=a(e);B=s.$watch(function(){return t(s)},function(e,t){e===n&&t===n||(e?c.attr("multiple","multiple"):c.removeAttr("multiple"),c.attr("aria-multiselectable",e?"true":"false"),R&&(V.setMultiple(e),N=x.$render,x.$render=function(){N(),h(),g(),v()},x.$render()))})}),u.$observe("disabled",function(e){t.isString(e)&&(e=!0),w!==n&&w===e||(w=e,e?c.attr({"aria-disabled":"true"}).removeAttr("tabindex").off("click",y).off("keydown",$):c.attr({tabindex:u.tabindex,"aria-disabled":"false"}).on("click",y).on("keydown",$))}),u.hasOwnProperty("disabled")||u.hasOwnProperty("ngDisabled")||(c.attr({"aria-disabled":"false"}),c.on("click",y),c.on("keydown",$));var I={role:"listbox","aria-expanded":"false","aria-multiselectable":m&&!u.ngMultiple?"true":"false"};c[0].hasAttribute("id")||(I.id="select_"+i.nextUid());var L="select_container_"+i.nextUid();R.attr("id",L),I["aria-owns"]=L,c.attr(I),s.$on("$destroy",function(){e.destroy()["finally"](function(){k&&(k.setFocused(!1),k.setHasValue(!1),k.input=null),x.$setTouched()})})}}var u=r.KEY_CODE;[u.SPACE,u.ENTER,u.UP_ARROW,u.DOWN_ARROW];return{restrict:"E",require:["^?mdInputContainer","mdSelect","ngModel","?^form"],compile:c,controller:function(){}}}function r(e,i,r,l){function o(e,n,r,o){function a(e){13!=e.keyCode&&32!=e.keyCode||d(e)}function d(n){var r=i.getClosest(n.target,"md-option"),l=r&&t.element(r).data("$mdOptionController");if(r&&l){if(r.hasAttribute("disabled"))return n.stopImmediatePropagation(),!1;var o=s.hashGetter(l.value),a=t.isDefined(s.selected[o]);e.$apply(function(){s.isMultiple?a?s.deselect(o):s.select(o,l.value):a||(s.deselect(Object.keys(s.selected)[0]),s.select(o,l.value)),s.refreshViewValue()})}}var s=o[0];n.addClass("_md"),l(n),n.on("click",d),n.on("keypress",a)}function a(l,o,a){function d(){var e=u.ngModel.$modelValue||u.ngModel.$viewValue||[];if(t.isArray(e)){var n=Object.keys(u.selected),i=e.map(u.hashGetter),r=n.filter(function(e){return i.indexOf(e)===-1});r.forEach(u.deselect),i.forEach(function(t,n){u.select(t,e[n])})}}function s(){var e=u.ngModel.$viewValue||u.ngModel.$modelValue;Object.keys(u.selected).forEach(u.deselect),u.select(u.hashGetter(e),e)}var u=this;u.isMultiple=t.isDefined(o.multiple),u.selected={},u.options={},l.$watchCollection(function(){return u.options},function(){u.ngModel.$render()});var p,f;u.setMultiple=function(e){function n(e,n){return t.isArray(e||n||[])}var i=u.ngModel;f=f||i.$isEmpty,u.isMultiple=e,p&&p(),u.isMultiple?(i.$validators["md-multiple"]=n,i.$render=d,l.$watchCollection(u.modelBinding,function(e){n(e)&&d(e),u.ngModel.$setPristine()}),i.$isEmpty=function(e){return!e||0===e.length}):(delete i.$validators["md-multiple"],i.$render=s)};var m,h,g,v="",b=300;u.optNodeForKeyboardSearch=function(e){m&&clearTimeout(m),m=setTimeout(function(){m=n,v="",g=n,h=n},b);var i=e.keyCode-(r.isNumPadKey(e)?48:0);v+=String.fromCharCode(i);var l=new RegExp("^"+v,"i");h||(h=a.find("md-option"),g=new Array(h.length),t.forEach(h,function(e,t){g[t]=e.textContent.trim()}));for(var o=0;o<g.length;++o)if(l.test(g[o]))return h[o]},u.init=function(n,r){u.ngModel=n,u.modelBinding=r,u.ngModel.$isEmpty=function(e){return!u.options[u.hashGetter(e)]};var o=i.getModelOption(n,"trackBy");if(o){var a={},d=e(o);u.hashGetter=function(e,t){return a.$value=e,d(t||l,a)}}else u.hashGetter=function(e){return t.isObject(e)?"object_"+(e.$$mdSelectId||(e.$$mdSelectId=++c)):e};u.setMultiple(u.isMultiple)},u.selectedLabels=function(e){e=e||{};var t=e.mode||"html",n=i.nodesToArray(a[0].querySelectorAll("md-option[selected]"));if(n.length){var r;return"html"==t?r=function(e){if(e.hasAttribute("md-option-empty"))return"";var t=e.innerHTML,n=e.querySelector(".md-ripple-container");n&&(t=t.replace(n.outerHTML,""));var i=e.querySelector(".md-container");return i&&(t=t.replace(i.outerHTML,"")),t}:"aria"==t&&(r=function(e){return e.hasAttribute("aria-label")?e.getAttribute("aria-label"):e.textContent}),i.uniq(n.map(r)).join(", ")}return""},u.select=function(e,t){var n=u.options[e];n&&n.setSelected(!0),u.selected[e]=t},u.deselect=function(e){var t=u.options[e];t&&t.setSelected(!1),delete u.selected[e]},u.addOption=function(e,n){if(t.isDefined(u.options[e]))throw new Error('Duplicate md-option values are not allowed in a select. Duplicate value "'+n.value+'" found.');u.options[e]=n,t.isDefined(u.selected[e])&&(u.select(e,n.value),t.isDefined(u.ngModel.$modelValue)&&u.hashGetter(u.ngModel.$modelValue)===e&&u.ngModel.$validate(),u.refreshViewValue())},u.removeOption=function(e){delete u.options[e]},u.refreshViewValue=function(){var e,n=[];for(var r in u.selected)(e=u.options[r])?n.push(e.value):n.push(u.selected[r]);var l=i.getModelOption(u.ngModel,"trackBy"),o=u.isMultiple?n:n[0],a=u.ngModel.$modelValue;(l?t.equals(a,o):a===o)||(u.ngModel.$setViewValue(o),u.ngModel.$render())}}return a.$inject=["$scope","$attrs","$element"],{restrict:"E",require:["mdSelectMenu"],scope:!1,controller:a,link:{pre:o}}}function l(e,n){function i(e,n){return e.append(t.element('<div class="md-text">').append(e.contents())),e.attr("tabindex",n.tabindex||"0"),r(n)||e.attr("md-option-empty",""),l}function r(e){var t=e.value,n=e.ngValue;return t||n}function l(i,r,l,o){function a(e,t,n){if(!c.hashGetter)return void(n||i.$$postDigest(function(){a(e,t,!0)}));var r=c.hashGetter(t,i),l=c.hashGetter(e,i);s.hashKey=l,s.value=e,c.removeOption(r,s),c.addOption(l,s)}function d(){var e={role:"option","aria-selected":"false"};r[0].hasAttribute("id")||(e.id="select_option_"+n.nextUid()),r.attr(e)}var s=o[0],c=o[1];c.isMultiple&&(r.addClass("md-checkbox-enabled"),r.prepend(u.clone())),t.isDefined(l.ngValue)?i.$watch(l.ngValue,a):t.isDefined(l.value)?a(l.value):i.$watch(function(){return r.text().trim()},a),l.$observe("disabled",function(e){e?r.attr("tabindex","-1"):r.attr("tabindex","0")}),i.$$postDigest(function(){l.$observe("selected",function(e){t.isDefined(e)&&("string"==typeof e&&(e=!0),e?(c.isMultiple||c.deselect(Object.keys(c.selected)[0]),c.select(s.hashKey,s.value)):c.deselect(s.hashKey),c.refreshViewValue())})}),e.attach(i,r),d(),i.$on("$destroy",function(){c.removeOption(s.hashKey,s)})}function o(e){this.selected=!1,this.setSelected=function(t){t&&!this.selected?e.attr({selected:"selected","aria-selected":"true"}):!t&&this.selected&&(e.removeAttr("selected"),e.attr("aria-selected","false")),this.selected=t}}return o.$inject=["$element"],{restrict:"E",require:["mdOption","^^mdSelectMenu"],controller:o,compile:i}}function o(){function e(e,n){function i(){return e.parent().find("md-select-header").length}function r(){var i=e.find("label");i.length||(i=t.element("<label>"),e.prepend(i)),i.addClass("md-container-ignore"),n.label&&i.text(n.label)}i()||r()}return{restrict:"E",compile:e}}function a(){return{restrict:"E"}}function d(i){function r(i,r,c,u,p,f,m,h,g){function v(e,t,n){function i(){return m(t,{addClass:"md-leave"}).start()}function r(){t.removeClass("md-active"),t.attr("aria-hidden","true"),t[0].style.display="none",$(n),!n.$destroy&&n.restoreFocus&&n.target.focus()}return n=n||{},n.cleanupInteraction(),n.cleanupResizing(),n.hideBackdrop(),n.$destroy===!0?r():i().then(r)}function b(e,l,o){function a(e,t,n){return n.parent.append(t),p(function(e,n){try{m(t,{removeClass:"md-leave",duration:0}).start().then(d).then(e)}catch(i){n(i)}})}function d(){return p(function(t){if(o.isRemoved)return p.reject(!1);var n=y(e,l,o);n.container.element.css(C.toCss(n.container.styles)),n.dropDown.element.css(C.toCss(n.dropDown.styles)),f(function(){l.addClass("md-active"),n.dropDown.element.css(C.toCss({transform:""})),v(o.focusedNode),t()})})}function s(e,t,n){return n.disableParentScroll&&!c.getClosest(n.target,"MD-DIALOG")?n.restoreScroll=c.disableScrollAround(n.element,n.parent):n.disableParentScroll=!1,n.hasBackdrop&&(n.backdrop=c.createBackdrop(e,"md-select-backdrop md-click-catcher"),h.enter(n.backdrop,g[0].body,null,{duration:0})),function(){n.backdrop&&n.backdrop.remove(),n.disableParentScroll&&n.restoreScroll(),delete n.restoreScroll}}function v(e){e&&!e.hasAttribute("disabled")&&e.focus()}function b(e,n){var i=l.find("md-select-menu");if(!n.target)throw new Error(c.supplant(w,[n.target]));t.extend(n,{isRemoved:!1,target:t.element(n.target),parent:t.element(n.parent),selectEl:i,contentEl:l.find("md-content"),optionNodes:i[0].getElementsByTagName("md-option")})}function $(){var n=function(e,t,n){return function(){if(!n.isRemoved){var i=y(e,t,n),r=i.container,l=i.dropDown;r.element.css(C.toCss(r.styles)),l.element.css(C.toCss(l.styles))}}}(e,l,o),i=t.element(u);return i.on("resize",n),i.on("orientationchange",n),function(){i.off("resize",n),i.off("orientationchange",n)}}function k(){o.loadingAsync&&!o.isRemoved&&(e.$$loadingAsyncDone=!1,p.when(o.loadingAsync).then(function(){e.$$loadingAsyncDone=!0,delete o.loadingAsync}).then(function(){f(d)}))}function S(){function e(e){e.preventDefault(),e.stopPropagation(),o.restoreFocus=!1,c.nextTick(i.hide,!0)}function t(e){switch(e.preventDefault(),e.stopPropagation(),e.keyCode){case M.UP_ARROW:return s();case M.DOWN_ARROW:return d();case M.SPACE:case M.ENTER:var t=c.getClosest(e.target,"md-option");t&&(p.triggerHandler({type:"click",target:t}),e.preventDefault()),u(e);break;case M.TAB:case M.ESCAPE:e.stopPropagation(),e.preventDefault(),o.restoreFocus=!0,c.nextTick(i.hide,!0);break;default:if(r.isInputKey(e)||r.isNumPadKey(e)){var n=p.controller("mdSelectMenu").optNodeForKeyboardSearch(e);o.focusedNode=n||o.focusedNode,n&&n.focus()}}}function a(e){var t,i=c.nodesToArray(o.optionNodes),r=i.indexOf(o.focusedNode);do r===-1?r=0:"next"===e&&r<i.length-1?r++:"prev"===e&&r>0&&r--,t=i[r],t.hasAttribute("disabled")&&(t=n);while(!t&&r<i.length-1&&r>0);t&&t.focus(),o.focusedNode=t}function d(){a("next")}function s(){a("prev")}function u(e){function t(){var t=!1;if(e&&e.currentTarget.children.length>0){var n=e.currentTarget.children[0],i=n.scrollHeight>n.clientHeight;if(i&&n.children.length>0){var r=e.pageX-e.currentTarget.getBoundingClientRect().left;r>n.querySelector("md-option").offsetWidth&&(t=!0)}}return t}if(!(e&&"click"==e.type&&e.currentTarget!=p[0]||t())){var n=c.getClosest(e.target,"md-option");n&&n.hasAttribute&&!n.hasAttribute("disabled")&&(e.preventDefault(),e.stopPropagation(),f.isMultiple||(o.restoreFocus=!0,c.nextTick(function(){i.hide(f.ngModel.$viewValue)},!0)))}}if(!o.isRemoved){var p=o.selectEl,f=p.controller("mdSelectMenu")||{};return l.addClass("md-clickable"),o.backdrop&&o.backdrop.on("click",e),p.on("keydown",t),p.on("click",u),function(){o.backdrop&&o.backdrop.off("click",e),p.off("keydown",t),p.off("click",u),l.removeClass("md-clickable"),o.isRemoved=!0}}}return k(),b(e,o),o.hideBackdrop=s(e,l,o),a(e,l,o).then(function(e){return l.attr("aria-hidden","false"),o.alreadyOpen=!0,o.cleanupInteraction=S(),o.cleanupResizing=$(),e},o.hideBackdrop)}function $(e){var t=e.selectCtrl;if(t){var n=e.selectEl.controller("mdSelectMenu");t.setLabelText(n?n.selectedLabels():""),t.triggerClose()}}function y(n,i,r){var p,f=i[0],m=r.target[0].children[0],h=g[0].body,v=r.selectEl[0],b=r.contentEl[0],$=h.getBoundingClientRect(),y=m.getBoundingClientRect(),w=!1,C={left:$.left+s,top:s,bottom:$.height-s,right:$.width-s-(c.floatingScrollbars()?16:0)},M={top:y.top-C.top,left:y.left-C.left,right:C.right-(y.left+y.width),bottom:C.bottom-(y.top+y.height)},k=$.width-2*s,S=v.querySelector("md-option[selected]"),x=v.getElementsByTagName("md-option"),A=v.getElementsByTagName("md-optgroup"),O=d(i,b),E=l(r.loadingAsync);p=E?b.firstElementChild||b:S?S:A.length?A[0]:x.length?x[0]:b.firstElementChild||b,b.offsetWidth>k?b.style["max-width"]=k+"px":b.style.maxWidth=null,w&&(b.style["min-width"]=y.width+"px"),O&&v.classList.add("md-overflow");var T=p;"MD-OPTGROUP"===(T.tagName||"").toUpperCase()&&(T=x[0]||b.firstElementChild||b,p=T),r.focusedNode=T,f.style.display="block";var D=v.getBoundingClientRect(),R=a(p);if(p){var P=u.getComputedStyle(p);R.paddingLeft=parseInt(P.paddingLeft,10)||0,R.paddingRight=parseInt(P.paddingRight,10)||0}if(O){var V=b.offsetHeight/2;b.scrollTop=R.top+R.height/2-V,M.top<V?b.scrollTop=Math.min(R.top,b.scrollTop+V-M.top):M.bottom<V&&(b.scrollTop=Math.max(R.top+R.height-D.height,b.scrollTop-V+M.bottom))}var N,B,I,L,_;w?(N=y.left,B=y.top+y.height,I="50% 0",B+D.height>C.bottom&&(B=y.top-D.height,I="50% 100%")):(N=y.left+R.left-R.paddingLeft+2,B=Math.floor(y.top+y.height/2-R.height/2-R.top+b.scrollTop)+2,I=R.left+y.width/2+"px "+(R.top+R.height/2-b.scrollTop)+"px 0px",L=Math.min(y.width+R.paddingLeft+R.paddingRight,k),_=e.getComputedStyle(m)["font-size"]);var H=f.getBoundingClientRect(),j=Math.round(100*Math.min(y.width/D.width,1))/100,K=Math.round(100*Math.min(y.height/D.height,1))/100;return{container:{element:t.element(f),styles:{left:Math.floor(o(C.left,N,C.right-H.width)),top:Math.floor(o(C.top,B,C.bottom-H.height)),"min-width":L,"font-size":_}},dropDown:{element:t.element(v),styles:{transformOrigin:I,transform:r.alreadyOpen?"":c.supplant("scale({0},{1})",[j,K])}}}}var w="$mdSelect.show() expected a target element in options.target but got '{0}'!",C=c.dom.animator,M=r.KEY_CODE;return{parent:"body",themable:!0,onShow:b,onRemove:v,hasBackdrop:!0,disableParentScroll:!0}}function l(e){return e&&t.isFunction(e.then)}function o(e,t,n){return Math.max(e,Math.min(t,n))}function a(e){return e?{left:e.offsetLeft,top:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}:{left:0,top:0,width:0,height:0}}function d(e,t){var n=!1;try{var i=e[0].style.display;e[0].style.display="block",n=t.scrollHeight>t.offsetHeight,e[0].style.display=i}finally{}return n}return r.$inject=["$mdSelect","$mdConstant","$mdUtil","$window","$q","$$rAF","$animateCss","$animate","$document"],i("$mdSelect").setDefaults({methods:["target"],options:r})}i.$inject=["$mdSelect","$mdUtil","$mdConstant","$mdTheming","$mdAria","$parse","$sce","$injector"],r.$inject=["$parse","$mdUtil","$mdConstant","$mdTheming"],l.$inject=["$mdButtonInkRipple","$mdUtil"],d.$inject=["$$interimElementProvider"];var s=8,c=0,u=t.element('<div class="md-container"><div class="md-icon"></div></div>');t.module("material.components.select",["material.core","material.components.backdrop"]).directive("mdSelect",i).directive("mdSelectMenu",r).directive("mdOption",l).directive("mdOptgroup",o).directive("mdSelectHeader",a).provider("$mdSelect",d)}(window,window.angular);
\ No newline at end of file |