added @ttskch/select2-bootstrap4-theme and updated legacy select2 scss code

pull/2197/head
REJack 2019-08-20 12:48:22 +02:00
parent 1b1b909162
commit 09651f0a82
No known key found for this signature in database
GPG Key ID: 9F3976CC630CC888
7 changed files with 258 additions and 91 deletions

View File

@ -182,6 +182,10 @@ const Plugins = [
from: 'node_modules/select2/dist/',
to : 'plugins/select2'
},
{
from: 'node_modules/@ttskch/select2-bootstrap4-theme/dist/',
to : 'plugins/select2-bootstrap4-theme'
},
// Sparklines
{
from: 'node_modules/sparklines/source/',

View File

@ -18,108 +18,111 @@
}
}
.select2-container--default.select2-container--open {
border-color: theme-color("primary");
}
.select2-dropdown {
border: 1px solid $gray-x-light;
//border-radius: $input-radius;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: theme-color("primary");
color: white;
}
.select2-results__option {
padding: 6px 12px;
user-select: none;
-webkit-user-select: none;
}
.select2-container .select2-selection--single .select2-selection__rendered {
padding-left: 0;
padding-right: 0;
height: auto;
margin-top: -3px;
}
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 6px;
padding-left: 20px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 31px;
right: 6px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
margin-top: 0;
}
.select2-dropdown,
.select2-search--inline {
.select2-search__field {
border: 1px solid $gray-x-light;
&:focus {
outline: none;
border: 1px solid theme-color("primary");
}
}
}
.select2-container--default .select2-results__option[aria-disabled=true] {
color: #999;
}
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: #ddd;
&,
&:hover {
color: #444;
}
}
//Multiple select
.select2-container--default {
.select2-selection--multiple {
min-height: $input-height;
&.select2-container--open {
border-color: theme-color("primary");
}
& .select2-dropdown {
border: 1px solid $gray-x-light;
//border-radius: $input-radius;
&:focus {
border-color: theme-color("primary");
}
}
.select2-selection__rendered li:first-child.select2-search.select2-search--inline {
width: 100%;
& .select2-results__option--highlighted[aria-selected] {
background-color: theme-color("primary");
color: white;
}
.select2-search__field {
width: 100% !important;
& .select2-results__option {
padding: 6px 12px;
user-select: none;
-webkit-user-select: none;
}
& .select2-selection--single .select2-selection__rendered {
padding-left: 0;
padding-right: 0;
height: auto;
margin-top: -3px;
}
&[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 6px;
padding-left: 20px;
}
& .select2-selection--single .select2-selection__arrow {
height: 31px;
right: 6px;
}
& .select2-selection--single .select2-selection__arrow b {
margin-top: 0;
}
.select2-dropdown,
.select2-search--inline {
.select2-search__field {
border: 1px solid $gray-x-light;
&:focus {
outline: none;
border: 1px solid theme-color("primary");
}
}
}
&.select2-container--focus .select2-selection--multiple {
border-color: $gray-x-light;
& .select2-results__option[aria-disabled=true] {
color: #999;
}
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: theme-color("primary");
border-color: darken(theme-color("primary"), 5%);
padding: 0 10px;
color: $white;
}
& .select2-results__option[aria-selected=true] {
background-color: #ddd;
&,
&:hover {
color: #444;
}
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
margin-right: 5px;
color: rgba(255, 255, 255, 0.7);
&:hover {
//Multiple select
& {
.select2-selection--multiple {
min-height: $input-height;
border: 1px solid $gray-x-light;
//border-radius: $input-radius;
&:focus {
border-color: theme-color("primary");
}
.select2-selection__rendered li:first-child.select2-search.select2-search--inline {
width: 100%;
.select2-search__field {
width: 100% !important;
}
}
}
&.select2-container--focus .select2-selection--multiple {
border-color: $gray-x-light;
}
}
& .select2-selection--multiple .select2-selection__choice {
background-color: theme-color("primary");
border-color: darken(theme-color("primary"), 5%);
padding: 0 10px;
color: $white;
}
}
.select2-container .select2-selection--single .select2-selection__rendered li {
padding-right: 10px;
& .select2-selection--multiple .select2-selection__choice__remove {
margin-right: 5px;
color: rgba(255, 255, 255, 0.7);
&:hover {
color: $white;
}
}
& .select2-selection--single .select2-selection__rendered li {
padding-right: 10px;
}
}

5
package-lock.json generated
View File

@ -2532,6 +2532,11 @@
"resolved": "https://registry.npmjs.org/@sweetalert2/theme-bootstrap-4/-/theme-bootstrap-4-2.1.0.tgz",
"integrity": "sha512-Ji33Ixo45EjGrGUX0Z+RqsI0X45r3NW464MigYhA9olUy4uOlwfTkumKpeudrY+tMZYDM2OP0LR9ndHBcyArbw=="
},
"@ttskch/select2-bootstrap4-theme": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@ttskch/select2-bootstrap4-theme/-/select2-bootstrap4-theme-1.2.3.tgz",
"integrity": "sha512-cVH3yrBBmkNrkqKPvHbt8dzP7NysAQfzJULxXlzkdf7NicoSUWbpjDjDGqMtUIIldDByrf2uC1HKKFRelWunQQ=="
},
"@types/estree": {
"version": "0.0.39",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",

View File

@ -52,6 +52,7 @@
"@fullcalendar/timegrid": "^4.2.0",
"@lgaitan/pace-progress": "^1.0.7",
"@sweetalert2/theme-bootstrap-4": "^2.1.0",
"@ttskch/select2-bootstrap4-theme": "^1.2.3",
"bootstrap": "^4.3.1",
"bootstrap-colorpicker": "^3.1.2",
"bootstrap-slider": "^10.6.1",

View File

@ -21,6 +21,7 @@
<link rel="stylesheet" href="../../plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
<!-- Select2 -->
<link rel="stylesheet" href="../../plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="../../plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<!-- Bootstrap4 Duallistbox -->
<link rel="stylesheet" href="../../plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
<!-- Theme style -->
@ -1117,7 +1118,9 @@
<script>
$(function () {
//Initialize Select2 Elements
$('.select2').select2()
$('.select2').select2({
theme: 'bootstrap4'
})
//Datemask dd/mm/yyyy
$('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })

View File

@ -0,0 +1,150 @@
.select2-container--bootstrap4 .select2-selection--single {
height: calc(1.5em + 0.75rem + 2px) !important; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder {
color: #757575;
line-height: calc(1.5em + 0.75rem); }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
position: absolute;
top: 50%;
right: 3px;
width: 20px; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b {
top: 60%;
border-color: #343a40 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
width: 0;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute; }
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
line-height: calc(1.5em + 0.75rem); }
.select2-search--dropdown .select2-search__field {
border: 1px solid #ced4da;
border-radius: 0.25rem; }
.select2-results__message {
color: #6c757d; }
.select2-container--bootstrap4 .select2-selection--multiple {
min-height: calc(1.5em + 0.75rem + 2px) !important; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered {
-webkit-box-sizing: border-box;
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
color: #343a40;
border: 1px solid #bdc6d0;
border-radius: 0.2rem;
padding: 0;
padding-right: 5px;
cursor: pointer;
float: left;
margin-top: 0.3em;
margin-right: 5px; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove {
color: #bdc6d0;
font-weight: bold;
margin-left: 3px;
margin-right: 1px;
padding-right: 3px;
padding-left: 3px;
float: left; }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #343a40; }
.select2-container {
display: block; }
.select2-container *:focus {
outline: 0; }
.input-group .select2-container--bootstrap4 {
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1; }
.input-group-prepend ~ .select2-container--bootstrap4 .select2-selection {
border-top-left-radius: 0;
border-bottom-left-radius: 0; }
.select2-container--bootstrap4 .select2-selection {
border: 1px solid #ced4da;
border-radius: 0.25rem;
width: 100%; }
.select2-container--bootstrap4.select2-container--focus .select2-selection {
border-color: #17a2b8;
-webkit-box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
.select2-container--bootstrap4.select2-container--focus.select2-container--open .select2-selection {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--bootstrap4.select2-container--disabled .select2-selection, .select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-selection {
background-color: #e9ecef;
cursor: not-allowed;
border-color: #ced4da;
-webkit-box-shadow: none;
box-shadow: none; }
.select2-container--bootstrap4.select2-container--disabled .select2-search__field, .select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-search__field {
background-color: transparent; }
select.is-invalid ~ .select2-container--bootstrap4 .select2-selection,
form.was-validated select:invalid ~ .select2-container--bootstrap4 .select2-selection {
border-color: #dc3545; }
select.is-valid ~ .select2-container--bootstrap4 .select2-selection,
form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-selection {
border-color: #28a745; }
.select2-container--bootstrap4 .select2-dropdown {
border-color: #ced4da;
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--bootstrap4 .select2-dropdown.select2-dropdown--above {
border-top: 1px solid #ced4da;
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem; }
.select2-container--bootstrap4 .select2-dropdown .select2-results__option[aria-selected=true] {
background-color: #e9ecef; }
.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected=true] {
background-color: #007bff;
color: #f8f9fa; }
.select2-container--bootstrap4 .select2-results__option[role=group] {
padding: 0; }
.select2-container--bootstrap4 .select2-results > .select2-results__options {
max-height: 15em;
overflow-y: auto; }
.select2-container--bootstrap4 .select2-results__group {
padding: 6px;
display: list-item;
color: #6c757d; }
.select2-container--bootstrap4 .select2-selection__clear {
width: 1.2em;
height: 1.2em;
line-height: 1.15em;
padding-left: 0.3em;
margin-top: 0.5em;
border-radius: 100%;
background-color: #6c757d;
color: #f8f9fa;
float: right;
margin-right: 0.3em; }
.select2-container--bootstrap4 .select2-selection__clear:hover {
background-color: #343a40; }

View File

@ -0,0 +1 @@
.select2-container--bootstrap4 .select2-selection--single{height:calc(1.5em + .75rem + 2px)!important}.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder{color:#757575;line-height:calc(1.5em + .75rem)}.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow{position:absolute;top:50%;right:3px;width:20px}.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b{top:60%;border-color:#343a40 transparent transparent;border-style:solid;border-width:5px 4px 0;width:0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute}.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered{line-height:calc(1.5em + .75rem)}.select2-search--dropdown .select2-search__field{border:1px solid #ced4da;border-radius:.25rem}.select2-results__message{color:#6c757d}.select2-container--bootstrap4 .select2-selection--multiple{min-height:calc(1.5em + .75rem + 2px)!important}.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered{-webkit-box-sizing:border-box;box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice{color:#343a40;border:1px solid #bdc6d0;border-radius:.2rem;padding:0 5px 0 0;cursor:pointer;float:left;margin-top:.3em;margin-right:5px}.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove{color:#bdc6d0;font-weight:700;margin-left:3px;margin-right:1px;padding-right:3px;padding-left:3px;float:left}.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover{color:#343a40}.select2-container{display:block}.select2-container :focus{outline:0}.input-group .select2-container--bootstrap4{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.input-group-prepend~.select2-container--bootstrap4 .select2-selection{border-top-left-radius:0;border-bottom-left-radius:0}.select2-container--bootstrap4 .select2-selection{border:1px solid #ced4da;border-radius:.25rem;width:100%}.select2-container--bootstrap4.select2-container--focus .select2-selection{border-color:#17a2b8;-webkit-box-shadow:0 0 0 .2rem rgba(0,123,255,.25);box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.select2-container--bootstrap4.select2-container--focus.select2-container--open .select2-selection{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-selection,.select2-container--bootstrap4.select2-container--disabled .select2-selection{background-color:#e9ecef;cursor:not-allowed;border-color:#ced4da;-webkit-box-shadow:none;box-shadow:none}.select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-search__field,.select2-container--bootstrap4.select2-container--disabled .select2-search__field{background-color:transparent}form.was-validated select:invalid~.select2-container--bootstrap4 .select2-selection,select.is-invalid~.select2-container--bootstrap4 .select2-selection{border-color:#dc3545}form.was-validated select:valid~.select2-container--bootstrap4 .select2-selection,select.is-valid~.select2-container--bootstrap4 .select2-selection{border-color:#28a745}.select2-container--bootstrap4 .select2-dropdown{border-color:#ced4da;border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--bootstrap4 .select2-dropdown.select2-dropdown--above{border-top:1px solid #ced4da;border-top-left-radius:.25rem;border-top-right-radius:.25rem}.select2-container--bootstrap4 .select2-dropdown .select2-results__option[aria-selected=true]{background-color:#e9ecef}.select2-container--bootstrap4 .select2-results__option--highlighted,.select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected=true]{background-color:#007bff;color:#f8f9fa}.select2-container--bootstrap4 .select2-results__option[role=group]{padding:0}.select2-container--bootstrap4 .select2-results>.select2-results__options{max-height:15em;overflow-y:auto}.select2-container--bootstrap4 .select2-results__group{padding:6px;display:list-item;color:#6c757d}.select2-container--bootstrap4 .select2-selection__clear{width:1.2em;height:1.2em;line-height:1.15em;padding-left:.3em;margin-top:.5em;border-radius:100%;background-color:#6c757d;color:#f8f9fa;float:right;margin-right:.3em}.select2-container--bootstrap4 .select2-selection__clear:hover{background-color:#343a40}