0?(this.pointer--,this.$refs.list.scrollTop>=this.pointerPosition&&(this.$refs.list.scrollTop=this.pointerPosition),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerBackward()):this.filteredOptions[this.pointer]&&this.filteredOptions[0].$isLabel&&!this.groupSelect&&this.pointerForward(),this.pointerDirty=!0},pointerReset:function(){this.closeOnSelect&&(this.pointer=0,this.$refs.list&&(this.$refs.list.scrollTop=0))},pointerAdjust:function(){this.pointer>=this.filteredOptions.length-1&&(this.pointer=this.filteredOptions.length?this.filteredOptions.length-1:0),this.filteredOptions.length>0&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()},pointerSet:function(t){this.pointer=t,this.pointerDirty=!0}}}},function(t,e,n){"use strict";var r=n(36),i=n(74),o=n(15),a=n(18);t.exports=n(72)(Array,"Array",(function(t,e){this._t=a(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e,n){"use strict";var r=n(31),i=(n.n(r),n(32)),o=n(33);e.a={name:"vue-multiselect",mixins:[i.a,o.a],props:{name:{type:String,default:""},selectLabel:{type:String,default:"Press enter to select"},selectGroupLabel:{type:String,default:"Press enter to select group"},selectedLabel:{type:String,default:"Selected"},deselectLabel:{type:String,default:"Press enter to remove"},deselectGroupLabel:{type:String,default:"Press enter to deselect group"},showLabels:{type:Boolean,default:!0},limit:{type:Number,default:99999},maxHeight:{type:Number,default:300},limitText:{type:Function,default:function(t){return"and ".concat(t," more")}},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},openDirection:{type:String,default:""},showNoOptions:{type:Boolean,default:!0},showNoResults:{type:Boolean,default:!0},tabindex:{type:Number,default:0}},computed:{isSingleLabelVisible:function(){return(this.singleValue||0===this.singleValue)&&(!this.isOpen||!this.searchable)&&!this.visibleValues.length},isPlaceholderVisible:function(){return!(this.internalValue.length||this.searchable&&this.isOpen)},visibleValues:function(){return this.multiple?this.internalValue.slice(0,this.limit):[]},singleValue:function(){return this.internalValue[0]},deselectLabelText:function(){return this.showLabels?this.deselectLabel:""},deselectGroupLabelText:function(){return this.showLabels?this.deselectGroupLabel:""},selectLabelText:function(){return this.showLabels?this.selectLabel:""},selectGroupLabelText:function(){return this.showLabels?this.selectGroupLabel:""},selectedLabelText:function(){return this.showLabels?this.selectedLabel:""},inputStyle:function(){if(this.searchable||this.multiple&&this.value&&this.value.length)return this.isOpen?{width:"100%"}:{width:"0",position:"absolute",padding:"0"}},contentStyle:function(){return this.options.length?{display:"inline-block"}:{display:"block"}},isAbove:function(){return"above"===this.openDirection||"top"===this.openDirection||"below"!==this.openDirection&&"bottom"!==this.openDirection&&"above"===this.preferredOpenDirection},showSearchInput:function(){return this.searchable&&(!this.hasSingleSelectedSlot||!this.visibleSingleValue&&0!==this.visibleSingleValue||this.isOpen)}}}},function(t,e,n){var r=n(1)("unscopables"),i=Array.prototype;null==i[r]&&n(8)(i,r,{}),t.exports=function(t){i[r][t]=!0}},function(t,e,n){var r=n(18),i=n(19),o=n(85);t.exports=function(t){return function(e,n,a){var s,c=r(e),l=i(c.length),u=o(a,l);if(t&&n!=n){for(;l>u;)if((s=c[u++])!=s)return!0}else for(;l>u;u++)if((t||u in c)&&c[u]===n)return t||u||0;return!t&&-1}}},function(t,e,n){var r=n(9),i=n(1)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){"use strict";var r=n(2);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,n){var r=n(0).document;t.exports=r&&r.documentElement},function(t,e,n){t.exports=!n(4)&&!n(7)((function(){return 7!=Object.defineProperty(n(21)("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(9);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){"use strict";function r(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=i(e),this.reject=i(n)}var i=n(14);t.exports.f=function(t){return new r(t)}},function(t,e,n){var r=n(2),i=n(76),o=n(22),a=n(27)("IE_PROTO"),s=function(){},c=function(){var t,e=n(21)("iframe"),r=o.length;for(e.style.display="none",n(40).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("
diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php
index 90652ea95..5030db55f 100644
--- a/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php
+++ b/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php
@@ -17,13 +17,26 @@
$columnIndex = explode('.', $column['index']);
$columnIndex = end($columnIndex);
+
+ $supportedClosureKey = ['wrapper', 'closure'];
+
+ $isClosure = ! empty(array_intersect($supportedClosureKey, array_keys($column)));
@endphp
- @if (isset($column['wrapper']))
- @if (isset($column['closure']) && $column['closure'] == true)
- | {!! $column['wrapper']($record) !!} |
- @else
- {{ $column['wrapper']($record) }} |
+ @if ($isClosure)
+ {{--
+ Depereciation Notice:
+ The following key i.e. `wrapper` will remove in the later version. Use only `closure`
+ key to manipulate the column. This will only hit the raw html.
+ --}}
+ @if (isset($column['wrapper']) && gettype($column['wrapper']) === 'object' && $column['wrapper'] instanceof \Closure)
+ @if (isset($column['closure']) && $column['closure'] == true)
+ {!! $column['wrapper']($record) !!} |
+ @else
+ {{ $column['wrapper']($record) }} |
+ @endif
+ @elseif (isset($column['closure']) && gettype($column['closure']) === 'object' && $column['closure'] instanceof \Closure)
+ {!! $column['closure']($record) !!} |
@endif
@else
@if ($column['type'] == 'price')
diff --git a/packages/Webkul/Velocity/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Velocity/src/DataGrids/CategoryDataGrid.php
index 11eff242b..fa52c4956 100644
--- a/packages/Webkul/Velocity/src/DataGrids/CategoryDataGrid.php
+++ b/packages/Webkul/Velocity/src/DataGrids/CategoryDataGrid.php
@@ -7,10 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
class CategoryDataGrid extends DataGrid
{
+ /**
+ * Index.
+ *
+ * @var string
+ */
protected $index = 'category_menu_id';
+ /**
+ * Sort order.
+ *
+ * @var string
+ */
protected $sortOrder = 'desc';
+ /**
+ * Prepare query builder.
+ *
+ * @return void
+ */
public function prepareQueryBuilder()
{
$defaultChannel = core()->getCurrentChannel();
@@ -18,18 +33,21 @@ class CategoryDataGrid extends DataGrid
$queryBuilder = DB::table('velocity_category as v_cat')
->select('v_cat.id as category_menu_id', 'v_cat.category_id', 'ct.name', 'v_cat.icon', 'v_cat.tooltip', 'v_cat.status')
->leftJoin('categories as c', 'c.id', '=', 'v_cat.category_id')
- ->leftJoin('category_translations as ct', function($leftJoin) {
+ ->leftJoin('category_translations as ct', function ($leftJoin) {
$leftJoin->on('c.id', '=', 'ct.category_id')
- ->where('ct.locale', app()->getLocale());
+ ->where('ct.locale', app()->getLocale());
})
->where('c.parent_id', $defaultChannel->root_category_id)
->groupBy('v_cat.id');
- // $this->addFilter('content_id', 'con.id');
-
$this->setQueryBuilder($queryBuilder);
}
+ /**
+ * Add columns.
+ *
+ * @return void
+ */
public function addColumns()
{
$this->addColumn([
@@ -57,9 +75,8 @@ class CategoryDataGrid extends DataGrid
'sortable' => true,
'searchable' => true,
'filterable' => true,
- 'closure' => true,
- 'wrapper' => function ($row) {
- return '';
+ 'closure' => function ($row) {
+ return '';
},
]);
@@ -70,9 +87,8 @@ class CategoryDataGrid extends DataGrid
'sortable' => true,
'searchable' => true,
'filterable' => true,
- 'closure' => true,
- 'wrapper' => function($row) {
- if ( $row->status ) {
+ 'closure' => function ($row) {
+ if ($row->status) {
return 'Enabled';
} else {
return 'Disabled';
@@ -81,7 +97,13 @@ class CategoryDataGrid extends DataGrid
]);
}
- public function prepareActions() {
+ /**
+ * Prepare actions.
+ *
+ * @return void
+ */
+ public function prepareActions()
+ {
$this->addAction([
'title' => trans('ui::app.datagrid.edit'),
'type' => 'Edit',
@@ -100,6 +122,11 @@ class CategoryDataGrid extends DataGrid
]);
}
+ /**
+ * Prepare mass actions.
+ *
+ * @return void
+ */
public function prepareMassActions()
{
$this->addMassAction([
diff --git a/packages/Webkul/Velocity/src/DataGrids/ContentDataGrid.php b/packages/Webkul/Velocity/src/DataGrids/ContentDataGrid.php
index 851191d35..9706a32c0 100644
--- a/packages/Webkul/Velocity/src/DataGrids/ContentDataGrid.php
+++ b/packages/Webkul/Velocity/src/DataGrids/ContentDataGrid.php
@@ -7,17 +7,32 @@ use Webkul\Ui\DataGrid\DataGrid;
class ContentDataGrid extends DataGrid
{
- protected $index = 'content_id'; //the column that needs to be treated as index column
+ /**
+ * Index.
+ *
+ * @var string
+ */
+ protected $index = 'content_id';
- protected $sortOrder = 'desc'; //asc or desc
+ /**
+ * Sort order.
+ *
+ * @var string
+ */
+ protected $sortOrder = 'desc';
+ /**
+ * Prepare query builder.
+ *
+ * @return void
+ */
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('velocity_contents as con')
->select('con.id as content_id', 'con_trans.title', 'con.position', 'con.content_type', 'con.status')
- ->leftJoin('velocity_contents_translations as con_trans', function($leftJoin) {
+ ->leftJoin('velocity_contents_translations as con_trans', function ($leftJoin) {
$leftJoin->on('con.id', '=', 'con_trans.content_id')
- ->where('con_trans.locale', app()->getLocale());
+ ->where('con_trans.locale', app()->getLocale());
})
->groupBy('con.id');
@@ -27,6 +42,11 @@ class ContentDataGrid extends DataGrid
$this->setQueryBuilder($queryBuilder);
}
+ /**
+ * Add columns.
+ *
+ * @return void
+ */
public function addColumns()
{
$this->addColumn([
@@ -63,7 +83,7 @@ class ContentDataGrid extends DataGrid
'sortable' => true,
'searchable' => false,
'filterable' => true,
- 'wrapper' => function($value) {
+ 'closure' => function ($value) {
if ($value->status == 1) {
return 'Active';
} else {
@@ -79,7 +99,7 @@ class ContentDataGrid extends DataGrid
'sortable' => true,
'searchable' => true,
'filterable' => false,
- 'wrapper' => function($value) {
+ 'closure' => function ($value) {
if ($value->content_type == 'category') {
return 'Category Slug';
} elseif ($value->content_type == 'link') {
@@ -93,7 +113,13 @@ class ContentDataGrid extends DataGrid
]);
}
- public function prepareActions() {
+ /**
+ * Prepare actions.
+ *
+ * @return void
+ */
+ public function prepareActions()
+ {
$this->addAction([
'title' => trans('ui::app.datagrid.edit'),
'type' => 'Edit',
@@ -112,6 +138,11 @@ class ContentDataGrid extends DataGrid
]);
}
+ /**
+ * Prepare mass actions.
+ *
+ * @return void
+ */
public function prepareMassActions()
{
$this->addMassAction([