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

2 lines
9.5 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.dataview=function(t,e,r,n,o,a){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=i(e);function l(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 p(t){if(Array.isArray(t))return l(t)}function u(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function c(t,e){if(t){if("string"==typeof t)return l(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)?l(t,e):void 0}}function f(){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 h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(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 g(t,e,r){return e&&d(t.prototype,e),r&&d(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,e){return m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},m(t,e)}function v(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&&m(t,e)}function b(t){return b="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},b(t)}function P(t,e){if(e&&("object"===b(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function w(t){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},w(t)}function k(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function E(t){var e=N();return function(){var r,n=w(t);if(e){var o=w(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return P(this,r)}}function N(){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 O=function(t){v(r,t);var e=E(r);function r(t){var n;return h(this,r),(n=e.call(this,t)).changeLayout=n.changeLayout.bind(y(n)),n}return g(r,[{key:"changeLayout",value:function(t,e){this.props.onChange({originalEvent:t,value:e}),t.preventDefault()}},{key:"render",value:function(){var t=this,e=n.classNames("p-dataview-layout-options p-selectbutton p-buttonset",this.props.className),r=n.classNames("p-button p-button-icon-only",{"p-highlight":"list"===this.props.layout}),a=n.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===this.props.layout});return s.default.createElement("div",{id:this.props.id,style:this.props.style,className:e},s.default.createElement("button",{type:"button",className:r,onClick:function(e){return t.changeLayout(e,"list")}},s.default.createElement("i",{className:"pi pi-bars"}),s.default.createElement(o.Ripple,null)),s.default.createElement("button",{type:"button",className:a,onClick:function(e){return t.changeLayout(e,"grid")}},s.default.createElement("i",{className:"pi pi-th-large"}),s.default.createElement(o.Ripple,null)))}}]),r}(e.Component);k(O,"defaultProps",{id:null,style:null,className:null,layout:null,onChange:null});var R=function(t){v(r,t);var e=E(r);function r(){return h(this,r),e.apply(this,arguments)}return g(r,[{key:"render",value:function(){return this.props.template(this.props.item,this.props.layout)}}]),r}(e.Component);k(R,"defaultProps",{template:null,item:null,layout:null});var C=function(t){v(o,t);var e=E(o);function o(t){var r;return h(this,o),(r=e.call(this,t)).props.onPage||(r.state={first:r.props.first,rows:r.props.rows}),r.sortChange=!1,r.onPageChange=r.onPageChange.bind(y(r)),r}return g(o,[{key:"getItemRenderKey",value:function(t){return this.props.dataKey?n.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 e=n.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,i=this.getTotalRecords();return s.default.createElement(r.Paginator,{first:o,rows:a,pageLinkSize:this.props.pageLinkSize,className:e,onPageChange:this.onPageChange,template:this.props.paginatorTemplate,totalRecords:i,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 r=p(t=this.props.value)||u(t)||c(t)||f();return r.sort((function(t,r){var o=n.ObjectUtils.resolveFieldData(t,e.props.sortField),a=n.ObjectUtils.resolveFieldData(r,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})),r}return null}},{key:"renderLoader",value:function(){if(this.props.loading){var t=n.classNames("p-dataview-loading-icon pi-spin",this.props.loadingIcon);return s.default.createElement("div",{className:"p-dataview-loading-overlay p-component-overlay"},s.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||a.localeOption("emptyMessage");return s.default.createElement("div",{className:"p-col-12 col-12 p-dataview-emptymessage"},t)}return null}},{key:"renderHeader",value:function(){return this.props.header?s.default.createElement("div",{className:"p-dataview-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?s.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),i=[],l=n;l<a;l++){var p=t[l];p&&i.push(s.default.createElement(R,{key:this.getItemRenderKey(t)||l,template:this.props.itemTemplate,layout:this.props.layout,item:p}))}return i}return t.map((function(t,r){return s.default.createElement(R,{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 s.default.createElement("div",{className:"p-dataview-content"},s.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=n.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),r=this.renderLoader(),o=this.renderTopPaginator(),a=this.renderBottomPaginator(),i=this.renderHeader(),l=this.renderFooter(),p=this.renderContent(t);return s.default.createElement("div",{id:this.props.id,style:this.props.style,className:e},r,i,o,p,a,l)}}]),o}(e.Component);return k(C,"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}),t.DataView=C,t.DataViewLayoutOptions=O,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.paginator,primereact.utils,primereact.ripple,primereact.api);