提交 a83b4bc9 编写于 作者: C codecalm

choices.js init

上级 cd91b833
......@@ -13,10 +13,11 @@
"masonry": "https://cdnjs.cloudflare.com/ajax/libs/masonry/4.2.2/masonry.pkgd.min.js",
"mapbox": "https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.js",
"google-maps": "https://maps.googleapis.com/maps/api/js?key=GOOGLE_MAPS_KEY",
"litepicker": "litepicker/dist/litepicker.js"
"litepicker": "litepicker/dist/litepicker.js",
"choices": "choices.js/public/assets/scripts/choices.js"
},
"css": {
"selectize": "selectize/dist/css/selectize.css",
"choices": "choices.js/public/assets/styles/choices.css",
"nouislider": "nouislider/distribute/nouislider.min.css",
"mapbox": "https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.css"
}
......
......@@ -33,30 +33,30 @@
<div class="mb-3">
<label class="form-label">Tags input</label>
{% include ui/form/selectize.html key="tags" %}
{% include ui/select.html id="tags" key="tags" %}
</div>
<div class="mb-3">
<label class="form-label">Advanced tags input</label>
{% include ui/form/selectize.html key="tags-advanced" %}
{% include ui/select.html id="tags-advanced" key="tags-advanced" %}
</div>
<div class="mb-3">
<label class="form-label">Advanced select</label>
{% include ui/form/selectize.html key="users" %}
{% include ui/select.html id="users" key="users" %}
</div>
<div class="mb-3">
<label class="form-label">Select with avatars</label>
{% include ui/form/selectize.html key="people" %}
{% include ui/select.html id="people" key="people" %}
</div>
<div class="mb-3">
<label class="form-label">Select with flags</label>
{% include ui/form/selectize.html key="countries" %}
{% include ui/select.html id="countries" key="countries" %}
</div>
<div class="mb-3">
<label class="form-label">Advanced select with validation state</label>
{% include ui/form/selectize.html key="countries" state="valid" select-id="states" %}
{% include ui/select.html id="countries" key="countries" state="valid" %}
</div>
\ No newline at end of file
<div class="mb-3">
<label class="form-label">Range input</label>
{% include ui/form/range.html value=40 %}
{% include ui/form/range.html value="20" id="simple" connect=true %}
{% include ui/form/range.html value="60,90" id="connect" %}
{% include ui/form/range.html value="40" id="color" class="text-green" connect=true %}
{% include ui/range.html value=40 %}
{% include ui/range.html value="20" id="simple" connect=true %}
{% include ui/range.html value="60,90" id="connect" %}
{% include ui/range.html value="40" id="color" class="text-green" connect=true %}
</div>
{% assign key = include.key | default: 'people' %}
{% assign id = include.select-id | default: key %}
{% assign data = site.data.selects[key] %}
{% assign options = data.options %}
<select name="{{ key }}" id="select-{{ id }}" class="form-select{% if include.state %} is-{{ include.state }}{% endif %}"{% if data.multiple %} multiple{% endif %}>
{% if options == 'people' %}
{% for person in site.data.people limit: 20 %}
{% capture avatar %}
{% include ui/avatar.html person=person class="avatar-xs rounded me-2" %}
{% endcapture %}
<option value="{{ person.id }}" data-data='{"avatar": "{{ avatar | strip | replace: '"', '\"' }}"}'{% if person.id == data.value %} selected{% endif %}>{{ person.full_name }}</option>
{% endfor %}
{% else %}
{% for option in options %}
{% if option[1] %}
{% assign current-value = option[0] %}
{% assign current-name = option[1].name %}
{% assign all-data = option[1] %}
{% else %}
{% assign current-value = option %}
{% assign current-name = option %}
{% endif %}
<option value="{{ current-value }}"{% if all-data.image %} data-data='{"image": "{{ site.base }}/{{ all-data.image }}"}'{% elsif all-data.flag %} data-data='{"flag": "{{ all-data.flag }}"}'{% endif %}{% if data.value == current-value or data.value contains current-value %} selected{% endif %}>{{ current-name }}</option>
{% endfor %}
{% endif %}
</select>
{% capture_global scripts %}
{% comment %}
<script>
$(document).ready(function () {
$('#select-{{ id }}').selectize({
{% if key == "countries" %}
render: {
option: function (data, escape) {
return '<div class="option"><span class="flag flag-country-' + data.flag + ' me-2"></span>' + escape(data.text) + '</div>';
},
item: function (data, escape) {
return '<div class="d-flex align-items-center"><span class="flag flag-country-' + data.flag + ' me-2"></span>' + escape(data.text) + '</div>';
}
}
{% elsif key == "people" %}
render: {
option: function (data, escape) {
return '<div class="option">' + data.avatar + '' + escape(data.text) + '</div>';
},
item: function (data, escape) {
return '<div class="d-flex align-items-center">' + data.avatar + '' + escape(data.text) + '</div>';
}
}
{% endif %}
{% if data.max-items %}
maxItems: {{ data.max-items }},
{% endif %}
{% if data.removable %}
plugins: ['remove_button'],
{% endif %}
});
});
</script>
{% endcomment %}
{% endcapture_global %}
{% assign calendar-id = include.calendar-id | default: 'main' %}
<div id="calendar-{{ calendar-id }}" class="card-calendar"></div>
{% capture_global scripts %}
<script>
document.addEventListener('DOMContentLoaded', function () {
{% if jekyll.environment == 'development' %}window.tabler_calendar = window.tabler_calendar || {};{% endif %}
var calendarEl = document.getElementById('calendar-{{ calendar-id }}'),
today = new Date(),
y = today.getFullYear(),
m = today.getMonth(),
d = today.getDate();
window.FullCalendar && ({% if jekyll.environment == 'development' %}window.tabler_calendar["calendar-{{ calendar-id }}"] = {% endif %}new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid' ],
themeSystem: 'standard',
header: {
left: 'title',
center: '',
right: 'prev,next'
},
selectable: true,
selectHelper: true,
nowIndicator: true,
views: {
dayGridMonth: { buttonText: 'month' },
timeGridWeek: { buttonText: 'week' },
timeGridDay: { buttonText: 'day' }
},
defaultView: 'dayGridMonth',
timeFormat: 'H(:mm)',
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1),
className: 'bg-blue-lt'
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, 7, 6, 0),
allDay: false,
className: 'bg-blue-lt'
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, 14, 6, 0),
allDay: false,
className: 'bg-lime-lt'
},
{
title: 'Meeting',
start: new Date(y, m, 4, 10, 30),
allDay: false,
className: 'bg-green-lt'
},
{
title: 'Lunch',
start: new Date(y, m, 5, 12, 0),
end: new Date(y, m, 5, 14, 0),
allDay: false,
className: 'bg-red-lt'
},
{
title: 'LBD Launch',
start: new Date(y, m, 19, 12, 0),
allDay: true,
className: 'bg-azure-lt'
},
{
title: 'Birthday Party',
start: new Date(y, m, 16, 19, 0),
end: new Date(y, m, 16, 22, 30),
allDay: false,
className: 'bg-orange-lt'
}
]
})).render();
});
</script>
{% endcapture_global %}
{% assign id = include.id %}
{% if id %}
{% assign key = include.key | default: 'people' %}
{% assign data = site.data.selects[key] %}
{% assign options = data.options %}
<select type="text" class="form-control{% if include.class %} {{ include.class }}{% endif %}"{% if placeholder %} placeholder="{{ placeholder }}"{% endif %} id="select-{{ id }}" value="{{ value }}">
{% for option in options %}
<option value="{{ option }}">{{ option }}</option>
{% endfor %}
</select>
{% capture script %}
<script>
// @formatter:off
document.addEventListener("DOMContentLoaded", function () {
{% if jekyll.environment == 'development' %}
window.tabler_select = window.tabler_select || {};
{% endif %}
window.Choices && ({% if jekyll.environment == 'development' %}window.tabler_select["select-{{ id }}"] = {% endif %}new Choices(document.getElementById('select-{{ id }}'), {
}));
});
// @formatter:on
</script>
{% endcapture %}
{% if include.show-scripts %}
{{ script }}
{% else %}
{% capture_global scripts %}
{{ script }}
{% endcapture_global %}
{% endif %}
{% endif %}
\ No newline at end of file
@import "config";
@import "vendor/apexcharts";
@import "vendor/fullcalendar";
@import "vendor/nouislider";
@import "vendor/litepicker";
\ No newline at end of file
.fc-unthemed {
.fc-content,
.fc-divider,
.fc-list-heading td,
.fc-list-view,
.fc-popover,
.fc-row,
tbody,
td,
th,
thead {
border-color: $border-color;
}
.fc-toolbar {
h2 {
font-size: $h2-font-size;
margin: 0;
}
}
.fc-button {
//@include button-variant($white, $border-color, $text-muted);
//@include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-border-radius);
//@include transition($btn-transition);
}
.fc-widget-header {
border: 0;
}
.fc-day-header {
padding-bottom: .25rem;
font-weight: $font-weight-bold;
}
&.card-calendar {
.fc-day-grid-container {
border-bottom: 0;
border-left: 0;
td:last-child {
//border-right: 0;
}
td:first-child {
//border-left: 0;
}
}
}
.fc-time {
font-weight: $font-weight-bold;
}
.fc-event {
border-color: rgba(0, 0, 0, .05);
color: $primary;
background-color: theme-color-lighter($primary);
padding: 0 .25rem;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册