katoikia-app/web-ui/web-react/node_modules/primereact/dataview/dataview.cjs.min.js

2 lines
9.5 KiB
JavaScript

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/paginator"),r=require("primereact/utils"),n=require("primereact/ripple"),o=require("primereact/api");function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=a(t);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function l(t){if(Array.isArray(t))return s(t)}function p(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function u(t,e){if(t){if("string"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,r){return e&&h(t.prototype,e),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function y(t,e){return y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},y(t,e)}function m(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return g(t)}function P(t){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},P(t)}function w(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function k(t){var e=E();return function(){var r,n=P(t);if(e){var o=P(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function E(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var N=function(e){m(a,t.Component);var o=k(a);function a(t){var e;return f(this,a),(e=o.call(this,t)).changeLayout=e.changeLayout.bind(g(e)),e}return d(a,[{key:"changeLayout",value:function(t,e){this.props.onChange({originalEvent:t,value:e}),t.preventDefault()}},{key:"render",value:function(){var t=this,e=r.classNames("p-dataview-layout-options p-selectbutton p-buttonset",this.props.className),o=r.classNames("p-button p-button-icon-only",{"p-highlight":"list"===this.props.layout}),a=r.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===this.props.layout});return i.default.createElement("div",{id:this.props.id,style:this.props.style,className:e},i.default.createElement("button",{type:"button",className:o,onClick:function(e){return t.changeLayout(e,"list")}},i.default.createElement("i",{className:"pi pi-bars"}),i.default.createElement(n.Ripple,null)),i.default.createElement("button",{type:"button",className:a,onClick:function(e){return t.changeLayout(e,"grid")}},i.default.createElement("i",{className:"pi pi-th-large"}),i.default.createElement(n.Ripple,null)))}}]),a}();w(N,"defaultProps",{id:null,style:null,className:null,layout:null,onChange:null});var O=function(e){m(n,t.Component);var r=k(n);function n(){return f(this,n),r.apply(this,arguments)}return d(n,[{key:"render",value:function(){return this.props.template(this.props.item,this.props.layout)}}]),n}();w(O,"defaultProps",{template:null,item:null,layout:null});var R=function(n){m(s,t.Component);var a=k(s);function s(t){var e;return f(this,s),(e=a.call(this,t)).props.onPage||(e.state={first:e.props.first,rows:e.props.rows}),e.sortChange=!1,e.onPageChange=e.onPageChange.bind(g(e)),e}return d(s,[{key:"getItemRenderKey",value:function(t){return this.props.dataKey?r.ObjectUtils.resolveFieldData(t,this.props.dataKey):null}},{key:"getTotalRecords",value:function(){return this.props.totalRecords?this.props.totalRecords:this.props.value?this.props.value.length:0}},{key:"createPaginator",value:function(t){var n=r.classNames("p-paginator-"+t,this.props.paginatorClassName),o=this.props.onPage?this.props.first:this.state.first,a=this.props.onPage?this.props.rows:this.state.rows,s=this.getTotalRecords();return i.default.createElement(e.Paginator,{first:o,rows:a,pageLinkSize:this.props.pageLinkSize,className:n,onPageChange:this.onPageChange,template:this.props.paginatorTemplate,totalRecords:s,rowsPerPageOptions:this.props.rowsPerPageOptions,currentPageReportTemplate:this.props.currentPageReportTemplate,leftContent:this.props.paginatorLeft,rightContent:this.props.paginatorRight,alwaysShow:this.props.alwaysShowPaginator,dropdownAppendTo:this.props.paginatorDropdownAppendTo})}},{key:"onPageChange",value:function(t){this.props.onPage?this.props.onPage(t):this.setState({first:t.first,rows:t.rows})}},{key:"isEmpty",value:function(){return!this.props.value||0===this.props.value.length}},{key:"sort",value:function(){var t,e=this;if(this.props.value){var n=l(t=this.props.value)||p(t)||u(t)||c();return n.sort((function(t,n){var o=r.ObjectUtils.resolveFieldData(t,e.props.sortField),a=r.ObjectUtils.resolveFieldData(n,e.props.sortField),i=null;return i=null==o&&null!=a?-1:null!=o&&null==a?1:null==o&&null==a?0:"string"==typeof o&&"string"==typeof a?o.localeCompare(a,void 0,{numeric:!0}):o<a?-1:o>a?1:0,e.props.sortOrder*i})),n}return null}},{key:"renderLoader",value:function(){if(this.props.loading){var t=r.classNames("p-dataview-loading-icon pi-spin",this.props.loadingIcon);return i.default.createElement("div",{className:"p-dataview-loading-overlay p-component-overlay"},i.default.createElement("i",{className:t}))}return null}},{key:"renderTopPaginator",value:function(){return!this.props.paginator||"bottom"===this.props.paginatorPosition&&"both"!==this.props.paginatorPosition?null:this.createPaginator("top")}},{key:"renderBottomPaginator",value:function(){return!this.props.paginator||"top"===this.props.paginatorPosition&&"both"!==this.props.paginatorPosition?null:this.createPaginator("bottom")}},{key:"renderEmptyMessage",value:function(){if(!this.props.loading){var t=this.props.emptyMessage||o.localeOption("emptyMessage");return i.default.createElement("div",{className:"p-col-12 col-12 p-dataview-emptymessage"},t)}return null}},{key:"renderHeader",value:function(){return this.props.header?i.default.createElement("div",{className:"p-dataview-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?i.default.createElement("div",{className:"p-dataview-footer"}," ",this.props.footer):null}},{key:"renderItems",value:function(t){var e=this;if(t&&t.length){if(this.props.paginator){for(var r=this.props.onPage?this.props.rows:this.state.rows,n=this.props.lazy?0:this.props.onPage?this.props.first:this.state.first,o=this.getTotalRecords(),a=Math.min(r+n,o),s=[],l=n;l<a;l++){var p=t[l];p&&s.push(i.default.createElement(O,{key:this.getItemRenderKey(t)||l,template:this.props.itemTemplate,layout:this.props.layout,item:p}))}return s}return t.map((function(t,r){return i.default.createElement(O,{key:e.getItemRenderKey(t)||r,template:e.props.itemTemplate,layout:e.props.layout,item:t})}))}return this.renderEmptyMessage()}},{key:"renderContent",value:function(t){var e=this.renderItems(t);return i.default.createElement("div",{className:"p-dataview-content"},i.default.createElement("div",{className:"p-grid p-nogutter grid grid-nogutter"},e))}},{key:"processData",value:function(){var t=this.props.value;return t&&t.length&&this.props.sortField&&(t=this.sort()),t}},{key:"render",value:function(){var t=this.processData(),e=r.classNames("p-dataview p-component",{"p-dataview-list":"list"===this.props.layout,"p-dataview-grid":"grid"===this.props.layout,"p-dataview-loading":this.props.loading},this.props.className),n=this.renderLoader(),o=this.renderTopPaginator(),a=this.renderBottomPaginator(),s=this.renderHeader(),l=this.renderFooter(),p=this.renderContent(t);return i.default.createElement("div",{id:this.props.id,style:this.props.style,className:e},n,s,o,p,a,l)}}]),s}();w(R,"defaultProps",{id:null,header:null,footer:null,value:null,layout:"list",dataKey:null,rows:null,first:0,totalRecords:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",emptyMessage:null,sortField:null,sortOrder:null,style:null,className:null,lazy:!1,loading:!1,loadingIcon:"pi pi-spinner",itemTemplate:null,onPage:null}),exports.DataView=R,exports.DataViewLayoutOptions=N;