chore(deps): added adminlte vendored items

(this might not be entirely necessary unless we're changing everything adminlte publishes)

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
2023-02-26 02:15:25 +00:00
parent 0695262e73
commit 25fe13f091
66 changed files with 3354 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
<button type="{{ $type }}" {{ $attributes->merge(['class' => "btn btn-{$theme}"]) }}>
@isset($icon) <i class="{{ $icon }}"></i> @endisset
@isset($label) {{ $label }} @endisset
</button>

View File

@@ -0,0 +1,165 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Date Range Input --}}
<input id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
let usrCfg = _AdminLTE_DateRange.parseCfg( @json($config) );
// Add support to display a placeholder. In this situation, the related
// input won't be updated automatically and the cancel button will be
// used to clear the input.
@if($attributes->has('placeholder'))
usrCfg.autoUpdateInput = false;
$('#{{ $id }}').on('apply.daterangepicker', function(ev, picker)
{
let startDate = picker.startDate.format(picker.locale.format);
let endDate = picker.endDate.format(picker.locale.format);
let value = picker.singleDatePicker
? startDate
: startDate + picker.locale.separator + endDate;
$(this).val(value);
});
$('#{{ $id }}').on('cancel.daterangepicker', function(ev, picker)
{
$(this).val('');
});
@endif
// Check if the default set of ranges should be enabled, and if a
// default range should be set at initialization.
@isset($enableDefaultRanges)
usrCfg.ranges = usrCfg.ranges || _AdminLTE_DateRange.defaultRanges;
let range = usrCfg.ranges[ @json($enableDefaultRanges) ];
if (Array.isArray(range) && range.length > 1) {
usrCfg.startDate = range[0];
usrCfg.endDate = range[1];
}
@endisset
// Add support to auto select the previous submitted value in case
// of validation errors. Note the previous value may be a date range or
// a single date depending on the plugin configuration.
@if($errors->any() && $enableOldSupport)
let oldRange = @json($getOldValue($errorKey, ""));
let separator = " - ";
if (usrCfg.locale && usrCfg.locale.separator) {
separator = usrCfg.locale.separator;
}
// Update the related input.
if (! usrCfg.autoUpdateInput) {
$('#{{ $id }}').val(oldRange);
}
// Update the internal plugin data.
if (oldRange) {
oldRange = oldRange.split(separator);
usrCfg.startDate = oldRange.length > 0 ? oldRange[0] : null;
usrCfg.endDate = oldRange.length > 1 ? oldRange[1] : null;
}
@endif
// Setup the underlying date range plugin.
$('#{{ $id }}').daterangepicker(usrCfg);
})
</script>
@endpush
{{-- Register Javascript utility class for this component --}}
@once
@push('js')
<script>
class _AdminLTE_DateRange {
/**
* A default set of ranges options.
*/
static defaultRanges = {
'Today': [
moment().startOf('day'),
moment().endOf('day')
],
'Yesterday': [
moment().subtract(1, 'days').startOf('day'),
moment().subtract(1, 'days').endOf('day')
],
'Last 7 Days': [
moment().subtract(6, 'days'),
moment()
],
'Last 30 Days': [
moment().subtract(29, 'days'),
moment()
],
'This Month': [
moment().startOf('month'),
moment().endOf('month')
],
'Last Month': [
moment().subtract(1, 'month').startOf('month'),
moment().subtract(1, 'month').endOf('month')
]
}
/**
* Parse the php plugin configuration and eval the javascript code.
*
* cfg: A json with the php side configuration.
*/
static parseCfg(cfg)
{
for (const prop in cfg) {
let v = cfg[prop];
if (typeof v === 'string' && v.startsWith('js:')) {
cfg[prop] = eval(v.slice(3));
} else if (typeof v === 'object') {
cfg[prop] = _AdminLTE_DateRange.parseCfg(v);
}
}
return cfg;
}
}
</script>
@endpush
@endonce

View File

@@ -0,0 +1,54 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Input Color --}}
<input id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
// Create a method to set the addon color.
let setAddonColor = function()
{
let color = $('#{{ $id }}').data('colorpicker').getValue();
$('#{{ $id }}').closest('.input-group')
.find('.input-group-text > i')
.css('color', color);
}
// Init the plugin and register the change event listener.
$('#{{ $id }}').colorpicker( @json($config) )
.on('change', setAddonColor);
// Add support to auto select the previous submitted value in case
// of validation errors.
@if($errors->any() && $enableOldSupport)
let oldColor = @json($getOldValue($errorKey, ""));
$('#{{ $id }}').val(oldColor).change();
@endif
// Set the initial color for the addon.
setAddonColor();
})
</script>
@endpush

View File

@@ -0,0 +1,67 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Input Date --}}
<input id="{{ $id }}" name="{{ $name }}" data-target="#{{ $id }}" data-toggle="datetimepicker"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
let usrCfg = _AdminLTE_InputDate.parseCfg( @json($config) );
$('#{{ $id }}').datetimepicker(usrCfg);
// Add support to auto display the old submitted value or values in case
// of validation errors.
let value = @json($getOldValue($errorKey, $attributes->get('value')));
$('#{{ $id }}').val(value || "");
})
</script>
@endpush
{{-- Register Javascript utility class for this component --}}
@once
@push('js')
<script>
class _AdminLTE_InputDate {
/**
* Parse the php plugin configuration and eval the javascript code.
*
* cfg: A json with the php side configuration.
*/
static parseCfg(cfg)
{
for (const prop in cfg) {
let v = cfg[prop];
if (typeof v === 'string' && v.startsWith('js:')) {
cfg[prop] = eval(v.slice(3));
} else if (typeof v === 'object') {
cfg[prop] = _AdminLTE_InputDate.parseCfg(v);
}
}
return cfg;
}
}
</script>
@endpush
@endonce

View File

@@ -0,0 +1,78 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
<div class="custom-file">
{{-- Custom file input --}}
<input type="file" id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
{{-- Custom file label --}}
<label class="custom-file-label text-truncate" for="{{ $id }}"
@isset($legend) data-browse="{{ $legend }}" @endisset>
{{ $placeholder }}
</label>
</div>
@overwrite
{{-- Add the plugin initialization code --}}
@once
@push('js')
<script>
$(() => {
bsCustomFileInput.init();
})
</script>
@endpush
@endonce
{{-- Setup the height and font size of the plugin when using sm/lg sizes --}}
{{-- NOTE: this may change with newer plugin or Bootstrap versions --}}
@once
@push('css')
<style type="text/css">
{{-- SM size setup --}}
.input-group-sm .custom-file-label:after {
height: 1.8125rem;
line-height: 1.25;
}
.input-group-sm .custom-file-label {
height: calc(1.8125rem + 2px);
line-height: 1.25;
}
.input-group-sm .custom-file {
height: calc(1.8125rem + 2px);
font-size: .875rem;
}
{{-- LG size setup --}}
.input-group-lg .custom-file-label:after {
height: 2.875rem;
line-height: 1.6;
}
.input-group-lg .custom-file-label {
height: calc(2.875rem + 2px);
line-height: 1.6;
}
.input-group-lg .custom-file {
height: calc(2.875rem + 2px);
font-size: 1.25rem;
}
</style>
@endpush
@endonce

View File

@@ -0,0 +1,65 @@
{{-- Setup the input group component structure --}}
<div class="{{ $makeFormGroupClass() }}">
{{-- Input label --}}
@isset($label)
<label for="{{ $id }}" @isset($labelClass) class="{{ $labelClass }}" @endisset>
{{ $label }}
</label>
@endisset
{{-- Input group --}}
<div class="{{ $makeInputGroupClass() }}">
{{-- Input prepend slot --}}
@isset($prependSlot)
<div class="input-group-prepend">{{ $prependSlot }}</div>
@endisset
{{-- Input group item --}}
@yield('input_group_item')
{{-- Input append slot --}}
@isset($appendSlot)
<div class="input-group-append">{{ $appendSlot }}</div>
@endisset
</div>
{{-- Error feedback --}}
@if($isInvalid())
<span class="invalid-feedback d-block" role="alert">
<strong>{{ $errors->first($errorKey) }}</strong>
</span>
@endif
{{-- Bottom slot --}}
@isset($bottomSlot)
{{ $bottomSlot }}
@endisset
</div>
{{-- Extra style customization for invalid input groups --}}
@once
@push('css')
<style type="text/css">
{{-- Highlight invalid input groups with a box-shadow --}}
.adminlte-invalid-igroup {
box-shadow: 0 .25rem 0.5rem rgba(0,0,0,.1);
}
{{-- Setup a red border on elements inside prepend/append add-ons --}}
.adminlte-invalid-igroup > .input-group-prepend > *,
.adminlte-invalid-igroup > .input-group-append > * {
border-color: #dc3545 !important;
}
</style>
@endpush
@endonce

View File

@@ -0,0 +1,136 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Input Slider --}}
<input id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
let usrCfg = @json($config);
// Check for disabled attribute (alternative to data-slider-enable).
@if($attributes->has('disabled'))
usrCfg.enabled = false;
@endif
// Check for min, max and step attributes (alternatives to
// data-slider-min, data-slider-max and data-slider-step).
@if($attributes->has('min'))
usrCfg.min = Number( @json($attributes['min']) );
@endif
@if($attributes->has('max'))
usrCfg.max = Number( @json($attributes['max']) );
@endif
@if($attributes->has('step'))
usrCfg.step = Number( @json($attributes['step']) );
@endif
// Check for value attribute (alternative to data-slider-value).
// Also, add support to auto select the previous submitted value.
@if($attributes->has('value') || ($errors->any() && $enableOldSupport))
let value = @json($getOldValue($errorKey, $attributes['value']));
if (value) {
value = value.split(",").map(Number);
usrCfg.value = value.length > 1 ? value : value[0];
}
@endif
// Initialize the plugin.
let slider = $('#{{ $id }}').bootstrapSlider(usrCfg);
// Fix height conflict when orientation is vertical.
let or = slider.bootstrapSlider('getAttribute', 'orientation');
if (or == 'vertical') {
$('#' + usrCfg.id).css('height', '210px');
slider.bootstrapSlider('relayout');
}
})
</script>
@endpush
{{-- Add CSS workarounds for the plugin --}}
{{-- NOTE: this may change with newer plugin versions --}}
@push('css')
<style type="text/css">
{{-- Setup plugin color --}}
@isset($color)
#{{ $config['id'] }} .slider-handle {
background: {{ $color }};
}
#{{ $config['id'] }} .slider-selection {
background: {{ $color }};
opacity: 0.5;
}
#{{ $config['id'] }} .slider-tick.in-selection {
background: {{ $color }};
opacity: 0.9;
}
@endisset
{{-- Set flex property when using addons slots --}}
@if(isset($appendSlot) || isset($prependSlot))
#{{ $config['id'] }} {
flex: 1 1 0;
align-self: center;
@isset($appendSlot) margin-right: 5px; @endisset
@isset($prependSlot) margin-left: 5px; @endisset
}
@endif
</style>
@endpush
{{-- Setup custom invalid style --}}
{{-- NOTE: this may change with newer plugin versions --}}
@once
@push('css')
<style type="text/css">
.adminlte-invalid-islgroup .slider-track,
.adminlte-invalid-islgroup > .input-group-prepend > *,
.adminlte-invalid-islgroup > .input-group-append > * {
box-shadow: 0 .25rem 0.5rem rgba(255,0,0,.25);
}
.adminlte-invalid-islgroup .slider-vertical {
margin-bottom: 1rem;
}
</style>
@endpush
@endonce

View File

@@ -0,0 +1,74 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Input Switch --}}
<input type="checkbox" id="{{ $id }}" name="{{ $name }}" value="true"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
$('#{{ $id }}').bootstrapSwitch( @json($config) );
// Add support to auto select the previous submitted value in case of
// validation errors.
@if($errors->any() && $enableOldSupport)
let oldState = @json((bool)$getOldValue($errorKey));
$('#{{ $id }}').bootstrapSwitch('state', oldState);
@endif
})
</script>
@endpush
{{-- Setup the height/font of the plugin when using sm/lg sizes --}}
{{-- NOTE: this may change with newer plugin versions --}}
@once
@push('css')
<style type="text/css">
{{-- MD (default) size setup --}}
.input-group .bootstrap-switch-handle-on,
.input-group .bootstrap-switch-handle-off {
height: 2.25rem !important;
}
{{-- LG size setup --}}
.input-group-lg .bootstrap-switch-handle-on,
.input-group-lg .bootstrap-switch-handle-off {
height: 2.875rem !important;
font-size: 1.25rem !important;
}
{{-- SM size setup --}}
.input-group-sm .bootstrap-switch-handle-on,
.input-group-sm .bootstrap-switch-handle-off {
height: 1.8125rem !important;
font-size: .875rem !important;
}
{{-- Custom invalid style setup --}}
.adminlte-invalid-iswgroup > .bootstrap-switch-wrapper,
.adminlte-invalid-iswgroup > .input-group-prepend > *,
.adminlte-invalid-iswgroup > .input-group-append > * {
box-shadow: 0 .25rem 0.5rem rgba(255,0,0,.25);
}
</style>
@endpush
@endonce

View File

@@ -0,0 +1,16 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Input --}}
<input id="{{ $id }}" name="{{ $name }}"
value="{{ $getOldValue($errorKey, $attributes->get('value')) }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
@overwrite

View File

@@ -0,0 +1,26 @@
{{-- Empty option --}}
@if(isset($emptyOption))
<option value>
{{ is_string($emptyOption) ? $emptyOption : '' }}
</option>
{{-- Placeholder option --}}
@elseif(isset($placeholder))
<option class="d-none" value>
{{ is_string($placeholder) ? $placeholder : '' }}
</option>
@endif
{{-- Other options --}}
@foreach($options as $key => $value)
<option value="{{ $key }}"
@if($isSelected($key)) selected @endif
@if($isDisabled($key)) disabled @endif>
{{ $value }}
</option>
@endforeach

View File

@@ -0,0 +1,53 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Select --}}
<select id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
{{ $slot }}
</select>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
$('#{{ $id }}').selectpicker( @json($config) );
// Add support to auto select old submitted values in case of
// validation errors.
@if($errors->any() && $enableOldSupport)
let oldOptions = @json(collect($getOldValue($errorKey)));
$('#{{ $id }}').selectpicker('val', oldOptions);
@endif
})
</script>
@endpush
{{-- Set of CSS workarounds for the plugin --}}
{{-- NOTE: this may change with newer plugin versions --}}
@once
@push('css')
<style type="text/css">
{{-- Fix the invalid visual style --}}
.bootstrap-select.is-invalid {
padding-right: 0px !important;
}
</style>
@endpush
@endonce

View File

@@ -0,0 +1,38 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Select --}}
<select id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
{{ $slot }}
</select>
@overwrite
{{-- Support to auto select the old submitted values --}}
@if($errors->any() && $enableOldSupport)
@push('js')
<script>
$(() => {
let oldOptions = @json(collect($getOldValue($errorKey)));
$('#{{ $id }} option').each(function()
{
let value = $(this).val() || $(this).text();
$(this).prop('selected', oldOptions.includes(value));
});
});
</script>
@endpush
@endif

View File

@@ -0,0 +1,106 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Select --}}
<select id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
{{ $slot }}
</select>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
$('#{{ $id }}').select2( @json($config) );
// Add support to auto select old submitted values in case of
// validation errors.
@if($errors->any() && $enableOldSupport)
let oldOptions = @json(collect($getOldValue($errorKey)));
$('#{{ $id }} option').each(function()
{
let value = $(this).val() || $(this).text();
$(this).prop('selected', oldOptions.includes(value));
});
$('#{{ $id }}').trigger('change');
@endif
})
</script>
@endpush
{{-- CSS workarounds for the Select2 plugin --}}
{{-- NOTE: this may change with newer plugin versions --}}
@once
@push('css')
<style type="text/css">
{{-- SM size setup --}}
.input-group-sm .select2-selection--single {
height: calc(1.8125rem + 2px) !important
}
.input-group-sm .select2-selection--single .select2-selection__rendered,
.input-group-sm .select2-selection--single .select2-selection__placeholder {
font-size: .875rem !important;
line-height: 2.125;
}
.input-group-sm .select2-selection--multiple {
min-height: calc(1.8125rem + 2px) !important
}
.input-group-sm .select2-selection--multiple .select2-selection__rendered {
font-size: .875rem !important;
line-height: normal;
}
{{-- LG size setup --}}
.input-group-lg .select2-selection--single {
height: calc(2.875rem + 2px) !important;
}
.input-group-lg .select2-selection--single .select2-selection__rendered,
.input-group-lg .select2-selection--single .select2-selection__placeholder {
font-size: 1.25rem !important;
line-height: 2.25;
}
.input-group-lg .select2-selection--multiple {
min-height: calc(2.875rem + 2px) !important
}
.input-group-lg .select2-selection--multiple .select2-selection__rendered {
font-size: 1.25rem !important;
line-height: 1.7;
}
{{-- Enhance the plugin to support readonly attribute --}}
select[readonly].select2-hidden-accessible + .select2-container {
pointer-events: none;
touch-action: none;
}
select[readonly].select2-hidden-accessible + .select2-container .select2-selection {
background: #e9ecef;
box-shadow: none;
}
select[readonly].select2-hidden-accessible + .select2-container .select2-search__field {
display: none;
}
</style>
@endpush
@endonce

View File

@@ -0,0 +1,74 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Summernote Textarea --}}
<textarea id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}
>{{ $getOldValue($errorKey, $slot) }}</textarea>
@overwrite
{{-- Add plugin initialization and configuration code --}}
@push('js')
<script>
$(() => {
let usrCfg = @json($config);
// Check for placeholder attribute.
@isset($attributes['placeholder'])
usrCfg['placeholder'] = "{{ $attributes['placeholder'] }}";
@endisset
// Initialize the plugin.
$('#{{ $id }}').summernote(usrCfg);
// Check for disabled attribute.
@isset($attributes['disabled'])
$('#{{ $id }}').summernote('disable');
@endisset
})
</script>
@endpush
{{-- Setup the font size of the plugin when using sm/lg sizes --}}
{{-- NOTE: this may change with newer plugin versions --}}
@once
@push('css')
<style type="text/css">
{{-- SM size setup --}}
.input-group-sm .note-editor {
font-size: .875rem;
line-height: 1;
}
{{-- LG size setup --}}
.input-group-lg .note-editor {
font-size: 1.25rem;
line-height: 1.5;
}
{{-- Setup custom invalid style --}}
.adminlte-invalid-itegroup .note-editor {
box-shadow: 0 .25rem 0.5rem rgba(0,0,0,.25);
border-color: #dc3545 !important;
}
</style>
@endpush
@endonce

View File

@@ -0,0 +1,16 @@
@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Textarea --}}
<textarea id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}
>{{ $getOldValue($errorKey, $slot) }}</textarea>
@overwrite