Browse Source

移除暂未兼容的组件

jqh 5 năm trước cách đây
mục cha
commit
fd28def3eb

+ 0 - 27
resources/views/widgets/carousel.blade.php

@@ -1,27 +0,0 @@
-<div {!! $attributes !!}>
-    <ol class="carousel-indicators">
-
-        @foreach($items as $key => $item)
-        <li data-target="#{!! $id !!}" data-slide-to="{{$key}}" class="{{ $key == 0 ? 'active' : '' }}"></li>
-        @endforeach
-
-    </ol>
-    <div class="carousel-inner">
-
-        @foreach($items as $key => $item)
-        <div class="item {{ $key == 0 ? 'active' : '' }}">
-            <img src="{{ url($item['image']) }}" alt="{{$item['caption']}}">
-            <div class="carousel-caption">
-                {{$item['caption']}}
-            </div>
-        </div>
-        @endforeach
-
-    </div>
-    <a class="left carousel-control" href="#{!! $id !!}" data-slide="prev">
-        <span class="fa fa-angle-left"></span>
-    </a>
-    <a class="right carousel-control" href="#{!! $id !!}" data-slide="next">
-        <span class="fa fa-angle-right"></span>
-    </a>
-</div>

+ 0 - 43
resources/views/widgets/navbar.blade.php

@@ -1,43 +0,0 @@
-<nav {!! $attributes !!}>
-    <div class="container-fluid">
-        <div class="navbar-header">
-            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#{{$id}}">
-                <span class="sr-only">Toggle navigation</span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-            </button>
-            <a class="navbar-brand" href="#">{!! $title !!}</a>
-        </div>
-
-        <div class="navbar-collapse collapse" id="{{$id}}">
-            @if($items['left'])
-            <ul class="nav navbar-nav">
-                @foreach($items['left'] as $k => $item)
-                    @if($k === '__dropdown__')
-                        <li class="dropdown">
-                            {!! $item !!}
-                        </li>
-                    @else
-                        {!! $item !!}
-                    @endif
-                @endforeach
-            </ul>
-            @endif
-
-            @if($items['right'])
-                <ul class="nav navbar-nav navbar-right">
-                    @foreach($items['right'] as $k => $item)
-                        @if($k === '__dropdown__')
-                            <li class="dropdown">
-                                {!! $item !!}
-                            </li>
-                        @else
-                            {!! $item !!}
-                        @endif
-                    @endforeach
-                </ul>
-            @endif
-        </div>
-    </div>
-</nav>

+ 0 - 62
src/Widgets/Carousel.php

@@ -1,62 +0,0 @@
-<?php
-
-namespace Dcat\Admin\Widgets;
-
-class Carousel extends Widget
-{
-    /**
-     * @var string
-     */
-    protected $view = 'admin::widgets.carousel';
-
-    /**
-     * @var array
-     */
-    protected $items;
-
-    /**
-     * @var string
-     */
-    protected $title = 'Carousel';
-
-    /**
-     * Carousel constructor.
-     *
-     * @param array $items
-     */
-    public function __construct($items = [])
-    {
-        $this->items = $items;
-
-        $this->id('carousel-'.uniqid());
-        $this->class('carousel slide');
-        $this->setHtmlAttribute('data-ride', 'carousel');
-    }
-
-    /**
-     * Set title.
-     *
-     * @param string $title
-     */
-    public function title($title)
-    {
-        $this->title = $title;
-    }
-
-    /**
-     * Render Carousel.
-     *
-     * @return string
-     */
-    public function render()
-    {
-        $variables = [
-            'items'      => $this->items,
-            'title'      => $this->title,
-            'attributes' => $this->formatHtmlAttributes(),
-            'id'         => $this->id,
-        ];
-
-        return view($this->view, $variables)->render();
-    }
-}

+ 0 - 90
src/Widgets/NavList.php

@@ -1,90 +0,0 @@
-<?php
-
-namespace Dcat\Admin\Widgets;
-
-use Dcat\Admin\Admin;
-use Illuminate\Contracts\Support\Arrayable;
-use Illuminate\Support\Str;
-
-class NavList extends Widget
-{
-    protected $items = [];
-
-    /**
-     * @var \Closure
-     */
-    protected $builder;
-
-    protected $active = [];
-
-    protected $click = false;
-
-    public function __construct($items = [])
-    {
-        $this->add($items);
-
-        $this->class('nav nav-pills nav-stacked');
-        $this->id('nav-list-'.Str::random(8));
-    }
-
-    public function checked($key)
-    {
-        $this->active = $key;
-
-        return $this;
-    }
-
-    public function click()
-    {
-        $this->click = true;
-
-        return $this;
-    }
-
-    public function add($items)
-    {
-        if ($items instanceof Arrayable) {
-            $items = $items->toArray();
-        }
-
-        $this->items = (array) $items;
-
-        return $this;
-    }
-
-    public function map(\Closure $closure)
-    {
-        $this->builder = $closure;
-
-        return $this;
-    }
-
-    public function render()
-    {
-        if ($this->click) {
-            Admin::script(
-                <<<JS
-$('#{$this->id} li').on('click', function () {
-    $('#{$this->id} li').removeClass('active');
-    $(this).addClass('active');
-});
-JS
-            );
-        }
-
-        $html = '';
-        foreach ($this->items as $k => $item) {
-            if ($builder = $this->builder) {
-                $item = $builder($item, $k);
-            }
-
-            $active = $this->active === $k ? 'active' : '';
-
-            $item = mb_strpos($item, '</a>') ? $item : "<a href='javascript:void(0)'>$item</a>";
-
-            $html .= "<li class='$active bg-white'>$item</li>";
-        }
-
-        return "<ul {$this->formatHtmlAttributes()}>{$html}</ul>";
-    }
-}

+ 0 - 178
src/Widgets/Navbar.php

@@ -1,178 +0,0 @@
-<?php
-
-namespace Dcat\Admin\Widgets;
-
-use Dcat\Admin\Admin;
-use Dcat\Admin\Support\Helper;
-use Illuminate\Support\Str;
-
-class Navbar extends Widget
-{
-    const DROPDOWN_FLAG_KEY = '__dropdown__';
-
-    protected $view = 'admin::widgets.navbar';
-
-    protected $id;
-
-    protected $title;
-
-    /**
-     * @var \Closure
-     */
-    protected $builder;
-
-    /**
-     * @var array
-     */
-    protected $items = [
-        'right' => [],
-        'left'  => [],
-    ];
-
-    protected $active;
-
-    protected $click = false;
-
-    /**
-     * Navbar constructor.
-     */
-    public function __construct(?string $title = '#', $items = [])
-    {
-        $this->title($title);
-        $this->add($items);
-
-        $this->class('navbar navbar-default');
-        $this->id = 'navbar-'.Str::random(8);
-    }
-
-    public function title($title)
-    {
-        $this->title = $title;
-
-        return $this;
-    }
-
-    public function noShadow()
-    {
-        return $this->class('no-shadow', true);
-    }
-
-    public function margin($value)
-    {
-        return $this->style('margin:'.$value);
-    }
-
-    public function add($items, bool $right = false)
-    {
-        if ($right) {
-            $this->items['right'] = array_merge($this->items['right'], Helper::array($items));
-        } else {
-            $this->items['left'] = array_merge($this->items['left'], Helper::array($items));
-        }
-
-        return $this;
-    }
-
-    public function left($items)
-    {
-        return $this->add($items, false);
-    }
-
-    public function right($items)
-    {
-        return $this->add($items, true);
-    }
-
-    public function checked($key)
-    {
-        $this->active = $key;
-
-        return $this;
-    }
-
-    public function click()
-    {
-        $this->click = true;
-
-        return $this;
-    }
-
-    public function map(\Closure $closure)
-    {
-        $this->builder = $closure;
-
-        return $this;
-    }
-
-    public function dropdown(
-        ?string $text,
-        array $options,
-        \Closure $closure = null,
-        bool $right = false
-    ) {
-        $dropdown = Dropdown::make($options)
-            ->button($text)
-            ->buttonClass('')
-            ->template('%s<ul class="dropdown-menu">%s</ul>');
-
-        if ($closure) {
-            $closure($dropdown);
-        }
-
-        $key = $right ? 'right' : 'left';
-
-        $this->items[$key][self::DROPDOWN_FLAG_KEY] = $dropdown;
-
-        return $this;
-    }
-
-    public function variables()
-    {
-        foreach ($this->items['left'] as $k => &$item) {
-            $item = $this->formatItem($k, $item);
-        }
-        foreach ($this->items['right'] as $k => &$item) {
-            $item = $this->formatItem($k, $item);
-        }
-
-        if ($this->click) {
-            Admin::script(
-                <<<JS
-$('#{$this->id} li.nav-li').on('click', function () {
-    $('#{$this->id} li.nav-li').removeClass('active');
-    $(this).addClass('active');
-});
-JS
-            );
-        }
-
-        return [
-            'id'         => $this->id,
-            'title'      => $this->title,
-            'items'      => $this->items,
-            'attributes' => $this->formatHtmlAttributes(),
-            'actives'    => $this->actives,
-        ];
-    }
-
-    protected function formatItem($k, $item)
-    {
-        if ($k === self::DROPDOWN_FLAG_KEY) {
-            return $item;
-        }
-
-        if ($builder = $this->builder) {
-            $item = $builder($item, $k);
-        }
-
-        if (mb_strpos($item, '</li>')) {
-            return $item;
-        }
-
-        $active = $this->active === $k ? 'active' : '';
-
-        $item = mb_strpos($item, '</a>') ? $item : "<a href='javascript:void(0)'>$item</a>";
-
-        return "<li class='nav-li $active'>$item</li>";
-    }
-}