Quellcode durchsuchen

:hammer: variable trait

jqh vor 5 Jahren
Ursprung
Commit
afacec07b4

+ 0 - 418
resources/assets/dcat/extra/step.scss

@@ -1,418 +0,0 @@
-@import "../sass/variables/variables";
-
-.sw-toolbar-bottom {
-  margin-top: 20px;
-  margin-left: 5px;
-}
-
-/* ---------------------------------------------------------------------------------------------------------------- */
-
-.dcat-step-box {
-  margin: 0 auto;
-}
-.dcat-step {
-  box-sizing: border-box;
-  padding: 0;
-  color: rgba(0, 0, 0, .65);
-  /*font-variant: tabular-nums;*/
-  line-height: 1.5;
-  list-style: none;
-  /*font-feature-settings: "tnum";*/
-  display: flex;
-  width: 100%;
-  font-size: 0;
-  margin: 0 auto 30px;
-}
-
-.dcat-step-item {
-  position: relative;
-  display: inline-block;
-  flex: 1 1;
-  overflow: hidden;
-  vertical-align: top
-}
-
-.dcat-step-item-container {
-  outline: 0;
-  border: 0!important;
-}
-
-.dcat-step-item:last-child {
-  flex: none
-}
-
-.dcat-step-item:last-child > .dcat-step-item-container > .dcat-step-content > .dcat-step-title:after, .dcat-step-item:last-child > .dcat-step-item-container > .dcat-step-line {
-  display: none
-}
-
-.dcat-step-content, .dcat-step-icons {
-  display: inline-block;
-  vertical-align: top;
-}
-
-.dcat-step-icons {
-  width: 32px;
-  height: 32px;
-  margin-right: 8px;
-  font-size: 16px;
-  line-height: 32px;
-  text-align: center;
-  border: 1px solid rgba(0, 0, 0, .25);
-  border-radius: 32px;
-  transition: background-color .3s, border-color .3s;
-}
-
-.dcat-step-icons > .dcat-step-icon {
-  position: relative;
-  top: -1px;
-  color: rgba(0,0,0,.25);
-  line-height: 1
-}
-
-.dcat-step-line {
-  position: absolute;
-  top: 12px;
-  left: 0;
-  width: 100%;
-  padding: 0 10px
-}
-
-.dcat-step-line:after {
-  display: inline-block;
-  width: 100%;
-  height: 1px;
-  background: #e8e8e8;
-  border-radius: 1px;
-  transition: background .3s;
-  content: ""
-}
-
-.dcat-step-title {
-  position: relative;
-  display: inline-block;
-  padding-right: 16px;
-  color: rgba(0, 0, 0, .65);
-  font-size: 16px;
-  line-height: 32px
-}
-
-.dcat-step-title:after {
-  position: absolute;
-  top: 16px;
-  left: 100%;
-  display: block;
-  width: 9999px;
-  height: 1px;
-  background: #e8e8e8;
-  content: ""
-}
-
-.dcat-step-desc {
-  color: rgba(0, 0, 0, .45);
-  font-size: 14px
-}
-
-.active .dcat-step-icons {
-  background-color: #fff;
-}
-
-.active > .dcat-step-item-container > .dcat-step-content > .dcat-step-title {
-  color: rgba(0, 0, 0, .85)
-}
-
-.active > .dcat-step-item-container > .dcat-step-content > .dcat-step-title:after {
-  background-color: #e8e8e8
-}
-
-.active > .dcat-step-item-container > .dcat-step-content > .dcat-step-desc {
-  color: rgba(0, 0, 0, .65)
-}
-
-.active > .dcat-step-item-container > .dcat-step-line:after {
-  background-color: #e8e8e8
-}
-
-.active .dcat-step-icons > .dcat-step-icon {
-  color: #fff
-}
-
-.active .dcat-step-title {
-  font-weight: 500
-}
-
-.done .dcat-step-icons {
-  background-color: #fff;
-}
-
-.done > .dcat-step-item-container > .dcat-step-content > .dcat-step-title {
-  color: rgba(0, 0, 0, .65)
-}
-
-.done > .dcat-step-item-container > .dcat-step-content > .dcat-step-desc {
-  color: rgba(0, 0, 0, .45)
-}
-
-.danger .dcat-step-icons {
-  background-color: #fff;
-  border-color: $red-darker
-}
-
-.danger .dcat-step-icons > .dcat-step-icon {
-  color: $red-darker
-}
-
-.danger .dcat-step-icons > .dcat-step-icon .dcat-step-icon-dot {
-  background: $red-darker
-}
-
-.danger > .dcat-step-item-container > .dcat-step-content > .dcat-step-title {
-  color: $red-darker
-}
-
-.danger > .dcat-step-item-container > .dcat-step-content > .dcat-step-title:after {
-  background-color: #e8e8e8
-}
-
-.danger > .dcat-step-item-container > .dcat-step-content > .dcat-step-desc {
-  color: $red-darker
-}
-
-.danger > .dcat-step-item-container > .dcat-step-line:after {
-  background-color: #e8e8e8
-}
-
-.dcat-step-item.dcat-step-next-error .dcat-step-title:after {
-  background: $red-darker
-}
-
-.dcat-step .dcat-step-item:not(.active) > .dcat-step-item-container[role=button] {
-  cursor: pointer
-}
-
-.dcat-step .dcat-step-item:not(.active) > .dcat-step-item-container[role=button] .dcat-step-desc, .dcat-step .dcat-step-item:not(.active) > .dcat-step-item-container[role=button] .dcat-step-icons .dcat-step-icon, .dcat-step .dcat-step-item:not(.active) > .dcat-step-item-container[role=button] .dcat-step-title {
-  transition: color .3s
-}
-
-.dcat-step-horizontal:not(.dcat-step-label-vertical) .dcat-step-item {
-  margin-right: 16px;
-  white-space: nowrap
-}
-
-.dcat-step-horizontal:not(.dcat-step-label-vertical) .dcat-step-item:last-child {
-  margin-right: 0
-}
-
-.dcat-step-horizontal:not(.dcat-step-label-vertical) .dcat-step-item:last-child .dcat-step-title {
-  padding-right: 0
-}
-
-.dcat-step-horizontal:not(.dcat-step-label-vertical) .dcat-step-line {
-  display: none
-}
-
-.dcat-step-horizontal:not(.dcat-step-label-vertical) .dcat-step-desc {
-  max-width: 140px;
-  white-space: normal
-}
-
-.dcat-step-sm.dcat-step-horizontal:not(.dcat-step-label-vertical) .dcat-step-item {
-  margin-right: 12px
-}
-
-.dcat-step-sm.dcat-step-horizontal:not(.dcat-step-label-vertical) .dcat-step-item:last-child {
-  margin-right: 0
-}
-
-.dcat-step-sm .dcat-step-icons {
-  width: 24px;
-  height: 24px;
-  font-size: 12px;
-  line-height: 24px;
-  text-align: center;
-  border-radius: 24px
-}
-
-.dcat-step-sm .dcat-step-title {
-  padding-right: 12px;
-  font-size: 14px;
-  line-height: 24px
-}
-
-.dcat-step-sm .dcat-step-title:after {
-  top: 12px
-}
-
-.dcat-step-sm .dcat-step-desc {
-  color: rgba(0, 0, 0, .45);
-  font-size: 14px
-}
-
-.dcat-step-sm .dcat-step-line {
-  top: 8px
-}
-
-@media (max-width: 540px) {
-  .dcat-step-horizontal.dcat-step-label-horizontal {
-    display: block
-  }
-
-  .dcat-step-box .nav-tabs > li {
-    float: none;
-  }
-
-  .dcat-step-box .nav-tabs>li>a {
-    padding: 0;
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal .dcat-step-item {
-    display: block;
-    overflow: visible
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal .dcat-step-icons {
-    float: left;
-    margin-right: 16px
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal .dcat-step-content {
-    display: block;
-    overflow: hidden
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal .dcat-step-title {
-    line-height: 32px
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal .dcat-step-desc {
-    padding-bottom: 12px
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal > .dcat-step-item > .dcat-step-item-container > .dcat-step-line {
-    position: absolute;
-    top: 0;
-    left: 16px;
-    width: 1px;
-    height: 100%;
-    padding: 38px 0 6px
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal > .dcat-step-item > .dcat-step-item-container > .dcat-step-line:after {
-    width: 1px;
-    height: 100%
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal > .dcat-step-item:not(:last-child) > .dcat-step-item-container > .dcat-step-line {
-    display: none;
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal > .dcat-step-item > .dcat-step-item-container > .dcat-step-content > .dcat-step-title:after {
-    display: none;
-  }
-
-  .dcat-step-horizontal.dcat-step-label-horizontal.dcat-step-sm .dcat-step-item-container .dcat-step-title {
-    line-height: 24px
-  }
-}
-
-.dcat-step-label-vertical .dcat-step-item {
-  overflow: visible
-}
-
-.dcat-step-label-vertical .dcat-step-line {
-  margin-left: 51px;
-  padding: 3.5px 24px;
-  left: 18px;
-  top: 23px;
-}
-
-.dcat-step-label-vertical .dcat-step-content {
-  display: block;
-  width: 104px;
-  margin-top: 8px;
-  text-align: center
-}
-
-.dcat-step-label-vertical .dcat-step-icons {
-  display: inline-block;
-  margin-left: 36px
-}
-
-.dcat-step-label-vertical .dcat-step-title {
-  padding-right: 0
-}
-
-.dcat-step-label-vertical .dcat-step-title:after {
-  display: none
-}
-
-.dcat-step-label-vertical.dcat-step-sm:not(.dcat-step-dot) .dcat-step-icons {
-  margin-left: 40px
-}
-
-.dcat-step-dot .dcat-step-title, .dcat-step-dot.dcat-step-sm .dcat-step-title {
-  line-height: 1.5
-}
-
-.dcat-step-dot .dcat-step-line, .dcat-step-dot.dcat-step-sm .dcat-step-line {
-  top: 2px;
-  width: 100%;
-  margin: 0 0 0 70px;
-  padding: 0
-}
-
-.dcat-step-dot .dcat-step-line:after, .dcat-step-dot.dcat-step-sm .dcat-step-line:after {
-  width: calc(100% - 20px);
-  height: 3px;
-  margin-left: 12px
-}
-
-.dcat-step-dot .dcat-step-item:first-child .dcat-step-icon-dot, .dcat-step-dot.dcat-step-sm .dcat-step-item:first-child .dcat-step-icon-dot {
-  left: 2px
-}
-
-.dcat-step-dot .dcat-step-icons, .dcat-step-dot.dcat-step-sm .dcat-step-icons {
-  width: 8px;
-  height: 8px;
-  margin-left: 67px;
-  padding-right: 0;
-  line-height: 8px;
-  background: 0 0;
-  border: 0
-}
-
-.dcat-step-dot .dcat-step-icons .dcat-step-icon-dot, .dcat-step-dot.dcat-step-sm .dcat-step-icons .dcat-step-icon-dot {
-  position: relative;
-  float: left;
-  width: 100%;
-  height: 100%;
-  border-radius: 100px;
-  transition: all .3s
-}
-
-.dcat-step-dot .dcat-step-icons .dcat-step-icon-dot:after, .dcat-step-dot.dcat-step-sm .dcat-step-icons .dcat-step-icon-dot:after {
-  position: absolute;
-  top: -12px;
-  left: -26px;
-  width: 60px;
-  height: 32px;
-  background: rgba(0, 0, 0, .001);
-  content: ""
-}
-
-.dcat-step-dot .dcat-step-content, .dcat-step-dot.dcat-step-sm .dcat-step-content {
-  width: 140px
-}
-
-.dcat-step-dot .active .dcat-step-icons, .dcat-step-dot.dcat-step-sm .active .dcat-step-icons {
-  width: 10px;
-  height: 10px;
-  line-height: 10px
-}
-
-.dcat-step-dot .active .dcat-step-icons .dcat-step-icon-dot, .dcat-step-dot.dcat-step-sm .active .dcat-step-icons .dcat-step-icon-dot {
-  top: -1px
-}
-
-.dcat-step-item a {
-  font-weight: normal!important;
-}

+ 0 - 633
resources/assets/dcat/plugins/SmartWizard/dist/js/jquery.smartWizard.js

@@ -1,633 +0,0 @@
-/*!
- * SmartWizard v4.2.2
- * The awesome jQuery step wizard plugin with Bootstrap support
- * http://www.techlaboratory.net/smartwizard
- *
- * Created by Dipu Raj
- * http://dipuraj.me
- *
- * Licensed under the terms of the MIT License
- * https://github.com/techlab/SmartWizard/blob/master/LICENSE
- */
-
-;(function ($, window, document, undefined) {
-    "use strict";
-    // Default options
-
-    var defaults = {
-        selected: 0, // Initial selected step, 0 = first step
-        keyNavigation: true, // Enable/Disable keyboard navigation(left and right keys are used if enabled)
-        autoAdjustHeight: true, // Automatically adjust content height
-        cycleSteps: false, // Allows to cycle the navigation of steps
-        backButtonSupport: true, // Enable the back button support
-        useURLhash: true, // Enable selection of the step based on url hash
-        showStepURLhash: true, // Show url hash based on step
-        lang: { // Language variables for button
-            next: 'Next',
-            previous: 'Previous'
-        },
-        toolbarSettings: {
-            toolbarPosition: 'bottom', // none, top, bottom, both
-            toolbarButtonPosition: 'end', // start, end
-            showNextButton: true, // show/hide a Next button
-            showPreviousButton: true, // show/hide a Previous button
-            toolbarExtraButtons: [] // Extra buttons to show on toolbar, array of jQuery input/buttons elements
-        },
-        anchorSettings: {
-            anchorClickable: true, // Enable/Disable anchor navigation
-            enableAllAnchors: false, // Activates all anchors clickable all times
-            markDoneStep: true, // Add done css
-            markAllPreviousStepsAsDone: true, // When a step selected by url hash, all previous steps are marked done
-            removeDoneStepOnNavigateBack: false, // While navigate back done step after active step will be cleared
-            enableAnchorOnDoneStep: true // Enable/Disable the done steps navigation
-        },
-        contentURL: null, // content url, Enables Ajax content loading. Can also set as data data-content-url on anchor
-        contentCache: true, // cache step contents, if false content is fetched always from ajax url
-        ajaxSettings: {}, // Ajax extra settings
-        disabledSteps: [], // Array Steps disabled
-        errorSteps: [], // Highlight step with errors
-        hiddenSteps: [], // Hidden steps
-        theme: 'default', // theme for the wizard, related css need to include for other than default theme
-        transitionEffect: 'none', // Effect on navigation, none/slide/fade
-        transitionSpeed: '400'
-    };
-
-    // The plugin constructor
-    function SmartWizard(element, options) {
-        // Merge user settings with default, recursively
-        this.options = $.extend(true, {}, defaults, options);
-        // Main container element
-        this.main = $(element);
-        // Navigation bar element
-        this.nav = this.main.children('ul');
-        // Step anchor elements
-        this.steps = $("li > a", this.nav);
-        // Content container
-        this.container = this.main.children('div');
-        // Content pages
-        this.pages = this.container.children('div');
-        // Active step index
-        this.current_index = null;
-        // Call initial method
-        this.init();
-    }
-
-    $.extend(SmartWizard.prototype, {
-
-        init: function () {
-            // Set the elements
-            this._setElements();
-            // Add toolbar
-            this._setToolbar();
-            // Assign plugin events
-            this._setEvents();
-
-            var idx = this.options.selected;
-            // Get selected step from the url
-            if (this.options.useURLhash) {
-                // Get step number from url hash if available
-                var hash = window.location.hash;
-                if (hash && hash.length > 0) {
-                    var elm = $("a[href*='" + hash + "']", this.nav);
-                    if (elm.length > 0) {
-                        var id = this.steps.index(elm);
-                        idx = id >= 0 ? id : idx;
-                    }
-                }
-            }
-
-            if (idx > 0 && this.options.anchorSettings.markDoneStep && this.options.anchorSettings.markAllPreviousStepsAsDone) {
-                // Mark previous steps of the active step as done
-                // this.steps.eq(idx).parent('li').prevAll().addClass("done");
-                this._setDone(this.steps.eq(idx).parent('li').prevAll());
-            }
-
-            // Show the initial step
-            this._showStep(idx);
-        },
-
-        // PRIVATE FUNCTIONS
-
-        _setElements: function () {
-            // Set the main element
-            this.main.addClass('sw-main sw-theme-' + this.options.theme);
-            // Set anchor elements
-            this.nav.addClass('step-anchor'); // nav-justified  nav-pills
-
-            // Make the anchor clickable
-            if (this.options.anchorSettings.enableAllAnchors !== false && this.options.anchorSettings.anchorClickable !== false) {
-                this.steps.parent('li').addClass('clickable');
-            }
-            // Set content container
-            this.container.addClass('sw-container tab-content');
-            // Set content pages
-            this.pages.addClass('tab-pane step-content');
-
-            // Disabled steps
-            var mi = this;
-            if (this.options.disabledSteps && this.options.disabledSteps.length > 0) {
-                $.each(this.options.disabledSteps, function (i, n) {
-                    mi.steps.eq(n).parent('li').addClass('disabled');
-                });
-            }
-            // Error steps
-            if (this.options.errorSteps && this.options.errorSteps.length > 0) {
-                $.each(this.options.errorSteps, function (i, n) {
-                    mi.steps.eq(n).parent('li').addClass('danger');
-                });
-            }
-            // Hidden steps
-            if (this.options.hiddenSteps && this.options.hiddenSteps.length > 0) {
-                $.each(this.options.hiddenSteps, function (i, n) {
-                    mi.steps.eq(n).parent('li').addClass('hidden');
-                });
-            }
-
-            return true;
-        },
-        _setToolbar: function () {
-            // Skip right away if the toolbar is not enabled
-            if (this.options.toolbarSettings.toolbarPosition === 'none') {
-                return true;
-            }
-            console.log(this.options.toolbarSettings.toolbarPosition);
-
-            // Create the toolbar buttons
-            var btnNext = this.options.toolbarSettings.showNextButton !== false ? $('<button></button>').text(this.options.lang.next).addClass('btn btn-default sw-btn-next').attr('type', 'button') : null;
-            var btnPrevious = this.options.toolbarSettings.showPreviousButton !== false ? $('<button></button>').text(this.options.lang.previous).addClass('btn btn-default sw-btn-prev').attr('type', 'button') : null;
-            var btnGroup = $('<div></div>').addClass('btn-group mr-2 sw-btn-group').attr('role', 'group').append(btnPrevious, btnNext);
-
-
-            var box1 = $('<div></div>').addClass('col-sm-2');
-            var box2 = $('<div></div>').addClass('col-sm-10').append(btnGroup);
-
-            // Add extra toolbar buttons
-            var btnGroupExtra = null;
-
-            if (this.options.toolbarSettings.toolbarExtraButtons && this.options.toolbarSettings.toolbarExtraButtons.length > 0) {
-                btnGroupExtra = $('<span></span>').addClass('mr-2 sw-btn-group-extra').attr('role', 'group');
-                $.each(this.options.toolbarSettings.toolbarExtraButtons, function (i, n) {
-                    btnGroupExtra.append(n.clone(true));
-                });
-            }
-
-            var toolbarTop, toolbarBottom;
-            // Append toolbar based on the position
-            switch (this.options.toolbarSettings.toolbarPosition) {
-                case 'top':
-                    toolbarTop = $('<div></div>').addClass('btn-toolbar sw-toolbar sw-toolbar-top justify-content-' + this.options.toolbarSettings.toolbarButtonPosition);
-                    toolbarTop.append(box1, box2);
-                    if (this.options.toolbarSettings.toolbarButtonPosition === 'left') {
-                        box2.append(btnGroupExtra);
-                    } else {
-                        box2.prepend(btnGroupExtra);
-                    }
-                    this.container.before(toolbarTop);
-                    break;
-                case 'bottom':
-                    toolbarBottom = $('<div></div>').addClass('btn-toolbar sw-toolbar sw-toolbar-bottom justify-content-' + this.options.toolbarSettings.toolbarButtonPosition);
-                    toolbarBottom.append(box1, box2);
-                    if (this.options.toolbarSettings.toolbarButtonPosition === 'left') {
-                        box2.append(btnGroupExtra);
-                    } else {
-                        box2.prepend(btnGroupExtra);
-                    }
-                    this.container.after(toolbarBottom);
-                    break;
-                case 'both':
-                    toolbarTop = $('<div></div>').addClass('btn-toolbar sw-toolbar sw-toolbar-top justify-content-' + this.options.toolbarSettings.toolbarButtonPosition);
-                    toolbarTop.append(box1, box2);
-                    if (this.options.toolbarSettings.toolbarButtonPosition === 'left') {
-                        box2.append(btnGroupExtra);
-                    } else {
-                        box2.prepend(btnGroupExtra);
-                    }
-                    this.container.before(toolbarTop);
-
-                    toolbarBottom = $('<div></div>').addClass('btn-toolbar sw-toolbar sw-toolbar-bottom justify-content-' + this.options.toolbarSettings.toolbarButtonPosition);
-                    toolbarBottom.append(box1, box2);
-                    if (this.options.toolbarSettings.toolbarButtonPosition === 'left') {
-                        box2.append(btnGroupExtra.clone(true));
-                    } else {
-                        box2.prepend(btnGroupExtra.clone(true));
-                    }
-                    this.container.after(toolbarBottom);
-                    break;
-                default:
-                    toolbarBottom = $('<div></div>').addClass('btn-toolbar sw-toolbar sw-toolbar-bottom justify-content-' + this.options.toolbarSettings.toolbarButtonPosition);
-                    toolbarBottom.append(box1, box2);
-                    if (this.options.toolbarSettings.toolbarButtonPosition === 'left') {
-                        box2.append(btnGroupExtra);
-                    } else {
-                        box2.prepend(btnGroupExtra);
-                    }
-                    this.container.after(toolbarBottom);
-                    break;
-            }
-            return true;
-        },
-        _setEvents: function () {
-            // Anchor click event
-            var mi = this;
-            $(this.steps).on("click", function (e) {
-                e.preventDefault();
-                if (mi.options.anchorSettings.anchorClickable === false) {
-                    return true;
-                }
-                var idx = mi.steps.index(this);
-                if (mi.options.anchorSettings.enableAnchorOnDoneStep === false && mi.steps.eq(idx).parent('li').hasClass('done')) {
-                    return true;
-                }
-
-                if (idx !== mi.current_index) {
-                    if (mi.options.anchorSettings.enableAllAnchors !== false && mi.options.anchorSettings.anchorClickable !== false) {
-                        mi._showStep(idx);
-                    } else {
-                        if (mi.steps.eq(idx).parent('li').hasClass('done')) {
-                            mi._showStep(idx);
-                        }
-                    }
-                }
-            });
-
-            // Keyboard navigation event
-            if (this.options.keyNavigation) {
-                $(document).keyup(function (e) {
-                    mi._keyNav(e);
-                });
-            }
-
-            // Back/forward browser button event
-            if (this.options.backButtonSupport) {
-                $(window).on('hashchange', function (e) {
-                    if (!mi.options.useURLhash) {
-                        return true;
-                    }
-                    if (window.location.hash) {
-                        var elm = $("a[href*='" + window.location.hash + "']", mi.nav);
-                        if (elm && elm.length > 0) {
-                            e.preventDefault();
-                            mi._showStep(mi.steps.index(elm));
-                        }
-                    }
-                });
-            }
-
-            return true;
-        },
-        _showNext: function () {
-            var si = this.current_index + 1;
-            // Find the next not disabled step
-            for (var i = si; i < this.steps.length; i++) {
-                if (!this.steps.eq(i).parent('li').hasClass('disabled') && !this.steps.eq(i).parent('li').hasClass('hidden')) {
-                    si = i;
-                    break;
-                }
-            }
-
-            if (this.steps.length <= si) {
-                if (!this.options.cycleSteps) {
-                    return false;
-                }
-                si = 0;
-            }
-            this._showStep(si);
-            return true;
-        },
-        _showPrevious: function () {
-            var si = this.current_index - 1;
-            // Find the previous not disabled step
-            for (var i = si; i >= 0; i--) {
-                if (!this.steps.eq(i).parent('li').hasClass('disabled') && !this.steps.eq(i).parent('li').hasClass('hidden')) {
-                    si = i;
-                    break;
-                }
-            }
-            if (0 > si) {
-                if (!this.options.cycleSteps) {
-                    return false;
-                }
-                si = this.steps.length - 1;
-            }
-            this._showStep(si);
-            return true;
-        },
-        _showStep: function (idx) {
-            // If step not found, skip
-            if (!this.steps.eq(idx)) {
-                return false;
-            }
-            // If current step is requested again, skip
-            if (idx == this.current_index) {
-                return false;
-            }
-            // If it is a disabled step, skip
-            if (this.steps.eq(idx).parent('li').hasClass('disabled') || this.steps.eq(idx).parent('li').hasClass('hidden')) {
-                return false;
-            }
-            // Load step content
-            this._loadStepContent(idx);
-            return true;
-        },
-        _loadStepContent: function (idx) {
-            var mi = this;
-            // Get current step elements
-            var curTab = this.steps.eq(this.current_index);
-            // Get the direction of step navigation
-            var stepDirection = '';
-            var elm = this.steps.eq(idx);
-            var contentURL = elm.data('content-url') && elm.data('content-url').length > 0 ? elm.data('content-url') : this.options.contentURL;
-
-            if (this.current_index !== null && this.current_index !== idx) {
-                stepDirection = this.current_index < idx ? "forward" : "backward";
-            }
-
-            // Trigger "leaveStep" event
-            if (this.current_index !== null && this._triggerEvent("leaveStep", [curTab, this.current_index, stepDirection]) === false) {
-                return false;
-            }
-
-            if (contentURL && contentURL.length > 0 && (!elm.data('has-content') || !this.options.contentCache)) {
-                // Get ajax content and then show step
-                var selPage = elm.length > 0 ? $(elm.attr("href"), this.main) : null;
-
-                var ajaxSettings = $.extend(true, {}, {
-                    url: contentURL,
-                    type: "POST",
-                    data: { step_number: idx },
-                    dataType: "text",
-                    beforeSend: function () {
-                        elm.parent('li').addClass('loading');
-                    },
-                    error: function (jqXHR, status, message) {
-                        elm.parent('li').removeClass('loading');
-                        $.error(message);
-                    },
-                    success: function (res) {
-                        if (res && res.length > 0) {
-                            elm.data('has-content', true);
-                            selPage.html(res);
-                        }
-                        elm.parent('li').removeClass('loading');
-                        mi._transitPage(idx);
-                    }
-                }, this.options.ajaxSettings);
-
-                $.ajax(ajaxSettings);
-            } else {
-                // Show step
-                this._transitPage(idx);
-            }
-            return true;
-        },
-        _transitPage: function (idx) {
-            var mi = this;
-            // Get current step elements
-            var curTab = this.steps.eq(this.current_index);
-            var curPage = curTab.length > 0 ? $(curTab.attr("href"), this.main) : null;
-            // Get step to show elements
-            var selTab = this.steps.eq(idx);
-            var selPage = selTab.length > 0 ? $(selTab.attr("href"), this.main) : null;
-            // Get the direction of step navigation
-            var stepDirection = '';
-            if (this.current_index !== null && this.current_index !== idx) {
-                stepDirection = this.current_index < idx ? "forward" : "backward";
-            }
-
-            var stepPosition = 'middle';
-            if (idx === 0) {
-                stepPosition = 'first';
-            } else if (idx === this.steps.length - 1) {
-                stepPosition = 'final';
-            }
-
-            this.options.transitionEffect = this.options.transitionEffect.toLowerCase();
-            this.pages.finish();
-            if (this.options.transitionEffect === 'slide') {
-                // normal slide
-                if (curPage && curPage.length > 0) {
-                    curPage.slideUp('fast', this.options.transitionEasing, function () {
-                        selPage.slideDown(mi.options.transitionSpeed, mi.options.transitionEasing);
-                    });
-                } else {
-                    selPage.slideDown(this.options.transitionSpeed, this.options.transitionEasing);
-                }
-            } else if (this.options.transitionEffect === 'fade') {
-                // normal fade
-                if (curPage && curPage.length > 0) {
-                    curPage.fadeOut('fast', this.options.transitionEasing, function () {
-                        selPage.fadeIn('fast', mi.options.transitionEasing, function () {
-                            $(this).show();
-                        });
-                    });
-                } else {
-                    selPage.fadeIn(this.options.transitionSpeed, this.options.transitionEasing, function () {
-                        $(this).show();
-                    });
-                }
-            } else {
-                if (curPage && curPage.length > 0) {
-                    curPage.hide();
-                }
-                selPage.show();
-            }
-            // Change the url hash to new step
-            this._setURLHash(selTab.attr("href"));
-            // Update controls
-            this._setAnchor(idx);
-            // Set the buttons based on the step
-            this._setButtons(idx);
-            // Fix height with content
-            this._fixHeight(idx);
-            // Update the current index
-            this.current_index = idx;
-
-            // Trigger "showStep" event
-            this._triggerEvent("showStep", [selTab, this.current_index, stepDirection, stepPosition]);
-            return true;
-        },
-        _setAnchor: function (idx) {
-            // Current step anchor > Remove other classes and add done class
-            this.steps.eq(this.current_index).parent('li').removeClass("active danger loading");
-            if (this.options.anchorSettings.markDoneStep !== false && this.current_index !== null) {
-                this._setDone(this.steps.eq(this.current_index).parent('li'));
-                if (this.options.anchorSettings.removeDoneStepOnNavigateBack !== false) {
-                    this._removeDone(this.steps.eq(idx).parent('li').nextAll());
-                }
-            }
-
-            // Next step anchor > Remove other classes and add active class
-            this.steps.eq(idx).parent('li').removeClass("danger loading").addClass("active");
-            this._removeDone(this.steps.eq(idx).parent('li'));
-            return true;
-        },
-
-        _setDone: function ($li) {
-            $li.addClass("done");
-
-            $li.find('.la-step-icon').html('<i style="vertical-align:middle"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="check" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path></svg></i>');
-        },
-
-        //
-        _removeDone: function ($lis) {
-            $lis.removeClass("done");
-
-            $lis.each(function (k, li) {
-                var $icon = $(li).find('.la-step-icon');
-
-                $icon.text($icon.data('index') + 1);
-            });
-
-
-        },
-
-        _setButtons: function (idx) {
-            // Previous/Next Button enable/disable based on step
-            if (!this.options.cycleSteps) {
-                if (0 >= idx) {
-                    $('.sw-btn-prev', this.main).addClass("disabled");
-                } else {
-                    $('.sw-btn-prev', this.main).removeClass("disabled");
-                }
-                if (this.steps.length - 1 <= idx) {
-                    $('.sw-btn-next', this.main).addClass("disabled");
-                } else {
-                    $('.sw-btn-next', this.main).removeClass("disabled");
-                }
-            }
-            return true;
-        },
-
-        // HELPER FUNCTIONS
-
-        _keyNav: function (e) {
-            var mi = this;
-            // Keyboard navigation
-            switch (e.which) {
-                case 37:
-                    // left
-                    mi._showPrevious();
-                    e.preventDefault();
-                    break;
-                case 39:
-                    // right
-                    mi._showNext();
-                    e.preventDefault();
-                    break;
-                default:
-                    return; // exit this handler for other keys
-            }
-        },
-        _fixHeight: function (idx) {
-            // Auto adjust height of the container
-            if (this.options.autoAdjustHeight) {
-                var selPage = this.steps.eq(idx).length > 0 ? $(this.steps.eq(idx).attr("href"), this.main) : null;
-                this.container.finish().animate({ minHeight: selPage.outerHeight() }, this.options.transitionSpeed, function () {});
-            }
-            return true;
-        },
-        _triggerEvent: function (name, params) {
-            // Trigger an event
-            var e = $.Event(name);
-            this.main.trigger(e, params);
-            if (e.isDefaultPrevented()) {
-                return false;
-            }
-            return e.result;
-        },
-        _setURLHash: function (hash) {
-            if (this.options.showStepURLhash && window.location.hash !== hash) {
-                window.location.hash = hash;
-            }
-        },
-
-        // PUBLIC FUNCTIONS
-
-        theme: function (v) {
-            if (this.options.theme === v) {
-                return false;
-            }
-            this.main.removeClass('sw-theme-' + this.options.theme);
-            this.options.theme = v;
-            this.main.addClass('sw-theme-' + this.options.theme);
-            // Trigger "themeChanged" event
-            this._triggerEvent("themeChanged", [this.options.theme]);
-        },
-        next: function () {
-            this._showNext();
-        },
-        prev: function () {
-            this._showPrevious();
-        },
-        reset: function () {
-            // Trigger "beginReset" event
-            if (this._triggerEvent("beginReset") === false) {
-                return false;
-            }
-
-            // Reset all elements and classes
-            this.container.stop(true);
-            this.pages.stop(true);
-            this.pages.hide();
-            this.current_index = null;
-            this._setURLHash(this.steps.eq(this.options.selected).attr("href"));
-            $(".sw-toolbar", this.main).remove();
-            this.steps.removeClass();
-            this.steps.parents('li').removeClass();
-            this.steps.data('has-content', false);
-            this.init();
-
-            // Trigger "endReset" event
-            this._triggerEvent("endReset");
-        },
-        stepState: function (stepArray, state) {
-            var mi = this;
-            stepArray = $.isArray(stepArray) ? stepArray : [stepArray];
-            var selSteps = $.grep(this.steps, function (n, i) {
-                return $.inArray(i, stepArray) !== -1 && i !== mi.current_index;
-            });
-            if (selSteps && selSteps.length > 0) {
-                switch (state) {
-                    case 'disable':
-                        $(selSteps).parents('li').addClass('disabled');
-                        break;
-                    case 'enable':
-                        $(selSteps).parents('li').removeClass('disabled');
-                        break;
-                    case 'hide':
-                        $(selSteps).parents('li').addClass('hidden');
-                        break;
-                    case 'show':
-                        $(selSteps).parents('li').removeClass('hidden');
-                        break;
-                }
-            }
-        }
-    });
-
-    // Wrapper for the plugin
-    $.fn.smartWizard = function (options) {
-        var args = arguments;
-        var instance;
-
-        if (options === undefined || typeof options === 'object') {
-            return this.each(function () {
-                if (!$.data(this, "smartWizard")) {
-                    $.data(this, "smartWizard", new SmartWizard(this, options));
-                }
-            });
-        } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
-            instance = $.data(this[0], 'smartWizard');
-
-            if (options === 'destroy') {
-                $.data(this, 'smartWizard', null);
-            }
-
-            if (instance instanceof SmartWizard && typeof instance[options] === 'function') {
-                return instance[options].apply(instance, Array.prototype.slice.call(args, 1));
-            } else {
-                return this;
-            }
-        }
-    };
-})(jQuery, window, document);

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
resources/assets/dcat/plugins/SmartWizard/dist/js/jquery.smartWizard.min.js


+ 1 - 1
resources/views/grid/displayer/extensions/name.blade.php

@@ -1,5 +1,5 @@
 @if($row->homepage)
-    <a href='{!! $row->homepage !!}' target='_blank' class="feather icon-chrome"></a>
+    <a href='{!! $row->homepage !!}' target='_blank' class="feather {{ $linkIcon }}"></a>
 @endif
 <span class="ext-name">
     {{ $value }}

+ 1 - 0
src/Console/stubs/extension/routes.stub

@@ -1,5 +1,6 @@
 <?php
 
 use {namespace}\Http\Controllers;
+use Illuminate\Support\Facades\Route;
 
 Route::get('{path}', Controllers\{className}Controller::class.'@index');

+ 2 - 2
src/Extend/Setting.php

@@ -41,7 +41,7 @@ abstract class Setting extends Form implements LazyRenderable
      */
     public function handle(array $input)
     {
-        $this->extension()->config($this->formatConfig($input));
+        $this->extension()->config($this->formatInput($input));
 
         return $this->response()->success(trans('admin.save_succeeded'));
     }
@@ -53,7 +53,7 @@ abstract class Setting extends Form implements LazyRenderable
      *
      * @return array
      */
-    protected function formatConfig(array $input)
+    protected function formatInput(array $input)
     {
         return $input;
     }

+ 13 - 15
src/Form.php

@@ -201,7 +201,7 @@ class Form implements Renderable
     /**
      * @var bool
      */
-    protected $useAjaxSubmit = true;
+    protected $ajax = true;
 
     /**
      * Model of the form.
@@ -263,6 +263,11 @@ class Form implements Renderable
      */
     protected $conditions = [];
 
+    /**
+     * @var array
+     */
+    public $context = [];
+
     /**
      * Create a new form instance.
      *
@@ -422,7 +427,7 @@ class Form implements Renderable
      */
     public function ajax(bool $value = true)
     {
-        $this->useAjaxSubmit = $value;
+        $this->ajax = $value;
 
         return $this;
     }
@@ -432,7 +437,7 @@ class Form implements Renderable
      */
     public function allowAjaxSubmit()
     {
-        return $this->useAjaxSubmit === true;
+        return $this->ajax === true;
     }
 
     /**
@@ -643,24 +648,15 @@ class Form implements Renderable
 
         $this->build();
 
-        //$this->prepareStepFormFields($this->inputs);
-
         if (($response = $this->callSubmitted())) {
             return $response;
         }
-        //
-        //// Validate step form.
-        //if ($this->isStepFormValidationRequest()) {
-        //    return $this->validateStepForm($this->inputs);
-        //}
 
         if ($response = $this->handleUploadFile($this->inputs)) {
             return $response;
         }
 
         if ($response = $this->deleteFileWhenCreating($this->inputs)) {
-            //$this->deleteFileInStepFormStashData($this->inputs);
-
             return $response;
         }
 
@@ -670,8 +666,6 @@ class Form implements Renderable
         }
 
         if (($response = $this->prepare($this->inputs))) {
-            $this->deleteFiles($this->inputs, true);
-
             return $response;
         }
     }
@@ -1581,8 +1575,12 @@ class Form implements Renderable
      *
      * @return array|mixed
      */
-    public function input($key, $value = null)
+    public function input($key = null, $value = null)
     {
+        if (is_null($key)) {
+            return $this->inputs;
+        }
+
         if (is_null($value)) {
             return Arr::get($this->inputs, $key);
         }

+ 24 - 17
src/Form/Builder.php

@@ -7,8 +7,8 @@ use Dcat\Admin\Admin;
 use Dcat\Admin\Contracts\UploadField;
 use Dcat\Admin\Form;
 use Dcat\Admin\Form\Field\Hidden;
-use Dcat\Admin\Form\Step\Builder as StepBuilder;
 use Dcat\Admin\Support\Helper;
+use Dcat\Admin\Traits\HasVariables;
 use Dcat\Admin\Widgets\DialogForm;
 use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Support\Arr;
@@ -21,6 +21,8 @@ use Illuminate\Support\Str;
  */
 class Builder
 {
+    use HasVariables;
+
     /**
      *  上个页面URL保存的key.
      */
@@ -54,7 +56,7 @@ class Builder
     protected $action;
 
     /**
-     * @var Collection
+     * @var Collection|Field[]
      */
     protected $fields;
 
@@ -733,6 +735,20 @@ class Builder
         return $this->footer->render();
     }
 
+    protected function defaultVariables()
+    {
+        return [
+            'form'       => $this,
+            'tabObj'     => $this->form->getTab(),
+            'width'      => $this->width,
+            'elementId'  => $this->getElementId(),
+            'showHeader' => $this->showHeader,
+            'fields'     => $this->fields,
+            'rows'       => $this->rows(),
+            'layout'     => $this->layout(),
+        ];
+    }
+
     /**
      * Render form.
      *
@@ -755,24 +771,13 @@ class Builder
 
         $open = $this->open(['class' => 'form-horizontal']);
 
-        $data = [
-            'form'       => $this,
-            'tabObj'     => $tabObj,
-            'width'      => $this->width,
-            'elementId'  => $this->getElementId(),
-            'showHeader' => $this->showHeader,
-            'fields'     => $this->fields,
-            'rows'       => $this->rows(),
-            'layout'     => $this->layout(),
-        ];
-
         if ($this->layout->hasColumns()) {
-            $content = $this->doWrap(view($this->view, $data));
+            $content = $this->doWrap(view($this->view, $this->variables()));
         } else {
             if (! $this->layout->hasBlocks()) {
                 $this->layout->prepend(
                     12,
-                    $this->doWrap(view($this->view, $data))
+                    $this->doWrap(view($this->view, $this->variables()))
                 );
             }
 
@@ -803,10 +808,12 @@ EOF;
     protected function doWrap(Renderable $view)
     {
         if ($wrapper = $this->wrapper) {
-            return $wrapper($view);
+            return Admin::resolveHtml($wrapper($view))['html'];
         }
 
-        return "<div class='card'>{$view->render()}</div>";
+        $html = Admin::resolveHtml($view->render())['html'];
+
+        return "<div class='card'>{$html}</div>";
     }
 
     /**

+ 8 - 27
src/Form/Field.php

@@ -6,6 +6,7 @@ use Dcat\Admin\Admin;
 use Dcat\Admin\Form;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Traits\HasBuilderEvents;
+use Dcat\Admin\Traits\HasVariables;
 use Dcat\Admin\Widgets\Form as WidgetForm;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Contracts\Support\Renderable;
@@ -19,9 +20,10 @@ use Illuminate\Support\Traits\Macroable;
  */
 class Field implements Renderable
 {
-    use Macroable,
-        Form\Concerns\HasFieldValidator,
-        HasBuilderEvents;
+    use Macroable;
+    use Form\Concerns\HasFieldValidator;
+    use HasBuilderEvents;
+    use HasVariables;
 
     const FILE_DELETE_FLAG = '_file_del_';
 
@@ -95,13 +97,6 @@ class Field implements Renderable
      */
     protected $elementClass = [];
 
-    /**
-     * Variables of elements.
-     *
-     * @var array
-     */
-    protected $variables = [];
-
     /**
      * Options for specify elements.
      *
@@ -1113,20 +1108,6 @@ class Field implements Renderable
         return $this;
     }
 
-    /**
-     * Add variables to field view.
-     *
-     * @param array $variables
-     *
-     * @return $this
-     */
-    protected function addVariables(array $variables = [])
-    {
-        $this->variables = array_merge($this->variables, $variables);
-
-        return $this;
-    }
-
     /**
      * @param array|string $labelClass
      * @param bool         $append
@@ -1183,9 +1164,9 @@ class Field implements Renderable
      *
      * @return array
      */
-    public function variables()
+    public function defaultVariables()
     {
-        return array_merge([
+        return [
             'id'          => $this->id,
             'name'        => $this->getElementName(),
             'help'        => $this->help,
@@ -1201,7 +1182,7 @@ class Field implements Renderable
             'formId'      => $this->getFormElementId(),
             'selector'    => $this->getElementClassSelector(),
             'options'     => $this->options,
-        ], $this->variables);
+        ];
     }
 
     protected function isCreating()

+ 13 - 19
src/Grid.php

@@ -11,6 +11,7 @@ use Dcat\Admin\Grid\Row;
 use Dcat\Admin\Grid\Tools;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Traits\HasBuilderEvents;
+use Dcat\Admin\Traits\HasVariables;
 use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Support\Collection;
@@ -19,6 +20,7 @@ use Illuminate\Support\Traits\Macroable;
 class Grid
 {
     use HasBuilderEvents;
+    use HasVariables;
     use Concerns\HasNames;
     use Concerns\HasFilter;
     use Concerns\HasTools;
@@ -96,13 +98,6 @@ class Grid
      */
     protected $built = false;
 
-    /**
-     * All variables in grid view.
-     *
-     * @var array
-     */
-    protected $variables = [];
-
     /**
      * Resource path of the grid.
      *
@@ -826,7 +821,7 @@ HTML;
      *
      * @return $this
      */
-    public function with($variables = [])
+    public function with(array $variables)
     {
         $this->variables = $variables;
 
@@ -838,27 +833,26 @@ HTML;
      *
      * @return array
      */
-    protected function variables()
+    protected function defaultVariables()
     {
-        $this->variables['grid'] = $this;
-        $this->variables['tableId'] = $this->getTableId();
-
-        return $this->variables;
+        return [
+            'grid'    => $this,
+            'tableId' => $this->getTableId(),
+        ];
     }
 
     /**
      * Set a view to render.
      *
      * @param string $view
-     * @param array  $variables
+     *
+     * @return $this
      */
-    public function view($view, $variables = [])
+    public function view($view)
     {
-        if (! empty($variables)) {
-            $this->with($variables);
-        }
-
         $this->view = $view;
+
+        return $this;
     }
 
     /**

+ 5 - 19
src/Grid/Filter/AbstractFilter.php

@@ -13,6 +13,7 @@ use Dcat\Admin\Grid\Filter\Presenter\Radio;
 use Dcat\Admin\Grid\Filter\Presenter\Select;
 use Dcat\Admin\Grid\Filter\Presenter\Text;
 use Dcat\Admin\Grid\LazyRenderable;
+use Dcat\Admin\Traits\HasVariables;
 use Dcat\Laravel\Database\WhereHasInServiceProvider;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Collection;
@@ -34,6 +35,8 @@ use Illuminate\Support\Collection;
  */
 abstract class AbstractFilter
 {
+    use HasVariables;
+
     /**
      * Element id.
      *
@@ -107,11 +110,6 @@ abstract class AbstractFilter
      */
     protected $ignore = false;
 
-    /**
-     * @var array
-     */
-    protected $variables = [];
-
     /**
      * AbstractFilter constructor.
      *
@@ -584,24 +582,12 @@ abstract class AbstractFilter
         }]];
     }
 
-    /**
-     * @param array $variables
-     *
-     * @return $this
-     */
-    public function addVariables(array $variables)
-    {
-        $this->variables = array_merge($this->variables, $variables);
-
-        return $this;
-    }
-
     /**
      * Variables for filter view.
      *
      * @return array
      */
-    protected function variables()
+    protected function defaultVariables()
     {
         return array_merge([
             'id'        => $this->id,
@@ -610,7 +596,7 @@ abstract class AbstractFilter
             'value'     => $this->value(),
             'width'     => $this->width,
             'style'     => $this->style,
-        ], $this->presenter()->variables(), $this->variables);
+        ], $this->presenter()->variables());
     }
 
     public function value()

+ 2 - 2
src/Grid/Filter/Group.php

@@ -299,13 +299,13 @@ JS;
     /**
      * {@inheritdoc}
      */
-    public function variables()
+    public function defaultVariables()
     {
         $select = request("{$this->id}_group");
 
         $default = $this->group->get($select) ?: $this->group->first();
 
-        return array_merge(parent::variables(), [
+        return array_merge(parent::defaultVariables(), [
             'group_name' => $this->name,
             'default'    => $default,
         ]);

+ 1 - 1
src/Grid/Filter/Presenter/DateTime.php

@@ -40,7 +40,7 @@ class DateTime extends Presenter
         return $options;
     }
 
-    public function variables(): array
+    public function defaultVariables(): array
     {
         return [
             'group'   => $this->filter->group,

+ 3 - 22
src/Grid/Filter/Presenter/Presenter.php

@@ -4,9 +4,12 @@ namespace Dcat\Admin\Grid\Filter\Presenter;
 
 use Dcat\Admin\Admin;
 use Dcat\Admin\Grid\Filter\AbstractFilter;
+use Dcat\Admin\Traits\HasVariables;
 
 abstract class Presenter
 {
+    use HasVariables;
+
     /**
      * @var array
      */
@@ -32,11 +35,6 @@ abstract class Presenter
      */
     protected $width = null;
 
-    /**
-     * @var array
-     */
-    protected $variables = [];
-
     /**
      * Set parent filter.
      *
@@ -113,23 +111,6 @@ abstract class Presenter
         return $value;
     }
 
-    public function addVariables(array $variables)
-    {
-        $this->variables = array_merge($this->variables, $variables);
-
-        return $this;
-    }
-
-    /**
-     * Blade template variables for this presenter.
-     *
-     * @return array
-     */
-    public function variables(): array
-    {
-        return $this->variables;
-    }
-
     /**
      * Collect assets.
      */

+ 1 - 1
src/Grid/Filter/Presenter/Radio.php

@@ -65,7 +65,7 @@ class Radio extends Presenter
     /**
      * @return array
      */
-    public function variables(): array
+    public function defaultVariables(): array
     {
         $this->prepare();
 

+ 3 - 3
src/Grid/Filter/Presenter/Select.php

@@ -248,15 +248,15 @@ class Select extends Presenter
     /**
      * @return array
      */
-    public function variables(): array
+    public function defaultVariables(): array
     {
-        return array_merge([
+        return [
             'options'   => $this->buildOptions(),
             'class'     => $this->getElementClass(),
             'selector'  => $this->getElementClassSelector(),
             'selectAll' => $this->selectAll,
             'configs'   => $this->config,
-        ], $this->variables);
+        ];
     }
 
     public function getElementClassSelector()

+ 1 - 1
src/Grid/Filter/Presenter/SelectTable.php

@@ -164,7 +164,7 @@ JS
     /**
      * @return array
      */
-    public function variables(): array
+    public function defaultVariables(): array
     {
         $this->formatOptions();
         $this->setUpTable();

+ 1 - 1
src/Grid/Filter/Presenter/Text.php

@@ -36,7 +36,7 @@ class Text extends Presenter
      *
      * @return array
      */
-    public function variables(): array
+    public function defaultVariables(): array
     {
         return [
             'placeholder' => $this->placeholder,

+ 2 - 0
src/Http/Displayers/Extensions/Name.php

@@ -7,6 +7,7 @@ use Dcat\Admin\Grid\Displayers\AbstractDisplayer;
 use Dcat\Admin\Http\Actions\Extensions\Disable;
 use Dcat\Admin\Http\Actions\Extensions\Enable;
 use Dcat\Admin\Http\Actions\Extensions\Uninstall;
+use Illuminate\Support\Str;
 
 class Name extends AbstractDisplayer
 {
@@ -18,6 +19,7 @@ class Name extends AbstractDisplayer
             'enableAction'    => $this->resolveAction(Enable::class),
             'disableAction'   => $this->resolveAction(Disable::class),
             'uninstallAction' => $this->resolveAction(Uninstall::class),
+            'linkIcon'        => Str::contains($this->row->homepage, 'github.com') ? 'icon-github' : 'icon-link',
         ]);
     }
 

+ 0 - 4
src/Layout/Asset.php

@@ -157,10 +157,6 @@ class Asset
         '@apex-charts' => [
             'js' => '@admin/dcat/plugins/charts/apexcharts.min.js',
         ],
-        '@smart-wizard' => [
-            'js' => '@admin/dcat/plugins/SmartWizard/dist/js/jquery.smartWizard.min.js',
-            'css' => '@admin/dcat/extra/step.css',
-        ],
         '@fontawesome-iconpicker' => [
             'js' => '@admin/dcat/plugins/fontawesome-iconpicker/dist/js/fontawesome-iconpicker.js',
             'css' => '@admin/dcat/plugins/fontawesome-iconpicker/dist/css/fontawesome-iconpicker.min.css',

+ 1 - 6
src/Show.php

@@ -233,16 +233,11 @@ class Show implements Renderable
      * Set a view to render.
      *
      * @param string $view
-     * @param array  $variables
      *
      * @return $this
      */
-    public function view($view, $variables = [])
+    public function view($view)
     {
-        if (! empty($variables)) {
-            $this->with($variables);
-        }
-
         $this->panel->view($view);
 
         return $this;

+ 6 - 4
src/Show/Field.php

@@ -8,6 +8,7 @@ use Dcat\Admin\Show;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Traits\HasBuilderEvents;
 use Dcat\Admin\Traits\HasDefinitions;
+use Dcat\Admin\Traits\HasVariables;
 use Dcat\Admin\Widgets\Dump;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Contracts\Support\Renderable;
@@ -20,9 +21,10 @@ use Illuminate\Support\Traits\Macroable;
 
 class Field implements Renderable
 {
-    use HasBuilderEvents,
-        HasDefinitions,
-        Macroable {
+    use HasBuilderEvents;
+    use HasVariables;
+    use HasDefinitions;
+    use Macroable {
             __call as macroCall;
         }
 
@@ -659,7 +661,7 @@ HTML;
      *
      * @return array
      */
-    protected function variables()
+    protected function defaultVariables()
     {
         return [
             'content' => $this->value,

+ 13 - 17
src/Show/Panel.php

@@ -3,11 +3,14 @@
 namespace Dcat\Admin\Show;
 
 use Dcat\Admin\Show;
+use Dcat\Admin\Traits\HasVariables;
 use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Support\Collection;
 
 class Panel implements Renderable
 {
+    use HasVariables;
+
     /**
      * The view to be rendered.
      *
@@ -22,13 +25,6 @@ class Panel implements Renderable
      */
     protected $fields;
 
-    /**
-     * Variables in the view.
-     *
-     * @var array
-     */
-    protected $data;
-
     /**
      * Parent show instance.
      *
@@ -48,15 +44,15 @@ class Panel implements Renderable
     {
         $this->parent = $show;
 
-        $this->initData();
+        $this->initVariables();
     }
 
     /**
      * Initialize view data.
      */
-    protected function initData()
+    protected function initVariables()
     {
-        $this->data = [
+        $this->variables = [
             'fields' => new Collection(),
             'tools'  => new Tools($this),
             'rows'   => $this->parent->rows(),
@@ -99,7 +95,7 @@ class Panel implements Renderable
      */
     public function style($style = 'info')
     {
-        $this->data['style'] = $style;
+        $this->variables['style'] = $style;
 
         return $this;
     }
@@ -113,7 +109,7 @@ class Panel implements Renderable
      */
     public function title($title)
     {
-        $this->data['title'] = $title;
+        $this->variables['title'] = $title;
 
         return $this;
     }
@@ -141,7 +137,7 @@ class Panel implements Renderable
      */
     public function with(array $variables = [])
     {
-        $this->data = array_merge($this->data, $variables);
+        $this->variables = array_merge($this->variables, $variables);
 
         return $this;
     }
@@ -174,10 +170,10 @@ class Panel implements Renderable
     public function tools($callable = null)
     {
         if ($callable === null) {
-            return $this->data['tools'];
+            return $this->variables['tools'];
         }
 
-        call_user_func($callable, $this->data['tools']);
+        call_user_func($callable, $this->variables['tools']);
     }
 
     /**
@@ -189,7 +185,7 @@ class Panel implements Renderable
      */
     public function fill($fields)
     {
-        $this->data['fields'] = $fields;
+        $this->variables['fields'] = $fields;
 
         return $this;
     }
@@ -209,7 +205,7 @@ class Panel implements Renderable
      */
     protected function doWrap()
     {
-        $view = view($this->view, $this->data);
+        $view = view($this->view, $this->variables());
 
         if (! $wrapper = $this->wrapper) {
             return "<div class='card dcat-box'>{$view->render()}</div>";

+ 39 - 0
src/Traits/HasVariables.php

@@ -0,0 +1,39 @@
+<?php
+
+namespace Dcat\Admin\Traits;
+
+/**
+ * @method array defaultVariables()
+ */
+trait HasVariables
+{
+    protected $variables = [];
+
+    /**
+     * 获取所有变量.
+     *
+     * @return array
+     */
+    public function variables()
+    {
+        if (! method_exists($this, 'defaultVariables')) {
+            return $this->variables;
+        }
+
+        return array_merge($this->defaultVariables(), $this->variables);
+    }
+
+    /**
+     * 设置变量.
+     *
+     * @param array $variables
+     *
+     * @return $this
+     */
+    public function addVariables(array $variables = [])
+    {
+        $this->variables = array_merge($this->variables, $variables);
+
+        return $this;
+    }
+}

+ 27 - 7
src/Tree.php

@@ -7,6 +7,7 @@ use Dcat\Admin\Contracts\TreeRepository;
 use Dcat\Admin\Exception\InvalidArgumentException;
 use Dcat\Admin\Repositories\EloquentRepository;
 use Dcat\Admin\Traits\HasBuilderEvents;
+use Dcat\Admin\Traits\HasVariables;
 use Dcat\Admin\Tree\AbstractTool;
 use Dcat\Admin\Tree\Tools;
 use Illuminate\Contracts\Support\Htmlable;
@@ -19,6 +20,7 @@ use Illuminate\Support\Traits\Macroable;
 class Tree implements Renderable
 {
     use HasBuilderEvents;
+    use HasVariables;
     use Macroable;
 
     /**
@@ -46,10 +48,12 @@ class Tree implements Renderable
      *
      * @var string
      */
-    protected $view = [
-        'tree'   => 'admin::tree.container',
-        'branch' => 'admin::tree.branch',
-    ];
+    protected $view = 'admin::tree.container';
+
+    /**
+     * @var string
+     */
+    protected $branchView = 'admin::tree.branch';
 
     /**
      * @var \Closure
@@ -408,10 +412,26 @@ JS;
      * Set view of tree.
      *
      * @param string $view
+     *
+     * @return $this
      */
     public function view($view)
     {
         $this->view = $view;
+
+        return $this;
+    }
+
+    /**
+     * @param string $view
+     *
+     * @return $this
+     */
+    public function branchView($view)
+    {
+        $this->branchView = $view;
+
+        return $this;
     }
 
     /**
@@ -429,7 +449,7 @@ JS;
      *
      * @return array
      */
-    public function variables()
+    public function defaultVariables()
     {
         return [
             'id'             => $this->elementId,
@@ -551,7 +571,7 @@ JS;
             view()->share([
                 'currentUrl'     => $this->url,
                 'keyName'        => $this->repository->getKeyName(),
-                'branchView'     => $this->view['branch'],
+                'branchView'     => $this->branchView,
                 'branchCallback' => $this->branchCallback,
             ]);
 
@@ -566,7 +586,7 @@ JS;
      */
     protected function doWrap()
     {
-        $view = view($this->view['tree'], $this->variables());
+        $view = view($this->view, $this->variables());
 
         if (! $wrapper = $this->wrapper) {
             return "<div class='card'>{$view->render()}</div>";

+ 1 - 1
src/Widgets/Alert.php

@@ -140,7 +140,7 @@ class Alert extends Widget
     /**
      * @return array
      */
-    public function variables()
+    public function defaultVariables()
     {
         $this->class("alert alert-{$this->style} alert-dismissable");
 

+ 1 - 1
src/Widgets/Box.php

@@ -141,7 +141,7 @@ class Box extends Widget
      *
      * @return array
      */
-    public function variables()
+    public function defaultVariables()
     {
         return [
             'title'      => $this->title,

+ 1 - 1
src/Widgets/Callout.php

@@ -138,7 +138,7 @@ class Callout extends Widget
     /**
      * @return array
      */
-    public function variables()
+    public function defaultVariables()
     {
         $this->class("callout callout-{$this->style} alert alert-dismissable");
 

+ 1 - 1
src/Widgets/Card.php

@@ -113,7 +113,7 @@ class Card extends Widget
     /**
      * {@inheritdoc}
      */
-    public function variables()
+    public function defaultVariables()
     {
         return [
             'title'      => $this->title,

+ 1 - 1
src/Widgets/DialogTable.php

@@ -185,7 +185,7 @@ class DialogTable extends Widget
 
     public function render()
     {
-        $this->with([
+        $this->addVariables([
             'id'     => $this->id(),
             'title'  => $this->title,
             'width'  => $this->width,

+ 1 - 1
src/Widgets/Dropdown.php

@@ -221,7 +221,7 @@ class Dropdown extends Widget
      */
     public function render()
     {
-        $this->with([
+        $this->addVariables([
             'options'  => $this->renderOptions(),
             'button'   => $this->button,
             'buttonId' => $this->buttonId,

+ 4 - 4
src/Widgets/Form.php

@@ -126,7 +126,7 @@ class Form implements Renderable
     /**
      * @var bool
      */
-    protected $useAjaxSubmit = true;
+    protected $ajax = true;
 
     /**
      * @var Fluent
@@ -595,7 +595,7 @@ class Form implements Renderable
             'rows'      => $this->rows(),
             'layout'    => $this->layout(),
             'elementId' => $this->getElementId(),
-            'ajax'      => $this->useAjaxSubmit,
+            'ajax'      => $this->ajax,
             'footer'    => $this->renderFooter(),
         ], $this->variables);
     }
@@ -746,7 +746,7 @@ HTML;
      */
     public function ajax(bool $value = true)
     {
-        $this->useAjaxSubmit = $value;
+        $this->ajax = $value;
 
         return $this;
     }
@@ -756,7 +756,7 @@ HTML;
      */
     public function allowAjaxSubmit()
     {
-        return $this->useAjaxSubmit === true;
+        return $this->ajax === true;
     }
 
     /**

+ 4 - 6
src/Widgets/Markdown.php

@@ -32,6 +32,8 @@ class Markdown extends Widget
     public function __construct($markdown = '')
     {
         $this->content($markdown);
+
+        $this->id('mkd-'.Str::random(8));
     }
 
     /**
@@ -53,12 +55,8 @@ class Markdown extends Widget
 
     public function render()
     {
-        $id = 'mkd-'.Str::random(8);
-
-        $this->defaultHtmlAttribute('id', $id);
-
-        $this->with([
-            'id'      => $id,
+        $this->addVariables([
+            'id'      => $this->id(),
             'content' => $this->renderContent(),
         ]);
 

+ 1 - 1
src/Widgets/Radio.php

@@ -175,7 +175,7 @@ class Radio extends Widget
     /**
      * @return array
      */
-    public function variables()
+    public function defaultVariables()
     {
         return [
             'style'      => $this->style,

+ 5 - 27
src/Widgets/Widget.php

@@ -8,6 +8,7 @@ use Dcat\Admin\Grid\LazyRenderable as LazyGrid;
 use Dcat\Admin\Layout\Content;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Traits\HasHtmlAttributes;
+use Dcat\Admin\Traits\HasVariables;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Support\Arr;
@@ -20,6 +21,7 @@ use Illuminate\Support\Arr;
 abstract class Widget implements Renderable
 {
     use HasHtmlAttributes;
+    use HasVariables;
 
     /**
      * @var array
@@ -41,11 +43,6 @@ abstract class Widget implements Renderable
      */
     protected $script = '';
 
-    /**
-     * @var array
-     */
-    protected $variables = [];
-
     /**
      * @var array
      */
@@ -118,31 +115,12 @@ abstract class Widget implements Renderable
      *
      * @return array
      */
-    public function variables()
+    public function defaultVariables()
     {
-        return array_merge([
+        return [
             'attributes' => $this->formatHtmlAttributes(),
             'options'    => $this->options,
-        ], $this->variables);
-    }
-
-    /**
-     * 设置视图变量.
-     *
-     * @param string|array $key
-     * @param mixed        $value
-     *
-     * @return $this
-     */
-    public function with($key, $value = null)
-    {
-        if (is_array($key)) {
-            $this->variables = array_merge($this->variables, $key);
-        } else {
-            $this->variables[$key] = $value;
-        }
-
-        return $this;
+        ];
     }
 
     /**

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.