From 9ff862909b36c1888f3b7a726a7aaddf4d89db60 Mon Sep 17 00:00:00 2001 From: Ievgenii Gardysh Date: Thu, 15 Jul 2021 20:06:17 +0300 Subject: [PATCH 1/4] Added CSS file to get ability to add styles --- resources/css/card.css | 3 +++ webpack.mix.js | 1 + 2 files changed, 4 insertions(+) create mode 100644 resources/css/card.css diff --git a/resources/css/card.css b/resources/css/card.css new file mode 100644 index 0000000..d5af7b0 --- /dev/null +++ b/resources/css/card.css @@ -0,0 +1,3 @@ +.card-panel { + height: auto; +} diff --git a/webpack.mix.js b/webpack.mix.js index 48ba617..c939732 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -2,3 +2,4 @@ let mix = require('laravel-mix') mix.setPublicPath('dist') .js('resources/js/card.js', 'js') + .postCss('resources/css/card.css', 'css') From e78183bed4617e9c0b4794278f2c8a1d38dc6d3d Mon Sep 17 00:00:00 2001 From: Ievgenii Gardysh Date: Thu, 15 Jul 2021 20:07:00 +0300 Subject: [PATCH 2/4] Connected styles file in FilterCardServiceProvider --- src/FilterCardServiceProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FilterCardServiceProvider.php b/src/FilterCardServiceProvider.php index 7472a12..0209240 100644 --- a/src/FilterCardServiceProvider.php +++ b/src/FilterCardServiceProvider.php @@ -18,6 +18,7 @@ public function boot() { Event::listen(ServingNova::class, function () { Nova::script('awesome-nova-filter-card', dirname(__DIR__) . '/dist/js/card.js'); + Nova::style('awesome-nova-filter-card', dirname(__DIR__) . '/dist/css/card.css'); }); } } From 6e1d3533cb5ffdfd8799c8de8956afb3011b98a1 Mon Sep 17 00:00:00 2001 From: Ievgenii Gardysh Date: Thu, 15 Jul 2021 20:07:57 +0300 Subject: [PATCH 3/4] Added ability to show filterCard as select --- resources/js/components/Card.vue | 58 +++++++++++++++++++++++++------- src/Cards/FilterCard.php | 14 ++++++++ 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/resources/js/components/Card.vue b/resources/js/components/Card.vue index d74e2e8..23b2292 100644 --- a/resources/js/components/Card.vue +++ b/resources/js/components/Card.vue @@ -1,14 +1,38 @@ diff --git a/src/Cards/FilterCard.php b/src/Cards/FilterCard.php index 45cb667..b033a66 100644 --- a/src/Cards/FilterCard.php +++ b/src/Cards/FilterCard.php @@ -28,4 +28,18 @@ public function __construct($filter) $this->withMeta(['filter' => $filter]); } + + public function showAsSelect($show_as_select = true) + { + $this->withMeta(['show_as_select' => $show_as_select]); + + return $this; + } + + public function hideSelectHeading($hide_select_heading = true) + { + $this->withMeta(['hide_select_heading' => $hide_select_heading]); + + return $this; + } } From a2bf911173fad61d4227a3e4d805cc939c1654e1 Mon Sep 17 00:00:00 2001 From: Ievgenii Gardysh Date: Thu, 15 Jul 2021 20:08:27 +0300 Subject: [PATCH 4/4] Added compiled files to dist --- dist/css/card.css | 1 + dist/js/card.js | 2 +- dist/mix-manifest.json | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 dist/css/card.css diff --git a/dist/css/card.css b/dist/css/card.css new file mode 100644 index 0000000..67fe808 --- /dev/null +++ b/dist/css/card.css @@ -0,0 +1 @@ +.card-panel{height:auto} \ No newline at end of file diff --git a/dist/js/card.js b/dist/js/card.js index 28ed198..ea80c95 100644 --- a/dist/js/card.js +++ b/dist/js/card.js @@ -1 +1 @@ -!function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=21)}([function(t,r){var e=Array.isArray;t.exports=e},function(t,r,e){var n=e(11),o=e(36),i=e(37),u="[object Null]",c="[object Undefined]",a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?c:u:a&&a in Object(t)?o(t):i(t)}},function(t,r,e){var n=e(15),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,r){t.exports=function(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}},function(t,r,e){var n=e(14),o=e(16);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},function(t,r){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,r,e){var n=e(10)(Object,"create");t.exports=n},function(t,r,e){var n=e(12);t.exports=function(t,r){for(var e=t.length;e--;)if(n(t[e][0],r))return e;return-1}},function(t,r,e){var n=e(92);t.exports=function(t,r){var e=t.__data__;return n(r)?e["string"==typeof r?"string":"hash"]:e.map}},function(t,r){t.exports=function(t){return t}},function(t,r,e){var n=e(34),o=e(41);t.exports=function(t,r){var e=o(t,r);return n(e)?e:void 0}},function(t,r,e){var n=e(2).Symbol;t.exports=n},function(t,r){t.exports=function(t,r){return t===r||t!=t&&r!=r}},function(t,r,e){var n=e(1),o=e(5),i="[object Symbol]";t.exports=function(t){return"symbol"==typeof t||o(t)&&n(t)==i}},function(t,r,e){var n=e(1),o=e(3),i="[object AsyncFunction]",u="[object Function]",c="[object GeneratorFunction]",a="[object Proxy]";t.exports=function(t){if(!o(t))return!1;var r=n(t);return r==u||r==c||r==i||r==a}},function(t,r,e){(function(r){var e="object"==typeof r&&r&&r.Object===Object&&r;t.exports=e}).call(r,e(35))},function(t,r){var e=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=e}},function(t,r){var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var o=typeof t;return!!(r=null==r?e:r)&&("number"==o||"symbol"!=o&&n.test(t))&&t>-1&&t%1==0&&t2?r[2]:void 0;for(s&&i(r[0],r[1],s)&&(n=1);++e0){if(++r>=e)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},function(t,r,e){var n=e(12),o=e(4),i=e(17),u=e(3);t.exports=function(t,r,e){if(!u(e))return!1;var c=typeof r;return!!("number"==c?o(e)&&i(r,e.length):"string"==c&&r in e)&&n(e[r],t)}},function(t,r,e){var n=e(18),o=e(54),i=e(4);t.exports=function(t){return i(t)?n(t,!0):o(t)}},function(t,r){t.exports=function(t,r){for(var e=-1,n=Array(t);++e-1}},function(t,r,e){var n=e(7);t.exports=function(t,r){var e=this.__data__,o=n(e,t);return o<0?(++this.size,e.push([t,r])):e[o][1]=r,this}},function(t,r,e){var n=e(10)(e(2),"Map");t.exports=n},function(t,r,e){var n=e(8);t.exports=function(t){var r=n(this,t).delete(t);return this.size-=r?1:0,r}},function(t,r){t.exports=function(t){var r=typeof t;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}},function(t,r,e){var n=e(8);t.exports=function(t){return n(this,t).get(t)}},function(t,r,e){var n=e(8);t.exports=function(t){return n(this,t).has(t)}},function(t,r,e){var n=e(8);t.exports=function(t,r){var e=n(this,t),o=e.size;return e.set(t,r),this.size+=e.size==o?0:1,this}},function(t,r,e){var n=e(97);t.exports=function(t){return null==t?"":n(t)}},function(t,r,e){var n=e(11),o=e(98),i=e(0),u=e(13),c=1/0,a=n?n.prototype:void 0,s=a?a.toString:void 0;t.exports=function t(r){if("string"==typeof r)return r;if(i(r))return o(r,t)+"";if(u(r))return s?s.call(r):"";var e=r+"";return"0"==e&&1/r==-c?"-0":e}},function(t,r){t.exports=function(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++e-1&&t%1==0&&t<=r}},function(t,e){var r=9007199254740991,n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var o=typeof t;return!!(e=null==e?r:e)&&("number"==o||"symbol"!=o&&n.test(t))&&t>-1&&t%1==0&&t{if("NavigationDuplicated"!=t.name)throw t})}}},c={methods:{async clearSelectedFilters(t){t?await this.$store.dispatch(`${this.resourceName}/resetFilterState`,{resourceName:this.resourceName,lens:t}):await this.$store.dispatch(`${this.resourceName}/resetFilterState`,{resourceName:this.resourceName}),this.updateQueryString({[this.pageParameter]:1,[this.filterParameter]:""})},filterChanged(){this.updateQueryString({[this.pageParameter]:1,[this.filterParameter]:this.$store.getters[`${this.resourceName}/currentEncodedFilters`]})},async initializeFilters(t){this.$store.commit(`${this.resourceName}/clearFilters`),await this.$store.dispatch(`${this.resourceName}/fetchFilters`,{resourceName:this.resourceName,viaResource:this.viaResource,viaResourceId:this.viaResourceId,viaRelationship:this.viaRelationship,lens:t}),await this.initializeState(t)},async initializeState(t){this.initialEncodedFilters?await this.$store.dispatch(`${this.resourceName}/initializeCurrentFilterValuesFromQueryString`,this.initialEncodedFilters):await this.$store.dispatch(`${this.resourceName}/resetFilterState`,{resourceName:this.resourceName,lens:t})}},computed:{filterParameter(){return this.resourceName+"_filter"}}};e.default={mixins:[i,c],props:{card:{required:!0},resourceName:{type:String,required:!0}},data:function(){return{filterKey:null}},created:function(){this.filterKey=this.card.filter},methods:{handleChange:function(t){var e=this.showAsSelect?t.target.value:t.value;this.$store.commit(this.resourceName+"/updateFilterState",{filterClass:this.filterKey,value:e}),this.filterChanged()},isActive:function(t){return String(this.value)==String(t.value)}},computed:{filter:function(){return this.$store.getters[this.resourceName+"/getFilter"](this.filterKey)},value:function(){return this.filter.currentValue},pageParameter:function(){return this.resourceName+"_page"},showAsSelect:function(){return this.card.show_as_select||!1},hideSelectHeading:function(){return this.card.hide_select_heading||!1}}}},function(t,e,r){var n=r(19),o=r(8),i=r(36),c=r(37),a=Object.prototype,u=a.hasOwnProperty,s=n(function(t,e){t=Object(t);var r=-1,n=e.length,s=n>2?e[2]:void 0;for(s&&i(e[0],e[1],s)&&(n=1);++r0){if(++e>=r)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,r){var n=r(8),o=r(9),i=r(11),c=r(0);t.exports=function(t,e,r){if(!c(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},function(t,e,r){var n=r(38),o=r(49),i=r(9);t.exports=function(t){return i(t)?n(t,!0):o(t)}},function(t,e,r){var n=r(39),o=r(40),i=r(42),c=r(43),a=r(11),u=r(45),s=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),l=!r&&o(t),f=!r&&!l&&c(t),p=!r&&!l&&!f&&u(t),h=r||l||f||p,d=h?n(t.length,String):[],v=d.length;for(var y in t)!e&&!s.call(t,y)||h&&("length"==y||f&&("offset"==y||"parent"==y)||p&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||a(y,v))||d.push(y);return d}},function(t,e){t.exports=function(t,e){for(var r=-1,n=Array(t);++r