diff --git a/js/src/plugins/js-search.plugin.js b/js/src/plugins/js-search.plugin.js index 82abd736cf..a7a25f2b08 100644 --- a/js/src/plugins/js-search.plugin.js +++ b/js/src/plugins/js-search.plugin.js @@ -192,8 +192,10 @@ export default class JsSearch extends atkPlugin { * @param options */ doSearch(uri, query, options, cb = function () {}) { + const queryKey = this.settings.uri_query_key; + if (query) { - options = $.extend(options, { _q: query }); + options = $.extend(options, { [queryKey]: query }); } if (this.settings.useAjax) { @@ -207,7 +209,7 @@ export default class JsSearch extends atkPlugin { onComplete: cb, }); } else { - uri = $.atkRemoveParam(uri, '_q'); + uri = $.atkRemoveParam(uri, queryKey); if (options.__atk_reload) { delete options.__atk_reload; } @@ -220,6 +222,7 @@ export default class JsSearch extends atkPlugin { JsSearch.DEFAULTS = { uri: null, uri_options: {}, + uri_query_key: null, q: null, autoQuery: false, timeOut: 300, diff --git a/public/atkjs-ui.min.js b/public/atkjs-ui.min.js index 0e667b04a1..fd4df4ca6a 100644 --- a/public/atkjs-ui.min.js +++ b/public/atkjs-ui.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jQuery"),require("Draggable")):"function"==typeof define&&define.amd?define("atk",["jQuery","Draggable"],e):"object"==typeof exports?exports.atk=e(require("jQuery"),require("Draggable")):t.atk=e(t.jQuery,t.Draggable)}(self,(function(__WEBPACK_EXTERNAL_MODULE__1145__,__WEBPACK_EXTERNAL_MODULE__7417__){return(()=>{var __webpack_modules__={8576:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var jquery__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1145),jquery__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);class ApiService{static getInstance(){return this.instance}constructor(){return this.instance||(this.instance=this,this.afterSuccessCallbacks=[]),this.instance}evalResponse(code,$){eval(code)}setService(t){t.successTest=this.successTest,t.onFailure=this.onFailure,t.onSuccess=this.onSuccess,t.onAbort=this.onAbort}onAbort(t){console.warn(t)}onSuccess(t,e){let n;try{if(t.success){if(t&&t.html&&t.id){const e=[];jquery__WEBPACK_IMPORTED_MODULE_0___default()(t.html).find(".ui.modal[id]").each(((t,n)=>{e.push("#"+jquery__WEBPACK_IMPORTED_MODULE_0___default()(n).attr("id"))})),e.length&&jquery__WEBPACK_IMPORTED_MODULE_0___default()(".ui.dimmer.modals.page").find(e.join(", ")).remove(),n=jquery__WEBPACK_IMPORTED_MODULE_0___default()("#"+t.id).replaceWith(t.html),n.length||console.error("Unable to replace element with id: "+t.id)}if(t&&t.portals){Object.keys(t.portals).forEach((e=>{0===jquery__WEBPACK_IMPORTED_MODULE_0___default()(".ui.dimmer.modals.page, .atk-side-panels").find("#"+e).length&&(jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).append(t.portals[e].html),atk.apiService.evalResponse(t.portals[e].js,jQuery))}))}if(t&&t.atkjs&&atk.apiService.evalResponse.call(this,t.atkjs,jQuery),atk.apiService.afterSuccessCallbacks.length>0){const t=this;atk.apiService.afterSuccessCallbacks.forEach((e=>{atk.apiService.evalResponse.call(t,e,jQuery)})),atk.apiService.afterSuccessCallbacks.splice(0)}}else if(t.isServiceError)throw{message:t.message}}catch(t){atk.apiService.showErrorModal(atk.apiService.getErrorHtml(t.message))}}suiFetch(t,e={},n="body"){const r=jquery__WEBPACK_IMPORTED_MODULE_0___default()(n),i=Object.assign(e);return"on"in i||(i.on="now"),"method"in i||(i.method="get"),i.url=t,new Promise(((t,e)=>{i.onFailure=function(t){atk.apiService.onFailure(t),e(t)},i.onSuccess=function(e,n){t(e)},r.api(i)}))}onAfterSuccess(t){this.afterSuccessCallbacks.push(t)}successTest(t){return this.data={},!!t.success}atkSuccessTest(t,e=null){t.success?this.onSuccess(t,e):this.onFailure(t)}onFailure(t){if(Object.prototype.hasOwnProperty.call(t,"success")&&!t.success)Object.prototype.hasOwnProperty.call(t,"useWindow")&&t.useWindow?atk.apiService.showErrorWindow(t.message):atk.apiService.showErrorModal(t.message);else{const e=t.match(/
]*>[\s\S]*<\/body>/gi);e?atk.apiService.showErrorModal(e):atk.apiService.showErrorModal(t)}}showErrorModal(t){const e=jquery__WEBPACK_IMPORTED_MODULE_0___default()(">1,v=23===s?n(2,-24)-n(2,-77):0,m=t<0||0===t&&1/t<0?1:0,g=0;for((t=e(t))!=t||t===1/0?(l=t!=t?1:0,c=f):(c=r(i(t)/o),t*(u=n(2,-c))<1&&(c--,u*=2),(t+=c+h>=1?v/u:v*n(2,1-h))*u>=2&&(c++,u/=2),c+h>=f?(l=0,c=f):c+h>=1?(l=(t*u-1)*n(2,s),c+=h):(l=t*n(2,h-1)*n(2,s),c=0));s>=8;d[g++]=255&l,l/=256,s-=8);for(c=c<0;d[g++]=255&c,c/=256,p-=8);return d[--g]|=128*m,d},unpack:function(t,e){var r,i=t.length,o=8*i-e-1,s=(1<