text: !function(e){var t={};function n(l){if(t[l])return t[l].exports;var r=t[l]={i:l,l:!1,exports:{}};return e[l].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(l,r,function(t){return e[t]}.bind(null,r));return l},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=10)}({10:function(e,t,n){e.exports=n(11)},11:function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){function t(l){var r=e.Dcat;(l=$.extend({title:"选择",selector:"",column:"",source:"",maxItem:1,area:["80%","90%"],queryName:"_resource_",items:{},placeholder:"",showCloseButton:!1,lang:{close:r.lang.close||"关闭",exceed_max_item:r.lang.exceed_max_item||"已超出最大可选择的数量",selected_options:r.lang.selected_options||"已选中:num个选项"},displayerContainer:null,hiddenInput:null,displayer:null,disabled:!1,clearAllClass:"",clearOneClass:"",window:null},l)).window=l.window||top||e;var a,o,c,i=t,s=l.column,u=s.replace(/[\[\]]*/g,"")+Math.random().toString(36).substr(2),d=l.window.layer,p=g(l.displayerContainer)||$(l.selector).parents(".select-resource").find('div[name="'+s+'"]'),f=g(l.hiddenInput)||p.parents(".input-group").find('input[type="hidden"]'),h=l.clearOneClass||u+"-tag-clear-button",m=l.clearAllClass||u+"-clear-button",y=l.maxItem,b=l.items;function g(e){if(e)return"object"===n(e)?e:$(e)}function v(e){var t=[];for(var n in e)t.push(n);!function(e){if(l.displayer)return"string"==typeof l.displayer&&r.helpers.isset(i.displayers,l.displayer)?i.displayers[l.displayer](e,p,l):l.displayer(e,p,l);i.displayers.default(e,p,l)}(e),function(e){f.val(e.length?e.join(","):"")}(t),$("."+m).click(k),$("."+h).click(C)}function x(e){e.parents("tr").css("background-color",""),e.prop("checked",!1)}function _(){setTimeout((function(){var e=d.getChildFrame('tbody .checkbox-grid input[type="checkbox"]:checked',o);for(var t in x(e),b)d.getChildFrame('.checkbox-grid input[data-id="'+t+'"]',o).click()}),10)}function w(){return $(d.getChildFrame('.checkbox-grid input[type="checkbox"]:not(.select-all)',o))}function C(){delete b[$(this).data("id")],v(b)}function k(){v(b={})}function O(t){return e.screen.width<=750?["100%","100%"]:t}l.clearOneClass=h,l.clearAllClass=m,$(l.selector).click((function(){if(!l.disabled){if(o)return c.show(),void _();$(document).one("pjax:complete",(function(){d.close(o),c.remove(),o=c=null})),-1===l.source.indexOf("?")&&(l.source+="?"),o=d.open({type:2,title:l.title,shadeClose:!0,maxmin:!1,resize:!1,shade:!1,scrollbar:!1,skin:"select-resource",area:O(l.area),content:"".concat(l.source).concat(l.queryName,"=1"),btn:l.showCloseButton?[l.closeButtonText]:null,success:function(e){a=l.window[e.find("iframe")[0].name],$("html").css({overflow:"auto"}),function(e){r.ready((function(){var e=$(d.getChildFrame(".checkbox-grid .select-all",o)),t=w();_(),1!=y&&e.on("change",(function(){setTimeout((function(){t.trigger("change")}),1)})),t.on("change",(function(){1==y?function(e){var t=e.data("id"),n=e.data("label")||t;w().each((function(){$(this).data("id")!=t&&x($(this))})),b={},e.prop("checked")&&(b[t]=n);v(b)}($(this)):function(e){var t=e.data("id"),n=e.data("label")||t,a=r.helpers.isset(b,t);e[0].checked?a||(b[t]=n):a&&delete b[t];if(y>0&&r.helpers.len(b)>y)return x(e),delete b[t],r.warning(l.lang.exceed_max_item);v(b)}($(this))})),1==y&&e.on("click",(function(){return!1}))}),e)}(a)},yes:function(){return c.hide(),!1},cancel:function(){return c.hide(),!1}}),c=l.window.$("#layui-layer"+o)}})),v(b)}t.displayers={default:function(e,t,n){var l='<span class="default-text" style="opacity:0.75">'+(n.placeholder||t.attr("placeholder"))+"</span>",r=n.maxItem;function a(e){return""+e+("<div class='pull-right "+n.clearAllClass+"' style='font-weight:bold;cursor:pointer'>×</div>")}Dcat.helpers.len(e)?1==r?t.html(a(e[Object.keys(e)[0]])):t.html(function(e){var t=[];for(var l in e)if(r>2||!r){var o="";o+='<li class="select2-selection__choice" >',o+=e[l]+' <span data-id="'+l+'" class="select2-selection__choice__remove ',o+=n.clearOneClass+'" role="presentation"> ×</span>',o+="</li>",t.push(o)}else t.push("<a class='label label-primary'>"+e[l]+" <span data-id="+l+" class='"+n.clearOneClass+"' style='font-weight:bold;cursor:pointer;font-size:14px'>×</span></a>");return r>2||!r?(t.unshift('<span class="select2-selection__clear '+n.clearAllClass+'">×</span>'),t='<ul class="select2-selection__rendered">'+t.join("")+"</ul>"):a(t.join("&nbsp;"))}(e)):t.html(l)},navList:function(e,t,n){var l,r='<span style="opacity:0.75">'+(n.placeholder||t.attr("placeholder"))+"</span>",a=n.maxItem;function o(e){return e+("<div class='pull-right "+n.clearAllClass+"' style='font-weight:bold;cursor:pointer'>×</div>")}(l=$(n.selector).parents(".select-resource").find("app")).html(""),Dcat.helpers.len(e)?1==a?t.html(o(e[Object.keys(e)[0]])):(t.html(o(n.lang.selected_options.replace(":num",Dcat.helpers.len(e)))),l.html(function(e){var t=[];for(var l in e){var r="";r+="<li>",r+="<a class='pull-left'>"+e[l]+"</a><a data-id='"+l+"' class='pull-right red text-danger ",r+=n.clearOneClass+"' ><i class='fa fa-close'></i></a>",r+="<span class='clearfix'></span></li>",t.push(r)}return t='<ul class="nav nav-pills nav-stacked" >'+t.join("")+"</ul>"}(e))):t.html(r)}},Dcat.ResourceSelector=t}(window)}});
  //# sourceMappingURL=resource-selector.js.map