diff --git a/dist/css/filter.css b/dist/css/filter.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/dist/css/filter.css @@ -0,0 +1 @@ + diff --git a/dist/js/filter.js b/dist/js/filter.js index 6e99930..bc1f192 100644 --- a/dist/js/filter.js +++ b/dist/js/filter.js @@ -1 +1 @@ -(()=>{var e={744:(e,t)=>{"use strict";t.Z=(e,t)=>{const r=e.__vccOpts||e;for(const[e,n]of t)r[e]=n;return r}},548:(e,t,r)=>{"use strict";r.d(t,{Z:()=>b});const n=Vue;var o={class:"pt-2 pb-3"},i={class:"px-3 text-xs uppercase font-bold tracking-wide"},a={class:"mt-1 px-3"},c={key:0,class:"flex items-center"},l={key:0,class:"mr-3"},s=["src"],u={class:"flex items-center"},f={key:0,class:"mr-3"},d=["src"];var v=r(751);const h={data:function(){return{search:"",selectedResource:null,selectedResourceId:null,availableResources:[]}},methods:{selectResource:function(e){this.selectedResource=e,this.selectedResourceId=e.value,this.field&&("function"==typeof this.emitFieldValueChange?this.emitFieldValueChange(this.fieldAttribute,this.selectedResourceId):Nova.$emit(this.fieldAttribute+"-change",this.selectedResourceId))},handleSearchCleared:function(){this.availableResources=[]},clearSelection:function(){this.selectedResource=null,this.selectedResourceId=null,this.availableResources=[],this.field&&("function"==typeof this.emitFieldValueChange?this.emitFieldValueChange(this.fieldAttribute,null):Nova.$emit(this.fieldAttribute+"-change",null))},performSearch:function(e){var t=this;this.search=e;var r=e.trim();""!=r&&this.searchDebouncer((function(){t.getAvailableResources(r)}),500)},searchDebouncer:r.n(v)()((function(e){return e()}),500)}},p=function(e,t,r){return Nova.request().get("/nova-api/".concat(e,"/associatable/").concat(t),r)},m={mixins:[h],props:{resourceName:{type:String,required:!0},filterKey:{type:String,required:!0}},methods:{getAvailableResources:function(){var e=this;return p(this.resourceName,this.fieldAttribute,{params:{search:this.search}}).then((function(t){var r=t.data.resources;e.availableResources=r}))},handleChange:function(e){this.$store.commit("".concat(this.resourceName,"/updateFilterState"),{filterClass:this.filterKey,value:e}),this.$emit("change")}},computed:{filter:function(){return this.$store.getters["".concat(this.resourceName,"/getFilter")](this.filterKey)},fieldAttribute:function(){return this.filter.fieldAttribute},value:function(){return this.filter.currentValue}}};const b=(0,r(744).Z)(m,[["render",function(e,t,r,v,h,p){var m=(0,n.resolveComponent)("SearchInput");return(0,n.openBlock)(),(0,n.createElementBlock)("div",o,[(0,n.createElementVNode)("h3",i,(0,n.toDisplayString)(p.filter.name),1),(0,n.createElementVNode)("div",a,[(0,n.createVNode)(m,{onInput:e.performSearch,onClear:e.clearSelection,onSelected:p.handleChange,value:p.value,data:e.availableResources,clearable:!1,trackBy:"value",searchBy:"display"},{option:(0,n.withCtx)((function(e){e.selected;var t=e.option;return[(0,n.createElementVNode)("div",u,[t.avatar?((0,n.openBlock)(),(0,n.createElementBlock)("div",f,[(0,n.createElementVNode)("img",{src:t.avatar,class:"w-8 h-8 rounded-full block"},null,8,d)])):(0,n.createCommentVNode)("",!0),(0,n.createTextVNode)(" "+(0,n.toDisplayString)(t.display),1)])]})),default:(0,n.withCtx)((function(){return[p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",c,[p.value.avatar?((0,n.openBlock)(),(0,n.createElementBlock)("div",l,[(0,n.createElementVNode)("img",{src:p.value.avatar,class:"w-8 h-8 rounded-full block"},null,8,s)])):(0,n.createCommentVNode)("",!0),(0,n.createTextVNode)(" "+(0,n.toDisplayString)(p.value.display),1)])):(0,n.createCommentVNode)("",!0)]})),_:1},8,["onInput","onClear","onSelected","value","data"])])])}]])},398:(e,t,r)=>{var n=r(78).Symbol;e.exports=n},868:(e,t,r)=>{var n=r(398),o=r(145),i=r(687),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},743:(e,t,r)=>{var n=r(2),o=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},704:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},145:(e,t,r)=>{var n=r(398),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,c=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,c),r=e[c];try{e[c]=void 0;var n=!0}catch(e){}var o=a.call(e);return n&&(t?e[c]=r:delete e[c]),o}},687:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},78:(e,t,r)=>{var n=r(704),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},2:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},751:(e,t,r)=>{var n=r(959),o=r(9),i=r(601),a=Math.max,c=Math.min;e.exports=function(e,t,r){var l,s,u,f,d,v,h=0,p=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var r=l,n=s;return l=s=void 0,h=t,f=e.apply(n,r)}function y(e){var r=e-v;return void 0===v||r>=t||r<0||m&&e-h>=u}function x(){var e=o();if(y(e))return N(e);d=setTimeout(x,function(e){var r=t-(e-v);return m?c(r,u-(e-h)):r}(e))}function N(e){return d=void 0,b&&l?g(e):(l=s=void 0,f)}function S(){var e=o(),r=y(e);if(l=arguments,s=this,v=e,r){if(void 0===d)return function(e){return h=e,d=setTimeout(x,t),p?g(e):f}(v);if(m)return clearTimeout(d),d=setTimeout(x,t),g(v)}return void 0===d&&(d=setTimeout(x,t)),f}return t=i(t)||0,n(r)&&(p=!!r.leading,u=(m="maxWait"in r)?a(i(r.maxWait)||0,t):u,b="trailing"in r?!!r.trailing:b),S.cancel=function(){void 0!==d&&clearTimeout(d),h=0,l=v=s=d=void 0},S.flush=function(){return void 0===d?f:N(o())},S}},959:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},193:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},961:(e,t,r)=>{var n=r(868),o=r(193);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},9:(e,t,r)=>{var n=r(78);e.exports=function(){return n.Date.now()}},601:(e,t,r)=>{var n=r(743),o=r(959),i=r(961),a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=c.test(e);return r||l.test(e)?s(e.slice(2),r?2:8):a.test(e)?NaN:+e}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Nova.booting((function(e){e.component("nova-searchable-belongs-to-filter",r(548).Z)}))})(); \ No newline at end of file +(()=>{var e,t={725:(e,t,r)=>{Nova.booting((function(e){e.component("nova-searchable-belongs-to-filter",r(548).Z)}))},655:()=>{},744:(e,t)=>{"use strict";t.Z=(e,t)=>{const r=e.__vccOpts||e;for(const[e,n]of t)r[e]=n;return r}},548:(e,t,r)=>{"use strict";r.d(t,{Z:()=>b});const n=Vue;var o={class:"pt-2 pb-3"},i={class:"px-3 text-xs uppercase font-bold tracking-wide"},a={class:"mt-1 px-3"},c={key:0,class:"flex items-center"},l={key:0,class:"mr-3"},s=["src"],u={class:"flex items-center"},f={key:0,class:"mr-3"},d=["src"];var v=r(751);const h={data:function(){return{search:"",selectedResource:null,selectedResourceId:null,availableResources:[]}},methods:{selectResource:function(e){this.selectedResource=e,this.selectedResourceId=e.value,this.field&&("function"==typeof this.emitFieldValueChange?this.emitFieldValueChange(this.fieldAttribute,this.selectedResourceId):Nova.$emit(this.fieldAttribute+"-change",this.selectedResourceId))},handleSearchCleared:function(){this.availableResources=[]},clearSelection:function(){this.selectedResource=null,this.selectedResourceId=null,this.availableResources=[],this.field&&("function"==typeof this.emitFieldValueChange?this.emitFieldValueChange(this.fieldAttribute,null):Nova.$emit(this.fieldAttribute+"-change",null))},performSearch:function(e){var t=this;this.search=e;var r=e.trim();""!=r&&this.searchDebouncer((function(){t.getAvailableResources(r)}),500)},searchDebouncer:r.n(v)()((function(e){return e()}),500)}},p=function(e,t,r){return Nova.request().get("/nova-api/".concat(e,"/associatable/").concat(t),r)},m={mixins:[h],props:{resourceName:{type:String,required:!0},filterKey:{type:String,required:!0}},methods:{getAvailableResources:function(){var e=this;return p(this.resourceName,this.fieldAttribute,{params:{search:this.search}}).then((function(t){var r=t.data.resources;e.availableResources=r}))},handleChange:function(e){this.$store.commit("".concat(this.resourceName,"/updateFilterState"),{filterClass:this.filterKey,value:e}),this.$emit("change")}},computed:{filter:function(){return this.$store.getters["".concat(this.resourceName,"/getFilter")](this.filterKey)},fieldAttribute:function(){return this.filter.fieldAttribute},value:function(){return this.filter.currentValue}}};const b=(0,r(744).Z)(m,[["render",function(e,t,r,v,h,p){var m=(0,n.resolveComponent)("SearchInput");return(0,n.openBlock)(),(0,n.createElementBlock)("div",o,[(0,n.createElementVNode)("h3",i,(0,n.toDisplayString)(p.filter.name),1),(0,n.createElementVNode)("div",a,[(0,n.createVNode)(m,{onInput:e.performSearch,onClear:e.clearSelection,onSelected:p.handleChange,value:p.value,data:e.availableResources,clearable:!1,trackBy:"value",searchBy:"display"},{option:(0,n.withCtx)((function(e){e.selected;var t=e.option;return[(0,n.createElementVNode)("div",u,[t.avatar?((0,n.openBlock)(),(0,n.createElementBlock)("div",f,[(0,n.createElementVNode)("img",{src:t.avatar,class:"w-8 h-8 rounded-full block"},null,8,d)])):(0,n.createCommentVNode)("",!0),(0,n.createTextVNode)(" "+(0,n.toDisplayString)(t.display),1)])]})),default:(0,n.withCtx)((function(){return[p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",c,[p.value.avatar?((0,n.openBlock)(),(0,n.createElementBlock)("div",l,[(0,n.createElementVNode)("img",{src:p.value.avatar,class:"w-8 h-8 rounded-full block"},null,8,s)])):(0,n.createCommentVNode)("",!0),(0,n.createTextVNode)(" "+(0,n.toDisplayString)(p.value.display),1)])):(0,n.createCommentVNode)("",!0)]})),_:1},8,["onInput","onClear","onSelected","value","data"])])])}]])},398:(e,t,r)=>{var n=r(78).Symbol;e.exports=n},868:(e,t,r)=>{var n=r(398),o=r(145),i=r(687),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},743:(e,t,r)=>{var n=r(2),o=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},704:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},145:(e,t,r)=>{var n=r(398),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,c=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,c),r=e[c];try{e[c]=void 0;var n=!0}catch(e){}var o=a.call(e);return n&&(t?e[c]=r:delete e[c]),o}},687:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},78:(e,t,r)=>{var n=r(704),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},2:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},751:(e,t,r)=>{var n=r(959),o=r(9),i=r(601),a=Math.max,c=Math.min;e.exports=function(e,t,r){var l,s,u,f,d,v,h=0,p=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var r=l,n=s;return l=s=void 0,h=t,f=e.apply(n,r)}function y(e){var r=e-v;return void 0===v||r>=t||r<0||m&&e-h>=u}function x(){var e=o();if(y(e))return N(e);d=setTimeout(x,function(e){var r=t-(e-v);return m?c(r,u-(e-h)):r}(e))}function N(e){return d=void 0,b&&l?g(e):(l=s=void 0,f)}function O(){var e=o(),r=y(e);if(l=arguments,s=this,v=e,r){if(void 0===d)return function(e){return h=e,d=setTimeout(x,t),p?g(e):f}(v);if(m)return clearTimeout(d),d=setTimeout(x,t),g(v)}return void 0===d&&(d=setTimeout(x,t)),f}return t=i(t)||0,n(r)&&(p=!!r.leading,u=(m="maxWait"in r)?a(i(r.maxWait)||0,t):u,b="trailing"in r?!!r.trailing:b),O.cancel=function(){void 0!==d&&clearTimeout(d),h=0,l=v=s=d=void 0},O.flush=function(){return void 0===d?f:N(o())},O}},959:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},193:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},961:(e,t,r)=>{var n=r(868),o=r(193);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},9:(e,t,r)=>{var n=r(78);e.exports=function(){return n.Date.now()}},601:(e,t,r)=>{var n=r(743),o=r(959),i=r(961),a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=c.test(e);return r||l.test(e)?s(e.slice(2),r?2:8):a.test(e)?NaN:+e}}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,e=[],n.O=(t,r,o,i)=>{if(!r){var a=1/0;for(u=0;u=i)&&Object.keys(n.O).every((e=>n.O[e](r[l])))?r.splice(l--,1):(c=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[r,o,i]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={599:0,319:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,i,[a,c,l]=r,s=0;if(a.some((t=>0!==e[t]))){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(l)var u=l(n)}for(t&&t(r);sn(725)));var o=n.O(void 0,[319],(()=>n(655)));o=n.O(o)})(); \ No newline at end of file diff --git a/dist/mix-manifest.json b/dist/mix-manifest.json index 3cdbba9..aa9385a 100644 --- a/dist/mix-manifest.json +++ b/dist/mix-manifest.json @@ -1,3 +1,4 @@ { - "/js/filter.js": "/js/filter.js" + "/js/filter.js": "/js/filter.js", + "/css/filter.css": "/css/filter.css" } diff --git a/webpack.mix.js b/webpack.mix.js index 9932953..18f30f9 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -6,4 +6,5 @@ mix .setPublicPath("dist") .js("resources/js/filter.js", "js") .vue({ version: 3 }) + .css("resources/css/filter.css", "css") .nova("suenerds/nova-searchable-belongs-to-filter");