├── .travis.yml ├── API.md ├── LICENSE ├── README.md ├── bower.json ├── deploy.sh ├── dist ├── ax5select.css ├── ax5select.js ├── ax5select.min.js └── ax5select.min.js.map ├── karma.conf.js ├── package.json ├── src ├── ax5select.js ├── ax5select.scss ├── modules │ └── ax5select-tmpl.js └── scss │ ├── _ax5select.scss │ └── _ax5select_variables.scss └── test ├── bower.json ├── index.html ├── index2.html ├── input-group.html ├── option-group.html ├── search.html ├── test.select.html └── test.select.js /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "4" 4 | before_script: 5 | - export CHROME_BIN=chromium-browser 6 | - export DISPLAY=:99.0 7 | - sh -e /etc/init.d/xvfb start -------------------------------------------------------------------------------- /API.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## ax5select 4 | **Kind**: global class 5 | **Author:** tom@axisj.com 6 | 7 | * [ax5select](#ax5select) 8 | * [.setConfig(config)](#ax5select.setConfig) ⇒ [ax5select](#ax5select) 9 | * [.bind(item)](#ax5select.bind) ⇒ [ax5select](#ax5select) 10 | * [.open(boundID, [tryCount])](#ax5select.open) ⇒ [ax5select](#ax5select) 11 | * [.update(item)](#ax5select.update) ⇒ [ax5select](#ax5select) 12 | * [.setOptions(boundID, options)](#ax5select.setOptions) ⇒ [ax5select](#ax5select) 13 | * [.val(boundID, [value], [selected])](#ax5select.val) ⇒ [ax5select](#ax5select) 14 | * [.close()](#ax5select.close) ⇒ [ax5select](#ax5select) 15 | 16 | 17 | 18 | ### ax5select.setConfig(config) ⇒ [ax5select](#ax5select) 19 | Preferences of select UI 20 | 21 | **Kind**: static method of [ax5select](#ax5select) 22 | 23 | | Param | Type | Description | 24 | | --- | --- | --- | 25 | | config | Object | 클래스 속성값 | 26 | 27 | **Example** 28 | ```js 29 | var options = []; 30 | for (var i = 0; i < 20; i++) { 31 | options.push({value: i, text: "optionText" + i}); 32 | } 33 | var mySelect = new ax5.ui.select({ 34 | theme: "danger" 35 | }); 36 | mySelect.bind({ 37 | theme: "primary", 38 | target: $('[data-ax5select="select1"]'), 39 | options: options, 40 | onChange: function () { 41 | console.log(this); 42 | }, 43 | onClose: function () { 44 | console.log(this); 45 | }, 46 | onStateChanged: function () { 47 | console.log(this); 48 | } 49 | }); 50 | ``` 51 | 52 | 53 | ### ax5select.bind(item) ⇒ [ax5select](#ax5select) 54 | bind select 55 | 56 | **Kind**: static method of [ax5select](#ax5select) 57 | 58 | | Param | Type | 59 | | --- | --- | 60 | | item | Object | 61 | | [item.id] | String | 62 | | [item.theme] | String | 63 | | [item.multiple] | Boolean | 64 | | item.target | Element | 65 | | item.options | Array.<Object> | 66 | 67 | **Example** 68 | ```js 69 | var mySelect = new ax5.ui.select(); 70 | mySelect.bind({ 71 | columnKeys: { 72 | optionValue: "value", 73 | optionText: "text" 74 | }, 75 | target: $('[data-ax5select="select1"]'), 76 | options: [ 77 | {value: "", text: ""} 78 | ], 79 | onChange: function(){ 80 | 81 | }, 82 | onClose: function(){ 83 | 84 | }, 85 | onStateChanged: function(){ 86 | 87 | } 88 | }); 89 | ``` 90 | 91 | 92 | ### ax5select.open(boundID, [tryCount]) ⇒ [ax5select](#ax5select) 93 | open the optionBox of select 94 | 95 | **Kind**: static method of [ax5select](#ax5select) 96 | 97 | | Param | Type | 98 | | --- | --- | 99 | | boundID | String | Number | Element | 100 | | [tryCount] | Number | 101 | 102 | 103 | 104 | ### ax5select.update(item) ⇒ [ax5select](#ax5select) 105 | **Kind**: static method of [ax5select](#ax5select) 106 | 107 | | Param | Type | 108 | | --- | --- | 109 | | item | Object | String | 110 | 111 | 112 | 113 | ### ax5select.setOptions(boundID, options) ⇒ [ax5select](#ax5select) 114 | **Kind**: static method of [ax5select](#ax5select) 115 | 116 | | Param | 117 | | --- | 118 | | boundID | 119 | | options | 120 | 121 | 122 | 123 | ### ax5select.val(boundID, [value], [selected]) ⇒ [ax5select](#ax5select) 124 | **Kind**: static method of [ax5select](#ax5select) 125 | 126 | | Param | Type | 127 | | --- | --- | 128 | | boundID | String | Number | Element | 129 | | [value] | String | Object | Array | 130 | | [selected] | Boolean | 131 | 132 | 133 | 134 | ### ax5select.close() ⇒ [ax5select](#ax5select) 135 | **Kind**: static method of [ax5select](#ax5select) 136 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2016 Thomas Jang, Brant and Team AXISJ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/ax5ui/ax5ui-select.svg?branch=master)](https://travis-ci.org/ax5ui/ax5ui-select) 2 | [![npm version](https://badge.fury.io/js/ax5ui-select.svg)](https://badge.fury.io/js/ax5ui-select) 3 | [![](https://img.shields.io/npm/dm/ax5ui-select.svg)](https://www.npmjs.com/package/ax5ui-select) 4 | 5 | # ax5ui-select 6 | "select" allows users to select a collection of items. 7 | 8 | > *Dependencies* 9 | > * _[jQuery 1.X+](http://jquery.com/)_ 10 | > * _[ax5core](http://ax5.io/ax5core)_ 11 | > * _[bootstrap](http://getbootstrap.com/)_ 12 | 13 | 14 | ### Install with bower 15 | ```sh 16 | bower install ax5ui-select 17 | ``` 18 | [bower](http://bower.io/#install-bower) is web front-end package manager. 19 | When you install `bower`, it will be installed under the `bower_components` folder to resolve the plug-in dependencies. 20 | (You can change the folder location. [.bowerrc](http://bower.io/docs/config/#bowerrc-specification) ) 21 | 22 | It is recommended that you install by using `bower`. 23 | If you've never used bower, please refer to [http://bower.io/#install-bower](http://bower.io/#install-bower). 24 | 25 | ### Install with npm 26 | If you do not use bower, it also can be installed by using npm as an alternative. 27 | In case of npm, which is the package manager for the front end, you need to solve the problem of plug-in dependencies. 28 | 29 | ```sh 30 | npm install jquery 31 | npm install ax5core 32 | npm install ax5ui-select 33 | ``` 34 | 35 | After downloading the install file of npm, you will need to copy it to the location where you want to use as a resource for the project. 36 | If the copy process is inconvenient, it also can be done easily by using `gulp` or `grunt`. 37 | 38 | ### Download code 39 | - [ax5core Github releases](https://github.com/ax5ui/ax5core/releases) 40 | - [ax5ui-select Github releases](https://github.com/ax5ui/ax5ui-select/releases) 41 | 42 | 43 | * * * 44 | 45 | ### Insert "ax5select" in HTML HEAD 46 | 47 | Folder location can be any for your project. However, please be sure to assign the right path in the project. 48 | ```html 49 | 50 | 51 | 52 | 53 | ``` 54 | 55 | **CDN urls** 56 | This is a list of CDN urls for ax5ui-select. ax5ui offers the CDN services through rawgit. 57 | ``` 58 | https://cdn.rawgit.com/ax5ui/ax5ui-select/master/dist/ax5select.css 59 | https://cdn.rawgit.com/ax5ui/ax5ui-select/master/dist/ax5select.js 60 | https://cdn.rawgit.com/ax5ui/ax5ui-select/master/dist/ax5select.min.js 61 | ``` 62 | 63 | ### Basic Usage 64 | ```html 65 |
66 |
67 |
68 | ``` 69 | ```js 70 | var options = []; 71 | for (var i = 0; i < 100; i++) { 72 | options.push({value: "optionValue" + i, text: "optionText" + i}); 73 | } 74 | 75 | $('[data-ax5select]').ax5select({ 76 | options: options 77 | }); 78 | ``` 79 | 80 | 81 | *** 82 | 83 | ## Preview 84 | - [See Demonstration](http://ax5.io/ax5ui-select/demo/index.html) 85 | 86 | If you have any questions, please refer to the following [gitHub](https://github.com/ax5ui/ax5ui-kernel) 87 | 88 | ## Question 89 | - https://jsdev.kr/c/axisj/ax5ui 90 | - https://github.com/ax5ui/ax5ui-kernel/issues 91 | 92 | [![axisj-contributed](https://img.shields.io/badge/AXISJ.com-Contributed-green.svg)](https://github.com/axisj) 93 | ![](https://img.shields.io/badge/Seowoo-Mondo&Thomas-red.svg) 94 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ax5ui-select", 3 | "version": "1.4.131", 4 | "description": "A select plugin that works with Bootstrap & jQuery", 5 | "authors": [ 6 | "ThomasJ " 7 | ], 8 | "main": "dist/ax5select.js", 9 | "keywords": [ 10 | "bootstrap", 11 | "jquery", 12 | "ax5ui", 13 | "plugin", 14 | "bootstrap jQuery plugins", 15 | "select", 16 | "ax5ui-select", 17 | "javascript ui" 18 | ], 19 | "dependencies": { 20 | "jquery": "", 21 | "ax5core": ">=1.4.115" 22 | }, 23 | "license": "MIT", 24 | "homepage": "ax5.io" 25 | } -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | VERSION=`jq '.version' package.json | sed -e 's/^"//' -e 's/"$//'` 2 | 3 | git tag -a $VERSION -m $VERSION || true 4 | 5 | git push origin HEAD:master --follow-tags --force || true 6 | 7 | npm publish || true 8 | -------------------------------------------------------------------------------- /dist/ax5select.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2017. tom@axisj.com 3 | * - github.com/thomasjang 4 | * - www.axisj.com 5 | *//*! 6 | * Copyright (c) 2017. tom@axisj.com 7 | * - github.com/thomasjang 8 | * - www.axisj.com 9 | */fieldset{padding:0;margin:0;border:0;min-width:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:bold}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type="file"]{display:block}input[type="range"]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857;color:#555}.form-control{box-sizing:border-box;display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;-o-transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{border:0;background-color:transparent}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type="search"]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio: 0){input[type="date"].form-control,input[type="time"].form-control,input[type="datetime-local"].form-control,input[type="month"].form-control{line-height:34px}input[type="date"].input-sm,.input-group-sm>input[type="date"].form-control,.input-group-sm>input[type="date"].input-group-addon,.input-group-sm>.input-group-btn>input[type="date"].btn,.input-group-sm input[type="date"],input[type="time"].input-sm,.input-group-sm>input[type="time"].form-control,.input-group-sm>input[type="time"].input-group-addon,.input-group-sm>.input-group-btn>input[type="time"].btn,.input-group-sm input[type="time"],input[type="datetime-local"].input-sm,.input-group-sm>input[type="datetime-local"].form-control,.input-group-sm>input[type="datetime-local"].input-group-addon,.input-group-sm>.input-group-btn>input[type="datetime-local"].btn,.input-group-sm input[type="datetime-local"],input[type="month"].input-sm,.input-group-sm>input[type="month"].form-control,.input-group-sm>input[type="month"].input-group-addon,.input-group-sm>.input-group-btn>input[type="month"].btn,.input-group-sm input[type="month"]{line-height:30px}input[type="date"].input-lg,.input-group-lg>input[type="date"].form-control,.input-group-lg>input[type="date"].input-group-addon,.input-group-lg>.input-group-btn>input[type="date"].btn,.input-group-lg input[type="date"],input[type="time"].input-lg,.input-group-lg>input[type="time"].form-control,.input-group-lg>input[type="time"].input-group-addon,.input-group-lg>.input-group-btn>input[type="time"].btn,.input-group-lg input[type="time"],input[type="datetime-local"].input-lg,.input-group-lg>input[type="datetime-local"].form-control,.input-group-lg>input[type="datetime-local"].input-group-addon,.input-group-lg>.input-group-btn>input[type="datetime-local"].btn,.input-group-lg input[type="datetime-local"],input[type="month"].input-lg,.input-group-lg>input[type="month"].form-control,.input-group-lg>input[type="month"].input-group-addon,.input-group-lg>.input-group-btn>input[type="month"].btn,.input-group-lg input[type="month"]{line-height:46px}}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{position:absolute;margin-left:-20px;margin-top:4px \9}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:normal;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type="radio"][disabled],input[type="radio"].disabled,fieldset[disabled] input[type="radio"],input[type="checkbox"][disabled],input[type="checkbox"].disabled,fieldset[disabled] input[type="checkbox"]{cursor:not-allowed}.radio-inline.disabled,fieldset[disabled] .radio-inline,.checkbox-inline.disabled,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,fieldset[disabled] .radio label,.checkbox.disabled label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0;min-height:34px}.form-control-static.input-lg,.input-group-lg>.form-control-static.form-control,.input-group-lg>.form-control-static.input-group-addon,.input-group-lg>.input-group-btn>.form-control-static.btn,.form-control-static.input-sm,.input-group-sm>.form-control-static.form-control,.input-group-sm>.form-control-static.input-group-addon,.input-group-sm>.input-group-btn>.form-control-static.btn{padding-left:0;padding-right:0}.input-sm,.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm,.input-group-sm>select.form-control,.input-group-sm>select.input-group-addon,.input-group-sm>.input-group-btn>select.btn{height:30px;line-height:30px}textarea.input-sm,.input-group-sm>textarea.form-control,.input-group-sm>textarea.input-group-addon,.input-group-sm>.input-group-btn>textarea.btn,select[multiple].input-sm,.input-group-sm>select[multiple].form-control,.input-group-sm>select[multiple].input-group-addon,.input-group-sm>.input-group-btn>select[multiple].btn{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm textarea.form-control,.form-group-sm select[multiple].form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg,.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33333;border-radius:6px}select.input-lg,.input-group-lg>select.form-control,.input-group-lg>select.input-group-addon,.input-group-lg>.input-group-btn>select.btn{height:46px;line-height:46px}textarea.input-lg,.input-group-lg>textarea.form-control,.input-group-lg>textarea.input-group-addon,.input-group-lg>.input-group-btn>textarea.btn,select[multiple].input-lg,.input-group-lg>select[multiple].form-control,.input-group-lg>select[multiple].input-group-addon,.input-group-lg>.input-group-btn>select[multiple].btn{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg textarea.form-control,.form-group-lg select[multiple].form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.33333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback,.input-group-lg>.form-control+.form-control-feedback,.input-group-lg>.input-group-addon+.form-control-feedback,.input-group-lg>.input-group-btn>.btn+.form-control-feedback,.input-group-lg+.form-control-feedback,.form-group-lg .form-control+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback,.input-group-sm>.form-control+.form-control-feedback,.input-group-sm>.input-group-addon+.form-control-feedback,.input-group-sm>.input-group-btn>.btn+.form-control-feedback,.input-group-sm+.form-control-feedback,.form-group-sm .form-control+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline,.has-success.radio label,.has-success.checkbox label,.has-success.radio-inline label,.has-success.checkbox-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline,.has-warning.radio label,.has-warning.checkbox label,.has-warning.radio-inline label,.has-warning.checkbox-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline,.has-error.radio label,.has-error.checkbox label,.has-error.radio-inline label,.has-error.checkbox-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;border-color:#a94442;background-color:#f2dede}.has-error .form-control-feedback{color:#a94442}.has-feedback label ~ .form-control-feedback{top:25px}.has-feedback label.sr-only ~ .form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width: 768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:7px}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-left:-15px;margin-right:-15px}.form-horizontal .form-group:before,.form-horizontal .form-group:after{content:" ";display:table}.form-horizontal .form-group:after{clear:both}@media (min-width: 768px){.form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:7px}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width: 768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width: 768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*="col-"]{float:none;padding-left:0;padding-right:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:normal;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.input-group-addon.btn{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.input-group-addon.btn{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}[data-ax5select] select[multiple].form-control{height:34px}[data-ax5select] .ax5select-display.input-sm,[data-ax5select] .input-group-sm>.ax5select-display.form-control,[data-ax5select] .input-group-sm>.ax5select-display.input-group-addon,[data-ax5select] .input-group-sm>.input-group-btn>.ax5select-display.btn{height:30px}[data-ax5select] select[multiple].input-sm,[data-ax5select] .input-group-sm>select[multiple].form-control,[data-ax5select] .input-group-sm>select[multiple].input-group-addon,[data-ax5select] .input-group-sm>.input-group-btn>select[multiple].btn{height:30px}[data-ax5select] .ax5select-display.input-lg,[data-ax5select] .input-group-lg>.ax5select-display.form-control,[data-ax5select] .input-group-lg>.ax5select-display.input-group-addon,[data-ax5select] .input-group-lg>.input-group-btn>.ax5select-display.btn{height:46px}[data-ax5select] select[multiple].input-lg,[data-ax5select] .input-group-lg>select[multiple].form-control,[data-ax5select] .input-group-lg>select[multiple].input-group-addon,[data-ax5select] .input-group-lg>.input-group-btn>select[multiple].btn{height:46px}.form-group-sm [data-ax5select] select[multiple].form-control{height:30px}.form-group-lg [data-ax5select] select[multiple].form-control{height:46px}@media (min-width: 768px){.form-inline [data-ax5select]{display:inline-block}}[data-ax5select]{position:relative;overflow:visible;display:block;box-sizing:border-box;margin:0}[data-ax5select] *,[data-ax5select] *:before,[data-ax5select] *:after{box-sizing:border-box}[data-ax5select] select{z-index:1;position:absolute;opacity:0;user-select:none}@-webkit-keyframes ax-select-option-group{from{-webkit-transform:translateY(-10%);opacity:0}to{-webkit-transform:translateY(0%);opacity:1}}@-moz-keyframes ax-select-option-group{from{-moz-transform:translateY(-10%);opacity:0}to{-moz-transform:translateY(0%);opacity:1}}@keyframes ax-select-option-group{from{-webkit-transform:translateY(-10%);-moz-transform:translateY(-10%);-ms-transform:translateY(-10%);-o-transform:translateY(-10%);transform:translateY(-10%);opacity:0}to{-webkit-transform:translateY(0%);-moz-transform:translateY(0%);-ms-transform:translateY(0%);-o-transform:translateY(0%);transform:translateY(0%);opacity:1}}@-webkit-keyframes ax-select-option-group-destroy{from{-webkit-transform:translateY(0%) scaleY(1);opacity:1}to{-webkit-transform:translateY(0%) scaleY(0);opacity:0}}@-moz-keyframes ax-select-option-group-destroy{from{-moz-transform:translateY(0%) scaleY(1);opacity:1}to{-moz-transform:translateY(0%) scaleY(0);opacity:0}}@keyframes ax-select-option-group-destroy{from{-webkit-transform:translateY(0%) scaleY(1);-moz-transform:translateY(0%) scaleY(1);-ms-transform:translateY(0%) scaleY(1);-o-transform:translateY(0%) scaleY(1);transform:translateY(0%) scaleY(1);opacity:1}to{-webkit-transform:translateY(0%) scaleY(0);-moz-transform:translateY(0%) scaleY(0);-ms-transform:translateY(0%) scaleY(0);-o-transform:translateY(0%) scaleY(0);transform:translateY(0%) scaleY(0);opacity:0}}.ax5select-display,.input-group [data-ax5select] .ax5select-display{position:relative;z-index:2;padding:0px;display:block;height:34px;font-size:14px;border-radius:4px;background-color:#fff;background-image:-webkit-linear-gradient(top, #fff,#eee);background-image:linear-gradient(to bottom,#fff,#eee);border:1px solid #ccc;color:#444;text-decoration:none;-webkit-box-shadow:none;box-shadow:none}.ax5select-display:hover,.input-group [data-ax5select] .ax5select-display:hover,.ax5select-display:focus,.input-group [data-ax5select] .ax5select-display:focus{text-decoration:none}.ax5select-display .ax5select-display-table,.input-group [data-ax5select] .ax5select-display .ax5select-display-table{width:100%;height:100%;display:table;border-collapse:collapse;user-select:none}.ax5select-display .ax5select-display-table [data-ax5select-display="label"]{display:table-cell;vertical-align:middle;padding:0px 7px;color:#444;white-space:nowrap}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"]{display:table-cell;vertical-align:middle;width:16px;text-align:center}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-reset{display:none}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed{display:block}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened{display:none}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed{width:16px;text-align:left;line-height:6.363px}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow{content:'';width:0px;height:0px;display:inline-block;border-left:4.5px solid transparent;border-right:4.5px solid transparent;border-top:6.363px solid #444;background:transparent;opacity:1}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened{width:16px;text-align:left;line-height:6.363px}.ax5select-display .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow{content:'';width:0px;height:0px;display:inline-block;border-left:4.5px solid transparent;border-right:4.5px solid transparent;border-bottom:6.363px solid #444;background:transparent;opacity:1}.ax5select-display[data-select-option-group-opened],.input-group [data-ax5select] [data-select-option-group-opened].ax5select-display{-webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,0.2);box-shadow:inset 1px 1px 3px rgba(0,0,0,0.2);background-image:none}.ax5select-display[data-select-option-group-opened] .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-reset{display:block;position:absolute;right:23px;top:0px;height:100%}.ax5select-display[data-select-option-group-opened] .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed{display:none}.ax5select-display[data-select-option-group-opened] .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened{display:block}.ax5select-display.default:hover:not([disabled]),.ax5select-display.default:active:not([disabled]),.ax5select-display.default:focus:not([disabled]),.ax5select-display.default[data-select-option-group-opened]:not([disabled]){border-color:#ccc;color:#555;text-decoration:none}.ax5select-display.default:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.default:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.default:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.default[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow{border-top-color:#555}.ax5select-display.default:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.default:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.default:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.default[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow{border-bottom-color:#555}.ax5select-display.default [disabled]{user-select:none}.ax5select-display.primary:hover:not([disabled]),.ax5select-display.primary:active:not([disabled]),.ax5select-display.primary:focus:not([disabled]),.ax5select-display.primary[data-select-option-group-opened]:not([disabled]){border-color:#337ab7;color:#555;text-decoration:none}.ax5select-display.primary:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.primary:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.primary:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.primary[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow{border-top-color:#555}.ax5select-display.primary:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.primary:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.primary:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.primary[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow{border-bottom-color:#555}.ax5select-display.primary [disabled]{user-select:none}.ax5select-display.success:hover:not([disabled]),.ax5select-display.success:active:not([disabled]),.ax5select-display.success:focus:not([disabled]),.ax5select-display.success[data-select-option-group-opened]:not([disabled]){border-color:#5cb85c;color:#555;text-decoration:none}.ax5select-display.success:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.success:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.success:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.success[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow{border-top-color:#555}.ax5select-display.success:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.success:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.success:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.success[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow{border-bottom-color:#555}.ax5select-display.success [disabled]{user-select:none}.ax5select-display.info:hover:not([disabled]),.ax5select-display.info:active:not([disabled]),.ax5select-display.info:focus:not([disabled]),.ax5select-display.info[data-select-option-group-opened]:not([disabled]){border-color:#5bc0de;color:#555;text-decoration:none}.ax5select-display.info:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.info:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.info:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.info[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow{border-top-color:#555}.ax5select-display.info:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.info:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.info:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.info[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow{border-bottom-color:#555}.ax5select-display.info [disabled]{user-select:none}.ax5select-display.warning:hover:not([disabled]),.ax5select-display.warning:active:not([disabled]),.ax5select-display.warning:focus:not([disabled]),.ax5select-display.warning[data-select-option-group-opened]:not([disabled]){border-color:#f0ad4e;color:#555;text-decoration:none}.ax5select-display.warning:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.warning:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.warning:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.warning[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow{border-top-color:#555}.ax5select-display.warning:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.warning:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.warning:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.warning[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow{border-bottom-color:#555}.ax5select-display.warning [disabled]{user-select:none}.ax5select-display.danger:hover:not([disabled]),.ax5select-display.danger:active:not([disabled]),.ax5select-display.danger:focus:not([disabled]),.ax5select-display.danger[data-select-option-group-opened]:not([disabled]){border-color:#d9534f;color:#555;text-decoration:none}.ax5select-display.danger:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.danger:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.danger:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow,.ax5select-display.danger[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-closed .addon-icon-arrow{border-top-color:#555}.ax5select-display.danger:hover:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.danger:active:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.danger:focus:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow,.ax5select-display.danger[data-select-option-group-opened]:not([disabled]) .ax5select-display-table [data-ax5select-display="addon"] .addon-icon-opened .addon-icon-arrow{border-bottom-color:#555}.ax5select-display.danger [disabled]{user-select:none}.ax5select-option-group{box-sizing:border-box;z-index:2000;position:absolute;left:0;top:0;border-radius:5px;box-shadow:0px 0px 3px 0px rgba(0,0,0,0.175);border:1px solid;overflow:hidden;background-color:#fbfbfb;background-image:-webkit-linear-gradient(bottom, #fbfbfb);background-image:linear-gradient(to top,#fbfbfb);-webkit-animation:ax-select-option-group .1s ease-out;-o-animation:ax-select-option-group .1s ease-out;animation:ax-select-option-group .1s ease-out;-webkit-transform:translateZ(0);-moz-transform:translateZ(0);-ms-transform:translateZ(0);-o-transform:translateZ(0);transform:translateZ(0);-webkit-transform-origin:center top;-moz-transform-origin:center top;-ms-transform-origin:center top;transform-origin:center top}.ax5select-option-group.destroy{-webkit-animation:ax-select-option-group-destroy .1s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;-o-animation:ax-select-option-group-destroy .1s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;animation:ax-select-option-group-destroy .1s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards}.ax5select-option-group.direction-top{-webkit-transform-origin:center top;-moz-transform-origin:center top;-ms-transform-origin:center top;transform-origin:center top}.ax5select-option-group.direction-bottom{-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;-ms-transform-origin:center bottom;transform-origin:center bottom}.ax5select-option-group.default{border-color:#ccc;color:#555}.ax5select-option-group.default .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover,.ax5select-option-group.default .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover{background:#a6a6a6 !important;color:#222}.ax5select-option-group.default .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after,.ax5select-option-group.default .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#222 !important}.ax5select-option-group.default .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"]{background:#ccc;color:#222}.ax5select-option-group.default .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#222 !important}.ax5select-option-group.default .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{background:#eee}.ax5select-option-group.default .ax-select-body .ax-select-option-group-buttons{border-top:1px solid;border-color:#ccc}.ax5select-option-group.primary{border-color:#337ab7;color:#555}.ax5select-option-group.primary .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover,.ax5select-option-group.primary .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover{background:#64a0d3 !important;color:#fff}.ax5select-option-group.primary .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after,.ax5select-option-group.primary .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.primary .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"]{background:#337ab7;color:#fff}.ax5select-option-group.primary .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.primary .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{background:#eee}.ax5select-option-group.primary .ax-select-body .ax-select-option-group-buttons{border-top:1px solid;border-color:#337ab7}.ax5select-option-group.success{border-color:#5cb85c;color:#555}.ax5select-option-group.success .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover,.ax5select-option-group.success .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover{background:#3d8b3d !important;color:#222}.ax5select-option-group.success .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after,.ax5select-option-group.success .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#222 !important}.ax5select-option-group.success .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"]{background:#5cb85c;color:#222}.ax5select-option-group.success .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#222 !important}.ax5select-option-group.success .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{background:#eee}.ax5select-option-group.success .ax-select-body .ax-select-option-group-buttons{border-top:1px solid;border-color:#5cb85c}.ax5select-option-group.info{border-color:#5bc0de;color:#555}.ax5select-option-group.info .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover,.ax5select-option-group.info .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover{background:#9bd8eb !important;color:#fff}.ax5select-option-group.info .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after,.ax5select-option-group.info .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.info .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"]{background:#5bc0de;color:#fff}.ax5select-option-group.info .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.info .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{background:#eee}.ax5select-option-group.info .ax-select-body .ax-select-option-group-buttons{border-top:1px solid;border-color:#5bc0de}.ax5select-option-group.warning{border-color:#f0ad4e;color:#555}.ax5select-option-group.warning .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover,.ax5select-option-group.warning .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover{background:#f6ce95 !important;color:#fff}.ax5select-option-group.warning .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after,.ax5select-option-group.warning .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.warning .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"]{background:#f0ad4e;color:#fff}.ax5select-option-group.warning .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.warning .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{background:#eee}.ax5select-option-group.warning .ax-select-body .ax-select-option-group-buttons{border-top:1px solid;border-color:#f0ad4e}.ax5select-option-group.danger{border-color:#d9534f;color:#555}.ax5select-option-group.danger .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover,.ax5select-option-group.danger .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover{background:#e7908e !important;color:#fff}.ax5select-option-group.danger .ax-select-body .ax-select-option-group-content .ax-select-option-item:hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after,.ax5select-option-group.danger .ax-select-body .ax-select-option-group-content .ax-select-option-item.hover .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.danger .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"]{background:#d9534f;color:#fff}.ax5select-option-group.danger .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{border-color:#fff !important}.ax5select-option-group.danger .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{background:#eee}.ax5select-option-group.danger .ax-select-body .ax-select-option-group-buttons{border-top:1px solid;border-color:#d9534f}.ax5select-option-group .ax-select-body{padding:0px}.ax5select-option-group .ax-select-body .ax-select-option-group-content{max-height:170px;overflow-y:auto;-webkit-overflow-scrolling:touch;position:relative}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item{padding:3px 0px;text-align:left;cursor:pointer;font-size:12px;position:relative;box-sizing:border-box;overflow:hidden}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:17px}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:12px;line-height:17px;padding:0px 0px 0px 0px;user-select:none}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox{overflow:hidden;width:12px;text-align:center}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap{position:relative;display:block;width:12px;height:17px}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{content:'';width:8px;height:4px;position:absolute;top:4.25px;right:0px;border:2px solid #000;border-top:none;border-right:none;background:transparent;opacity:0.1;-webkit-transform:rotate(-50deg);-moz-transform:rotate(-50deg);-ms-transform:rotate(-50deg);-o-transform:rotate(-50deg);transform:rotate(-50deg)}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-label{padding:0px 7px;padding-right:8px}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{opacity:1}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:17px}.ax5select-option-group .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:12px;line-height:17px;padding:5px 10px;user-select:none}.ax5select-option-group .ax-select-body .ax-select-option-group-buttons{text-align:center;padding:3px 0px}.ax5select-option-group.ax5select-option-group-lg .ax-select-body{padding:0px}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content{max-height:206px;overflow-y:auto;-webkit-overflow-scrolling:touch;position:relative}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item{padding:5px 0px;text-align:left;cursor:pointer;font-size:15.6px;position:relative;box-sizing:border-box;overflow:hidden}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:20.6px}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:15.6px;line-height:20.6px;padding:0px 0px 0px 0px;user-select:none}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox{overflow:hidden;width:15.6px;text-align:center}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap{position:relative;display:block;width:15.6px;height:20.6px}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{content:'';width:11.6px;height:5.8px;position:absolute;top:5.15px;right:0px;border:2px solid #000;border-top:none;border-right:none;background:transparent;opacity:0.1;-webkit-transform:rotate(-50deg);-moz-transform:rotate(-50deg);-ms-transform:rotate(-50deg);-o-transform:rotate(-50deg);transform:rotate(-50deg)}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-label{padding:0px 7px;padding-right:11.6px}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{opacity:1}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:20.6px}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:15.6px;line-height:20.6px;padding:5px 10px;user-select:none}.ax5select-option-group.ax5select-option-group-lg .ax-select-body .ax-select-option-group-buttons{text-align:center;padding:5px 0px}.ax5select-option-group.ax5select-option-group-sm .ax-select-body{padding:0px}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content{max-height:158px;overflow-y:auto;-webkit-overflow-scrolling:touch;position:relative}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item{padding:2px 0px;text-align:left;cursor:pointer;font-size:10.8px;position:relative;box-sizing:border-box;overflow:hidden}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:15.8px}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:10.8px;line-height:15.8px;padding:0px 0px 0px 0px;user-select:none}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox{overflow:hidden;width:10.8px;text-align:center}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap{position:relative;display:block;width:10.8px;height:15.8px}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{content:'';width:6.8px;height:3.4px;position:absolute;top:3.95px;right:0px;border:2px solid #000;border-top:none;border-right:none;background:transparent;opacity:0.1;-webkit-transform:rotate(-50deg);-moz-transform:rotate(-50deg);-ms-transform:rotate(-50deg);-o-transform:rotate(-50deg);transform:rotate(-50deg)}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-label{padding:0px 7px;padding-right:6.8px}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{opacity:1}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:15.8px}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:10.8px;line-height:15.8px;padding:5px 10px;user-select:none}.ax5select-option-group.ax5select-option-group-sm .ax-select-body .ax-select-option-group-buttons{text-align:center;padding:2px 0px}.ax5select-option-group.ax5select-option-group-xs .ax-select-body{padding:0px}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content{max-height:146px;overflow-y:auto;-webkit-overflow-scrolling:touch;position:relative}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item{padding:1px 0px;text-align:left;cursor:pointer;font-size:9.6px;position:relative;box-sizing:border-box;overflow:hidden}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:14.6px}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:9.6px;line-height:14.6px;padding:0px 0px 0px 0px;user-select:none}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox{overflow:hidden;width:9.6px;text-align:center}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap{position:relative;display:block;width:9.6px;height:14.6px}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{content:'';width:5.6px;height:2.8px;position:absolute;top:3.65px;right:0px;border:2px solid #000;border-top:none;border-right:none;background:transparent;opacity:0.1;-webkit-transform:rotate(-50deg);-moz-transform:rotate(-50deg);-ms-transform:rotate(-50deg);-o-transform:rotate(-50deg);transform:rotate(-50deg)}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-label{padding:0px 7px;padding-right:5.6px}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-item[data-option-selected="true"] .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox:after{opacity:1}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder{display:table;position:relative;border-collapse:separate;overflow:hidden;width:100%;height:14.6px}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-content .ax-select-option-group .ax-select-option-item-holder .ax-select-option-group-label{box-sizing:border-box;display:table-cell;vertical-align:middle;white-space:nowrap;font-size:9.6px;line-height:14.6px;padding:5px 10px;user-select:none}.ax5select-option-group.ax5select-option-group-xs .ax-select-body .ax-select-option-group-buttons{text-align:center;padding:1px 0px}.input-group [data-ax5select]{display:table-cell}.input-group [data-ax5select] select{z-index:1;position:absolute;opacity:0;user-select:none}.input-group [data-ax5select]:first-child .ax5select-display{border-top-right-radius:0;border-bottom-right-radius:0}.input-group [data-ax5select]:last-child .ax5select-display{border-top-left-radius:0;border-bottom-left-radius:0} 10 | -------------------------------------------------------------------------------- /dist/ax5select.min.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(){var e=ax5.ui,t=ax5.util,i=void 0;e.addClass({className:"select"},function(){var e=function(){var e=this,n=void 0;this.instanceId=ax5.getGuid(),this.config={theme:"default",animateTime:100,lang:{noSelected:"",noOptions:"no options",loading:"now loading..",multipleLabel:'"{{label}}"외 {{length}}건'},columnKeys:{optionValue:"value",optionText:"text",optionSelected:"selected"}},this.queue=[],this.activeSelectOptionGroup=null,this.activeSelectQueueIndex=-1,this.openTimer=null,this.closeTimer=null,this.waitOptionsCallback=null,this.keyUpTimer=null,this.xvar={},n=this.config;var o=jQuery(window),s={18:"KEY_ALT",8:"KEY_BACKSPACE",17:"KEY_CONTROL",46:"KEY_DELETE",40:"KEY_DOWN",35:"KEY_END",187:"KEY_EQUAL",27:"KEY_ESC",36:"KEY_HOME",45:"KEY_INSERT",37:"KEY_LEFT",189:"KEY_MINUS",34:"KEY_PAGEDOWN",33:"KEY_PAGEUP",13:"KEY_RETURN",39:"KEY_RIGHT",16:"KEY_SHIFT",9:"KEY_TAB",38:"KEY_UP",91:"KEY_WINDOW"},l=function(e,t){return e&&e.onStateChanged?e.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),"changeValue"==t.state&&(e&&e.onChange?e.onChange.call(t,t):this.onChange&&this.onChange.call(t,t)),e=null,t=null,!0},a=function(){for(var e=this.queue.length,i=void 0;e--;)this.queue[e].$display&&(i=Math.max(this.queue[e].$select.outerWidth(),t.number(this.queue[e].minWidth)),this.queue[e].$display.css({"min-width":i}),this.queue[e].reset&&this.queue[e].$display.find(".addon-icon-reset").css({"line-height":this.queue[e].$display.height()+"px"}));return e=null,i=null,this},c=function(e){if(!this.activeSelectOptionGroup)return this;var t=this.queue[this.activeSelectQueueIndex],i={},n=0,s={},l={},a=void 0;e&&jQuery(document.body).append(this.activeSelectOptionGroup),i=t.$target.offset(),s={width:t.$target.outerWidth(),height:t.$target.outerHeight()},l={winWidth:Math.max(o.width(),jQuery(document.body).width()),winHeight:Math.max(o.height(),jQuery(document.body).height()),width:this.activeSelectOptionGroup.outerWidth(),height:this.activeSelectOptionGroup.outerHeight()},t.direction&&""!==t.direction&&"auto"!==t.direction?a=t.direction:(a="top",i.top-l.height-n<0?a="top":i.top+s.height+l.height+n>l.winHeight&&(a="bottom")),e&&this.activeSelectOptionGroup.addClass("direction-"+a),this.activeSelectOptionGroup.css(function(){if("top"==a){if(i.top+s.height+l.height+n>l.winHeight){var e=i.top+s.height/2-l.height/2;return e+l.height+n>l.winHeight&&(e=0),e<0&&(e=0),{left:i.left,top:e,width:s.width}}return{left:i.left,top:i.top+s.height+1,width:s.width}}if("bottom"==a)return{left:i.left,top:i.top-l.height-1,width:s.width}}.call(this))},u=function(e,i){if(!this.activeSelectOptionGroup)return this;var n=this.queue[this.activeSelectQueueIndex],o="display";return(i=t.findParentNode(e.target,function(e){return e.getAttribute("data-option-value")||""==e.getAttribute("data-option-value")?(o="optionItem",!0):n.$target.get(0)==e?(o="display",!0):void 0}))?("optionItem"===o&&(this.val(n.id,{index:{gindex:i.getAttribute("data-option-group-index"),index:i.getAttribute("data-option-index")}},void 0,"internal"),n.$select.trigger("change"),n.$display.focus(),n.multiple||this.close()),this):(this.close(),this)},d=function(e){if(e.keyCode==ax5.info.eventKeys.ESC)this.close();else if(e.which==ax5.info.eventKeys.RETURN)if(this.queue[this.activeSelectQueueIndex].optionFocusIndex>-1){var t=this.activeSelectOptionGroup.find('[data-option-focus-index="'+this.queue[this.activeSelectQueueIndex].optionFocusIndex+'"]');this.val(this.queue[this.activeSelectQueueIndex].id,{index:{gindex:t.attr("data-option-group-index"),index:t.attr("data-option-index")}},void 0,"internal"),this.queue[this.activeSelectQueueIndex].$select.trigger("change"),this.queue[this.activeSelectQueueIndex].multiple||this.close()}else this.close()},p=function(e){var i=this.queue[e],n=[];return t.isArray(i.selected)&&i.selected.length>0?i.selected.forEach(function(e){e.selected&&n.push(e[i.columnKeys.optionText])}):!i.multiple&&i.options&&i.options[0]?i.options[0].optgroup?n[0]=i.options[0].options[0][i.columnKeys.optionText]:n[0]=i.options[0][i.columnKeys.optionText]:n[0]=i.lang.noSelected,function(){if(i.multiple&&n.length>1){var e={label:n[0],length:n.length-1};return ax5.mustache.render(i.lang.multipleLabel,e)}return n[0]}()},r=function(e){this.queue[e].$displayLabel.html(p.call(this,e))},h=function(e,t){var i=[],n=-1,o=this.queue[e].indexedOptions.length-1,s=void 0;if(t){for(;o-n++;){if(s=this.queue[e].indexedOptions[n],(""+s.value).toLowerCase()==t.toLowerCase()){i=[{"@findex":s["@findex"],optionsSort:0}];break}var l=(""+s.value).toLowerCase().search(t.toLowerCase());if(l>-1&&(i.push({"@findex":s["@findex"],optionsSort:l}),i.length>2))break;l=null}i.sort(function(e,t){return e.optionsSort-t.optionsSort})}i&&i.length>0&&x.call(this,e,void 0,i[0]["@findex"]);try{return i}finally{i=null,n=null,o=null,s=null}},x=function(e,t,i){var n=void 0,o=void 0,s=void 0,l=void 0;if(this.activeSelectOptionGroup&&this.queue[e].options&&this.queue[e].options.length>0){"undefined"!=typeof i?n=i:(o=this.queue[e].optionFocusIndex==-1?this.queue[e].optionSelectedIndex||-1:this.queue[e].optionFocusIndex,o==-1?n=t>0?0:this.queue[e].optionItemLength-1:(n=o+t,n<0?n=0:n>this.queue[e].optionItemLength-1&&(n=this.queue[e].optionItemLength-1))),this.queue[e].optionFocusIndex=n,this.activeSelectOptionGroup.find("[data-option-focus-index]").removeClass("hover"),s=this.activeSelectOptionGroup.find('[data-option-focus-index="'+n+'"]').addClass("hover"),l=this.activeSelectOptionGroup.find('[data-els="content"]');var a=s.outerHeight(),c=l.innerHeight(),u=l.scrollTop(),d=s.position().top+l.scrollTop();c+ud&&l.scrollTop(d)}},f=function(){var o=t.debounce(function(t,i){h.call(e,i,t),e.queue[i].$displayInput.val("")},300),l={click:function(i,n){var o=t.findParentNode(n.target,function(e){if(e.getAttribute("data-selected-clear"))return!0});o?this.val(i,{clear:!0}):e.activeSelectQueueIndex==i?this.queue[i].optionFocusIndex==-1&&e.close():(e.open(i),t.stopEvent(n))},keyUp:function(e,t){t.which==ax5.info.eventKeys.SPACE?l.click.call(this,e,t):s[t.which]||o(this.queue[e].$displayInput.val(),e)},keyDown:function(e,i){i.which==ax5.info.eventKeys.DOWN?(x.call(this,e,1),t.stopEvent(i)):i.which==ax5.info.eventKeys.UP&&(x.call(this,e,-1),t.stopEvent(i))},blur:function(e,t){},selectChange:function(e,t){this.val(e,this.queue[e].$select.val(),!0)}};return function(e){var t=this.queue[e],o={};return t.selected=[],t.options||(t.options=[]),t.options.forEach(function(e){e[n.columnKeys.optionSelected]&&t.selected.push(jQuery.extend({},e))}),t.$display?(t.$displayLabel.html(p.call(this,e)),t.options=m.call(this,e,t.options),a.call(this)):(o.instanceId=this.instanceId,o.id=t.id,o.name=t.name,o.theme=t.theme,o.tabIndex=t.tabIndex,o.multiple=t.multiple,o.reset=t.reset,o.label=p.call(this,e),o.formSize=function(){return t.size?"input-"+t.size:""}(),t.$display=i.tmpl.get.call(this,"tmpl",o),t.$displayLabel=t.$display.find('[data-ax5select-display="label"]'),t.$target.find("select").get(0)?(t.$select=t.$target.find("select"),t.$select.attr("tabindex","-1").attr("class","form-control "+o.formSize),o.name&&t.$select.attr("name","name"),o.multiple&&t.$select.attr("multiple","multiple")):(t.$select=i.tmpl.get.call(this,"selectTmpl",o),t.$target.append(t.$select)),t.$target.append(t.$display),t.$displayInput=t.$display.find('[data-ax5select-display="input"]'),t.options=m.call(this,e,t.options),a.call(this),t.$displayInput.unbind("blur.ax5select").bind("blur.ax5select",l.blur.bind(this,e)).unbind("keyup.ax5select").bind("keyup.ax5select",l.keyUp.bind(this,e)).unbind("keydown.ax5select").bind("keydown.ax5select",l.keyDown.bind(this,e))),t.$display.unbind("click.ax5select").bind("click.ax5select",l.click.bind(this,e)).unbind("keyup.ax5select").bind("keyup.ax5select",l.keyUp.bind(this,e)),t.$select.unbind("change.ax5select").bind("change.ax5select",l.selectChange.bind(this,e)),o=null,t=null,e=null,this}}(),m=function(){var i=function(e,t){t?this.queue[e].multiple?this.queue[e].selected.push(jQuery.extend({},t)):this.queue[e].selected[0]=jQuery.extend({},t):this.queue[e].selected=[]};return function(n,o){var s=this.queue[n],l=void 0,a=void 0,c=void 0,u=0;return i.call(this,n,!1),o?(s.options=o,s.indexedOptions=[],l=[],s.options.forEach(function(t,o){t.optgroup?(t["@gindex"]=o,t.options.forEach(function(t,o){t["@index"]=o,t["@findex"]=u,l.push('"),t[s.columnKeys.optionSelected]&&i.call(e,n,t),s.indexedOptions.push({"@findex":u,value:t[s.columnKeys.optionValue],text:t[s.columnKeys.optionText]}),u++})):(t["@index"]=o,t["@findex"]=u,l.push('"),t[s.columnKeys.optionSelected]&&i.call(e,n,t),s.indexedOptions.push({"@findex":u,value:t[s.columnKeys.optionValue],text:t[s.columnKeys.optionText]}),u++)}),s.optionItemLength=u,s.$select.html(l.join(""))):(a=t.toArray(s.$select.get(0).options),c=[],a.forEach(function(t,o){var l={};l[s.columnKeys.optionValue]=t.value,l[s.columnKeys.optionText]=t.text,l[s.columnKeys.optionSelected]=t.selected,l["@index"]=o,l["@findex"]=o,t.selected&&i.call(e,n,l),c.push(l),l=null}),s.options=c,s.indexedOptions=c),!s.multiple&&0==s.selected.length&&s.options&&s.options[0]&&(s.options[0].optgroup?(s.options[0].options[0][s.columnKeys.optionSelected]=!0,s.selected.push(jQuery.extend({},s.options[0].options[0]))):(s.options[0][s.columnKeys.optionSelected]=!0,s.selected.push(jQuery.extend({},s.options[0])))),l=null,a=null,c=null,s.options}}(),v=function(e){return t.isString(e)||(e=jQuery(e).data("data-ax5select-id")),t.isString(e)?t.search(this.queue,function(){return this.id==e}):void console.log(ax5.info.getError("ax5select","402","getQueIdx"))};this.init=function(){this.onStateChanged=n.onStateChanged,this.onChange=n.onChange,jQuery(window).bind("resize.ax5select-display-"+this.instanceId,function(){a.call(this)}.bind(this))},this.bind=function(e){var i={},o=void 0;return e=jQuery.extend(!0,i,n,e),e.target?(e.$target=jQuery(e.target),e.id||(e.id=e.$target.data("data-ax5select-id")),e.id||(e.id="ax5select-"+ax5.getGuid(),e.$target.data("data-ax5select-id",e.id)),e.name=e.$target.attr("data-ax5select"),e.options&&(e.options=JSON.parse(JSON.stringify(e.options))),function(i){t.isObject(i)&&!i.error&&(e=jQuery.extend(!0,e,i))}(t.parseJson(e.$target.attr("data-ax5select-config"),!0)),o=t.search(this.queue,function(){return this.id==e.id}),o===-1?(this.queue.push(e),f.call(this,this.queue.length-1)):(this.queue[o].selected=[],this.queue[o].options=e.options,this.queue[o]=jQuery.extend(!0,{},this.queue[o],e),f.call(this,o)),i=null,o=null,this):(console.log(ax5.info.getError("ax5select","401","bind")),this)},this.open=function(){var e=function(e){e.onExpand.call({self:this,item:e},function(e){if(this.waitOptionsCallback){var n={},o=this.queue[this.activeSelectQueueIndex];!function(e,i){var n={};i.options.forEach(function(t,i){t["@index"]=i,n[t[e.columnKeys.optionValue]]=t}),t.isArray(e.selected)&&e.selected.forEach(function(t){n[t[e.columnKeys.optionValue]]&&(i.options[n[t[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(o,e),o.$displayLabel.html(p.call(this,this.activeSelectQueueIndex)),o.options=m.call(this,this.activeSelectQueueIndex,e.options),a.call(this),n.id=o.id,n.theme=o.theme,n.size="ax5select-option-group-"+o.size,n.multiple=o.multiple,n.lang=o.lang,n.options=o.options,this.activeSelectOptionGroup.find('[data-els="content"]').html(i.tmpl.get.call(this,"optionsTmpl",n,o.columnKeys))}}.bind(this))};return function(o,s){this.waitOptionsCallback=null;var a=t.isNumber(o)?o:v.call(this,o),p=this.queue[a],r={},h=void 0,x=void 0;return p.$display.attr("disabled")?this:(this.openTimer&&clearTimeout(this.openTimer),this.activeSelectOptionGroup?this.activeSelectQueueIndex==a?this:s>2?this:(this.close(),this.openTimer=setTimeout(function(){this.open(a,(s||0)+1)}.bind(this),n.animateTime),this):(p.optionFocusIndex=-1,p.selected&&p.selected.length>0&&(p.optionSelectedIndex=p.selected[0]["@findex"]),r.id=p.id,r.theme=p.theme,r.size="ax5select-option-group-"+p.size,r.multiple=p.multiple,r.lang=p.lang,p.$display.attr("data-select-option-group-opened","true"),p.onExpand&&(r.waitOptions=!0),r.options=p.options,this.activeSelectOptionGroup=i.tmpl.get.call(this,"optionGroupTmpl",r),this.activeSelectOptionGroup.find('[data-els="content"]').html(i.tmpl.get.call(this,"optionsTmpl",r,p.columnKeys)),this.activeSelectQueueIndex=a,c.call(this,"append"),jQuery(window).bind("resize.ax5select-"+this.instanceId,function(){c.call(this)}.bind(this)),p.selected&&p.selected.length>0&&(x=this.activeSelectOptionGroup.find('[data-option-index="'+p.selected[0]["@index"]+'"]'),x.get(0)&&(h=x.position().top-this.activeSelectOptionGroup.height()/3,this.activeSelectOptionGroup.find('[data-els="content"]').stop().animate({scrollTop:h},p.animateTime,"swing",function(){}))),p.$displayInput.val(""),setTimeout(function(){p.$displayInput.trigger("focus"),jQuery(window).bind("keyup.ax5select-"+this.instanceId,function(e){e=e||window.event,d.call(this,e),t.stopEvent(e)}.bind(this)),jQuery(window).bind("click.ax5select-"+this.instanceId,function(e){e=e||window.event,u.call(this,e),t.stopEvent(e)}.bind(this))}.bind(this),300),l.call(this,p,{self:this,state:"open",item:p}),p.onExpand&&(this.waitOptionsCallback=!0,e.call(this,p)),r=null,h=null,x=null,this))}}(),this.update=function(e){return this.bind(e),this},this.setOptions=function(e,t){var i=v.call(this,e);return this.queue[i].selected=[],this.queue[i].options=t,f.call(this,i),this},this.val=function(){var i=function(e,t,i){return"undefined"==typeof i?!e.multiple||!t:i},n=function(e){this.queue[e].options.forEach(function(e){e.optgroup?e.options.forEach(function(e){e.selected=!1}):e.selected=!1})},o={index:function(n,o,s){var l=this.queue[n];t.isString(o.index.gindex)?(l.options[o.index.gindex].options[o.index.index][l.columnKeys.optionSelected]=i(l,l.options[o.index.gindex].options[o.index.index][l.columnKeys.optionSelected],s),e.activeSelectOptionGroup.find('[data-option-group-index="'+o.index.gindex+'"][data-option-index="'+o.index.index+'"]').attr("data-option-selected",l.options[o.index.gindex].options[o.index.index][l.columnKeys.optionSelected].toString())):(l.options[o.index.index][l.columnKeys.optionSelected]=i(l,l.options[o.index.index][l.columnKeys.optionSelected],s),e.activeSelectOptionGroup.find('[data-option-index="'+o.index.index+'"]').attr("data-option-selected",l.options[o.index.index][l.columnKeys.optionSelected].toString())),m.call(this,n,l.options),r.call(this,n),c.call(this)},arr:function(i,n,s){n.forEach(function(n){if(t.isString(n)||t.isNumber(n))o.value.call(e,i,n,s);else for(var l in o)if(n[l]){o[l].call(e,i,n,s);break}})},value:function(e,n,o){var s=this.queue[e],l=t.search(s.options,function(){return this[s.columnKeys.optionValue]==n});return l>-1?(s.options[l][s.columnKeys.optionSelected]=i(s,s.options[l][s.columnKeys.optionSelected],o),m.call(this,e,s.options),void r.call(this,e)):void console.log(ax5.info.getError("ax5select","501","val"))},text:function(e,n,o){var s=this.queue[e],l=t.search(s.options,function(){return this[s.columnKeys.optionText]==n});return l>-1?(s.options[l][s.columnKeys.optionSelected]=i(s,s.options[l][s.columnKeys.optionSelected],o),m.call(this,e,s.options),void r.call(this,e)):void console.log(ax5.info.getError("ax5select","501","val"))},clear:function(e){n.call(this,e),m.call(this,e,this.queue[e].options),r.call(this,e),this.activeSelectOptionGroup&&this.activeSelectOptionGroup.find("[data-option-index]").attr("data-option-selected","false")}};return function(e,i,s,a){var c=t.isNumber(e)?e:v.call(this,e);if(!this.queue[c])return this;if("undefined"==typeof i||this.queue[c].multiple||n.call(this,c),"undefined"==typeof i)return this.queue[c].selected;if(t.isArray(i))o.arr.call(this,c,i,s);else if(t.isString(i)||t.isNumber(i))o.value.call(this,c,i,s);else if(null===i)o.clear.call(this,c);else for(var u in o)if(i[u]){o[u].call(this,c,i,s);break}return"undefined"!=typeof i&&l.call(this,this.queue[c],{self:this,item:this.queue[c],state:a?"changeValue":"setValue",value:this.queue[c].selected,internal:a}),e=null,this}}(),this.close=function(e){return this.closeTimer&&clearTimeout(this.closeTimer),this.activeSelectOptionGroup?(e=this.queue[this.activeSelectQueueIndex],e.optionFocusIndex=-1,e.$displayInput.val("").trigger("blur"),e.$display.removeAttr("data-select-option-group-opened").trigger("focus"),this.activeSelectOptionGroup.addClass("destroy"),jQuery(window).unbind("resize.ax5select-"+this.instanceId).unbind("click.ax5select-"+this.instanceId).unbind("keyup.ax5select-"+this.instanceId),this.closeTimer=setTimeout(function(){this.activeSelectOptionGroup&&this.activeSelectOptionGroup.remove(),this.activeSelectOptionGroup=null,this.activeSelectQueueIndex=-1;var t={self:this,item:e,value:e.selected,state:"close"};l.call(this,e,t),e.onClose&&e.onClose.call(t)}.bind(this),n.animateTime),this.waitOptionsCallback=null,this):this},this.enable=function(e){var t=v.call(this,e);return this.queue[t].$display.removeAttr("disabled"),this.queue[t].$select.removeAttr("disabled"),l.call(this,this.queue[t],{self:this,state:"enable"}),this},this.disable=function(e){var t=v.call(this,e);return this.queue[t].$display.attr("disabled","disabled"),this.queue[t].$select.attr("disabled","disabled"),l.call(this,this.queue[t],{self:this,state:"disable"}),this},this.main=function(){arguments&&t.isObject(arguments[0])?this.setConfig(arguments[0]):this.init()}.apply(this,arguments)};return e}()),i=ax5.ui.select}(),ax5.ui.select_instance=new ax5.ui.select,jQuery.fn.ax5select=function(){return function(e){if(ax5.util.isString(arguments[0])){var t=arguments[0];switch(t){case"open":return ax5.ui.select_instance.open(this);case"close":return ax5.ui.select_instance.close(this);case"setValue":return ax5.ui.select_instance.val(this,arguments[1],arguments[2]);case"getValue":return ax5.ui.select_instance.val(this);case"enable":return ax5.ui.select_instance.enable(this);case"disable":return ax5.ui.select_instance.disable(this);case"setOptions":return ax5.ui.select_instance.setOptions(this,arguments[1]);default:return this}}else"undefined"==typeof e&&(e={}),jQuery.each(this,function(){var t={target:this};e=jQuery.extend({},e,t),ax5.ui.select_instance.bind(e)});return this}}(),function(){var e=ax5.ui.select,t=function(e){return'\n
\n
\n
\n
\n
\n
\n'},i=function(e){return'\n\n
\n
{{label}}
\n
\n {{#multiple}}{{#reset}}\n {{{.}}}\n {{/reset}}{{/multiple}}\n {{#icons}}\n {{clesed}}\n {{opened}}\n {{/icons}}\n {{^icons}}\n \n \n {{/icons}}\n
\n
\n \n
\n'},n=function(e){return'\n\n'},o=function(e){return'\n{{#waitOptions}}\n
\n
\n \n {{{lang.loading}}}\n \n
\n
\n{{/waitOptions}}\n{{^waitOptions}}\n {{#options}}\n {{#optgroup}}\n
\n
\n \n {{{.}}}\n \n
\n {{#options}}\n
\n
\n {{#multiple}}\n \n \n \n {{/multiple}}\n {{{'+e.optionText+'}}}\n
\n
\n {{/options}}\n
\n {{/optgroup}}\n {{^optgroup}}\n
\n
\n {{#multiple}}\n \n \n \n {{/multiple}}\n {{{'+e.optionText+'}}}\n
\n
\n {{/optgroup}}\n {{/options}}\n {{^options}}\n
\n
\n \n {{{lang.noOptions}}}\n \n
\n
\n {{/options}}\n{{/waitOptions}}\n'};e.tmpl={optionGroupTmpl:t,tmpl:i,selectTmpl:n,optionsTmpl:o,get:function(t,i,n){return jQuery(ax5.mustache.render(e.tmpl[t].call(this,n),i))}}}(); 2 | //# sourceMappingURL=ax5select.min.js.map 3 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. tom@axisj.com 3 | * - github.com/thomasjang 4 | * - www.axisj.com 5 | */ 6 | 7 | // Karma configuration 8 | // Generated on Wed Sep 21 2016 00:37:04 GMT+0900 (KST) 9 | 10 | module.exports = function (config) { 11 | var configuration = { 12 | // base path that will be used to resolve all patterns (eg. files, exclude) 13 | basePath: '', 14 | 15 | // frameworks to use 16 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 17 | frameworks: ['mocha'], 18 | 19 | // list of files / patterns to load in the browser 20 | files: [ 21 | 'https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js', 22 | 'https://cdnjs.cloudflare.com/ajax/libs/should.js/11.1.2/should.min.js', 23 | 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js', 24 | 'https://cdn.rawgit.com/ax5ui/ax5core/master/dist/ax5core.min.js', 25 | 'dist/ax5select.min.js', 26 | 'https://rawgit.com/aeei/aejs/master/dist/ae.min.js', 27 | 'test/test.*.js' 28 | ], 29 | // list of files to exclude 30 | exclude: [], 31 | // preprocess matching files before serving them to the browser 32 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 33 | preprocessors: {}, 34 | // test results reporter to use 35 | // possible values: 'dots', 'progress' 36 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 37 | reporters: ['progress'], 38 | // web server port 39 | port: 9876, 40 | // enable / disable colors in the output (reporters and logs) 41 | colors: true, 42 | // level of logging 43 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 44 | logLevel: config.LOG_INFO, 45 | // enable / disable watching file and executing tests whenever any file changes 46 | autoWatch: true, 47 | // start these browsers 48 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 49 | //browsers: ['PhantomJS'], 50 | browsers: ['Chrome', 'Firefox'], 51 | customLaunchers: { 52 | Chrome_travis_ci: { 53 | base: 'Chrome', 54 | flags: ['--no-sandbox'] 55 | } 56 | }, 57 | singleRun: true, 58 | concurrency: Infinity 59 | }; 60 | 61 | if (process.env.TRAVIS) { 62 | configuration.browsers = ['PhantomJS']; 63 | } 64 | 65 | config.set(configuration); 66 | } 67 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ax5ui-select", 3 | "version": "1.4.131", 4 | "description": "A select plugin that works with Bootstrap & jQuery", 5 | "license": "MIT", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/ax5ui/ax5ui-select" 9 | }, 10 | "author": { 11 | "name": "Thomas Jang", 12 | "email": "tom@axisj.com", 13 | "url": "ax5.io" 14 | }, 15 | "keywords": [ 16 | "bootstrap", 17 | "jquery", 18 | "ax5ui", 19 | "plugin", 20 | "bootstrap jQuery plugins", 21 | "select", 22 | "ax5ui-select", 23 | "javascript ui" 24 | ], 25 | "scripts": { 26 | "test": "karma start karma.conf.js" 27 | }, 28 | "dependencies": { 29 | "jquery": "", 30 | "ax5core": ">=1.4.115" 31 | }, 32 | "devDependencies": { 33 | "karma": "^1.3.0", 34 | "karma-mocha": "^1.2.0", 35 | "karma-phantomjs-launcher": "^1.0.2", 36 | "mocha": "^3.1.0", 37 | "phantomjs-prebuilt": "^2.1.13", 38 | "webdriverio": "^4.6.1" 39 | } 40 | } -------------------------------------------------------------------------------- /src/ax5select.js: -------------------------------------------------------------------------------- 1 | // ax5.ui.select 2 | (function () { 3 | 4 | let UI = ax5.ui, 5 | U = ax5.util, 6 | SELECT; 7 | 8 | UI.addClass({ 9 | className: "select" 10 | }, (function () { 11 | /** 12 | * @class ax5select 13 | * @classdesc 14 | * @author tom@axisj.com 15 | */ 16 | let ax5select = function () { 17 | let self = this, 18 | cfg; 19 | 20 | this.instanceId = ax5.getGuid(); 21 | this.config = { 22 | theme: 'default', 23 | animateTime: 100, 24 | lang: { 25 | noSelected: '', 26 | noOptions: 'no options', 27 | loading: 'now loading..', 28 | multipleLabel: '"{{label}}"외 {{length}}건' 29 | }, 30 | columnKeys: { 31 | optionValue: 'value', 32 | optionText: 'text', 33 | optionSelected: 'selected' 34 | } 35 | }; 36 | this.queue = []; 37 | this.activeSelectOptionGroup = null; 38 | this.activeSelectQueueIndex = -1; 39 | this.openTimer = null; 40 | this.closeTimer = null; 41 | this.waitOptionsCallback = null; 42 | this.keyUpTimer = null; 43 | this.xvar = {}; 44 | 45 | cfg = this.config; 46 | 47 | let $window = jQuery(window), 48 | ctrlKeys = { 49 | "18": "KEY_ALT", 50 | "8": "KEY_BACKSPACE", 51 | "17": "KEY_CONTROL", 52 | "46": "KEY_DELETE", 53 | "40": "KEY_DOWN", 54 | "35": "KEY_END", 55 | "187": "KEY_EQUAL", 56 | "27": "KEY_ESC", 57 | "36": "KEY_HOME", 58 | "45": "KEY_INSERT", 59 | "37": "KEY_LEFT", 60 | "189": "KEY_MINUS", 61 | "34": "KEY_PAGEDOWN", 62 | "33": "KEY_PAGEUP", 63 | // "190": "KEY_PERIOD", 64 | "13": "KEY_RETURN", 65 | "39": "KEY_RIGHT", 66 | "16": "KEY_SHIFT", 67 | // "32": "KEY_SPACE", 68 | "9": "KEY_TAB", 69 | "38": "KEY_UP", 70 | "91": "KEY_WINDOW" 71 | //"107" : "NUMPAD_ADD", 72 | //"194" : "NUMPAD_COMMA", 73 | //"110" : "NUMPAD_DECIMAL", 74 | //"111" : "NUMPAD_DIVIDE", 75 | //"12" : "NUMPAD_EQUAL", 76 | //"106" : "NUMPAD_MULTIPLY", 77 | //"109" : "NUMPAD_SUBTRACT" 78 | }, 79 | onStateChanged = function (item, that) { 80 | if (item && item.onStateChanged) { 81 | item.onStateChanged.call(that, that); 82 | } 83 | else if (this.onStateChanged) { 84 | this.onStateChanged.call(that, that); 85 | } 86 | 87 | if (that.state == "changeValue") { 88 | if (item && item.onChange) { 89 | item.onChange.call(that, that); 90 | } 91 | else if (this.onChange) { 92 | this.onChange.call(that, that); 93 | } 94 | } 95 | 96 | item = null; 97 | that = null; 98 | return true; 99 | }, 100 | alignSelectDisplay = function () { 101 | let i = this.queue.length, w; 102 | while (i--) { 103 | if (this.queue[i].$display) { 104 | w = Math.max(this.queue[i].$select.outerWidth(), U.number(this.queue[i].minWidth)); 105 | this.queue[i].$display.css({ 106 | "min-width": w 107 | }); 108 | if (this.queue[i].reset) { 109 | this.queue[i].$display.find(".addon-icon-reset").css({ 110 | "line-height": this.queue[i].$display.height() + "px" 111 | }); 112 | } 113 | } 114 | } 115 | 116 | i = null; 117 | w = null; 118 | return this; 119 | }, 120 | alignSelectOptionGroup = function (append) { 121 | if (!this.activeSelectOptionGroup) return this; 122 | 123 | let item = this.queue[this.activeSelectQueueIndex], 124 | pos = {}, positionMargin = 0, 125 | dim = {}, pickerDim = {}, 126 | pickerDirection; 127 | 128 | if (append) jQuery(document.body).append(this.activeSelectOptionGroup); 129 | 130 | pos = item.$target.offset(); 131 | dim = { 132 | width: item.$target.outerWidth(), 133 | height: item.$target.outerHeight() 134 | }; 135 | pickerDim = { 136 | winWidth: Math.max($window.width(), jQuery(document.body).width()), 137 | winHeight: Math.max($window.height(), jQuery(document.body).height()), 138 | width: this.activeSelectOptionGroup.outerWidth(), 139 | height: this.activeSelectOptionGroup.outerHeight() 140 | }; 141 | 142 | // picker css(width, left, top) & direction 결정 143 | if (!item.direction || item.direction === "" || item.direction === "auto") { 144 | // set direction 145 | pickerDirection = "top"; 146 | 147 | if (pos.top - pickerDim.height - positionMargin < 0) { 148 | pickerDirection = "top"; 149 | } else if (pos.top + dim.height + pickerDim.height + positionMargin > pickerDim.winHeight) { 150 | pickerDirection = "bottom"; 151 | } 152 | } else { 153 | pickerDirection = item.direction; 154 | } 155 | // todo : 표현할 공간이 없다면.. 156 | if (append) { 157 | this.activeSelectOptionGroup 158 | .addClass("direction-" + pickerDirection); 159 | } 160 | this.activeSelectOptionGroup 161 | .css((function () { 162 | if (pickerDirection == "top") { 163 | if (pos.top + dim.height + pickerDim.height + positionMargin > pickerDim.winHeight) { 164 | 165 | var newTop = pos.top + dim.height / 2 - pickerDim.height / 2; 166 | if (newTop + pickerDim.height + positionMargin > pickerDim.winHeight) { 167 | newTop = 0; 168 | } 169 | if (newTop < 0) { 170 | newTop = 0; 171 | } 172 | 173 | return { 174 | left: pos.left, 175 | top: newTop, 176 | width: dim.width 177 | } 178 | } 179 | return { 180 | left: pos.left, 181 | top: pos.top + dim.height + 1, 182 | width: dim.width 183 | } 184 | } 185 | else if (pickerDirection == "bottom") { 186 | return { 187 | left: pos.left, 188 | top: pos.top - pickerDim.height - 1, 189 | width: dim.width 190 | } 191 | } 192 | }).call(this)); 193 | }, 194 | onBodyClick = function (e, target) { 195 | if (!this.activeSelectOptionGroup) return this; 196 | 197 | let item = this.queue[this.activeSelectQueueIndex], 198 | clickEl = "display"; 199 | 200 | target = U.findParentNode(e.target, function (target) { 201 | if (target.getAttribute("data-option-value") || target.getAttribute("data-option-value") == "") { 202 | clickEl = "optionItem"; 203 | return true; 204 | } 205 | else if (item.$target.get(0) == target) { 206 | clickEl = "display"; 207 | return true; 208 | } 209 | }); 210 | 211 | if (!target) { 212 | this.close(); 213 | return this; 214 | } 215 | else if (clickEl === "optionItem") { 216 | this.val(item.id, { 217 | index: { 218 | gindex: target.getAttribute("data-option-group-index"), 219 | index: target.getAttribute("data-option-index") 220 | } 221 | }, undefined, "internal"); 222 | item.$select.trigger("change"); 223 | item.$display.focus(); 224 | if (!item.multiple) this.close(); 225 | } 226 | else { 227 | //open and display click 228 | //console.log(this.instanceId); 229 | } 230 | 231 | return this; 232 | }, 233 | onBodyKeyup = function (e) { 234 | if (e.keyCode == ax5.info.eventKeys.ESC) { 235 | this.close(); 236 | } 237 | else if (e.which == ax5.info.eventKeys.RETURN) { 238 | if (this.queue[this.activeSelectQueueIndex].optionFocusIndex > -1) { // 아이템에 포커스가 활성화 된 후, 마우스 이벤트 이면 무시 239 | let $option = this.activeSelectOptionGroup.find('[data-option-focus-index="' + this.queue[this.activeSelectQueueIndex].optionFocusIndex + '"]'); 240 | this.val(this.queue[this.activeSelectQueueIndex].id, { 241 | index: { 242 | gindex: $option.attr("data-option-group-index"), 243 | index: $option.attr("data-option-index") 244 | } 245 | }, undefined, "internal"); 246 | this.queue[this.activeSelectQueueIndex].$select.trigger("change"); 247 | if (!this.queue[this.activeSelectQueueIndex].multiple) this.close(); 248 | } else { 249 | this.close(); 250 | } 251 | } 252 | }, 253 | getLabel = function (queIdx) { 254 | let item = this.queue[queIdx], 255 | labels = []; 256 | 257 | if (U.isArray(item.selected) && item.selected.length > 0) { 258 | item.selected.forEach(function (n) { 259 | if (n.selected) labels.push(n[item.columnKeys.optionText]); 260 | }); 261 | } 262 | else { 263 | if (!item.multiple && item.options && item.options[0]) { 264 | if (item.options[0].optgroup) { 265 | labels[0] = item.options[0].options[0][item.columnKeys.optionText]; 266 | } 267 | else { 268 | labels[0] = item.options[0][item.columnKeys.optionText]; 269 | } 270 | } 271 | else { 272 | labels[0] = item.lang.noSelected; 273 | } 274 | } 275 | 276 | return (function () { 277 | if (item.multiple && labels.length > 1) { 278 | let data = { 279 | label: labels[0], 280 | length: labels.length - 1 281 | }; 282 | return ax5.mustache.render(item.lang.multipleLabel, data); 283 | } 284 | else { 285 | return labels[0]; 286 | } 287 | })(); 288 | }, 289 | syncLabel = function (queIdx) { 290 | this.queue[queIdx].$displayLabel 291 | .html(getLabel.call(this, queIdx)); 292 | }, 293 | focusWord = function (queIdx, searchWord) { 294 | let options = [], i = -1, l = this.queue[queIdx].indexedOptions.length - 1, n; 295 | if (searchWord) { 296 | while (l - i++) { 297 | n = this.queue[queIdx].indexedOptions[i]; 298 | if (('' + n.value).toLowerCase() == searchWord.toLowerCase()) { 299 | options = [{'@findex': n['@findex'], optionsSort: 0}]; 300 | break; 301 | } else { 302 | let sort = ('' + n.value).toLowerCase().search(searchWord.toLowerCase()); 303 | if (sort > -1) { 304 | options.push({'@findex': n['@findex'], optionsSort: sort}); 305 | if (options.length > 2) break; 306 | } 307 | sort = null; 308 | } 309 | } 310 | options.sort(function (a, b) { 311 | return a.optionsSort - b.optionsSort; 312 | }); 313 | } 314 | if (options && options.length > 0) { 315 | focusMove.call(this, queIdx, undefined, options[0]['@findex']); 316 | } 317 | 318 | try { 319 | return options; 320 | } finally { 321 | options = null; 322 | i = null; 323 | l = null; 324 | n = null; 325 | } 326 | }, 327 | focusMove = function (queIdx, direction, findex) { 328 | let _focusIndex, 329 | _prevFocusIndex, 330 | focusOptionEl, 331 | optionGroupScrollContainer; 332 | 333 | if (this.activeSelectOptionGroup && this.queue[queIdx].options && this.queue[queIdx].options.length > 0) { 334 | 335 | if (typeof findex !== "undefined") { 336 | _focusIndex = findex 337 | } 338 | else { 339 | _prevFocusIndex = (this.queue[queIdx].optionFocusIndex == -1) ? this.queue[queIdx].optionSelectedIndex || -1 : this.queue[queIdx].optionFocusIndex; 340 | if (_prevFocusIndex == -1) { 341 | _focusIndex = (direction > 0) ? 0 : this.queue[queIdx].optionItemLength - 1; 342 | } 343 | else { 344 | _focusIndex = _prevFocusIndex + direction; 345 | if (_focusIndex < 0) _focusIndex = 0; 346 | else if (_focusIndex > this.queue[queIdx].optionItemLength - 1) _focusIndex = this.queue[queIdx].optionItemLength - 1; 347 | } 348 | } 349 | 350 | this.queue[queIdx].optionFocusIndex = _focusIndex; 351 | 352 | this.activeSelectOptionGroup 353 | .find('[data-option-focus-index]') 354 | .removeClass("hover"); 355 | 356 | focusOptionEl = this.activeSelectOptionGroup 357 | .find('[data-option-focus-index="' + _focusIndex + '"]') 358 | .addClass("hover"); 359 | 360 | optionGroupScrollContainer = this.activeSelectOptionGroup.find('[data-els="content"]'); 361 | 362 | let focusOptionElHeight = focusOptionEl.outerHeight(), 363 | optionGroupScrollContainerHeight = optionGroupScrollContainer.innerHeight(), 364 | optionGroupScrollContainerScrollTop = optionGroupScrollContainer.scrollTop(), 365 | focusOptionElTop = focusOptionEl.position().top + optionGroupScrollContainer.scrollTop(); 366 | 367 | if (optionGroupScrollContainerHeight + optionGroupScrollContainerScrollTop < focusOptionElTop + focusOptionElHeight) { 368 | optionGroupScrollContainer.scrollTop(focusOptionElTop + focusOptionElHeight - optionGroupScrollContainerHeight); 369 | } 370 | else if (optionGroupScrollContainerScrollTop > focusOptionElTop) { 371 | optionGroupScrollContainer.scrollTop(focusOptionElTop); 372 | } 373 | // optionGroup scroll check 374 | } 375 | }, 376 | bindSelectTarget = (function () { 377 | let focusWordCall = U.debounce(function (searchWord, queIdx) { 378 | focusWord.call(self, queIdx, searchWord); 379 | self.queue[queIdx].$displayInput.val(''); 380 | }, 300); 381 | 382 | let selectEvent = { 383 | 'click': function (queIdx, e) { 384 | var target = U.findParentNode(e.target, function (target) { 385 | if (target.getAttribute("data-selected-clear")) { 386 | //clickEl = "clear"; 387 | return true; 388 | } 389 | }); 390 | 391 | if (target) { 392 | this.val(queIdx, {clear: true}); 393 | } 394 | else { 395 | if (self.activeSelectQueueIndex == queIdx) { 396 | if (this.queue[queIdx].optionFocusIndex == -1) { // 아이템에 포커스가 활성화 된 후, 마우스 이벤트 이면 무시 397 | self.close(); 398 | } 399 | } 400 | else { 401 | self.open(queIdx); 402 | U.stopEvent(e); 403 | } 404 | } 405 | }, 406 | 'keyUp': function (queIdx, e) { 407 | if (e.which == ax5.info.eventKeys.SPACE) { 408 | selectEvent.click.call(this, queIdx, e); 409 | } 410 | else if (!ctrlKeys[e.which]) { 411 | // 사용자 입력이 뜸해지면 찾고 검색 값 제거... 412 | focusWordCall(this.queue[queIdx].$displayInput.val(), queIdx); 413 | } 414 | }, 415 | 'keyDown': function (queIdx, e) { 416 | if (e.which == ax5.info.eventKeys.DOWN) { 417 | focusMove.call(this, queIdx, 1); 418 | U.stopEvent(e); 419 | } 420 | else if (e.which == ax5.info.eventKeys.UP) { 421 | focusMove.call(this, queIdx, -1); 422 | U.stopEvent(e); 423 | } 424 | }, 425 | 'blur': function (queIdx, e) { 426 | 427 | }, 428 | 'selectChange': function (queIdx, e) { 429 | this.val(queIdx, this.queue[queIdx].$select.val(), true); 430 | } 431 | }; 432 | return function (queIdx) { 433 | let item = this.queue[queIdx], 434 | data = {}; 435 | 436 | // find selected 437 | item.selected = []; 438 | if(!item.options) item.options = []; 439 | item.options.forEach(function (n) { 440 | if (n[cfg.columnKeys.optionSelected]) item.selected.push(jQuery.extend({}, n)); 441 | }); 442 | 443 | if (!item.$display) { 444 | /// 템플릿에 전달할 오브젝트 선언 445 | data.instanceId = this.instanceId; 446 | data.id = item.id; 447 | data.name = item.name; 448 | data.theme = item.theme; 449 | data.tabIndex = item.tabIndex; 450 | data.multiple = item.multiple; 451 | data.reset = item.reset; 452 | 453 | data.label = getLabel.call(this, queIdx); 454 | data.formSize = (function () { 455 | return (item.size) ? "input-" + item.size : ""; 456 | })(); 457 | 458 | item.$display = SELECT.tmpl.get.call(this, "tmpl", data); 459 | item.$displayLabel = item.$display.find('[data-ax5select-display="label"]'); 460 | 461 | if (item.$target.find("select").get(0)) { 462 | item.$select = item.$target.find("select"); 463 | // select 속성만 변경 464 | item.$select 465 | .attr("tabindex", "-1") 466 | .attr("class", "form-control " + data.formSize); 467 | if (data.name) { 468 | item.$select.attr("name", "name"); 469 | } 470 | if (data.multiple) { 471 | item.$select.attr("multiple", "multiple"); 472 | } 473 | } 474 | else { 475 | item.$select = SELECT.tmpl.get.call(this, "selectTmpl", data); 476 | item.$target.append(item.$select); 477 | // select append 478 | } 479 | 480 | item.$target.append(item.$display); 481 | item.$displayInput = item.$display.find('[data-ax5select-display="input"]'); // 사용자 입력값을 받기위한 숨음 입력필드 482 | item.options = syncSelectOptions.call(this, queIdx, item.options); 483 | 484 | alignSelectDisplay.call(this); 485 | 486 | item.$displayInput 487 | .unbind("blur.ax5select") 488 | .bind("blur.ax5select", selectEvent.blur.bind(this, queIdx)) 489 | .unbind('keyup.ax5select') 490 | .bind('keyup.ax5select', selectEvent.keyUp.bind(this, queIdx)) 491 | .unbind("keydown.ax5select") 492 | .bind("keydown.ax5select", selectEvent.keyDown.bind(this, queIdx)); 493 | } 494 | else { 495 | item.$displayLabel 496 | .html(getLabel.call(this, queIdx)); 497 | item.options = syncSelectOptions.call(this, queIdx, item.options); 498 | 499 | alignSelectDisplay.call(this); 500 | } 501 | 502 | item.$display 503 | .unbind('click.ax5select') 504 | .bind('click.ax5select', selectEvent.click.bind(this, queIdx)) 505 | .unbind('keyup.ax5select') 506 | .bind('keyup.ax5select', selectEvent.keyUp.bind(this, queIdx)); 507 | 508 | // select 태그에 대한 change 이벤트 감시 509 | item.$select 510 | .unbind('change.ax5select') 511 | .bind('change.ax5select', selectEvent.selectChange.bind(this, queIdx)); 512 | 513 | data = null; 514 | item = null; 515 | queIdx = null; 516 | return this; 517 | }; 518 | })(), 519 | syncSelectOptions = (function () { 520 | let setSelected = function (queIdx, O) { 521 | if (!O) { 522 | this.queue[queIdx].selected = []; 523 | } 524 | else { 525 | if (this.queue[queIdx].multiple) this.queue[queIdx].selected.push(jQuery.extend({}, O)); 526 | else this.queue[queIdx].selected[0] = jQuery.extend({}, O); 527 | } 528 | }; 529 | 530 | return function (queIdx, options) { 531 | let item = this.queue[queIdx], 532 | po, elementOptions, newOptions, focusIndex = 0; 533 | 534 | setSelected.call(this, queIdx, false); // item.selected 초기화 535 | 536 | if (options) { 537 | item.options = options; 538 | item.indexedOptions = []; 539 | 540 | // select options 태그 생성 541 | po = []; 542 | item.options.forEach(function (O, OIndex) { 543 | if (O.optgroup) { 544 | 545 | O['@gindex'] = OIndex; 546 | O.options.forEach(function (OO, OOIndex) { 547 | OO['@index'] = OOIndex; 548 | OO['@findex'] = focusIndex; 549 | po.push(''); 552 | if (OO[item.columnKeys.optionSelected]) { 553 | setSelected.call(self, queIdx, OO); 554 | } 555 | 556 | item.indexedOptions.push({ 557 | '@findex': focusIndex, value: OO[item.columnKeys.optionValue], text: OO[item.columnKeys.optionText] 558 | }); 559 | focusIndex++; 560 | }); 561 | } 562 | else { 563 | O['@index'] = OIndex; 564 | O['@findex'] = focusIndex; 565 | po.push(''); 568 | if (O[item.columnKeys.optionSelected]) { 569 | setSelected.call(self, queIdx, O); 570 | } 571 | 572 | item.indexedOptions.push({ 573 | '@findex': focusIndex, value: O[item.columnKeys.optionValue], text: O[item.columnKeys.optionText] 574 | }); 575 | focusIndex++; 576 | } 577 | }); 578 | item.optionItemLength = focusIndex; 579 | item.$select.html(po.join('')); 580 | } 581 | else { 582 | /// select > options 태그로 스크립트 options를 만들어주는 역할 583 | elementOptions = U.toArray(item.$select.get(0).options); 584 | // select option 스크립트 생성 585 | newOptions = []; 586 | elementOptions.forEach(function (O, OIndex) { 587 | var option = {}; 588 | //if (O.value != "") { 589 | option[item.columnKeys.optionValue] = O.value; 590 | option[item.columnKeys.optionText] = O.text; 591 | option[item.columnKeys.optionSelected] = O.selected; 592 | option['@index'] = OIndex; 593 | option['@findex'] = OIndex; 594 | if (O.selected) setSelected.call(self, queIdx, option); 595 | newOptions.push(option); 596 | //} 597 | option = null; 598 | }); 599 | item.options = newOptions; 600 | item.indexedOptions = newOptions; 601 | } 602 | 603 | if (!item.multiple && item.selected.length == 0 && item.options && item.options[0]) { 604 | if (item.options[0].optgroup) { 605 | item.options[0].options[0][item.columnKeys.optionSelected] = true; 606 | item.selected.push(jQuery.extend({}, item.options[0].options[0])); 607 | } 608 | else { 609 | item.options[0][item.columnKeys.optionSelected] = true; 610 | item.selected.push(jQuery.extend({}, item.options[0])); 611 | } 612 | } 613 | 614 | po = null; 615 | elementOptions = null; 616 | newOptions = null; 617 | return item.options; 618 | } 619 | })(), 620 | getQueIdx = function (boundID) { 621 | if (!U.isString(boundID)) { 622 | boundID = jQuery(boundID).data("data-ax5select-id"); 623 | } 624 | if (!U.isString(boundID)) { 625 | console.log(ax5.info.getError("ax5select", "402", "getQueIdx")); 626 | return; 627 | } 628 | return U.search(this.queue, function () { 629 | return this.id == boundID; 630 | }); 631 | }; 632 | /// private end 633 | 634 | /** 635 | * Preferences of select UI 636 | * @method ax5select.setConfig 637 | * @param {Object} config - 클래스 속성값 638 | * @returns {ax5select} 639 | * @example 640 | * ```js 641 | * var options = []; 642 | * for (var i = 0; i < 20; i++) { 643 | * options.push({value: i, text: "optionText" + i}); 644 | * } 645 | 646 | * var mySelect = new ax5.ui.select({ 647 | * theme: "danger" 648 | * }); 649 | 650 | * mySelect.bind({ 651 | * theme: "primary", 652 | * target: $('[data-ax5select="select1"]'), 653 | * options: options, 654 | * onChange: function () { 655 | * console.log(this); 656 | * }, 657 | * onClose: function () { 658 | * console.log(this); 659 | * }, 660 | * onStateChanged: function () { 661 | * console.log(this); 662 | * } 663 | * }); 664 | * ``` 665 | */ 666 | this.init = function () { 667 | this.onStateChanged = cfg.onStateChanged; 668 | this.onChange = cfg.onChange; 669 | 670 | jQuery(window).bind("resize.ax5select-display-" + this.instanceId, (function () { 671 | alignSelectDisplay.call(this); 672 | }).bind(this)); 673 | }; 674 | 675 | /** 676 | * bind select 677 | * @method ax5select.bind 678 | * @param {Object} item 679 | * @param {String} [item.id] 680 | * @param {String} [item.theme] 681 | * @param {Boolean} [item.multiple] 682 | * @param {Element} item.target 683 | * @param {Object[]} item.options 684 | * @returns {ax5select} 685 | * @example 686 | * ```js 687 | * var mySelect = new ax5.ui.select(); 688 | * mySelect.bind({ 689 | * columnKeys: { 690 | * optionValue: "value", 691 | * optionText: "text" 692 | * }, 693 | * target: $('[data-ax5select="select1"]'), 694 | * options: [ 695 | * {value: "", text: ""} 696 | * ], 697 | * onChange: function(){ 698 | * 699 | * }, 700 | * onClose: function(){ 701 | * 702 | * }, 703 | * onStateChanged: function(){ 704 | * 705 | * } 706 | * }); 707 | * ``` 708 | */ 709 | this.bind = function (item) { 710 | let selectConfig = {}, 711 | queIdx; 712 | 713 | item = jQuery.extend(true, selectConfig, cfg, item); 714 | 715 | if (!item.target) { 716 | console.log(ax5.info.getError("ax5select", "401", "bind")); 717 | return this; 718 | } 719 | 720 | item.$target = jQuery(item.target); 721 | 722 | if (!item.id) item.id = item.$target.data("data-ax5select-id"); 723 | if (!item.id) { 724 | item.id = 'ax5select-' + ax5.getGuid(); 725 | item.$target.data("data-ax5select-id", item.id); 726 | } 727 | item.name = item.$target.attr("data-ax5select"); 728 | 729 | if (item.options) { 730 | item.options = JSON.parse(JSON.stringify(item.options)); 731 | } 732 | 733 | // target attribute data 734 | (function (data) { 735 | if (U.isObject(data) && !data.error) { 736 | item = jQuery.extend(true, item, data); 737 | } 738 | })(U.parseJson(item.$target.attr("data-ax5select-config"), true)); 739 | 740 | queIdx = U.search(this.queue, function () { 741 | return this.id == item.id; 742 | }); 743 | 744 | if (queIdx === -1) { 745 | this.queue.push(item); 746 | bindSelectTarget.call(this, this.queue.length - 1); 747 | } 748 | else { 749 | this.queue[queIdx].selected = []; 750 | this.queue[queIdx].options = item.options; 751 | this.queue[queIdx] = jQuery.extend(true, {}, this.queue[queIdx], item); 752 | bindSelectTarget.call(this, queIdx); 753 | } 754 | 755 | selectConfig = null; 756 | queIdx = null; 757 | return this; 758 | }; 759 | 760 | /** 761 | * open the optionBox of select 762 | * @method ax5select.open 763 | * @param {(String|Number|Element)} boundID 764 | * @param {Number} [tryCount] 765 | * @returns {ax5select} 766 | */ 767 | this.open = (function () { 768 | 769 | let onExpand = function (item) { 770 | item.onExpand.call({ 771 | self: this, 772 | item: item 773 | }, (function (O) { 774 | if (this.waitOptionsCallback) { 775 | var data = {}; 776 | var item = this.queue[this.activeSelectQueueIndex]; 777 | 778 | /// 현재 selected 검증후 처리 779 | (function (item, O) { 780 | var optionsMap = {}; 781 | O.options.forEach(function (_O, _OIndex) { 782 | _O["@index"] = _OIndex; 783 | optionsMap[_O[item.columnKeys.optionValue]] = _O; 784 | }); 785 | if (U.isArray(item.selected)) { 786 | item.selected.forEach(function (_O) { 787 | if (optionsMap[_O[item.columnKeys.optionValue]]) { 788 | O.options[optionsMap[_O[item.columnKeys.optionValue]]["@index"]][item.columnKeys.optionSelected] = true; 789 | } 790 | }); 791 | } 792 | })(item, O); 793 | 794 | 795 | item.$displayLabel 796 | .html(getLabel.call(this, this.activeSelectQueueIndex)); 797 | item.options = syncSelectOptions.call(this, this.activeSelectQueueIndex, O.options); 798 | 799 | alignSelectDisplay.call(this); 800 | 801 | /// 템플릿에 전달할 오브젝트 선언 802 | data.id = item.id; 803 | data.theme = item.theme; 804 | data.size = "ax5select-option-group-" + item.size; 805 | data.multiple = item.multiple; 806 | data.lang = item.lang; 807 | data.options = item.options; 808 | this.activeSelectOptionGroup.find('[data-els="content"]').html(SELECT.tmpl.get.call(this, "optionsTmpl", data, item.columnKeys)); 809 | } 810 | }).bind(this)); 811 | }; 812 | 813 | return function (boundID, tryCount) { 814 | this.waitOptionsCallback = null; 815 | 816 | /** 817 | * open select from the outside 818 | */ 819 | let queIdx = (U.isNumber(boundID)) ? boundID : getQueIdx.call(this, boundID), 820 | item = this.queue[queIdx], 821 | data = {}, focusTop, selectedOptionEl; 822 | 823 | if (item.$display.attr("disabled")) return this; 824 | 825 | if (this.openTimer) clearTimeout(this.openTimer); 826 | if (this.activeSelectOptionGroup) { 827 | if (this.activeSelectQueueIndex == queIdx) { 828 | return this; 829 | } 830 | 831 | if (tryCount > 2) return this; 832 | this.close(); 833 | this.openTimer = setTimeout((function () { 834 | this.open(queIdx, (tryCount || 0) + 1); 835 | }).bind(this), cfg.animateTime); 836 | 837 | return this; 838 | } 839 | 840 | item.optionFocusIndex = -1; // optionGroup이 열리면 포커스 인덱스 초기화 -1로 841 | if (item.selected && item.selected.length > 0) { 842 | item.optionSelectedIndex = item.selected[0]["@findex"]; 843 | } 844 | 845 | /// 템플릿에 전달할 오브젝트 선언 846 | data.id = item.id; 847 | data.theme = item.theme; 848 | data.size = "ax5select-option-group-" + item.size; 849 | data.multiple = item.multiple; 850 | 851 | data.lang = item.lang; 852 | item.$display.attr("data-select-option-group-opened", "true"); 853 | //console.log(data.lang); 854 | 855 | if (item.onExpand) { 856 | // onExpand 인 경우 UI 대기모드 추가 857 | data.waitOptions = true; 858 | } 859 | 860 | data.options = item.options; 861 | this.activeSelectOptionGroup = SELECT.tmpl.get.call(this, "optionGroupTmpl", data); 862 | this.activeSelectOptionGroup.find('[data-els="content"]').html(SELECT.tmpl.get.call(this, "optionsTmpl", data, item.columnKeys)); 863 | this.activeSelectQueueIndex = queIdx; 864 | 865 | alignSelectOptionGroup.call(this, "append"); // alignSelectOptionGroup 에서 body append 866 | jQuery(window).bind("resize.ax5select-" + this.instanceId, (function () { 867 | alignSelectOptionGroup.call(this); 868 | }).bind(this)); 869 | 870 | if (item.selected && item.selected.length > 0) { 871 | selectedOptionEl = this.activeSelectOptionGroup.find('[data-option-index="' + item.selected[0]["@index"] + '"]'); 872 | 873 | if (selectedOptionEl.get(0)) { 874 | focusTop = selectedOptionEl.position().top - this.activeSelectOptionGroup.height() / 3; 875 | this.activeSelectOptionGroup.find('[data-els="content"]') 876 | .stop().animate({scrollTop: focusTop}, item.animateTime, 'swing', function () { 877 | }); 878 | } 879 | } 880 | 881 | /// 사용자 입력으로 옵션을 검색하기 위한 시나리오 882 | // 옵션그룹이 활성화 되면 사용자 입력을 받기위한 input 값 초기화 및 포커스 다른 select가 닫히면서 display focus 이벤트와 충돌하는 문제가 있으므로 883 | // 1밀리세컨 지연후 포커스 처리. input에 포커스가 되므로 input value로 options를 검색 할 수 있게 됩니다. 884 | item.$displayInput.val(''); 885 | 886 | setTimeout((function () { 887 | item.$displayInput.trigger("focus"); 888 | 889 | jQuery(window).bind("keyup.ax5select-" + this.instanceId, (function (e) { 890 | e = e || window.event; 891 | onBodyKeyup.call(this, e); 892 | U.stopEvent(e); 893 | }).bind(this)); 894 | 895 | jQuery(window).bind("click.ax5select-" + this.instanceId, (function (e) { 896 | e = e || window.event; 897 | onBodyClick.call(this, e); 898 | U.stopEvent(e); 899 | }).bind(this)); 900 | 901 | }).bind(this), 300); 902 | 903 | onStateChanged.call(this, item, { 904 | self: this, 905 | state: "open", 906 | item: item 907 | }); 908 | 909 | // waitOption timer 910 | if (item.onExpand) { 911 | this.waitOptionsCallback = true; 912 | onExpand.call(this, item); 913 | } 914 | 915 | data = null; 916 | focusTop = null; 917 | selectedOptionEl = null; 918 | return this; 919 | } 920 | })(); 921 | 922 | /** 923 | * @method ax5select.update 924 | * @param {(Object|String)} item 925 | * @returns {ax5select} 926 | */ 927 | this.update = function (_item) { 928 | this.bind(_item); 929 | return this; 930 | }; 931 | 932 | /** 933 | * @method ax5select.setOptions 934 | * @param boundID 935 | * @param options 936 | * @returns {ax5select} 937 | */ 938 | this.setOptions = function (boundID, options) { 939 | let queIdx = getQueIdx.call(this, boundID); 940 | this.queue[queIdx].selected = []; 941 | this.queue[queIdx].options = options; 942 | bindSelectTarget.call(this, queIdx); 943 | return this; 944 | }; 945 | 946 | /** 947 | * @method ax5select.val 948 | * @param {(String|Number|Element)} boundID 949 | * @param {(String|Object|Array)} [value] 950 | * @param {Boolean} [selected] 951 | * @returns {ax5select} 952 | */ 953 | this.val = (function () { 954 | 955 | // todo : val 함수 리팩토링 필요 956 | let getSelected = function (_item, o, selected) { 957 | if (typeof selected === "undefined") { 958 | return (_item.multiple) ? !o : true; 959 | } else { 960 | return selected; 961 | } 962 | }, 963 | clearSelected = function (queIdx) { 964 | this.queue[queIdx].options.forEach(function (n) { 965 | if (n.optgroup) { 966 | n.options.forEach(function (nn) { 967 | nn.selected = false; 968 | }); 969 | } 970 | else { 971 | n.selected = false; 972 | } 973 | }); 974 | }, 975 | processor = { 976 | 'index': function (queIdx, value, selected) { 977 | // 클래스 내부에서 호출된 형태, 그런 이유로 옵션그룹에 대한 상태를 변경 하고 있다. 978 | let item = this.queue[queIdx]; 979 | 980 | /* 981 | if (U.isArray(value.index)) { 982 | value.index.forEach(function (n) { 983 | item.options[n][item.columnKeys.optionSelected] = getSelected(item, item.options[n][item.columnKeys.optionSelected], selected); 984 | self.activeSelectOptionGroup 985 | .find('[data-option-index="' + n + '"]') 986 | .attr("data-option-selected", item.options[n][item.columnKeys.optionSelected].toString()); 987 | }); 988 | } 989 | else { 990 | } 991 | */ 992 | if (U.isString(value.index.gindex)) { 993 | item.options[value.index.gindex].options[value.index.index][item.columnKeys.optionSelected] = getSelected(item, item.options[value.index.gindex].options[value.index.index][item.columnKeys.optionSelected], selected); 994 | self.activeSelectOptionGroup 995 | .find('[data-option-group-index="' + value.index.gindex + '"][data-option-index="' + value.index.index + '"]') 996 | .attr("data-option-selected", item.options[value.index.gindex].options[value.index.index][item.columnKeys.optionSelected].toString()); 997 | } 998 | else { 999 | item.options[value.index.index][item.columnKeys.optionSelected] = getSelected(item, item.options[value.index.index][item.columnKeys.optionSelected], selected); 1000 | self.activeSelectOptionGroup 1001 | .find('[data-option-index="' + value.index.index + '"]') 1002 | .attr("data-option-selected", item.options[value.index.index][item.columnKeys.optionSelected].toString()); 1003 | 1004 | } 1005 | 1006 | syncSelectOptions.call(this, queIdx, item.options); 1007 | syncLabel.call(this, queIdx); 1008 | alignSelectOptionGroup.call(this); 1009 | }, 1010 | 'arr': function (queIdx, values, selected) { 1011 | values.forEach(function (value) { 1012 | if (U.isString(value) || U.isNumber(value)) { 1013 | processor.value.call(self, queIdx, value, selected); 1014 | } 1015 | else { 1016 | for (var key in processor) { 1017 | if (value[key]) { 1018 | processor[key].call(self, queIdx, value, selected); 1019 | break; 1020 | } 1021 | } 1022 | } 1023 | }); 1024 | }, 1025 | 'value': function (queIdx, value, selected) { 1026 | let item = this.queue[queIdx], 1027 | optionIndex = U.search(item.options, function () { 1028 | return this[item.columnKeys.optionValue] == value; 1029 | }); 1030 | if (optionIndex > -1) { 1031 | item.options[optionIndex][item.columnKeys.optionSelected] = getSelected(item, item.options[optionIndex][item.columnKeys.optionSelected], selected); 1032 | } 1033 | else { 1034 | console.log(ax5.info.getError("ax5select", "501", "val")); 1035 | return; 1036 | } 1037 | 1038 | syncSelectOptions.call(this, queIdx, item.options); 1039 | syncLabel.call(this, queIdx); 1040 | }, 1041 | 'text': function (queIdx, value, selected) { 1042 | let item = this.queue[queIdx], 1043 | optionIndex = U.search(item.options, function () { 1044 | return this[item.columnKeys.optionText] == value; 1045 | }); 1046 | if (optionIndex > -1) { 1047 | item.options[optionIndex][item.columnKeys.optionSelected] = getSelected(item, item.options[optionIndex][item.columnKeys.optionSelected], selected); 1048 | } 1049 | else { 1050 | console.log(ax5.info.getError("ax5select", "501", "val")); 1051 | return; 1052 | } 1053 | 1054 | syncSelectOptions.call(this, queIdx, item.options); 1055 | syncLabel.call(this, queIdx); 1056 | }, 1057 | 'clear': function (queIdx) { 1058 | clearSelected.call(this, queIdx); 1059 | syncSelectOptions.call(this, queIdx, this.queue[queIdx].options); 1060 | syncLabel.call(this, queIdx); 1061 | 1062 | if (this.activeSelectOptionGroup) { 1063 | this.activeSelectOptionGroup 1064 | .find('[data-option-index]') 1065 | .attr("data-option-selected", "false"); 1066 | } 1067 | } 1068 | }; 1069 | 1070 | return function (boundID, value, selected, internal) { 1071 | let queIdx = (U.isNumber(boundID)) ? boundID : getQueIdx.call(this, boundID); 1072 | if (!this.queue[queIdx]) { 1073 | return this; 1074 | } 1075 | if (typeof value !== "undefined" && !this.queue[queIdx].multiple) { 1076 | clearSelected.call(this, queIdx); 1077 | } 1078 | 1079 | if (typeof value == "undefined") { 1080 | return this.queue[queIdx].selected; 1081 | } 1082 | else if (U.isArray(value)) { 1083 | processor.arr.call(this, queIdx, value, selected); 1084 | } 1085 | else if (U.isString(value) || U.isNumber(value)) { 1086 | processor.value.call(this, queIdx, value, selected); 1087 | } 1088 | else { 1089 | if (value === null) { 1090 | processor.clear.call(this, queIdx); 1091 | } 1092 | else { 1093 | for (var key in processor) { 1094 | if (value[key]) { 1095 | processor[key].call(this, queIdx, value, selected); 1096 | break; 1097 | } 1098 | } 1099 | } 1100 | } 1101 | 1102 | if (typeof value !== "undefined") { 1103 | onStateChanged.call(this, this.queue[queIdx], { 1104 | self: this, 1105 | item: this.queue[queIdx], 1106 | state: (internal) ? "changeValue" : "setValue", 1107 | value: this.queue[queIdx].selected, 1108 | internal: internal 1109 | }); 1110 | } 1111 | 1112 | boundID = null; 1113 | return this; 1114 | }; 1115 | })(); 1116 | 1117 | /** 1118 | * @method ax5select.close 1119 | * @returns {ax5select} 1120 | */ 1121 | this.close = function (item) { 1122 | if (this.closeTimer) clearTimeout(this.closeTimer); 1123 | if (!this.activeSelectOptionGroup) return this; 1124 | 1125 | item = this.queue[this.activeSelectQueueIndex]; 1126 | item.optionFocusIndex = -1; 1127 | 1128 | item.$displayInput.val('').trigger("blur"); 1129 | item.$display.removeAttr("data-select-option-group-opened").trigger("focus"); 1130 | 1131 | this.activeSelectOptionGroup.addClass("destroy"); 1132 | 1133 | jQuery(window) 1134 | .unbind("resize.ax5select-" + this.instanceId) 1135 | .unbind("click.ax5select-" + this.instanceId) 1136 | .unbind("keyup.ax5select-" + this.instanceId); 1137 | 1138 | this.closeTimer = setTimeout((function () { 1139 | if (this.activeSelectOptionGroup) this.activeSelectOptionGroup.remove(); 1140 | this.activeSelectOptionGroup = null; 1141 | this.activeSelectQueueIndex = -1; 1142 | 1143 | var that = { 1144 | self: this, 1145 | item: item, 1146 | value: item.selected, 1147 | state: "close" 1148 | }; 1149 | 1150 | onStateChanged.call(this, item, that); 1151 | 1152 | // waitOption timer 1153 | if (item.onClose) { 1154 | item.onClose.call(that); 1155 | } 1156 | }).bind(this), cfg.animateTime); 1157 | this.waitOptionsCallback = null; 1158 | return this; 1159 | }; 1160 | 1161 | this.enable = function (boundID) { 1162 | let queIdx = getQueIdx.call(this, boundID); 1163 | this.queue[queIdx].$display.removeAttr("disabled"); 1164 | this.queue[queIdx].$select.removeAttr("disabled"); 1165 | 1166 | onStateChanged.call(this, this.queue[queIdx], { 1167 | self: this, 1168 | state: "enable" 1169 | }); 1170 | 1171 | return this; 1172 | }; 1173 | 1174 | this.disable = function (boundID) { 1175 | let queIdx = getQueIdx.call(this, boundID); 1176 | this.queue[queIdx].$display.attr("disabled", "disabled"); 1177 | this.queue[queIdx].$select.attr("disabled", "disabled"); 1178 | 1179 | onStateChanged.call(this, this.queue[queIdx], { 1180 | self: this, 1181 | state: "disable" 1182 | }); 1183 | 1184 | return this; 1185 | }; 1186 | 1187 | // 클래스 생성자 1188 | this.main = (function () { 1189 | if (arguments && U.isObject(arguments[0])) { 1190 | this.setConfig(arguments[0]); 1191 | } 1192 | else { 1193 | this.init(); 1194 | } 1195 | }).apply(this, arguments); 1196 | }; 1197 | return ax5select; 1198 | })()); 1199 | SELECT = ax5.ui.select; 1200 | })(); 1201 | 1202 | ax5.ui.select_instance = new ax5.ui.select(); 1203 | jQuery.fn.ax5select = (function () { 1204 | return function (config) { 1205 | if (ax5.util.isString(arguments[0])) { 1206 | let methodName = arguments[0]; 1207 | 1208 | switch (methodName) { 1209 | case "open": 1210 | return ax5.ui.select_instance.open(this); 1211 | break; 1212 | case "close": 1213 | return ax5.ui.select_instance.close(this); 1214 | break; 1215 | case "setValue": 1216 | return ax5.ui.select_instance.val(this, arguments[1], arguments[2]); 1217 | break; 1218 | case "getValue": 1219 | return ax5.ui.select_instance.val(this); 1220 | break; 1221 | case "enable": 1222 | return ax5.ui.select_instance.enable(this); 1223 | break; 1224 | case "disable": 1225 | return ax5.ui.select_instance.disable(this); 1226 | break; 1227 | case "setOptions": 1228 | return ax5.ui.select_instance.setOptions(this, arguments[1]); 1229 | break; 1230 | default: 1231 | return this; 1232 | } 1233 | } 1234 | else { 1235 | if (typeof config == "undefined") config = {}; 1236 | jQuery.each(this, function () { 1237 | let defaultConfig = { 1238 | target: this 1239 | }; 1240 | config = jQuery.extend({}, config, defaultConfig); 1241 | ax5.ui.select_instance.bind(config); 1242 | }); 1243 | } 1244 | return this; 1245 | } 1246 | 1247 | })(); 1248 | 1249 | 1250 | // muliple 속성이 없는 select의 기본 선택 해제 방법.. 결정 필요.. 1251 | // onExpand 가 있으면..? -------------------------------------------------------------------------------- /src/ax5select.scss: -------------------------------------------------------------------------------- 1 | @import "node_modules/ax5core/src/_ax5.scss"; 2 | 3 | @import "scss/ax5select_variables"; 4 | @import "scss/ax5select"; -------------------------------------------------------------------------------- /src/modules/ax5select-tmpl.js: -------------------------------------------------------------------------------- 1 | // ax5.ui.select.tmpl 2 | (function () { 3 | 4 | var SELECT = ax5.ui.select; 5 | 6 | var optionGroupTmpl = function (columnKeys) { 7 | return ` 8 |
9 |
10 |
11 |
12 |
13 |
14 | `; 15 | }; 16 | var tmpl = function (columnKeys) { 17 | return ` 18 | 20 |
21 |
{{label}}
22 |
23 | {{#multiple}}{{#reset}} 24 | {{{.}}} 25 | {{/reset}}{{/multiple}} 26 | {{#icons}} 27 | {{clesed}} 28 | {{opened}} 29 | {{/icons}} 30 | {{^icons}} 31 | 32 | 33 | {{/icons}} 34 |
35 |
36 | 38 |
39 | `; 40 | }; 41 | var selectTmpl = function (columnKeys) { 42 | return ` 43 | 44 | `; 45 | }; 46 | var optionsTmpl = function (columnKeys) { 47 | return ` 48 | {{#waitOptions}} 49 |
50 |
51 | 52 | {{{lang.loading}}} 53 | 54 |
55 |
56 | {{/waitOptions}} 57 | {{^waitOptions}} 58 | {{#options}} 59 | {{#optgroup}} 60 |
61 |
62 | 63 | {{{.}}} 64 | 65 |
66 | {{#options}} 67 |
70 |
71 | {{#multiple}} 72 | 73 | 74 | 75 | {{/multiple}} 76 | {{{${columnKeys.optionText}}}} 77 |
78 |
79 | {{/options}} 80 |
81 | {{/optgroup}} 82 | {{^optgroup}} 83 |
84 |
85 | {{#multiple}} 86 | 87 | 88 | 89 | {{/multiple}} 90 | {{{${columnKeys.optionText}}}} 91 |
92 |
93 | {{/optgroup}} 94 | {{/options}} 95 | {{^options}} 96 |
97 |
98 | 99 | {{{lang.noOptions}}} 100 | 101 |
102 |
103 | {{/options}} 104 | {{/waitOptions}} 105 | `; 106 | }; 107 | 108 | SELECT.tmpl = { 109 | "optionGroupTmpl": optionGroupTmpl, 110 | "tmpl": tmpl, 111 | "selectTmpl": selectTmpl, 112 | "optionsTmpl": optionsTmpl, 113 | 114 | get: function (tmplName, data, columnKeys) { 115 | return jQuery(ax5.mustache.render(SELECT.tmpl[tmplName].call(this, columnKeys), data)); 116 | } 117 | }; 118 | 119 | })(); -------------------------------------------------------------------------------- /src/scss/_ax5select.scss: -------------------------------------------------------------------------------- 1 | /// override bootstrap.form-control 2 | @mixin input-size($parent, $input-height) { 3 | [data-ax5select] { 4 | .ax5select-display#{$parent} { 5 | height: $input-height; 6 | } 7 | select[multiple]#{$parent} { 8 | height: $input-height; 9 | } 10 | } 11 | } 12 | 13 | [data-ax5select] select[multiple].form-control { 14 | height: $input-height-base; 15 | } 16 | 17 | @include input-size('.input-sm', $input-height-small); 18 | @include input-size('.input-lg', $input-height-large); 19 | 20 | .form-group-sm { 21 | [data-ax5select] { 22 | select[multiple].form-control { 23 | height: $input-height-small; 24 | } 25 | } 26 | 27 | } 28 | 29 | .form-group-lg { 30 | [data-ax5select] { 31 | select[multiple].form-control { 32 | height: $input-height-large; 33 | } 34 | } 35 | } 36 | 37 | .form-inline { 38 | @media (min-width: $screen-sm-min) { 39 | // Inline-block all the things for "inline" 40 | [data-ax5select] { 41 | display: inline-block; 42 | } 43 | } 44 | } 45 | 46 | // select group 47 | [data-ax5select] { 48 | position: relative; 49 | overflow: visible; 50 | display: block; 51 | box-sizing: border-box; 52 | *, 53 | *:before, 54 | *:after { 55 | box-sizing: border-box; 56 | } 57 | margin: 0; 58 | 59 | select { 60 | z-index: 1; 61 | position: absolute; 62 | opacity: 0; 63 | user-select: none; 64 | } 65 | } 66 | 67 | @include keyframes(ax-select-option-group) { 68 | from { 69 | @include transform(translateY(-10%)); 70 | opacity: 0; 71 | } 72 | to { 73 | @include transform(translateY(0%)); 74 | opacity: 1; 75 | } 76 | } 77 | 78 | @include keyframes(ax-select-option-group-destroy) { 79 | from { 80 | @include transform(translateY(0%) scaleY(1.0)); 81 | opacity: 1; 82 | } 83 | to { 84 | @include transform(translateY(0%) scaleY(0.0)); 85 | opacity: 0; 86 | } 87 | } 88 | 89 | @mixin ax5select-display-theme($base-color, $back-color, $theme-color) { 90 | &:hover, &:active, &:focus, &[data-select-option-group-opened] { 91 | &:not([disabled]) { 92 | border-color: $theme-color; 93 | color: $base-color; 94 | //background-color: transparent; 95 | text-decoration: none; 96 | 97 | .ax5select-display-table { 98 | [data-ax5select-display="label"] { 99 | 100 | } 101 | [data-ax5select-display="addon"] { 102 | .addon-icon-closed { 103 | .addon-icon-arrow { 104 | border-top-color: $base-color; 105 | } 106 | } 107 | .addon-icon-opened { 108 | .addon-icon-arrow { 109 | border-bottom-color: $base-color; 110 | } 111 | } 112 | } 113 | } 114 | } 115 | } 116 | [disabled] { 117 | user-select: none; 118 | } 119 | } 120 | 121 | @mixin ax5select-option-group-theme($base-color, $back-color, $theme-color, $hover-type) { 122 | border-color: $theme-color; 123 | color: $base-color; 124 | 125 | .ax-select-body { 126 | 127 | .ax-select-option-group-content { 128 | .ax-select-option-item { 129 | &:hover, &.hover { 130 | @if nth($hover-type, 1) == "lighten" { 131 | background: lighten($theme-color, 15%) !important; 132 | color: lighten($base-color, nth($hover-type, 2)); 133 | } @else if nth($hover-type, 1) == "darken" { 134 | background: darken($theme-color, 15%) !important; 135 | color: darken($base-color, nth($hover-type, 2)); 136 | } 137 | 138 | .ax-select-option-item-holder { 139 | .ax-select-option-item-cell { 140 | &.ax-select-option-item-checkbox { 141 | .item-checkbox-wrap { 142 | &.useCheckBox { 143 | &:after { 144 | @if nth($hover-type, 1) == "lighten" { 145 | border-color: lighten($base-color, nth($hover-type, 2)) !important; 146 | } @else if nth($hover-type, 1) == "darken" { 147 | border-color: darken($base-color, nth($hover-type, 2)) !important; 148 | } 149 | } 150 | } 151 | } 152 | } 153 | &.ax-select-option-item-label { 154 | } 155 | } 156 | } 157 | } 158 | &[data-option-selected="true"] { 159 | @if nth($hover-type, 1) == "lighten" { 160 | background: $theme-color; 161 | color: lighten($base-color, nth($hover-type, 2)); 162 | } @else if nth($hover-type, 1) == "darken" { 163 | background: $theme-color; 164 | color: darken($base-color, nth($hover-type, 2)); 165 | } 166 | 167 | .ax-select-option-item-holder { 168 | .ax-select-option-item-cell { 169 | &.ax-select-option-item-checkbox { 170 | .item-checkbox-wrap { 171 | &.useCheckBox { 172 | &:after { 173 | @if nth($hover-type, 1) == "lighten" { 174 | border-color: lighten($base-color, nth($hover-type, 2)) !important; 175 | } @else if nth($hover-type, 1) == "darken" { 176 | border-color: darken($base-color, nth($hover-type, 2)) !important; 177 | } 178 | } 179 | } 180 | } 181 | } 182 | &.ax-select-option-item-label { 183 | } 184 | } 185 | } 186 | } 187 | } 188 | .ax-select-option-group { 189 | 190 | .ax-select-option-item-holder { 191 | 192 | .ax-select-option-group-label { 193 | background: #eee; 194 | } 195 | } 196 | } 197 | } 198 | 199 | .ax-select-option-group-buttons { 200 | border-top: 1px solid; 201 | border-color: $theme-color; 202 | } 203 | } 204 | 205 | &:hover { 206 | 207 | } 208 | } 209 | 210 | @mixin ax5select-option-group-size($padding, $font-size) { 211 | .ax-select-body { 212 | padding: $ax5select-option-group-body-padding; 213 | $ax5select-option-item-height: $font-size + 5; 214 | $ax5select-option-item-checkbox-size: $font-size - 4; 215 | .ax-select-option-group-content { 216 | max-height: $ax5select-option-item-height * 10; 217 | overflow-y: auto; 218 | -webkit-overflow-scrolling: touch; 219 | position: relative; 220 | .ax-select-option-item { 221 | padding: $padding; 222 | text-align: left; 223 | cursor: pointer; 224 | font-size: $font-size; 225 | position: relative; 226 | box-sizing: border-box; 227 | overflow: hidden; 228 | //table-layout: fixed; 229 | 230 | .ax-select-option-item-holder { 231 | display: table; 232 | position: relative; 233 | border-collapse: separate; 234 | overflow: hidden; 235 | //table-layout: fixed; 236 | width: 100%; 237 | height: $ax5select-option-item-height; 238 | 239 | .ax-select-option-item-cell { 240 | box-sizing: border-box; 241 | display: table-cell; 242 | vertical-align: middle; 243 | white-space: nowrap; 244 | font-size: $font-size; 245 | line-height: $ax5select-option-item-height; 246 | padding: 0px 0px 0px 0px; 247 | user-select: none; 248 | 249 | &.ax-select-option-item-checkbox { 250 | overflow: hidden; 251 | width: $font-size; 252 | text-align: center; 253 | .item-checkbox-wrap { 254 | position: relative; 255 | display: block; 256 | width: $font-size; 257 | height: $ax5select-option-item-height; 258 | 259 | &.useCheckBox { 260 | &:after { 261 | content: ''; 262 | width: $ax5select-option-item-checkbox-size; 263 | height: $ax5select-option-item-checkbox-size / 2; 264 | position: absolute; 265 | top: ($ax5select-option-item-height) / 4; 266 | right: 0px; 267 | border: 2px solid #000; 268 | border-top: none; 269 | border-right: none; 270 | background: transparent; 271 | opacity: 0.1; 272 | @include transform(rotate(-50deg)); 273 | } 274 | } 275 | } 276 | } 277 | &.ax-select-option-item-label { 278 | padding: $ax5select-label-padding; 279 | padding-right: $ax5select-option-item-checkbox-size; 280 | } 281 | } 282 | } 283 | 284 | &[data-option-selected="true"] { 285 | .ax-select-option-item-holder .ax-select-option-item-cell.ax-select-option-item-checkbox .item-checkbox-wrap.useCheckBox { 286 | &:after { 287 | opacity: 1; 288 | } 289 | } 290 | } 291 | } 292 | .ax-select-option-group { 293 | 294 | .ax-select-option-item-holder { 295 | display: table; 296 | position: relative; 297 | border-collapse: separate; 298 | overflow: hidden; 299 | //table-layout: fixed; 300 | width: 100%; 301 | height: $ax5select-option-item-height; 302 | 303 | .ax-select-option-group-label { 304 | box-sizing: border-box; 305 | display: table-cell; 306 | vertical-align: middle; 307 | white-space: nowrap; 308 | font-size: $font-size; 309 | line-height: $ax5select-option-item-height; 310 | 311 | padding: 5px 10px; // todo : theme 정리 나중에 312 | user-select: none; 313 | } 314 | } 315 | } 316 | } 317 | .ax-select-option-group-buttons { 318 | text-align: center; 319 | padding: $padding; 320 | } 321 | } 322 | } 323 | 324 | // themes 325 | $base-colors: ( 326 | default: $ax5select-default-base-color, 327 | primary: $ax5select-primary-base-color, 328 | success: $ax5select-success-base-color, 329 | info: $ax5select-info-base-color, 330 | warning: $ax5select-warning-base-color, 331 | danger: $ax5select-danger-base-color 332 | ); 333 | $theme-colors: ( 334 | default: $ax5select-default-theme-color, 335 | primary: $ax5select-primary-theme-color, 336 | success: $ax5select-success-theme-color, 337 | info: $ax5select-info-theme-color, 338 | warning: $ax5select-warning-theme-color, 339 | danger: $ax5select-danger-theme-color 340 | ); 341 | $hover-types: ( 342 | default: $ax5select-default-hover-type, 343 | primary: $ax5select-primary-hover-type, 344 | success: $ax5select-success-hover-type, 345 | info: $ax5select-info-hover-type, 346 | warning: $ax5select-warning-hover-type, 347 | danger: $ax5select-danger-hover-type 348 | ); 349 | 350 | /// select-display 351 | .ax5select-display { 352 | position: relative; 353 | z-index: 2; 354 | padding: 0px; 355 | 356 | display: block; 357 | height: $input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border) 358 | font-size: $font-size-base; 359 | border-radius: $input-border-radius; // Note: This has no effect on s in CSS. 360 | 361 | @include ax-background(top, $ax5select-label-bg-colors); 362 | border: $ax5select-label-border; 363 | color: $ax5select-label-color; 364 | 365 | text-decoration: none; 366 | @include box-shadow(none); 367 | // @include box-shadow(inset 0px -2px 5px rgba(0,0,0,.075)); 368 | 369 | &:hover, &:focus { 370 | text-decoration: none; 371 | } 372 | 373 | .ax5select-display-table { 374 | width: 100%; 375 | height: 100%; 376 | display: table; 377 | //table-layout: fixed; 378 | border-collapse: collapse; 379 | user-select: none; 380 | 381 | [data-ax5select-display="label"] { 382 | display: table-cell; 383 | vertical-align: middle; 384 | padding: $ax5select-label-padding; 385 | color: $ax5select-label-color; 386 | white-space: nowrap; 387 | } 388 | [data-ax5select-display="addon"] { 389 | display: table-cell; 390 | vertical-align: middle; 391 | width: $ax5select-addon-icon-height * 2 + $ax5select-addon-icon-padding-right; 392 | text-align: center; 393 | 394 | .addon-icon-reset { 395 | display: none; 396 | } 397 | .addon-icon-closed { 398 | display: block; 399 | } 400 | .addon-icon-opened { 401 | display: none; 402 | } 403 | .addon-icon-closed { 404 | width: $ax5select-addon-icon-height * 2 + $ax5select-addon-icon-padding-right; 405 | text-align: left; 406 | line-height: ($ax5select-addon-icon-height * 1.414); 407 | .addon-icon-arrow { 408 | content: ''; 409 | width: 0px; 410 | height: 0px; 411 | display: inline-block; 412 | border-left: $ax5select-addon-icon-height solid transparent; 413 | border-right: $ax5select-addon-icon-height solid transparent; 414 | border-top: ($ax5select-addon-icon-height * 1.414) solid $ax5select-addon-icon-color; 415 | background: transparent; 416 | opacity: 1; 417 | } 418 | } 419 | .addon-icon-opened { 420 | width: $ax5select-addon-icon-height * 2 + $ax5select-addon-icon-padding-right; 421 | text-align: left; 422 | line-height: ($ax5select-addon-icon-height * 1.414); 423 | .addon-icon-arrow { 424 | content: ''; 425 | width: 0px; 426 | height: 0px; 427 | display: inline-block; 428 | border-left: $ax5select-addon-icon-height solid transparent; 429 | border-right: $ax5select-addon-icon-height solid transparent; 430 | border-bottom: ($ax5select-addon-icon-height * 1.414) solid $ax5select-addon-icon-color; 431 | background: transparent; 432 | opacity: 1; 433 | } 434 | } 435 | } 436 | } 437 | 438 | &[data-select-option-group-opened] { 439 | @include box-shadow(inset 1px 1px 3px rgba(0, 0, 0, 0.2)); 440 | background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 441 | .ax5select-display-table [data-ax5select-display="addon"] { 442 | .addon-icon-reset { 443 | display: block; 444 | position: absolute; 445 | right: $ax5select-addon-icon-height * 2 + $ax5select-addon-icon-padding-right * 2; 446 | top: 0px; 447 | height: 100%; 448 | } 449 | .addon-icon-closed { 450 | display: none; 451 | } 452 | .addon-icon-opened { 453 | display: block; 454 | } 455 | } 456 | } 457 | 458 | @each $theme in $base-colors { 459 | &.#{nth($theme, 1)} { 460 | @include ax5select-display-theme(map_get($base-colors, nth($theme, 1)), $ax5select-option-group-bg, map_get($theme-colors, nth($theme, 1))); 461 | } 462 | } 463 | 464 | &.input-xs { 465 | 466 | } 467 | &.input-sm { 468 | 469 | } 470 | &.input-lg { 471 | 472 | } 473 | } 474 | 475 | /// select-option-group 476 | .ax5select-option-group { 477 | box-sizing: border-box; 478 | z-index: $ax5select-option-group-z-index; 479 | position: absolute; 480 | left: 0; 481 | top: 0; 482 | border-radius: $ax5select-option-group-border-radius; 483 | box-shadow: $ax5select-option-group-box-shadow; 484 | border: $ax5select-option-group-inner-border; 485 | overflow: hidden; 486 | @include ax-background($ax5select-option-group-bg); 487 | @include animation(ax-select-option-group $ax5select-option-group-easing-time-open ease-out); 488 | @include transform(translateZ(0)); 489 | @include transform-origin(center top); 490 | 491 | &.destroy { 492 | @include animation(ax-select-option-group-destroy $ax5select-option-group-easing-time-close $ease-in-back forwards); 493 | } 494 | &.direction-top { 495 | @include transform-origin(center top); 496 | } 497 | &.direction-bottom { 498 | @include transform-origin(center bottom); 499 | } 500 | 501 | @each $theme in $base-colors { 502 | &.#{nth($theme, 1)} { 503 | @include ax5select-option-group-theme(map_get($base-colors, nth($theme, 1)), $ax5select-option-group-bg, map_get($theme-colors, nth($theme, 1)), map_get($hover-types, nth($theme, 1))); 504 | } 505 | } 506 | 507 | @include ax5select-option-group-size($ax5select-option-item-padding, $ax5select-option-item-font-size); 508 | &.ax5select-option-group-lg { 509 | @include ax5select-option-group-size($ax5select-option-item-padding-lg, $ax5select-option-item-font-size-lg); 510 | } 511 | &.ax5select-option-group-sm { 512 | @include ax5select-option-group-size($ax5select-option-item-padding-sm, $ax5select-option-item-font-size-sm); 513 | } 514 | &.ax5select-option-group-xs { 515 | @include ax5select-option-group-size($ax5select-option-item-padding-xs, $ax5select-option-item-font-size-xs); 516 | } 517 | } 518 | 519 | 520 | /// suport input-group 521 | .input-group { 522 | [data-ax5select] { 523 | display: table-cell; 524 | 525 | select { 526 | z-index: 1; 527 | position: absolute; 528 | opacity: 0; 529 | user-select: none; 530 | } 531 | .ax5select-display { 532 | @extend .ax5select-display; 533 | } 534 | &:first-child{ 535 | .ax5select-display { 536 | border-top-right-radius: 0; 537 | border-bottom-right-radius: 0; 538 | } 539 | } 540 | &:last-child{ 541 | .ax5select-display { 542 | border-top-left-radius: 0; 543 | border-bottom-left-radius: 0; 544 | } 545 | } 546 | } 547 | } -------------------------------------------------------------------------------- /src/scss/_ax5select_variables.scss: -------------------------------------------------------------------------------- 1 | $gray-base: #000 !default; 2 | $gray-darker: lighten($gray-base, 13.5%) !default; // #222 3 | $gray-dark: lighten($gray-base, 20%) !default; // #333 4 | $gray: lighten($gray-base, 33.5%) !default; // #555 5 | $gray-light: lighten($gray-base, 46.7%) !default; // #777 6 | $gray-lighter: lighten($gray-base, 93.5%) !default; // #eee 7 | 8 | $brand-primary: #616161 !default; // #337ab7 9 | $brand-success: #00C6AE !default; 10 | $brand-info: #44ADF9 !default; 11 | $brand-fn1: #6977CF !default; 12 | $brand-fn2: #485398 !default; 13 | $brand-warning: #FFB802 !default; 14 | $brand-danger: #E97426 !default; 15 | 16 | $border-radius-base: 3px !default; 17 | $border-radius-large: 5px !default; 18 | $border-radius-small: 2px !default; 19 | 20 | 21 | //== Form states and alerts 22 | // 23 | //## Define colors for form feedback states and, by default, alerts. 24 | 25 | $state-success-text: #3c763d !default; 26 | $state-success-bg: #dff0d8 !default; 27 | $state-success-border: darken(adjust-hue($state-success-bg, -10), 5%) !default; 28 | 29 | $state-info-text: #31708f !default; 30 | $state-info-bg: #d9edf7 !default; 31 | $state-info-border: darken(adjust-hue($state-info-bg, -10), 7%) !default; 32 | 33 | $state-warning-text: #8a6d3b !default; 34 | $state-warning-bg: #fcf8e3 !default; 35 | $state-warning-border: darken(adjust-hue($state-warning-bg, -10), 5%) !default; 36 | 37 | $state-danger-text: #a94442 !default; 38 | $state-danger-bg: #f2dede !default; 39 | $state-danger-border: darken(adjust-hue($state-danger-bg, -10), 5%) !default; 40 | 41 | //== Panels 42 | // 43 | //## 44 | 45 | $panel-bg: #fff !default; 46 | $panel-body-padding: 15px !default; 47 | $panel-heading-padding: 10px 15px !default; 48 | $panel-footer-padding: $panel-heading-padding !default; 49 | $panel-border-radius: $border-radius-base !default; 50 | 51 | //** Border color for elements within panels 52 | $panel-inner-border: #ddd !default; 53 | $panel-footer-bg: #f5f5f5 !default; 54 | 55 | $panel-default-text: $gray-dark !default; 56 | $panel-default-border: #ddd !default; 57 | $panel-default-heading-bg: #f5f5f5 !default; 58 | 59 | $panel-primary-text: #fff !default; 60 | $panel-primary-border: $brand-primary !default; 61 | $panel-primary-heading-bg: $brand-primary !default; 62 | 63 | $panel-success-text: $state-success-text !default; 64 | $panel-success-border: $state-success-border !default; 65 | $panel-success-heading-bg: $state-success-bg !default; 66 | 67 | $panel-info-text: $state-info-text !default; 68 | $panel-info-border: $state-info-border !default; 69 | $panel-info-heading-bg: $state-info-bg !default; 70 | 71 | $panel-warning-text: $state-warning-text !default; 72 | $panel-warning-border: $state-warning-border !default; 73 | $panel-warning-heading-bg: $state-warning-bg !default; 74 | 75 | $panel-danger-text: $state-danger-text !default; 76 | $panel-danger-border: $state-danger-border !default; 77 | $panel-danger-heading-bg: $state-danger-bg !default; 78 | 79 | 80 | //============== ax5select 81 | $ax5select-label-padding: 0px 7px !default; 82 | 83 | $ax5select-label-bg-colors: (#fff, #eee) !default; 84 | $ax5select-label-border: 1px solid #ccc !default; 85 | $ax5select-label-color: #444 !default; 86 | 87 | $ax5select-addon-icon-height: 4.5px !default; 88 | $ax5select-addon-icon-color: #444 !default; 89 | $ax5select-addon-icon-padding-right: 7px !default; 90 | 91 | ///== option group 92 | $ax5select-option-group-z-index: 2000 !default; 93 | $ax5select-option-group-box-model: border-box !default; 94 | $ax5select-option-group-bg: lighten(#eee, 5%) !default; 95 | $ax5select-option-group-inner-border: 1px solid !default; 96 | $ax5select-option-group-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.175) !default; 97 | $ax5select-option-group-border-radius: 5px !default; 98 | $ax5select-option-group-body-padding: 0px !default; 99 | 100 | $ax5select-option-group-easing-time-open: 0.1s !default; 101 | $ax5select-option-group-easing-time-close: 0.1s !default; 102 | $ax5select-option-group-arrow-size: 10px !default; 103 | $ax5select-option-group-arrow-border-width: 1px !default; 104 | 105 | $ax5select-option-item-padding: 3px 0px !default; 106 | $ax5select-option-item-font-size: 12px !default; 107 | 108 | $ax5select-option-item-padding-lg: 5px 0px !default; 109 | $ax5select-option-item-font-size-lg: $ax5select-option-item-font-size * 1.3 !default; 110 | 111 | $ax5select-option-item-padding-sm: 2px 0px !default; 112 | $ax5select-option-item-font-size-sm: $ax5select-option-item-font-size * 0.9 !default; 113 | 114 | $ax5select-option-item-padding-xs: 1px 0px !default; 115 | $ax5select-option-item-font-size-xs: $ax5select-option-item-font-size * 0.8 !default; 116 | 117 | ///~~ theme 118 | $ax5select-default-base-color: $gray !default; 119 | $ax5select-default-theme-color: #ccc !default; 120 | $ax5select-default-hover-type: darken, 20% !default; 121 | 122 | $ax5select-primary-base-color: $gray !default; 123 | $ax5select-primary-theme-color: $brand-primary !default; 124 | $ax5select-primary-hover-type: lighten, 100% !default; 125 | 126 | $ax5select-success-base-color: $gray !default; 127 | $ax5select-success-theme-color: $brand-success !default; 128 | $ax5select-success-hover-type: darken, 20% !default; 129 | 130 | $ax5select-info-base-color: $gray !default; 131 | $ax5select-info-theme-color: $brand-info !default; 132 | $ax5select-info-hover-type: lighten, 100% !default; 133 | 134 | $ax5select-warning-base-color: $gray !default; 135 | $ax5select-warning-theme-color: $brand-warning !default; 136 | $ax5select-warning-hover-type: lighten, 100% !default; 137 | 138 | $ax5select-danger-base-color: $gray !default; 139 | $ax5select-danger-theme-color: $brand-danger !default; 140 | $ax5select-danger-hover-type: lighten, 100% !default; -------------------------------------------------------------------------------- /test/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ax5ui-tester", 3 | "dependencies": { 4 | "jquery": "^1.11.0", 5 | "ax5core": ">=1.4.115", 6 | "ax5ui-mask": ">=1.3.0", 7 | "ax5ui-calendar": ">=1.3.0", 8 | "ax5ui-formatter": ">=1.3.0", 9 | "bootstrap": "^3.3.6", 10 | "font-awesome": "" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

form-group

19 | 20 |
21 |
22 |
23 |
28 |
29 |
30 | 31 |
32 |
33 |
38 | 39 |
40 |
41 |
42 | 43 |
44 | 45 | 46 |
47 |
50 | 51 |
52 |
53 | 54 |
55 | 56 | 57 | 58 | 59 | 60 |
61 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /test/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | Title 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 |

form-group

25 | 26 |
27 |
28 |
29 |
34 |
35 |
36 |
37 |
38 |
43 |
44 |
45 |
46 |
47 |
52 |
53 |
54 | 55 |
56 | 57 | 58 |
59 | 60 | 61 | 62 | 63 | 64 |
65 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /test/input-group.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | Title 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 |

input-group

25 | 26 |
27 |
31 | 32 | 35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 | 45 | 46 |
50 | 51 |
52 |
53 | 54 |
55 | 56 |
57 | 58 | 59 | 60 | 61 | 62 |
63 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /test/option-group.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | Title 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 |

form-group

25 | 26 |
27 |
28 |
29 |
34 |
35 |
36 |
37 |
38 | 39 | 40 |
41 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /test/search.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | Title 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 |

sarch

25 | 26 |
27 |
28 |
29 |
34 |
35 |
36 |
37 |
38 |
43 |
44 |
45 |
46 |
47 | 48 | 49 |
50 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /test/test.select.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | ax5ui testing 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/test.select.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. tom@axisj.com 3 | * - github.com/thomasjang 4 | * - www.axisj.com 5 | */ 6 | 7 | describe('ax5select TEST', function () { 8 | var myUI; 9 | var options = []; 10 | options.push({value: "1", text: "string"}); 11 | options.push({value: "2", text: "number"}); 12 | options.push({value: "3", text: "substr"}); 13 | options.push({value: "4", text: "substring"}); 14 | options.push({value: "search", text: "search"}); 15 | options.push({value: "parseInt", text: "parseInt"}); 16 | options.push({value: "toFixed", text: "toFixed"}); 17 | options.push({value: "min", text: "min"}); 18 | options.push({value: "max", text: "max"}); 19 | 20 | var tmpl = '
' + 21 | '
' + 22 | '
'; 23 | 24 | $(document.body).append(tmpl); 25 | 26 | /// 27 | it('new ax5select', function (done) { 28 | try { 29 | myUI = new ax5.ui.select(); 30 | done(); 31 | } catch (e) { 32 | done(e); 33 | } 34 | }); 35 | 36 | it('bind select', function (done) { 37 | myUI.bind({ 38 | target: $('[data-ax5select="select1"]'), 39 | options: options, 40 | onChange: function () { 41 | 42 | }, 43 | onStateChanged: function () { 44 | } 45 | }); 46 | done(); 47 | }); 48 | 49 | after(function () { 50 | $('[data-ax5select="select1"]').remove(); 51 | }); 52 | }); 53 | 54 | /* ax5.select.method... */ 55 | describe('ax5.ui.select method TEST', function () { 56 | var myUI = new ax5.ui.select(); 57 | var that; 58 | 59 | before(function () { 60 | var options = []; 61 | options.push({value: "1", text: "string"}); 62 | options.push({value: "2", text: "number"}); 63 | options.push({value: "3", text: "substr"}); 64 | options.push({value: "4", text: "substring"}); 65 | options.push({value: "search", text: "search"}); 66 | options.push({value: "parseInt", text: "parseInt"}); 67 | options.push({value: "toFixed", text: "toFixed"}); 68 | options.push({value: "min", text: "min"}); 69 | options.push({value: "max", text: "max"}); 70 | 71 | var tmpl = '
' + 72 | '
' + 73 | '
'; 74 | 75 | $(document.body).append(tmpl); 76 | 77 | myUI.bind({ 78 | target: $('[data-ax5select="select2"]'), 79 | options: options, 80 | onChange: function () { 81 | 82 | }, 83 | onStateChanged: function () { 84 | that = this; 85 | } 86 | }); 87 | }); 88 | 89 | it('select open test', function (done) { 90 | myUI.open($('[data-ax5select="select2"]')); 91 | done(ae.equalAll("open", that.state)); 92 | }); 93 | 94 | it('select close test', function (done) { 95 | myUI.close($('[data-ax5select="select2"]')); 96 | setTimeout(function () { 97 | done(ae.equalAll("close", that.state)); 98 | }, myUI.config.animateTime); 99 | }); 100 | 101 | it('select setValue / getValue', function (done) { 102 | myUI.val($('[data-ax5select="select2"]'), "3"); 103 | var val = myUI.val($('[data-ax5select="select2"]'))[0]; 104 | done( 105 | ae.equalAll("3", val.value) 106 | || ae.equalAll("substr", val.text) 107 | ); 108 | }); 109 | 110 | it('select update test', function (done) { 111 | myUI.update({ 112 | target: $('[data-ax5select="select2"]'), 113 | theme: "danger", 114 | animateTime: 200, 115 | options:[ 116 | {value: "A", text: "AMAZING"}, 117 | {value: "B", text: "BEAUTIFUL"}, 118 | {value: "C", text: "CREATIVE"} 119 | ] 120 | }); 121 | done( 122 | ae.equalAll("danger", myUI.queue[0].theme) 123 | || ae.equalAll(200, myUI.queue[0].animateTime) 124 | ); 125 | }); 126 | 127 | it('select disable test', function (done) { 128 | myUI.disable($('[data-ax5select="select2"]')); 129 | done( 130 | ae.equalAll("disabled", myUI.queue[0].$display.attr("disabled")) 131 | || ae.equalAll("disabled", myUI.queue[0].$select.attr("disabled")) 132 | ); 133 | }); 134 | 135 | it('select enable test', function (done) { 136 | myUI.enable($('[data-ax5select="select2"]')); 137 | done( 138 | ae.equalAll("undefined", typeof myUI.queue[0].$display.attr("disabled")) 139 | || ae.equalAll("undefined", typeof myUI.queue[0].$select.attr("disabled")) 140 | ); 141 | }); 142 | 143 | it('select setOptions test', function (done) { 144 | var myOptions = [ 145 | {value: "+", text: "addition"}, 146 | {value: "-", text: "subtraction"}, 147 | {value: "*", text: "multiplication"}, 148 | {value: "/", text: "division"} 149 | ]; 150 | myUI.setOptions($('[data-ax5select="select2"]'), myOptions); 151 | done(ae.equalAll(myOptions, myUI.queue[0].options)); 152 | }); 153 | 154 | after(function () { 155 | $('[data-ax5select="select2"]').remove(); 156 | }); 157 | }); 158 | 159 | describe('multiple ax5.ui.select method TEST', function () { 160 | var myUI = new ax5.ui.select(); 161 | 162 | before(function () { 163 | var options = []; 164 | options.push({value: "1", text: "string"}); 165 | options.push({value: "2", text: "number"}); 166 | options.push({value: "3", text: "substr"}); 167 | options.push({value: "4", text: "substring"}); 168 | options.push({value: "search", text: "search"}); 169 | options.push({value: "parseInt", text: "parseInt"}); 170 | options.push({value: "toFixed", text: "toFixed"}); 171 | options.push({value: "min", text: "min"}); 172 | options.push({value: "max", text: "max"}); 173 | 174 | var tmpl = '
' + 175 | '
' + 176 | '
' + 177 | '
' + 178 | '
'; 179 | 180 | $(document.body).append(tmpl); 181 | 182 | myUI.bind({ 183 | target: $('[data-ax5select="select3"]'), 184 | multiple: true, 185 | options: options 186 | }); 187 | }); 188 | 189 | it('select multiple setValue / getValue', function (done) { 190 | myUI.val($('[data-ax5select="select3"]'), ["3", "4"], true); 191 | var val = myUI.val($('[data-ax5select="select3"]')); 192 | 193 | done( 194 | ae.equalAll("select3=3&select3=4", $(document["select-form"]).serialize()) 195 | || ae.equalAll("3", val[0].value) 196 | || ae.equalAll("substr", val[0].text) 197 | || ae.equalAll("4", val[1].value) 198 | || ae.equalAll("substring", val[1].text) 199 | ); 200 | }); 201 | 202 | after(function () { 203 | $(document["select-form"]).remove(); 204 | }); 205 | }); --------------------------------------------------------------------------------