primevue
Version:
PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc
2 lines (1 loc) • 6.57 kB
JavaScript
this.primevue=this.primevue||{},this.primevue.dataview=function(t,e,r,o,a){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=n(t);function i(){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 l(t,e){if(t){if("string"==typeof t)return d(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)?d(t,e):void 0}}function p(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function u(t){if(Array.isArray(t))return d(t)}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}var c={name:"DataView",extends:{name:"BaseDataView",extends:n(r).default,props:{value:{type:Array,default:null},layout:{type:String,default:"list"},rows:{type:Number,default:0},first:{type:Number,default:0},totalRecords:{type:Number,default:0},paginator:{type:Boolean,default:!1},paginatorPosition:{type:String,default:"bottom"},alwaysShowPaginator:{type:Boolean,default:!0},paginatorTemplate:{type:String,default:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown"},pageLinkSize:{type:Number,default:5},rowsPerPageOptions:{type:Array,default:null},currentPageReportTemplate:{type:String,default:"({currentPage} of {totalPages})"},sortField:{type:[String,Function],default:null},sortOrder:{type:Number,default:null},lazy:{type:Boolean,default:!1},dataKey:{type:String,default:null}},style:n(o).default,provide:function(){return{$parentInstance:this}}},emits:["update:first","update:rows","page"],data:function(){return{d_first:this.first,d_rows:this.rows}},watch:{first:function(t){this.d_first=t},rows:function(t){this.d_rows=t},sortField:function(){this.resetPage()},sortOrder:function(){this.resetPage()}},methods:{getKey:function(t,r){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):r},onPage:function(t){this.d_first=t.first,this.d_rows=t.rows,this.$emit("update:first",this.d_first),this.$emit("update:rows",this.d_rows),this.$emit("page",t)},sort:function(){var t,r=this;if(this.value){var o=u(t=this.value)||p(t)||l(t)||i(),a=e.ObjectUtils.localeComparator();return o.sort((function(t,o){var n=e.ObjectUtils.resolveFieldData(t,r.sortField),s=e.ObjectUtils.resolveFieldData(o,r.sortField);return e.ObjectUtils.sort(n,s,r.sortOrder,a)})),o}return null},resetPage:function(){this.d_first=0,this.$emit("update:first",this.d_first)}},computed:{getTotalRecords:function(){return this.totalRecords?this.totalRecords:this.value?this.value.length:0},empty:function(){return!this.value||0===this.value.length},emptyMessageText:function(){var t;return(null===(t=this.$primevue.config)||void 0===t||null===(t=t.locale)||void 0===t?void 0:t.emptyMessage)||""},paginatorTop:function(){return this.paginator&&("bottom"!==this.paginatorPosition||"both"===this.paginatorPosition)},paginatorBottom:function(){return this.paginator&&("top"!==this.paginatorPosition||"both"===this.paginatorPosition)},items:function(){if(this.value&&this.value.length){var t=this.value;if(t&&t.length&&this.sortField&&(t=this.sort()),this.paginator){var e=this.lazy?0:this.d_first;return t.slice(e,e+this.d_rows)}return t}return null}},components:{DVPaginator:s.default}};return c.render=function(t,e,r,o,n,s){var i=a.resolveComponent("DVPaginator");return a.openBlock(),a.createElementBlock("div",a.mergeProps({class:t.cx("root")},t.ptm("root"),{"data-pc-name":"dataview"}),[t.$slots.header?(a.openBlock(),a.createElementBlock("div",a.mergeProps({key:0,class:t.cx("header")},t.ptm("header")),[a.renderSlot(t.$slots,"header")],16)):a.createCommentVNode("",!0),s.paginatorTop?(a.openBlock(),a.createBlock(i,{key:1,rows:n.d_rows,first:n.d_first,totalRecords:s.getTotalRecords,pageLinkSize:t.pageLinkSize,template:t.paginatorTemplate,rowsPerPageOptions:t.rowsPerPageOptions,currentPageReportTemplate:t.currentPageReportTemplate,class:a.normalizeClass(t.cx("paginator")),alwaysShow:t.alwaysShowPaginator,onPage:e[0]||(e[0]=function(t){return s.onPage(t)}),unstyled:t.unstyled,pt:t.ptm("paginator")},a.createSlots({_:2},[t.$slots.paginatorstart?{name:"start",fn:a.withCtx((function(){return[a.renderSlot(t.$slots,"paginatorstart")]})),key:"0"}:void 0,t.$slots.paginatorend?{name:"end",fn:a.withCtx((function(){return[a.renderSlot(t.$slots,"paginatorend")]})),key:"1"}:void 0]),1032,["rows","first","totalRecords","pageLinkSize","template","rowsPerPageOptions","currentPageReportTemplate","class","alwaysShow","unstyled","pt"])):a.createCommentVNode("",!0),a.createElementVNode("div",a.mergeProps({class:t.cx("content")},t.ptm("content")),[s.empty?(a.openBlock(),a.createElementBlock("div",a.mergeProps({key:1,class:t.cx("emptyMessage")},t.ptm("emptyMessage")),[a.renderSlot(t.$slots,"empty",{layout:t.layout},(function(){return[a.createTextVNode(a.toDisplayString(s.emptyMessageText),1)]}))],16)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[t.$slots.list&&"list"===t.layout?a.renderSlot(t.$slots,"list",{key:0,items:s.items}):a.createCommentVNode("",!0),t.$slots.grid&&"grid"===t.layout?a.renderSlot(t.$slots,"grid",{key:1,items:s.items}):a.createCommentVNode("",!0)],64))],16),s.paginatorBottom?(a.openBlock(),a.createBlock(i,{key:2,rows:n.d_rows,first:n.d_first,totalRecords:s.getTotalRecords,pageLinkSize:t.pageLinkSize,template:t.paginatorTemplate,rowsPerPageOptions:t.rowsPerPageOptions,currentPageReportTemplate:t.currentPageReportTemplate,class:a.normalizeClass(t.cx("paginator")),alwaysShow:t.alwaysShowPaginator,onPage:e[1]||(e[1]=function(t){return s.onPage(t)}),unstyled:t.unstyled,pt:t.ptm("paginator")},a.createSlots({_:2},[t.$slots.paginatorstart?{name:"start",fn:a.withCtx((function(){return[a.renderSlot(t.$slots,"paginatorstart")]})),key:"0"}:void 0,t.$slots.paginatorend?{name:"end",fn:a.withCtx((function(){return[a.renderSlot(t.$slots,"paginatorend")]})),key:"1"}:void 0]),1032,["rows","first","totalRecords","pageLinkSize","template","rowsPerPageOptions","currentPageReportTemplate","class","alwaysShow","unstyled","pt"])):a.createCommentVNode("",!0),t.$slots.footer?(a.openBlock(),a.createElementBlock("div",a.mergeProps({key:3,class:t.cx("footer")},t.ptm("footer")),[a.renderSlot(t.$slots,"footer")],16)):a.createCommentVNode("",!0)],16)},c}(primevue.paginator,primevue.utils,primevue.basecomponent,primevue.dataview.style,Vue);