Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/views/selectable_table/SelectableTable",["module","exports","require","@frontend-taglib-clay$clayui/empty-state","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/loading-indicator","@frontend-taglib-clay$clayui/table","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../FrontendDataSetContext"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=f(a("@frontend-taglib-clay$clayui/empty-state")),n=a("@frontend-taglib-clay$clayui/form"),r=f(a("@frontend-taglib-clay$clayui/loading-indicator")),c=f(a("@frontend-taglib-clay$clayui/table")),o=(f(a("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),u=f(a("../../FrontendDataSetContext"));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function f(e){return e&&e.__esModule?e:{default:e}}function d(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,l)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?d(Object(a),!0).forEach((function(t){m(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):d(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function m(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function y({dataLoading:e,items:t,schema:a,style:i}){const{namespace:f}=(0,o.useContext)(u.default),{selectedItemsKey:d}=(0,o.useContext)(u.default),[m,y]=(0,o.useState)(null);function b(e,t,a){const l=m.map((l=>{const n=l[d];return t&&n!==t?l:s(s({},l),{},{restrictionFields:l.restrictionFields.map((t=>e!==t.name?t:s(s({},t),{},{value:"boolean"==typeof a?a:!t.value})))})}));y(l)}return(0,o.useEffect)((()=>{y(t)}),[t]),e?o.default.createElement(r.default,{className:"mt-7"}):m&&0!==(null==m?void 0:m.length)?o.default.createElement("div",{className:"table-style-".concat(i)},o.default.createElement(c.default,{borderless:!0,hover:!1,responsive:!1},o.default.createElement(c.default.Head,null,o.default.createElement(c.default.Row,null,o.default.createElement(c.default.Cell,{className:"table-cell-expand-smaller",headingCell:!0,headingTitle:!0},a.firstColumnLabel),m[0].restrictionFields.map((e=>{const t=m.reduce(((t,a)=>t+(a.restrictionFields.find((t=>t.name===e.name)).value?1:0)),0);return o.default.createElement(c.default.Cell,{className:"table-cell-expand-smaller",headingCell:!0,key:e.name},o.default.createElement(n.ClayCheckbox,{checked:t===m.length,className:"mr-2",indeterminate:t>0&&t<m.length,label:e.label,name:"".concat(e.name,"_column"),onChange:()=>b(e.name,null,t!==m.length)}))})))),o.default.createElement(c.default.Body,null,m.map(((e,t)=>{const l=e[d];return o.default.createElement(c.default.Row,{key:t},o.default.createElement(c.default.Cell,null,e[a.firstColumnName]),e.restrictionFields.map((e=>o.default.createElement(c.default.Cell,{key:e.name},o.default.createElement(n.ClayCheckbox,{checked:e.value,name:f+l,onChange:()=>{b(e.name,l)},value:e.name})))))}))))):o.default.createElement(l.default,{description:Liferay.Language.get("sorry,-no-results-were-found"),imgSrc:"".concat(themeDisplay.getPathThemeImages(),"/states/search_state.gif"),title:Liferay.Language.get("no-results-found")})}y.defaultProps={items:[]};var b=y;t.default=b}}));
//# sourceMappingURL=SelectableTable.js.map