primevue 3.30.2 → 3.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/Accordion.d.ts +5 -5
- package/accordion/Accordion.vue +1 -1
- package/accordion/accordion.cjs.js +3 -3
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.esm.js +3 -3
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +3 -3
- package/accordion/accordion.min.js +1 -1
- package/accordiontab/AccordionTab.d.ts +18 -12
- package/autocomplete/AutoComplete.d.ts +34 -23
- package/autocomplete/AutoComplete.vue +3 -3
- package/autocomplete/BaseAutoComplete.vue +4 -0
- package/autocomplete/autocomplete.cjs.js +9 -5
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +9 -5
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +9 -5
- package/autocomplete/autocomplete.min.js +1 -1
- package/avatar/Avatar.d.ts +7 -7
- package/avatar/Avatar.vue +2 -2
- package/avatar/avatar.cjs.js +2 -2
- package/avatar/avatar.cjs.min.js +1 -1
- package/avatar/avatar.esm.js +2 -2
- package/avatar/avatar.esm.min.js +1 -1
- package/avatar/avatar.js +2 -2
- package/avatar/avatar.min.js +1 -1
- package/avatargroup/AvatarGroup.d.ts +3 -3
- package/badge/Badge.d.ts +3 -3
- package/badgedirective/BadgeDirective.d.ts +45 -4
- package/badgedirective/badgedirective.cjs.js +11 -1
- package/badgedirective/badgedirective.cjs.min.js +1 -1
- package/badgedirective/badgedirective.esm.js +11 -1
- package/badgedirective/badgedirective.esm.min.js +1 -1
- package/badgedirective/badgedirective.js +11 -1
- package/badgedirective/badgedirective.min.js +1 -1
- package/basecomponent/BaseComponent.vue +51 -25
- package/basecomponent/basecomponent.cjs.js +66 -42
- package/basecomponent/basecomponent.cjs.min.js +1 -1
- package/basecomponent/basecomponent.esm.js +66 -42
- package/basecomponent/basecomponent.esm.min.js +1 -1
- package/basecomponent/basecomponent.js +66 -42
- package/basecomponent/basecomponent.min.js +1 -1
- package/basedirective/basedirective.cjs.js +9 -3
- package/basedirective/basedirective.cjs.min.js +1 -1
- package/basedirective/basedirective.esm.js +9 -3
- package/basedirective/basedirective.esm.min.js +1 -1
- package/basedirective/basedirective.js +9 -3
- package/basedirective/basedirective.min.js +1 -1
- package/blockui/BaseBlockUI.vue +0 -8
- package/blockui/BlockUI.d.ts +7 -3
- package/blockui/BlockUI.vue +35 -10
- package/blockui/blockui.cjs.js +34 -12
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +34 -12
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +34 -12
- package/blockui/blockui.min.js +1 -1
- package/breadcrumb/Breadcrumb.d.ts +25 -10
- package/breadcrumb/BreadcrumbItem.vue +18 -8
- package/breadcrumb/breadcrumb.cjs.js +18 -8
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +18 -8
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +18 -8
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/button/Button.d.ts +8 -7
- package/button/Button.vue +4 -0
- package/button/button.cjs.js +5 -0
- package/button/button.cjs.min.js +1 -1
- package/button/button.esm.js +5 -0
- package/button/button.esm.min.js +1 -1
- package/button/button.js +5 -0
- package/button/button.min.js +1 -1
- package/calendar/Calendar.d.ts +129 -53
- package/calendar/Calendar.vue +49 -7
- package/calendar/calendar.cjs.js +72 -35
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +72 -35
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +72 -35
- package/calendar/calendar.min.js +1 -1
- package/card/Card.d.ts +9 -9
- package/carousel/Carousel.d.ts +32 -20
- package/carousel/Carousel.vue +10 -2
- package/carousel/carousel.cjs.js +11 -2
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +11 -2
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +11 -2
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/CascadeSelect.d.ts +25 -19
- package/cascadeselect/CascadeSelect.vue +2 -1
- package/cascadeselect/CascadeSelectSub.vue +1 -0
- package/cascadeselect/cascadeselect.cjs.js +9 -7
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +9 -7
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +9 -7
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/chart/Chart.d.ts +5 -5
- package/checkbox/Checkbox.d.ts +8 -8
- package/chip/Chip.d.ts +7 -7
- package/chips/Chips.d.ts +10 -10
- package/colorpicker/ColorPicker.d.ts +18 -11
- package/colorpicker/ColorPicker.vue +1 -1
- package/colorpicker/colorpicker.cjs.js +3 -3
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +3 -3
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +3 -3
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/Column.d.ts +58 -58
- package/columngroup/ColumnGroup.d.ts +3 -3
- package/config/PrimeVue.d.ts +22 -0
- package/config/config.cjs.js +4 -1
- package/config/config.cjs.min.js +1 -1
- package/config/config.esm.js +4 -1
- package/config/config.esm.min.js +1 -1
- package/config/config.js +4 -1
- package/config/config.min.js +1 -1
- package/confirmdialog/ConfirmDialog.d.ts +14 -14
- package/confirmpopup/ConfirmPopup.d.ts +16 -10
- package/confirmpopup/ConfirmPopup.vue +1 -1
- package/confirmpopup/confirmpopup.cjs.js +3 -3
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +4 -4
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +3 -3
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/ContextMenu.d.ts +27 -13
- package/contextmenu/ContextMenu.vue +1 -1
- package/contextmenu/ContextMenuSub.vue +14 -12
- package/contextmenu/contextmenu.cjs.js +19 -17
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +20 -18
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +19 -17
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +4538 -507
- package/core/core.min.js +19 -15
- package/datatable/BaseDataTable.vue +1 -1
- package/datatable/BodyCell.vue +1 -0
- package/datatable/ColumnFilter.vue +1 -1
- package/datatable/DataTable.d.ts +37 -31
- package/datatable/DataTable.vue +4 -1
- package/datatable/datatable.cjs.js +10 -5
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +10 -5
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +10 -5
- package/datatable/datatable.min.js +1 -1
- package/dataview/DataView.d.ts +10 -10
- package/dataviewlayoutoptions/DataViewLayoutOptions.d.ts +7 -7
- package/deferredcontent/DeferredContent.d.ts +3 -3
- package/dialog/BaseDialog.vue +3 -7
- package/dialog/Dialog.d.ts +21 -15
- package/dialog/Dialog.vue +2 -1
- package/dialog/dialog.cjs.js +9 -6
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +9 -6
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +9 -6
- package/dialog/dialog.min.js +1 -1
- package/divider/BaseDivider.vue +9 -24
- package/divider/Divider.d.ts +4 -4
- package/divider/Divider.vue +1 -1
- package/divider/divider.cjs.js +15 -2
- package/divider/divider.cjs.min.js +1 -1
- package/divider/divider.esm.js +15 -2
- package/divider/divider.esm.min.js +1 -1
- package/divider/divider.js +15 -2
- package/divider/divider.min.js +1 -1
- package/dock/BaseDock.vue +1 -1
- package/dock/Dock.d.ts +13 -9
- package/dock/Dock.vue +19 -2
- package/dock/DockSub.vue +8 -7
- package/dock/dock.cjs.js +18 -11
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.esm.js +18 -11
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +18 -11
- package/dock/dock.min.js +1 -1
- package/dropdown/BaseDropdown.vue +5 -5
- package/dropdown/Dropdown.d.ts +34 -28
- package/dropdown/Dropdown.vue +2 -2
- package/dropdown/dropdown.cjs.js +9 -9
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +9 -9
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +9 -9
- package/dropdown/dropdown.min.js +1 -1
- package/editor/BaseEditor.vue +0 -14
- package/editor/Editor.d.ts +19 -19
- package/editor/Editor.vue +20 -20
- package/editor/editor.cjs.js +20 -34
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +20 -34
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +20 -34
- package/editor/editor.min.js +1 -1
- package/fieldset/Fieldset.d.ts +17 -11
- package/fieldset/Fieldset.vue +1 -1
- package/fieldset/fieldset.cjs.js +3 -3
- package/fieldset/fieldset.cjs.min.js +1 -1
- package/fieldset/fieldset.esm.js +3 -3
- package/fieldset/fieldset.esm.min.js +1 -1
- package/fieldset/fieldset.js +3 -3
- package/fieldset/fieldset.min.js +1 -1
- package/fileupload/FileUpload.d.ts +24 -24
- package/fileupload/FileUpload.vue +4 -4
- package/fileupload/fileupload.cjs.js +10 -4
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.esm.js +10 -4
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +10 -4
- package/fileupload/fileupload.min.js +1 -1
- package/focustrap/FocusTrap.d.ts +5 -5
- package/galleria/Galleria.d.ts +53 -34
- package/galleria/Galleria.vue +1 -1
- package/galleria/GalleriaItem.vue +9 -2
- package/galleria/GalleriaThumbnails.vue +1 -0
- package/galleria/galleria.cjs.js +14 -5
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +14 -5
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +14 -5
- package/galleria/galleria.min.js +1 -1
- package/image/Image.d.ts +28 -21
- package/image/Image.vue +4 -4
- package/image/image.cjs.js +6 -5
- package/image/image.cjs.min.js +1 -1
- package/image/image.esm.js +6 -5
- package/image/image.esm.min.js +1 -1
- package/image/image.js +6 -5
- package/image/image.min.js +1 -1
- package/inlinemessage/InlineMessage.d.ts +5 -5
- package/inplace/Inplace.d.ts +8 -8
- package/inputmask/InputMask.d.ts +32 -4
- package/inputmask/InputMask.vue +9 -1
- package/inputmask/inputmask.cjs.js +9 -1
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +9 -1
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +9 -1
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/InputNumber.d.ts +10 -10
- package/inputswitch/InputSwitch.d.ts +9 -9
- package/inputtext/InputText.d.ts +3 -3
- package/knob/Knob.d.ts +7 -7
- package/listbox/Listbox.d.ts +18 -18
- package/megamenu/MegaMenu.d.ts +26 -18
- package/megamenu/MegaMenuSub.vue +14 -11
- package/megamenu/megamenu.cjs.js +15 -12
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +15 -12
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +15 -12
- package/megamenu/megamenu.min.js +1 -1
- package/menu/Menu.d.ts +28 -14
- package/menu/Menu.vue +2 -2
- package/menu/Menuitem.vue +4 -1
- package/menu/menu.cjs.js +9 -5
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +9 -5
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +9 -5
- package/menu/menu.min.js +1 -1
- package/menubar/Menubar.d.ts +29 -17
- package/menubar/MenubarSub.vue +15 -11
- package/menubar/menubar.cjs.js +16 -12
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +16 -12
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +16 -12
- package/menubar/menubar.min.js +1 -1
- package/message/Message.d.ts +18 -12
- package/message/Message.vue +1 -1
- package/message/message.cjs.js +3 -3
- package/message/message.cjs.min.js +1 -1
- package/message/message.esm.js +4 -4
- package/message/message.esm.min.js +1 -1
- package/message/message.js +3 -3
- package/message/message.min.js +1 -1
- package/multiselect/MultiSelect.d.ts +47 -41
- package/multiselect/MultiSelect.vue +1 -1
- package/multiselect/multiselect.cjs.js +3 -3
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +3 -3
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +3 -3
- package/multiselect/multiselect.min.js +1 -1
- package/orderlist/OrderList.d.ts +24 -18
- package/orderlist/OrderList.vue +2 -1
- package/orderlist/orderlist.cjs.js +3 -1
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +3 -1
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +3 -1
- package/orderlist/orderlist.min.js +1 -1
- package/organizationchart/OrganizationChart.d.ts +15 -15
- package/overlaypanel/OverlayPanel.d.ts +13 -7
- package/overlaypanel/OverlayPanel.vue +2 -1
- package/overlaypanel/overlaypanel.cjs.js +5 -3
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +6 -4
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +5 -3
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +15 -15
- package/paginator/Paginator.d.ts +20 -20
- package/paginator/Paginator.vue +2 -1
- package/paginator/paginator.cjs.js +2 -0
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +3 -1
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +2 -0
- package/paginator/paginator.min.js +1 -1
- package/panel/Panel.d.ts +19 -13
- package/panel/Panel.vue +1 -1
- package/panel/panel.cjs.js +3 -3
- package/panel/panel.cjs.min.js +1 -1
- package/panel/panel.esm.js +3 -3
- package/panel/panel.esm.min.js +1 -1
- package/panel/panel.js +3 -3
- package/panel/panel.min.js +1 -1
- package/panelmenu/PanelMenu.d.ts +35 -21
- package/panelmenu/PanelMenu.vue +13 -12
- package/panelmenu/PanelMenuSub.vue +14 -12
- package/panelmenu/panelmenu.cjs.js +31 -28
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +31 -28
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +31 -28
- package/panelmenu/panelmenu.min.js +1 -1
- package/passthrough/index.cjs.js +74 -0
- package/passthrough/index.cjs.min.js +1 -0
- package/passthrough/index.d.ts +15 -0
- package/passthrough/index.esm.js +70 -0
- package/passthrough/index.esm.min.js +1 -0
- package/passthrough/index.js +77 -0
- package/passthrough/index.min.js +1 -0
- package/passthrough/package.json +6 -0
- package/passthrough/tailwind/index.cjs.js +3828 -0
- package/passthrough/tailwind/index.cjs.min.js +1 -0
- package/passthrough/tailwind/index.d.ts +5 -0
- package/passthrough/tailwind/index.esm.js +3823 -0
- package/passthrough/tailwind/index.esm.min.js +1 -0
- package/passthrough/tailwind/index.js +3835 -0
- package/passthrough/tailwind/index.min.js +1 -0
- package/passthrough/tailwind/package.json +6 -0
- package/password/Password.d.ts +25 -14
- package/password/Password.vue +2 -1
- package/password/password.cjs.js +4 -3
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +4 -3
- package/password/password.esm.min.js +1 -1
- package/password/password.js +4 -3
- package/password/password.min.js +1 -1
- package/picklist/PickList.d.ts +42 -36
- package/picklist/PickList.vue +3 -2
- package/picklist/picklist.cjs.js +4 -2
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +4 -2
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +4 -2
- package/picklist/picklist.min.js +1 -1
- package/progressbar/ProgressBar.d.ts +5 -5
- package/progressspinner/ProgressSpinner.d.ts +5 -5
- package/radiobutton/RadioButton.d.ts +10 -10
- package/rating/Rating.d.ts +12 -12
- package/rating/Rating.vue +3 -3
- package/rating/rating.cjs.js +3 -3
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +3 -3
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +3 -3
- package/rating/rating.min.js +1 -1
- package/resources/themes/arya-blue/theme.css +7 -0
- package/resources/themes/arya-green/theme.css +7 -0
- package/resources/themes/arya-orange/theme.css +7 -0
- package/resources/themes/arya-purple/theme.css +7 -0
- package/resources/themes/bootstrap4-dark-blue/theme.css +7 -0
- package/resources/themes/bootstrap4-dark-purple/theme.css +7 -0
- package/resources/themes/bootstrap4-light-blue/theme.css +7 -0
- package/resources/themes/bootstrap4-light-purple/theme.css +7 -0
- package/resources/themes/fluent-light/theme.css +7 -0
- package/resources/themes/lara-dark-blue/theme.css +7 -0
- package/resources/themes/lara-dark-indigo/theme.css +7 -0
- package/resources/themes/lara-dark-purple/theme.css +7 -0
- package/resources/themes/lara-dark-teal/theme.css +7 -0
- package/resources/themes/lara-light-blue/theme.css +7 -0
- package/resources/themes/lara-light-indigo/theme.css +7 -0
- package/resources/themes/lara-light-purple/theme.css +7 -0
- package/resources/themes/lara-light-teal/theme.css +7 -0
- package/resources/themes/luna-amber/theme.css +7 -0
- package/resources/themes/luna-blue/theme.css +7 -0
- package/resources/themes/luna-green/theme.css +7 -0
- package/resources/themes/luna-pink/theme.css +7 -0
- package/resources/themes/md-dark-deeppurple/theme.css +7 -0
- package/resources/themes/md-dark-indigo/theme.css +7 -0
- package/resources/themes/md-light-deeppurple/theme.css +7 -0
- package/resources/themes/md-light-indigo/theme.css +7 -0
- package/resources/themes/mdc-dark-deeppurple/theme.css +7 -0
- package/resources/themes/mdc-dark-indigo/theme.css +7 -0
- package/resources/themes/mdc-light-deeppurple/theme.css +7 -0
- package/resources/themes/mdc-light-indigo/theme.css +7 -0
- package/resources/themes/mira/theme.css +7 -0
- package/resources/themes/nano/theme.css +7 -0
- package/resources/themes/nova/theme.css +7 -0
- package/resources/themes/nova-accent/theme.css +7 -0
- package/resources/themes/nova-alt/theme.css +7 -0
- package/resources/themes/nova-vue/theme.css +7 -0
- package/resources/themes/rhea/theme.css +7 -0
- package/resources/themes/saga-blue/theme.css +7 -0
- package/resources/themes/saga-green/theme.css +7 -0
- package/resources/themes/saga-orange/theme.css +7 -0
- package/resources/themes/saga-purple/theme.css +7 -0
- package/resources/themes/soho-dark/theme.css +7 -0
- package/resources/themes/soho-light/theme.css +7 -0
- package/resources/themes/tailwind-light/theme.css +7 -0
- package/resources/themes/vela-blue/theme.css +7 -0
- package/resources/themes/vela-green/theme.css +7 -0
- package/resources/themes/vela-orange/theme.css +7 -0
- package/resources/themes/vela-purple/theme.css +7 -0
- package/resources/themes/viva-dark/theme.css +7 -0
- package/resources/themes/viva-light/theme.css +7 -0
- package/ripple/Ripple.d.ts +3 -3
- package/row/Row.d.ts +2 -2
- package/scrollpanel/ScrollPanel.d.ts +7 -7
- package/scrolltop/ScrollTop.d.ts +11 -5
- package/scrolltop/ScrollTop.vue +1 -1
- package/scrolltop/scrolltop.cjs.js +3 -3
- package/scrolltop/scrolltop.cjs.min.js +1 -1
- package/scrolltop/scrolltop.esm.js +4 -4
- package/scrolltop/scrolltop.esm.min.js +1 -1
- package/scrolltop/scrolltop.js +3 -3
- package/scrolltop/scrolltop.min.js +1 -1
- package/selectbutton/SelectButton.d.ts +5 -5
- package/sidebar/Sidebar.d.ts +16 -10
- package/sidebar/Sidebar.vue +1 -1
- package/sidebar/sidebar.cjs.js +3 -3
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.esm.js +3 -3
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +3 -3
- package/sidebar/sidebar.min.js +1 -1
- package/skeleton/Skeleton.d.ts +3 -3
- package/slider/Slider.d.ts +7 -7
- package/speeddial/BaseSpeedDial.vue +12 -36
- package/speeddial/SpeedDial.d.ts +14 -9
- package/speeddial/SpeedDial.vue +5 -4
- package/speeddial/speeddial.cjs.js +44 -23
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +44 -23
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +44 -23
- package/speeddial/speeddial.min.js +1 -1
- package/splitbutton/SplitButton.d.ts +8 -8
- package/splitbutton/SplitButton.vue +22 -3
- package/splitbutton/splitbutton.cjs.js +17 -5
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.esm.js +17 -5
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +17 -5
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/Splitter.d.ts +16 -5
- package/splitter/Splitter.vue +8 -1
- package/splitter/splitter.cjs.js +9 -1
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +9 -1
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +9 -1
- package/splitter/splitter.min.js +1 -1
- package/splitterpanel/SplitterPanel.d.ts +14 -3
- package/splitterpanel/SplitterPanel.vue +8 -1
- package/splitterpanel/splitterpanel.cjs.js +8 -1
- package/splitterpanel/splitterpanel.cjs.min.js +1 -1
- package/splitterpanel/splitterpanel.esm.js +8 -1
- package/splitterpanel/splitterpanel.esm.min.js +1 -1
- package/splitterpanel/splitterpanel.js +8 -1
- package/splitterpanel/splitterpanel.min.js +1 -1
- package/steps/BaseSteps.vue +1 -1
- package/steps/Steps.d.ts +33 -8
- package/steps/Steps.vue +17 -7
- package/steps/steps.cjs.js +19 -9
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.esm.js +19 -9
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +19 -9
- package/steps/steps.min.js +1 -1
- package/styleclass/StyleClass.d.ts +2 -2
- package/tabmenu/TabMenu.d.ts +15 -11
- package/tabmenu/TabMenu.vue +11 -10
- package/tabmenu/tabmenu.cjs.js +11 -10
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +11 -10
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +11 -10
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabpanel/TabPanel.d.ts +10 -10
- package/tabview/TabView.d.ts +16 -16
- package/tabview/TabView.vue +1 -0
- package/tabview/tabview.cjs.js +2 -1
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.esm.js +2 -1
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +2 -1
- package/tabview/tabview.min.js +1 -1
- package/tag/Tag.d.ts +5 -5
- package/terminal/Terminal.d.ts +11 -11
- package/textarea/Textarea.d.ts +3 -3
- package/tieredmenu/TieredMenu.d.ts +27 -13
- package/tieredmenu/TieredMenu.vue +1 -1
- package/tieredmenu/TieredMenuSub.vue +13 -11
- package/tieredmenu/tieredmenu.cjs.js +16 -14
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +16 -14
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +16 -14
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/Timeline.d.ts +9 -9
- package/toast/BaseToast.vue +4 -0
- package/toast/Toast.d.ts +23 -17
- package/toast/Toast.vue +3 -2
- package/toast/toast.cjs.js +4 -2
- package/toast/toast.cjs.min.js +1 -1
- package/toast/toast.esm.js +5 -3
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +4 -2
- package/toast/toast.min.js +1 -1
- package/togglebutton/ToggleButton.d.ts +31 -9
- package/togglebutton/ToggleButton.vue +12 -3
- package/togglebutton/togglebutton.cjs.js +12 -3
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.esm.js +12 -3
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +12 -3
- package/togglebutton/togglebutton.min.js +1 -1
- package/toolbar/Toolbar.d.ts +6 -6
- package/toolbar/Toolbar.vue +3 -3
- package/toolbar/toolbar.cjs.js +3 -6
- package/toolbar/toolbar.cjs.min.js +1 -1
- package/toolbar/toolbar.esm.js +3 -6
- package/toolbar/toolbar.esm.min.js +1 -1
- package/toolbar/toolbar.js +3 -6
- package/toolbar/toolbar.min.js +1 -1
- package/tooltip/Tooltip.d.ts +35 -6
- package/tooltip/tooltip.cjs.js +17 -4
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +17 -4
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +413 -400
- package/tooltip/tooltip.min.js +1 -1
- package/tree/Tree.d.ts +20 -20
- package/tree/Tree.vue +1 -0
- package/tree/tree.cjs.js +3 -2
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +3 -2
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +3 -2
- package/tree/tree.min.js +1 -1
- package/treeselect/TreeSelect.d.ts +23 -17
- package/treeselect/TreeSelect.vue +2 -2
- package/treeselect/treeselect.cjs.js +4 -4
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +4 -4
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +4 -4
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/TreeTable.d.ts +21 -21
- package/treetable/TreeTable.vue +2 -1
- package/treetable/treetable.cjs.js +1 -1
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +1 -1
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +1 -1
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/TriStateCheckbox.d.ts +11 -11
- package/usestyle/UseStyle.d.ts +2 -1
- package/usestyle/usestyle.cjs.js +20 -7
- package/usestyle/usestyle.cjs.min.js +1 -1
- package/usestyle/usestyle.esm.js +20 -7
- package/usestyle/usestyle.esm.min.js +1 -1
- package/usestyle/usestyle.js +20 -7
- package/usestyle/usestyle.min.js +1 -1
- package/utils/Utils.d.ts +4 -0
- package/utils/utils.cjs.js +48 -8
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +48 -8
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +48 -8
- package/utils/utils.min.js +1 -1
- package/vetur-attributes.json +129 -125
- package/vetur-tags.json +1 -0
- package/virtualscroller/BaseVirtualScroller.vue +1 -1
- package/virtualscroller/VirtualScroller.d.ts +7 -7
- package/virtualscroller/virtualscroller.cjs.js +2 -1
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +2 -1
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +2 -1
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +160 -127
package/vetur-tags.json
CHANGED
|
@@ -110,27 +110,27 @@ export interface VirtualScrollerItemOptions {
|
|
|
110
110
|
*/
|
|
111
111
|
export interface VirtualScrollerPassThroughOptions {
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* Used to pass attributes to the root's DOM element.
|
|
114
114
|
*/
|
|
115
115
|
root?: VirtualScrollerPassThroughOptionType;
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
117
|
+
* Used to pass attributes to the content's DOM element.
|
|
118
118
|
*/
|
|
119
119
|
content?: VirtualScrollerPassThroughOptionType;
|
|
120
120
|
/**
|
|
121
|
-
*
|
|
121
|
+
* Used to pass attributes to the loader's DOM element.
|
|
122
122
|
*/
|
|
123
123
|
loader?: VirtualScrollerPassThroughOptionType;
|
|
124
124
|
/**
|
|
125
|
-
*
|
|
125
|
+
* Used to pass attributes to the loading icon's DOM element.
|
|
126
126
|
*/
|
|
127
127
|
loadingIcon?: VirtualScrollerPassThroughOptionType;
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
129
|
+
* Used to pass attributes to the spacer's DOM element.
|
|
130
130
|
*/
|
|
131
131
|
spacer?: VirtualScrollerPassThroughOptionType;
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
133
|
+
* Used to manage all lifecycle hooks
|
|
134
134
|
* @see {@link BaseComponent.ComponentHooks}
|
|
135
135
|
*/
|
|
136
136
|
hooks?: ComponentHooks;
|
|
@@ -311,7 +311,7 @@ export interface VirtualScrollerProps {
|
|
|
311
311
|
*/
|
|
312
312
|
autoSize?: boolean | undefined;
|
|
313
313
|
/**
|
|
314
|
-
*
|
|
314
|
+
* Used to pass attributes to DOM elements inside the component.
|
|
315
315
|
* @type {VirtualScrollerPassThroughOptions}
|
|
316
316
|
*/
|
|
317
317
|
pt?: VirtualScrollerPassThroughOptions;
|
|
@@ -13,7 +13,8 @@ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
|
|
13
13
|
|
|
14
14
|
var styles = "\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n";
|
|
15
15
|
var _useStyle = usestyle.useStyle(styles, {
|
|
16
|
-
name: 'virtualscroller'
|
|
16
|
+
name: 'virtualscroller',
|
|
17
|
+
manual: true
|
|
17
18
|
}),
|
|
18
19
|
loadStyle = _useStyle.load;
|
|
19
20
|
var script$1 = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("primevue/icons/spinner"),e=require("primevue/utils"),i=require("primevue/basecomponent"),s=require("primevue/usestyle"),n=require("vue");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var l=o(t),r=o(i),a=s.useStyle("\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n",{name:"virtualscroller"});function h(t){return h="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},h(t)}function c(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?c(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function d(t,e,i){return(e=m(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function m(t){var e=f(t,"string");return"symbol"===h(e)?e:String(e)}function f(t,e){if("object"!==h(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!==h(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var p={name:"VirtualScroller",extends:{name:"BaseVirtualScroller",extends:r.default,props:{id:{type:String,default:null},style:null,class:null,items:{type:Array,default:null},itemSize:{type:[Number,Array],default:0},scrollHeight:null,scrollWidth:null,orientation:{type:String,default:"vertical"},numToleratedItems:{type:Number,default:null},delay:{type:Number,default:0},resizeDelay:{type:Number,default:10},lazy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loaderDisabled:{type:Boolean,default:!1},columns:{type:Array,default:null},loading:{type:Boolean,default:!1},showSpacer:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!1},tabindex:{type:Number,default:0},inline:{type:Boolean,default:!1},step:{type:Number,default:0},appendOnly:{type:Boolean,default:!1},autoSize:{type:Boolean,default:!1}},css:{loadStyle:a.load},provide:function(){return{$parentInstance:this}}},emits:["update:numToleratedItems","scroll","scroll-index-change","lazy-load"],data:function(){return{first:this.isBoth()?{rows:0,cols:0}:0,last:this.isBoth()?{rows:0,cols:0}:0,page:this.isBoth()?{rows:0,cols:0}:0,numItemsInViewport:this.isBoth()?{rows:0,cols:0}:0,lastScrollPos:this.isBoth()?{top:0,left:0}:0,d_numToleratedItems:this.numToleratedItems,d_loading:this.loading,loaderArr:[],spacerStyle:{},contentStyle:{}}},element:null,content:null,lastScrollPos:null,scrollTimeout:null,resizeTimeout:null,defaultWidth:0,defaultHeight:0,defaultContentWidth:0,defaultContentHeight:0,isRangeChanged:!1,lazyLoadState:{},resizeListener:null,initialized:!1,watch:{numToleratedItems:function(t){this.d_numToleratedItems=t},loading:function(t){this.d_loading=t},items:function(t,e){e&&e.length===(t||[]).length||(this.init(),this.calculateAutoSize())},itemSize:function(){this.init(),this.calculateAutoSize()},orientation:function(){this.lastScrollPos=this.isBoth()?{top:0,left:0}:0},scrollHeight:function(){this.init(),this.calculateAutoSize()},scrollWidth:function(){this.init(),this.calculateAutoSize()}},mounted:function(){this.viewInit(),this.lastScrollPos=this.isBoth()?{top:0,left:0}:0,this.lazyLoadState=this.lazyLoadState||{}},updated:function(){!this.initialized&&this.viewInit()},unmounted:function(){this.unbindResizeListener(),this.initialized=!1},methods:{viewInit:function(){e.DomHandler.isVisible(this.element)&&(this.setContentEl(this.content),this.init(),this.bindResizeListener(),this.defaultWidth=e.DomHandler.getWidth(this.element),this.defaultHeight=e.DomHandler.getHeight(this.element),this.defaultContentWidth=e.DomHandler.getWidth(this.content),this.defaultContentHeight=e.DomHandler.getHeight(this.content),this.initialized=!0)},init:function(){this.disabled||(this.setSize(),this.calculateOptions(),this.setSpacerSize())},isVertical:function(){return"vertical"===this.orientation},isHorizontal:function(){return"horizontal"===this.orientation},isBoth:function(){return"both"===this.orientation},scrollTo:function(t){this.lastScrollPos=this.both?{top:0,left:0}:0,this.element&&this.element.scrollTo(t)},scrollToIndex:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",s=this.isBoth(),n=this.isHorizontal(),o=this.first,l=this.calculateNumItems().numToleratedItems,r=this.getContentPosition(),a=this.itemSize,h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<=(arguments.length>1?arguments[1]:void 0)?0:t},c=function(t,e,i){return t*e+i},u=function(){return e.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:i})},d=s?{rows:0,cols:0}:0,m=!1;s?(u(c((d={rows:h(t[0],l[0]),cols:h(t[1],l[1])}).cols,a[1],r.left),c(d.rows,a[0],r.top)),m=d.rows!==o.rows||d.cols!==o.cols):(d=h(t,l),n?u(c(d,a,r.left),0):u(0,c(d,a,r.top)),m=d!==o),this.isRangeChanged=m,this.first=d},scrollInView:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(e){var n=this.isBoth(),o=this.isHorizontal(),l=this.getRenderedRange(),r=l.first,a=l.viewport,h=function(){return i.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:s})},c="to-end"===e;if("to-start"===e){if(n)a.first.rows-r.rows>t[0]?h(a.first.cols*this.itemSize[1],(a.first.rows-1)*this.itemSize[0]):a.first.cols-r.cols>t[1]&&h((a.first.cols-1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.first-r>t){var u=(a.first-1)*this.itemSize;o?h(u,0):h(0,u)}}else if(c)if(n)a.last.rows-r.rows<=t[0]+1?h(a.first.cols*this.itemSize[1],(a.first.rows+1)*this.itemSize[0]):a.last.cols-r.cols<=t[1]+1&&h((a.first.cols+1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.last-r<=t+1){var d=(a.first+1)*this.itemSize;o?h(d,0):h(0,d)}}else this.scrollToIndex(t,s)},getRenderedRange:function(){var t=function(t,e){return Math.floor(t/(e||t))},e=this.first,i=0;if(this.element){var s=this.isBoth(),n=this.isHorizontal(),o=this.element.scrollTop,l=o.scrollTop,r=o.scrollLeft;if(s)i={rows:(e={rows:t(l,this.itemSize[0]),cols:t(r,this.itemSize[1])}).rows+this.numItemsInViewport.rows,cols:e.cols+this.numItemsInViewport.cols};else i=(e=t(n?r:l,this.itemSize))+this.numItemsInViewport}return{first:this.first,last:this.last,viewport:{first:e,last:i}}},calculateNumItems:function(){var t=this.isBoth(),e=this.isHorizontal(),i=this.itemSize,s=this.getContentPosition(),n=this.element?this.element.offsetWidth-s.left:0,o=this.element?this.element.offsetHeight-s.top:0,l=function(t,e){return Math.ceil(t/(e||t))},r=function(t){return Math.ceil(t/2)},a=t?{rows:l(o,i[0]),cols:l(n,i[1])}:l(e?n:o,i);return{numItemsInViewport:a,numToleratedItems:this.d_numToleratedItems||(t?[r(a.rows),r(a.cols)]:r(a))}},calculateOptions:function(){var t=this,e=this.isBoth(),i=this.first,s=this.calculateNumItems(),n=s.numItemsInViewport,o=s.numToleratedItems,l=function(e,i,s){return t.getLast(e+i+(e<s?2:3)*s,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},r=e?{rows:l(i.rows,n.rows,o[0]),cols:l(i.cols,n.cols,o[1],!0)}:l(i,n,o);this.last=r,this.numItemsInViewport=n,this.d_numToleratedItems=o,this.$emit("update:numToleratedItems",this.d_numToleratedItems),this.showLoader&&(this.loaderArr=e?Array.from({length:n.rows}).map((function(){return Array.from({length:n.cols})})):Array.from({length:n})),this.lazy&&Promise.resolve().then((function(){t.lazyLoadState={first:t.step?e?{rows:0,cols:i.cols}:0:i,last:Math.min(t.step?t.step:r,t.items.length)},t.$emit("lazy-load",t.lazyLoadState)}))},calculateAutoSize:function(){var t=this;this.autoSize&&!this.d_loading&&Promise.resolve().then((function(){if(t.content){var i=t.isBoth(),s=t.isHorizontal(),n=t.isVertical();t.content.style.minHeight=t.content.style.minWidth="auto",t.content.style.position="relative",t.element.style.contain="none";var o=[e.DomHandler.getWidth(t.content),e.DomHandler.getHeight(t.content)],l=o[1];o[0]!==t.defaultContentWidth&&(t.element.style.width=""),l!==t.defaultContentHeight&&(t.element.style.height="");var r=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],a=r[0],h=r[1];(i||s)&&(t.element.style.width=a<t.defaultWidth?a+"px":t.scrollWidth||t.defaultWidth+"px"),(i||n)&&(t.element.style.height=h<t.defaultHeight?h+"px":t.scrollHeight||t.defaultHeight+"px"),t.content.style.minHeight=t.content.style.minWidth="",t.content.style.position="",t.element.style.contain=""}}))},getLast:function(){return this.items?Math.min((arguments.length>1?arguments[1]:void 0)?(this.columns||this.items[0]).length:this.items.length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},getContentPosition:function(){if(this.content){var t=getComputedStyle(this.content),e=parseFloat(t.paddingLeft)+Math.max(parseFloat(t.left)||0,0),i=parseFloat(t.paddingRight)+Math.max(parseFloat(t.right)||0,0),s=parseFloat(t.paddingTop)+Math.max(parseFloat(t.top)||0,0),n=parseFloat(t.paddingBottom)+Math.max(parseFloat(t.bottom)||0,0);return{left:e,right:i,top:s,bottom:n,x:e+i,y:s+n}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},setSize:function(){var t=this;if(this.element){var e=this.isBoth(),i=this.isHorizontal(),s=this.element.parentElement,n=this.scrollWidth||"".concat(this.element.offsetWidth||s.offsetWidth,"px"),o=this.scrollHeight||"".concat(this.element.offsetHeight||s.offsetHeight,"px"),l=function(e,i){return t.element.style[e]=i};e||i?(l("height",o),l("width",n)):l("height",o)}},setSpacerSize:function(){var t=this,e=this.items;if(e){var i=this.isBoth(),s=this.isHorizontal(),n=this.getContentPosition(),o=function(e,i,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.spacerStyle=u(u({},t.spacerStyle),d({},"".concat(e),(i||[]).length*s+n+"px"))};i?(o("height",e,this.itemSize[0],n.y),o("width",this.columns||e[1],this.itemSize[1],n.x)):s?o("width",this.columns||e,this.itemSize,n.x):o("height",e,this.itemSize,n.y)}},setContentPosition:function(t){var e=this;if(this.content&&!this.appendOnly){var i=this.isBoth(),s=this.isHorizontal(),n=t?t.first:this.first,o=function(t,e){return t*e},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.contentStyle=u(u({},e.contentStyle),{transform:"translate3d(".concat(t,"px, ").concat(i,"px, 0)")})};if(i)l(o(n.cols,this.itemSize[1]),o(n.rows,this.itemSize[0]));else{var r=o(n,this.itemSize);s?l(r,0):l(0,r)}}},onScrollPositionChange:function(t){var e=this,i=t.target,s=this.isBoth(),n=this.isHorizontal(),o=this.getContentPosition(),l=function(t,e){return t?t>e?t-e:t:0},r=function(t,e){return Math.floor(t/(e||t))},a=function(t,e,i,s,n,o){return t<=n?n:o?i-s-n:e+n-1},h=function(t,e,i,s,n,o,l){return t<=o?0:Math.max(0,l?t<e?i:t-o:t>e?i:t-2*o)},c=function(t,i,s,n,o,l){var r=i+n+2*o;return t>=o&&(r+=o+1),e.getLast(r,l)},u=l(i.scrollTop,o.top),d=l(i.scrollLeft,o.left),m=s?{rows:0,cols:0}:0,f=this.last,p=!1,g=this.lastScrollPos;if(s){var y=this.lastScrollPos.top<=u,v=this.lastScrollPos.left<=d;if(!this.appendOnly||this.appendOnly&&(y||v)){var w={rows:r(u,this.itemSize[0]),cols:r(d,this.itemSize[1])},S={rows:a(w.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],y),cols:a(w.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],v)};m={rows:h(w.rows,S.rows,this.first.rows,0,0,this.d_numToleratedItems[0],y),cols:h(w.cols,S.cols,this.first.cols,0,0,this.d_numToleratedItems[1],v)},f={rows:c(w.rows,m.rows,0,this.numItemsInViewport.rows,this.d_numToleratedItems[0]),cols:c(w.cols,m.cols,0,this.numItemsInViewport.cols,this.d_numToleratedItems[1],!0)},p=m.rows!==this.first.rows||f.rows!==this.last.rows||m.cols!==this.first.cols||f.cols!==this.last.cols||this.isRangeChanged,g={top:u,left:d}}}else{var z=n?d:u,I=this.lastScrollPos<=z;if(!this.appendOnly||this.appendOnly&&I){var b=r(z,this.itemSize);f=c(b,m=h(b,a(b,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,I),this.first,0,0,this.d_numToleratedItems,I),0,this.numItemsInViewport,this.d_numToleratedItems),p=m!==this.first||f!==this.last||this.isRangeChanged,g=z}}return{first:m,last:f,isRangeChanged:p,scrollPos:g}},onScrollChange:function(t){var e=this.onScrollPositionChange(t),i=e.first,s=e.last,n=e.scrollPos;if(e.isRangeChanged){var o={first:i,last:s};if(this.setContentPosition(o),this.first=i,this.last=s,this.lastScrollPos=n,this.$emit("scroll-index-change",o),this.lazy&&this.isPageChanged(i)){var l={first:this.step?Math.min(this.getPageByFirst(i)*this.step,this.items.length-this.step):i,last:Math.min(this.step?(this.getPageByFirst(i)+1)*this.step:s,this.items.length)};(this.lazyLoadState.first!==l.first||this.lazyLoadState.last!==l.last)&&this.$emit("lazy-load",l),this.lazyLoadState=l}}},onScroll:function(t){var e=this;if(this.$emit("scroll",t),this.delay&&this.isPageChanged()){if(this.scrollTimeout&&clearTimeout(this.scrollTimeout),!this.d_loading&&this.showLoader)(this.onScrollPositionChange(t).isRangeChanged||!!this.step&&this.isPageChanged())&&(this.d_loading=!0);this.scrollTimeout=setTimeout((function(){e.onScrollChange(t),!e.d_loading||!e.showLoader||e.lazy&&void 0!==e.loading||(e.d_loading=!1,e.page=e.getPageByFirst())}),this.delay)}else this.onScrollChange(t)},onResize:function(){var t=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((function(){if(e.DomHandler.isVisible(t.element)){var i=t.isBoth(),s=t.isVertical(),n=t.isHorizontal(),o=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],l=o[0],r=o[1],a=l!==t.defaultWidth,h=r!==t.defaultHeight;(i?a||h:n?a:!!s&&h)&&(t.d_numToleratedItems=t.numToleratedItems,t.defaultWidth=l,t.defaultHeight=r,t.defaultContentWidth=e.DomHandler.getWidth(t.content),t.defaultContentHeight=e.DomHandler.getHeight(t.content),t.init())}}),this.resizeDelay)},bindResizeListener:function(){this.resizeListener||(this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener),window.addEventListener("orientationchange",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),window.removeEventListener("orientationchange",this.resizeListener),this.resizeListener=null)},getOptions:function(t){var e=(this.items||[]).length,i=this.isBoth()?this.first.rows+t:this.first+t;return{index:i,count:e,first:0===i,last:i===e-1,even:i%2==0,odd:i%2!=0}},getLoaderOptions:function(t,e){var i=this.loaderArr.length;return u({index:t,count:i,first:0===t,last:t===i-1,even:t%2==0,odd:t%2!=0},e)},getPageByFirst:function(t){return Math.floor(((null!=t?t:this.first)+4*this.d_numToleratedItems)/(this.step||1))},isPageChanged:function(t){return!this.step||this.page!==this.getPageByFirst(null!=t?t:this.first)},setContentEl:function(t){this.content=t||this.content||e.DomHandler.findSingle(this.element,'[data-pc-section="content"]')},elementRef:function(t){this.element=t},contentRef:function(t){this.content=t}},computed:{containerClass:function(){return["p-virtualscroller",this.class,{"p-virtualscroller-inline":this.inline,"p-virtualscroller-both p-both-scroll":this.isBoth(),"p-virtualscroller-horizontal p-horizontal-scroll":this.isHorizontal()}]},contentClass:function(){return["p-virtualscroller-content",{"p-virtualscroller-loading":this.d_loading}]},loaderClass:function(){return["p-virtualscroller-loader",{"p-component-overlay":!this.$slots.loader}]},loadedItems:function(){var t=this;return this.items&&!this.d_loading?this.isBoth()?this.items.slice(this.appendOnly?0:this.first.rows,this.last.rows).map((function(e){return t.columns?e:e.slice(t.appendOnly?0:t.first.cols,t.last.cols)})):this.isHorizontal()&&this.columns?this.items:this.items.slice(this.appendOnly?0:this.first,this.last):[]},loadedRows:function(){return this.d_loading?this.loaderDisabled?this.loaderArr:[]:this.loadedItems},loadedColumns:function(){if(this.columns){var t=this.isBoth(),e=this.isHorizontal();if(t||e)return this.d_loading&&this.loaderDisabled?t?this.loaderArr[0]:this.loaderArr:this.columns.slice(t?this.first.cols:this.first,t?this.last.cols:this.last)}return this.columns}},components:{SpinnerIcon:l.default}},g=["tabindex"];p.render=function(t,e,i,s,o,l){var r=n.resolveComponent("SpinnerIcon");return t.disabled?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.renderSlot(t.$slots,"default"),n.renderSlot(t.$slots,"content",{items:t.items,rows:t.items,columns:l.loadedColumns})],64)):(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,ref:l.elementRef,class:l.containerClass,tabindex:t.tabindex,style:t.style,onScroll:e[0]||(e[0]=function(){return l.onScroll&&l.onScroll.apply(l,arguments)})},t.ptm("root"),{"data-pc-name":"virtualscroller"}),[n.renderSlot(t.$slots,"content",{styleClass:l.contentClass,items:l.loadedItems,getItemOptions:l.getOptions,loading:o.d_loading,getLoaderOptions:l.getLoaderOptions,itemSize:t.itemSize,rows:l.loadedRows,columns:l.loadedColumns,contentRef:l.contentRef,spacerStyle:o.spacerStyle,contentStyle:o.contentStyle,vertical:l.isVertical(),horizontal:l.isHorizontal(),both:l.isBoth()},(function(){return[n.createElementVNode("div",n.mergeProps({ref:l.contentRef,class:l.contentClass,style:o.contentStyle},t.ptm("content")),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.loadedItems,(function(e,i){return n.renderSlot(t.$slots,"item",{key:i,item:e,options:l.getOptions(i)})})),128))],16)]})),t.showSpacer?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,class:"p-virtualscroller-spacer",style:o.spacerStyle},t.ptm("spacer")),null,16)):n.createCommentVNode("",!0),!t.loaderDisabled&&t.showLoader&&o.d_loading?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:1,class:l.loaderClass},t.ptm("loader")),[t.$slots&&t.$slots.loader?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(o.loaderArr,(function(e,i){return n.renderSlot(t.$slots,"loader",{key:i,options:l.getLoaderOptions(i,l.isBoth()&&{numCols:t.d_numItemsInViewport.cols})})})),128)):n.createCommentVNode("",!0),n.renderSlot(t.$slots,"loadingicon",{},(function(){return[n.createVNode(r,n.mergeProps({spin:"",class:"p-virtualscroller-loading-icon"},t.ptm("loadingIcon")),null,16)]}))],16)):n.createCommentVNode("",!0)],16,g))},module.exports=p;
|
|
1
|
+
"use strict";var t=require("primevue/icons/spinner"),e=require("primevue/utils"),i=require("primevue/basecomponent"),s=require("primevue/usestyle"),n=require("vue");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var l=o(t),r=o(i),a=s.useStyle("\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n",{name:"virtualscroller",manual:!0});function h(t){return h="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},h(t)}function c(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?c(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function d(t,e,i){return(e=m(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function m(t){var e=f(t,"string");return"symbol"===h(e)?e:String(e)}function f(t,e){if("object"!==h(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!==h(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var p={name:"VirtualScroller",extends:{name:"BaseVirtualScroller",extends:r.default,props:{id:{type:String,default:null},style:null,class:null,items:{type:Array,default:null},itemSize:{type:[Number,Array],default:0},scrollHeight:null,scrollWidth:null,orientation:{type:String,default:"vertical"},numToleratedItems:{type:Number,default:null},delay:{type:Number,default:0},resizeDelay:{type:Number,default:10},lazy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loaderDisabled:{type:Boolean,default:!1},columns:{type:Array,default:null},loading:{type:Boolean,default:!1},showSpacer:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!1},tabindex:{type:Number,default:0},inline:{type:Boolean,default:!1},step:{type:Number,default:0},appendOnly:{type:Boolean,default:!1},autoSize:{type:Boolean,default:!1}},css:{loadStyle:a.load},provide:function(){return{$parentInstance:this}}},emits:["update:numToleratedItems","scroll","scroll-index-change","lazy-load"],data:function(){return{first:this.isBoth()?{rows:0,cols:0}:0,last:this.isBoth()?{rows:0,cols:0}:0,page:this.isBoth()?{rows:0,cols:0}:0,numItemsInViewport:this.isBoth()?{rows:0,cols:0}:0,lastScrollPos:this.isBoth()?{top:0,left:0}:0,d_numToleratedItems:this.numToleratedItems,d_loading:this.loading,loaderArr:[],spacerStyle:{},contentStyle:{}}},element:null,content:null,lastScrollPos:null,scrollTimeout:null,resizeTimeout:null,defaultWidth:0,defaultHeight:0,defaultContentWidth:0,defaultContentHeight:0,isRangeChanged:!1,lazyLoadState:{},resizeListener:null,initialized:!1,watch:{numToleratedItems:function(t){this.d_numToleratedItems=t},loading:function(t){this.d_loading=t},items:function(t,e){e&&e.length===(t||[]).length||(this.init(),this.calculateAutoSize())},itemSize:function(){this.init(),this.calculateAutoSize()},orientation:function(){this.lastScrollPos=this.isBoth()?{top:0,left:0}:0},scrollHeight:function(){this.init(),this.calculateAutoSize()},scrollWidth:function(){this.init(),this.calculateAutoSize()}},mounted:function(){this.viewInit(),this.lastScrollPos=this.isBoth()?{top:0,left:0}:0,this.lazyLoadState=this.lazyLoadState||{}},updated:function(){!this.initialized&&this.viewInit()},unmounted:function(){this.unbindResizeListener(),this.initialized=!1},methods:{viewInit:function(){e.DomHandler.isVisible(this.element)&&(this.setContentEl(this.content),this.init(),this.bindResizeListener(),this.defaultWidth=e.DomHandler.getWidth(this.element),this.defaultHeight=e.DomHandler.getHeight(this.element),this.defaultContentWidth=e.DomHandler.getWidth(this.content),this.defaultContentHeight=e.DomHandler.getHeight(this.content),this.initialized=!0)},init:function(){this.disabled||(this.setSize(),this.calculateOptions(),this.setSpacerSize())},isVertical:function(){return"vertical"===this.orientation},isHorizontal:function(){return"horizontal"===this.orientation},isBoth:function(){return"both"===this.orientation},scrollTo:function(t){this.lastScrollPos=this.both?{top:0,left:0}:0,this.element&&this.element.scrollTo(t)},scrollToIndex:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",s=this.isBoth(),n=this.isHorizontal(),o=this.first,l=this.calculateNumItems().numToleratedItems,r=this.getContentPosition(),a=this.itemSize,h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<=(arguments.length>1?arguments[1]:void 0)?0:t},c=function(t,e,i){return t*e+i},u=function(){return e.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:i})},d=s?{rows:0,cols:0}:0,m=!1;s?(u(c((d={rows:h(t[0],l[0]),cols:h(t[1],l[1])}).cols,a[1],r.left),c(d.rows,a[0],r.top)),m=d.rows!==o.rows||d.cols!==o.cols):(d=h(t,l),n?u(c(d,a,r.left),0):u(0,c(d,a,r.top)),m=d!==o),this.isRangeChanged=m,this.first=d},scrollInView:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(e){var n=this.isBoth(),o=this.isHorizontal(),l=this.getRenderedRange(),r=l.first,a=l.viewport,h=function(){return i.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:s})},c="to-end"===e;if("to-start"===e){if(n)a.first.rows-r.rows>t[0]?h(a.first.cols*this.itemSize[1],(a.first.rows-1)*this.itemSize[0]):a.first.cols-r.cols>t[1]&&h((a.first.cols-1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.first-r>t){var u=(a.first-1)*this.itemSize;o?h(u,0):h(0,u)}}else if(c)if(n)a.last.rows-r.rows<=t[0]+1?h(a.first.cols*this.itemSize[1],(a.first.rows+1)*this.itemSize[0]):a.last.cols-r.cols<=t[1]+1&&h((a.first.cols+1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.last-r<=t+1){var d=(a.first+1)*this.itemSize;o?h(d,0):h(0,d)}}else this.scrollToIndex(t,s)},getRenderedRange:function(){var t=function(t,e){return Math.floor(t/(e||t))},e=this.first,i=0;if(this.element){var s=this.isBoth(),n=this.isHorizontal(),o=this.element.scrollTop,l=o.scrollTop,r=o.scrollLeft;if(s)i={rows:(e={rows:t(l,this.itemSize[0]),cols:t(r,this.itemSize[1])}).rows+this.numItemsInViewport.rows,cols:e.cols+this.numItemsInViewport.cols};else i=(e=t(n?r:l,this.itemSize))+this.numItemsInViewport}return{first:this.first,last:this.last,viewport:{first:e,last:i}}},calculateNumItems:function(){var t=this.isBoth(),e=this.isHorizontal(),i=this.itemSize,s=this.getContentPosition(),n=this.element?this.element.offsetWidth-s.left:0,o=this.element?this.element.offsetHeight-s.top:0,l=function(t,e){return Math.ceil(t/(e||t))},r=function(t){return Math.ceil(t/2)},a=t?{rows:l(o,i[0]),cols:l(n,i[1])}:l(e?n:o,i);return{numItemsInViewport:a,numToleratedItems:this.d_numToleratedItems||(t?[r(a.rows),r(a.cols)]:r(a))}},calculateOptions:function(){var t=this,e=this.isBoth(),i=this.first,s=this.calculateNumItems(),n=s.numItemsInViewport,o=s.numToleratedItems,l=function(e,i,s){return t.getLast(e+i+(e<s?2:3)*s,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},r=e?{rows:l(i.rows,n.rows,o[0]),cols:l(i.cols,n.cols,o[1],!0)}:l(i,n,o);this.last=r,this.numItemsInViewport=n,this.d_numToleratedItems=o,this.$emit("update:numToleratedItems",this.d_numToleratedItems),this.showLoader&&(this.loaderArr=e?Array.from({length:n.rows}).map((function(){return Array.from({length:n.cols})})):Array.from({length:n})),this.lazy&&Promise.resolve().then((function(){t.lazyLoadState={first:t.step?e?{rows:0,cols:i.cols}:0:i,last:Math.min(t.step?t.step:r,t.items.length)},t.$emit("lazy-load",t.lazyLoadState)}))},calculateAutoSize:function(){var t=this;this.autoSize&&!this.d_loading&&Promise.resolve().then((function(){if(t.content){var i=t.isBoth(),s=t.isHorizontal(),n=t.isVertical();t.content.style.minHeight=t.content.style.minWidth="auto",t.content.style.position="relative",t.element.style.contain="none";var o=[e.DomHandler.getWidth(t.content),e.DomHandler.getHeight(t.content)],l=o[1];o[0]!==t.defaultContentWidth&&(t.element.style.width=""),l!==t.defaultContentHeight&&(t.element.style.height="");var r=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],a=r[0],h=r[1];(i||s)&&(t.element.style.width=a<t.defaultWidth?a+"px":t.scrollWidth||t.defaultWidth+"px"),(i||n)&&(t.element.style.height=h<t.defaultHeight?h+"px":t.scrollHeight||t.defaultHeight+"px"),t.content.style.minHeight=t.content.style.minWidth="",t.content.style.position="",t.element.style.contain=""}}))},getLast:function(){return this.items?Math.min((arguments.length>1?arguments[1]:void 0)?(this.columns||this.items[0]).length:this.items.length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},getContentPosition:function(){if(this.content){var t=getComputedStyle(this.content),e=parseFloat(t.paddingLeft)+Math.max(parseFloat(t.left)||0,0),i=parseFloat(t.paddingRight)+Math.max(parseFloat(t.right)||0,0),s=parseFloat(t.paddingTop)+Math.max(parseFloat(t.top)||0,0),n=parseFloat(t.paddingBottom)+Math.max(parseFloat(t.bottom)||0,0);return{left:e,right:i,top:s,bottom:n,x:e+i,y:s+n}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},setSize:function(){var t=this;if(this.element){var e=this.isBoth(),i=this.isHorizontal(),s=this.element.parentElement,n=this.scrollWidth||"".concat(this.element.offsetWidth||s.offsetWidth,"px"),o=this.scrollHeight||"".concat(this.element.offsetHeight||s.offsetHeight,"px"),l=function(e,i){return t.element.style[e]=i};e||i?(l("height",o),l("width",n)):l("height",o)}},setSpacerSize:function(){var t=this,e=this.items;if(e){var i=this.isBoth(),s=this.isHorizontal(),n=this.getContentPosition(),o=function(e,i,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.spacerStyle=u(u({},t.spacerStyle),d({},"".concat(e),(i||[]).length*s+n+"px"))};i?(o("height",e,this.itemSize[0],n.y),o("width",this.columns||e[1],this.itemSize[1],n.x)):s?o("width",this.columns||e,this.itemSize,n.x):o("height",e,this.itemSize,n.y)}},setContentPosition:function(t){var e=this;if(this.content&&!this.appendOnly){var i=this.isBoth(),s=this.isHorizontal(),n=t?t.first:this.first,o=function(t,e){return t*e},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.contentStyle=u(u({},e.contentStyle),{transform:"translate3d(".concat(t,"px, ").concat(i,"px, 0)")})};if(i)l(o(n.cols,this.itemSize[1]),o(n.rows,this.itemSize[0]));else{var r=o(n,this.itemSize);s?l(r,0):l(0,r)}}},onScrollPositionChange:function(t){var e=this,i=t.target,s=this.isBoth(),n=this.isHorizontal(),o=this.getContentPosition(),l=function(t,e){return t?t>e?t-e:t:0},r=function(t,e){return Math.floor(t/(e||t))},a=function(t,e,i,s,n,o){return t<=n?n:o?i-s-n:e+n-1},h=function(t,e,i,s,n,o,l){return t<=o?0:Math.max(0,l?t<e?i:t-o:t>e?i:t-2*o)},c=function(t,i,s,n,o,l){var r=i+n+2*o;return t>=o&&(r+=o+1),e.getLast(r,l)},u=l(i.scrollTop,o.top),d=l(i.scrollLeft,o.left),m=s?{rows:0,cols:0}:0,f=this.last,p=!1,g=this.lastScrollPos;if(s){var y=this.lastScrollPos.top<=u,v=this.lastScrollPos.left<=d;if(!this.appendOnly||this.appendOnly&&(y||v)){var w={rows:r(u,this.itemSize[0]),cols:r(d,this.itemSize[1])},S={rows:a(w.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],y),cols:a(w.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],v)};m={rows:h(w.rows,S.rows,this.first.rows,0,0,this.d_numToleratedItems[0],y),cols:h(w.cols,S.cols,this.first.cols,0,0,this.d_numToleratedItems[1],v)},f={rows:c(w.rows,m.rows,0,this.numItemsInViewport.rows,this.d_numToleratedItems[0]),cols:c(w.cols,m.cols,0,this.numItemsInViewport.cols,this.d_numToleratedItems[1],!0)},p=m.rows!==this.first.rows||f.rows!==this.last.rows||m.cols!==this.first.cols||f.cols!==this.last.cols||this.isRangeChanged,g={top:u,left:d}}}else{var z=n?d:u,I=this.lastScrollPos<=z;if(!this.appendOnly||this.appendOnly&&I){var b=r(z,this.itemSize);f=c(b,m=h(b,a(b,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,I),this.first,0,0,this.d_numToleratedItems,I),0,this.numItemsInViewport,this.d_numToleratedItems),p=m!==this.first||f!==this.last||this.isRangeChanged,g=z}}return{first:m,last:f,isRangeChanged:p,scrollPos:g}},onScrollChange:function(t){var e=this.onScrollPositionChange(t),i=e.first,s=e.last,n=e.scrollPos;if(e.isRangeChanged){var o={first:i,last:s};if(this.setContentPosition(o),this.first=i,this.last=s,this.lastScrollPos=n,this.$emit("scroll-index-change",o),this.lazy&&this.isPageChanged(i)){var l={first:this.step?Math.min(this.getPageByFirst(i)*this.step,this.items.length-this.step):i,last:Math.min(this.step?(this.getPageByFirst(i)+1)*this.step:s,this.items.length)};(this.lazyLoadState.first!==l.first||this.lazyLoadState.last!==l.last)&&this.$emit("lazy-load",l),this.lazyLoadState=l}}},onScroll:function(t){var e=this;if(this.$emit("scroll",t),this.delay&&this.isPageChanged()){if(this.scrollTimeout&&clearTimeout(this.scrollTimeout),!this.d_loading&&this.showLoader)(this.onScrollPositionChange(t).isRangeChanged||!!this.step&&this.isPageChanged())&&(this.d_loading=!0);this.scrollTimeout=setTimeout((function(){e.onScrollChange(t),!e.d_loading||!e.showLoader||e.lazy&&void 0!==e.loading||(e.d_loading=!1,e.page=e.getPageByFirst())}),this.delay)}else this.onScrollChange(t)},onResize:function(){var t=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((function(){if(e.DomHandler.isVisible(t.element)){var i=t.isBoth(),s=t.isVertical(),n=t.isHorizontal(),o=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],l=o[0],r=o[1],a=l!==t.defaultWidth,h=r!==t.defaultHeight;(i?a||h:n?a:!!s&&h)&&(t.d_numToleratedItems=t.numToleratedItems,t.defaultWidth=l,t.defaultHeight=r,t.defaultContentWidth=e.DomHandler.getWidth(t.content),t.defaultContentHeight=e.DomHandler.getHeight(t.content),t.init())}}),this.resizeDelay)},bindResizeListener:function(){this.resizeListener||(this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener),window.addEventListener("orientationchange",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),window.removeEventListener("orientationchange",this.resizeListener),this.resizeListener=null)},getOptions:function(t){var e=(this.items||[]).length,i=this.isBoth()?this.first.rows+t:this.first+t;return{index:i,count:e,first:0===i,last:i===e-1,even:i%2==0,odd:i%2!=0}},getLoaderOptions:function(t,e){var i=this.loaderArr.length;return u({index:t,count:i,first:0===t,last:t===i-1,even:t%2==0,odd:t%2!=0},e)},getPageByFirst:function(t){return Math.floor(((null!=t?t:this.first)+4*this.d_numToleratedItems)/(this.step||1))},isPageChanged:function(t){return!this.step||this.page!==this.getPageByFirst(null!=t?t:this.first)},setContentEl:function(t){this.content=t||this.content||e.DomHandler.findSingle(this.element,'[data-pc-section="content"]')},elementRef:function(t){this.element=t},contentRef:function(t){this.content=t}},computed:{containerClass:function(){return["p-virtualscroller",this.class,{"p-virtualscroller-inline":this.inline,"p-virtualscroller-both p-both-scroll":this.isBoth(),"p-virtualscroller-horizontal p-horizontal-scroll":this.isHorizontal()}]},contentClass:function(){return["p-virtualscroller-content",{"p-virtualscroller-loading":this.d_loading}]},loaderClass:function(){return["p-virtualscroller-loader",{"p-component-overlay":!this.$slots.loader}]},loadedItems:function(){var t=this;return this.items&&!this.d_loading?this.isBoth()?this.items.slice(this.appendOnly?0:this.first.rows,this.last.rows).map((function(e){return t.columns?e:e.slice(t.appendOnly?0:t.first.cols,t.last.cols)})):this.isHorizontal()&&this.columns?this.items:this.items.slice(this.appendOnly?0:this.first,this.last):[]},loadedRows:function(){return this.d_loading?this.loaderDisabled?this.loaderArr:[]:this.loadedItems},loadedColumns:function(){if(this.columns){var t=this.isBoth(),e=this.isHorizontal();if(t||e)return this.d_loading&&this.loaderDisabled?t?this.loaderArr[0]:this.loaderArr:this.columns.slice(t?this.first.cols:this.first,t?this.last.cols:this.last)}return this.columns}},components:{SpinnerIcon:l.default}},g=["tabindex"];p.render=function(t,e,i,s,o,l){var r=n.resolveComponent("SpinnerIcon");return t.disabled?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.renderSlot(t.$slots,"default"),n.renderSlot(t.$slots,"content",{items:t.items,rows:t.items,columns:l.loadedColumns})],64)):(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,ref:l.elementRef,class:l.containerClass,tabindex:t.tabindex,style:t.style,onScroll:e[0]||(e[0]=function(){return l.onScroll&&l.onScroll.apply(l,arguments)})},t.ptm("root"),{"data-pc-name":"virtualscroller"}),[n.renderSlot(t.$slots,"content",{styleClass:l.contentClass,items:l.loadedItems,getItemOptions:l.getOptions,loading:o.d_loading,getLoaderOptions:l.getLoaderOptions,itemSize:t.itemSize,rows:l.loadedRows,columns:l.loadedColumns,contentRef:l.contentRef,spacerStyle:o.spacerStyle,contentStyle:o.contentStyle,vertical:l.isVertical(),horizontal:l.isHorizontal(),both:l.isBoth()},(function(){return[n.createElementVNode("div",n.mergeProps({ref:l.contentRef,class:l.contentClass,style:o.contentStyle},t.ptm("content")),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.loadedItems,(function(e,i){return n.renderSlot(t.$slots,"item",{key:i,item:e,options:l.getOptions(i)})})),128))],16)]})),t.showSpacer?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,class:"p-virtualscroller-spacer",style:o.spacerStyle},t.ptm("spacer")),null,16)):n.createCommentVNode("",!0),!t.loaderDisabled&&t.showLoader&&o.d_loading?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:1,class:l.loaderClass},t.ptm("loader")),[t.$slots&&t.$slots.loader?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(o.loaderArr,(function(e,i){return n.renderSlot(t.$slots,"loader",{key:i,options:l.getLoaderOptions(i,l.isBoth()&&{numCols:t.d_numItemsInViewport.cols})})})),128)):n.createCommentVNode("",!0),n.renderSlot(t.$slots,"loadingicon",{},(function(){return[n.createVNode(r,n.mergeProps({spin:"",class:"p-virtualscroller-loading-icon"},t.ptm("loadingIcon")),null,16)]}))],16)):n.createCommentVNode("",!0)],16,g))},module.exports=p;
|
|
@@ -6,7 +6,8 @@ import { resolveComponent, openBlock, createElementBlock, mergeProps, renderSlot
|
|
|
6
6
|
|
|
7
7
|
var styles = "\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n";
|
|
8
8
|
var _useStyle = useStyle(styles, {
|
|
9
|
-
name: 'virtualscroller'
|
|
9
|
+
name: 'virtualscroller',
|
|
10
|
+
manual: true
|
|
10
11
|
}),
|
|
11
12
|
loadStyle = _useStyle.load;
|
|
12
13
|
var script$1 = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"primevue/icons/spinner";import{DomHandler as e}from"primevue/utils";import i from"primevue/basecomponent";import{useStyle as s}from"primevue/usestyle";import{resolveComponent as n,openBlock as o,createElementBlock as l,mergeProps as r,renderSlot as a,createElementVNode as h,Fragment as c,renderList as u,createCommentVNode as d,createVNode as m}from"vue";var f=s("\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n",{name:"virtualscroller"});function p(t){return p="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},p(t)}function g(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function y(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?g(Object(i),!0).forEach((function(e){v(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):g(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function v(t,e,i){return(e=w(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function w(t){var e=z(t,"string");return"symbol"===p(e)?e:String(e)}function z(t,e){if("object"!==p(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!==p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var S={name:"VirtualScroller",extends:{name:"BaseVirtualScroller",extends:i,props:{id:{type:String,default:null},style:null,class:null,items:{type:Array,default:null},itemSize:{type:[Number,Array],default:0},scrollHeight:null,scrollWidth:null,orientation:{type:String,default:"vertical"},numToleratedItems:{type:Number,default:null},delay:{type:Number,default:0},resizeDelay:{type:Number,default:10},lazy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loaderDisabled:{type:Boolean,default:!1},columns:{type:Array,default:null},loading:{type:Boolean,default:!1},showSpacer:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!1},tabindex:{type:Number,default:0},inline:{type:Boolean,default:!1},step:{type:Number,default:0},appendOnly:{type:Boolean,default:!1},autoSize:{type:Boolean,default:!1}},css:{loadStyle:f.load},provide:function(){return{$parentInstance:this}}},emits:["update:numToleratedItems","scroll","scroll-index-change","lazy-load"],data:function(){return{first:this.isBoth()?{rows:0,cols:0}:0,last:this.isBoth()?{rows:0,cols:0}:0,page:this.isBoth()?{rows:0,cols:0}:0,numItemsInViewport:this.isBoth()?{rows:0,cols:0}:0,lastScrollPos:this.isBoth()?{top:0,left:0}:0,d_numToleratedItems:this.numToleratedItems,d_loading:this.loading,loaderArr:[],spacerStyle:{},contentStyle:{}}},element:null,content:null,lastScrollPos:null,scrollTimeout:null,resizeTimeout:null,defaultWidth:0,defaultHeight:0,defaultContentWidth:0,defaultContentHeight:0,isRangeChanged:!1,lazyLoadState:{},resizeListener:null,initialized:!1,watch:{numToleratedItems:function(t){this.d_numToleratedItems=t},loading:function(t){this.d_loading=t},items:function(t,e){e&&e.length===(t||[]).length||(this.init(),this.calculateAutoSize())},itemSize:function(){this.init(),this.calculateAutoSize()},orientation:function(){this.lastScrollPos=this.isBoth()?{top:0,left:0}:0},scrollHeight:function(){this.init(),this.calculateAutoSize()},scrollWidth:function(){this.init(),this.calculateAutoSize()}},mounted:function(){this.viewInit(),this.lastScrollPos=this.isBoth()?{top:0,left:0}:0,this.lazyLoadState=this.lazyLoadState||{}},updated:function(){!this.initialized&&this.viewInit()},unmounted:function(){this.unbindResizeListener(),this.initialized=!1},methods:{viewInit:function(){e.isVisible(this.element)&&(this.setContentEl(this.content),this.init(),this.bindResizeListener(),this.defaultWidth=e.getWidth(this.element),this.defaultHeight=e.getHeight(this.element),this.defaultContentWidth=e.getWidth(this.content),this.defaultContentHeight=e.getHeight(this.content),this.initialized=!0)},init:function(){this.disabled||(this.setSize(),this.calculateOptions(),this.setSpacerSize())},isVertical:function(){return"vertical"===this.orientation},isHorizontal:function(){return"horizontal"===this.orientation},isBoth:function(){return"both"===this.orientation},scrollTo:function(t){this.lastScrollPos=this.both?{top:0,left:0}:0,this.element&&this.element.scrollTo(t)},scrollToIndex:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",s=this.isBoth(),n=this.isHorizontal(),o=this.first,l=this.calculateNumItems().numToleratedItems,r=this.getContentPosition(),a=this.itemSize,h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<=(arguments.length>1?arguments[1]:void 0)?0:t},c=function(t,e,i){return t*e+i},u=function(){return e.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:i})},d=s?{rows:0,cols:0}:0,m=!1;s?(u(c((d={rows:h(t[0],l[0]),cols:h(t[1],l[1])}).cols,a[1],r.left),c(d.rows,a[0],r.top)),m=d.rows!==o.rows||d.cols!==o.cols):(d=h(t,l),n?u(c(d,a,r.left),0):u(0,c(d,a,r.top)),m=d!==o),this.isRangeChanged=m,this.first=d},scrollInView:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(e){var n=this.isBoth(),o=this.isHorizontal(),l=this.getRenderedRange(),r=l.first,a=l.viewport,h=function(){return i.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:s})},c="to-end"===e;if("to-start"===e){if(n)a.first.rows-r.rows>t[0]?h(a.first.cols*this.itemSize[1],(a.first.rows-1)*this.itemSize[0]):a.first.cols-r.cols>t[1]&&h((a.first.cols-1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.first-r>t){var u=(a.first-1)*this.itemSize;o?h(u,0):h(0,u)}}else if(c)if(n)a.last.rows-r.rows<=t[0]+1?h(a.first.cols*this.itemSize[1],(a.first.rows+1)*this.itemSize[0]):a.last.cols-r.cols<=t[1]+1&&h((a.first.cols+1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.last-r<=t+1){var d=(a.first+1)*this.itemSize;o?h(d,0):h(0,d)}}else this.scrollToIndex(t,s)},getRenderedRange:function(){var t=function(t,e){return Math.floor(t/(e||t))},e=this.first,i=0;if(this.element){var s=this.isBoth(),n=this.isHorizontal(),o=this.element.scrollTop,l=o.scrollTop,r=o.scrollLeft;if(s)i={rows:(e={rows:t(l,this.itemSize[0]),cols:t(r,this.itemSize[1])}).rows+this.numItemsInViewport.rows,cols:e.cols+this.numItemsInViewport.cols};else i=(e=t(n?r:l,this.itemSize))+this.numItemsInViewport}return{first:this.first,last:this.last,viewport:{first:e,last:i}}},calculateNumItems:function(){var t=this.isBoth(),e=this.isHorizontal(),i=this.itemSize,s=this.getContentPosition(),n=this.element?this.element.offsetWidth-s.left:0,o=this.element?this.element.offsetHeight-s.top:0,l=function(t,e){return Math.ceil(t/(e||t))},r=function(t){return Math.ceil(t/2)},a=t?{rows:l(o,i[0]),cols:l(n,i[1])}:l(e?n:o,i);return{numItemsInViewport:a,numToleratedItems:this.d_numToleratedItems||(t?[r(a.rows),r(a.cols)]:r(a))}},calculateOptions:function(){var t=this,e=this.isBoth(),i=this.first,s=this.calculateNumItems(),n=s.numItemsInViewport,o=s.numToleratedItems,l=function(e,i,s){return t.getLast(e+i+(e<s?2:3)*s,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},r=e?{rows:l(i.rows,n.rows,o[0]),cols:l(i.cols,n.cols,o[1],!0)}:l(i,n,o);this.last=r,this.numItemsInViewport=n,this.d_numToleratedItems=o,this.$emit("update:numToleratedItems",this.d_numToleratedItems),this.showLoader&&(this.loaderArr=e?Array.from({length:n.rows}).map((function(){return Array.from({length:n.cols})})):Array.from({length:n})),this.lazy&&Promise.resolve().then((function(){t.lazyLoadState={first:t.step?e?{rows:0,cols:i.cols}:0:i,last:Math.min(t.step?t.step:r,t.items.length)},t.$emit("lazy-load",t.lazyLoadState)}))},calculateAutoSize:function(){var t=this;this.autoSize&&!this.d_loading&&Promise.resolve().then((function(){if(t.content){var i=t.isBoth(),s=t.isHorizontal(),n=t.isVertical();t.content.style.minHeight=t.content.style.minWidth="auto",t.content.style.position="relative",t.element.style.contain="none";var o=[e.getWidth(t.content),e.getHeight(t.content)],l=o[1];o[0]!==t.defaultContentWidth&&(t.element.style.width=""),l!==t.defaultContentHeight&&(t.element.style.height="");var r=[e.getWidth(t.element),e.getHeight(t.element)],a=r[0],h=r[1];(i||s)&&(t.element.style.width=a<t.defaultWidth?a+"px":t.scrollWidth||t.defaultWidth+"px"),(i||n)&&(t.element.style.height=h<t.defaultHeight?h+"px":t.scrollHeight||t.defaultHeight+"px"),t.content.style.minHeight=t.content.style.minWidth="",t.content.style.position="",t.element.style.contain=""}}))},getLast:function(){return this.items?Math.min((arguments.length>1?arguments[1]:void 0)?(this.columns||this.items[0]).length:this.items.length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},getContentPosition:function(){if(this.content){var t=getComputedStyle(this.content),e=parseFloat(t.paddingLeft)+Math.max(parseFloat(t.left)||0,0),i=parseFloat(t.paddingRight)+Math.max(parseFloat(t.right)||0,0),s=parseFloat(t.paddingTop)+Math.max(parseFloat(t.top)||0,0),n=parseFloat(t.paddingBottom)+Math.max(parseFloat(t.bottom)||0,0);return{left:e,right:i,top:s,bottom:n,x:e+i,y:s+n}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},setSize:function(){var t=this;if(this.element){var e=this.isBoth(),i=this.isHorizontal(),s=this.element.parentElement,n=this.scrollWidth||"".concat(this.element.offsetWidth||s.offsetWidth,"px"),o=this.scrollHeight||"".concat(this.element.offsetHeight||s.offsetHeight,"px"),l=function(e,i){return t.element.style[e]=i};e||i?(l("height",o),l("width",n)):l("height",o)}},setSpacerSize:function(){var t=this,e=this.items;if(e){var i=this.isBoth(),s=this.isHorizontal(),n=this.getContentPosition(),o=function(e,i,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.spacerStyle=y(y({},t.spacerStyle),v({},"".concat(e),(i||[]).length*s+n+"px"))};i?(o("height",e,this.itemSize[0],n.y),o("width",this.columns||e[1],this.itemSize[1],n.x)):s?o("width",this.columns||e,this.itemSize,n.x):o("height",e,this.itemSize,n.y)}},setContentPosition:function(t){var e=this;if(this.content&&!this.appendOnly){var i=this.isBoth(),s=this.isHorizontal(),n=t?t.first:this.first,o=function(t,e){return t*e},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.contentStyle=y(y({},e.contentStyle),{transform:"translate3d(".concat(t,"px, ").concat(i,"px, 0)")})};if(i)l(o(n.cols,this.itemSize[1]),o(n.rows,this.itemSize[0]));else{var r=o(n,this.itemSize);s?l(r,0):l(0,r)}}},onScrollPositionChange:function(t){var e=this,i=t.target,s=this.isBoth(),n=this.isHorizontal(),o=this.getContentPosition(),l=function(t,e){return t?t>e?t-e:t:0},r=function(t,e){return Math.floor(t/(e||t))},a=function(t,e,i,s,n,o){return t<=n?n:o?i-s-n:e+n-1},h=function(t,e,i,s,n,o,l){return t<=o?0:Math.max(0,l?t<e?i:t-o:t>e?i:t-2*o)},c=function(t,i,s,n,o,l){var r=i+n+2*o;return t>=o&&(r+=o+1),e.getLast(r,l)},u=l(i.scrollTop,o.top),d=l(i.scrollLeft,o.left),m=s?{rows:0,cols:0}:0,f=this.last,p=!1,g=this.lastScrollPos;if(s){var y=this.lastScrollPos.top<=u,v=this.lastScrollPos.left<=d;if(!this.appendOnly||this.appendOnly&&(y||v)){var w={rows:r(u,this.itemSize[0]),cols:r(d,this.itemSize[1])},z={rows:a(w.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],y),cols:a(w.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],v)};m={rows:h(w.rows,z.rows,this.first.rows,0,0,this.d_numToleratedItems[0],y),cols:h(w.cols,z.cols,this.first.cols,0,0,this.d_numToleratedItems[1],v)},f={rows:c(w.rows,m.rows,0,this.numItemsInViewport.rows,this.d_numToleratedItems[0]),cols:c(w.cols,m.cols,0,this.numItemsInViewport.cols,this.d_numToleratedItems[1],!0)},p=m.rows!==this.first.rows||f.rows!==this.last.rows||m.cols!==this.first.cols||f.cols!==this.last.cols||this.isRangeChanged,g={top:u,left:d}}}else{var S=n?d:u,I=this.lastScrollPos<=S;if(!this.appendOnly||this.appendOnly&&I){var b=r(S,this.itemSize);f=c(b,m=h(b,a(b,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,I),this.first,0,0,this.d_numToleratedItems,I),0,this.numItemsInViewport,this.d_numToleratedItems),p=m!==this.first||f!==this.last||this.isRangeChanged,g=S}}return{first:m,last:f,isRangeChanged:p,scrollPos:g}},onScrollChange:function(t){var e=this.onScrollPositionChange(t),i=e.first,s=e.last,n=e.scrollPos;if(e.isRangeChanged){var o={first:i,last:s};if(this.setContentPosition(o),this.first=i,this.last=s,this.lastScrollPos=n,this.$emit("scroll-index-change",o),this.lazy&&this.isPageChanged(i)){var l={first:this.step?Math.min(this.getPageByFirst(i)*this.step,this.items.length-this.step):i,last:Math.min(this.step?(this.getPageByFirst(i)+1)*this.step:s,this.items.length)};(this.lazyLoadState.first!==l.first||this.lazyLoadState.last!==l.last)&&this.$emit("lazy-load",l),this.lazyLoadState=l}}},onScroll:function(t){var e=this;if(this.$emit("scroll",t),this.delay&&this.isPageChanged()){if(this.scrollTimeout&&clearTimeout(this.scrollTimeout),!this.d_loading&&this.showLoader)(this.onScrollPositionChange(t).isRangeChanged||!!this.step&&this.isPageChanged())&&(this.d_loading=!0);this.scrollTimeout=setTimeout((function(){e.onScrollChange(t),!e.d_loading||!e.showLoader||e.lazy&&void 0!==e.loading||(e.d_loading=!1,e.page=e.getPageByFirst())}),this.delay)}else this.onScrollChange(t)},onResize:function(){var t=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((function(){if(e.isVisible(t.element)){var i=t.isBoth(),s=t.isVertical(),n=t.isHorizontal(),o=[e.getWidth(t.element),e.getHeight(t.element)],l=o[0],r=o[1],a=l!==t.defaultWidth,h=r!==t.defaultHeight;(i?a||h:n?a:!!s&&h)&&(t.d_numToleratedItems=t.numToleratedItems,t.defaultWidth=l,t.defaultHeight=r,t.defaultContentWidth=e.getWidth(t.content),t.defaultContentHeight=e.getHeight(t.content),t.init())}}),this.resizeDelay)},bindResizeListener:function(){this.resizeListener||(this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener),window.addEventListener("orientationchange",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),window.removeEventListener("orientationchange",this.resizeListener),this.resizeListener=null)},getOptions:function(t){var e=(this.items||[]).length,i=this.isBoth()?this.first.rows+t:this.first+t;return{index:i,count:e,first:0===i,last:i===e-1,even:i%2==0,odd:i%2!=0}},getLoaderOptions:function(t,e){var i=this.loaderArr.length;return y({index:t,count:i,first:0===t,last:t===i-1,even:t%2==0,odd:t%2!=0},e)},getPageByFirst:function(t){return Math.floor(((null!=t?t:this.first)+4*this.d_numToleratedItems)/(this.step||1))},isPageChanged:function(t){return!this.step||this.page!==this.getPageByFirst(null!=t?t:this.first)},setContentEl:function(t){this.content=t||this.content||e.findSingle(this.element,'[data-pc-section="content"]')},elementRef:function(t){this.element=t},contentRef:function(t){this.content=t}},computed:{containerClass:function(){return["p-virtualscroller",this.class,{"p-virtualscroller-inline":this.inline,"p-virtualscroller-both p-both-scroll":this.isBoth(),"p-virtualscroller-horizontal p-horizontal-scroll":this.isHorizontal()}]},contentClass:function(){return["p-virtualscroller-content",{"p-virtualscroller-loading":this.d_loading}]},loaderClass:function(){return["p-virtualscroller-loader",{"p-component-overlay":!this.$slots.loader}]},loadedItems:function(){var t=this;return this.items&&!this.d_loading?this.isBoth()?this.items.slice(this.appendOnly?0:this.first.rows,this.last.rows).map((function(e){return t.columns?e:e.slice(t.appendOnly?0:t.first.cols,t.last.cols)})):this.isHorizontal()&&this.columns?this.items:this.items.slice(this.appendOnly?0:this.first,this.last):[]},loadedRows:function(){return this.d_loading?this.loaderDisabled?this.loaderArr:[]:this.loadedItems},loadedColumns:function(){if(this.columns){var t=this.isBoth(),e=this.isHorizontal();if(t||e)return this.d_loading&&this.loaderDisabled?t?this.loaderArr[0]:this.loaderArr:this.columns.slice(t?this.first.cols:this.first,t?this.last.cols:this.last)}return this.columns}},components:{SpinnerIcon:t}},I=["tabindex"];S.render=function(t,e,i,s,f,p){var g=n("SpinnerIcon");return t.disabled?(o(),l(c,{key:1},[a(t.$slots,"default"),a(t.$slots,"content",{items:t.items,rows:t.items,columns:p.loadedColumns})],64)):(o(),l("div",r({key:0,ref:p.elementRef,class:p.containerClass,tabindex:t.tabindex,style:t.style,onScroll:e[0]||(e[0]=function(){return p.onScroll&&p.onScroll.apply(p,arguments)})},t.ptm("root"),{"data-pc-name":"virtualscroller"}),[a(t.$slots,"content",{styleClass:p.contentClass,items:p.loadedItems,getItemOptions:p.getOptions,loading:f.d_loading,getLoaderOptions:p.getLoaderOptions,itemSize:t.itemSize,rows:p.loadedRows,columns:p.loadedColumns,contentRef:p.contentRef,spacerStyle:f.spacerStyle,contentStyle:f.contentStyle,vertical:p.isVertical(),horizontal:p.isHorizontal(),both:p.isBoth()},(function(){return[h("div",r({ref:p.contentRef,class:p.contentClass,style:f.contentStyle},t.ptm("content")),[(o(!0),l(c,null,u(p.loadedItems,(function(e,i){return a(t.$slots,"item",{key:i,item:e,options:p.getOptions(i)})})),128))],16)]})),t.showSpacer?(o(),l("div",r({key:0,class:"p-virtualscroller-spacer",style:f.spacerStyle},t.ptm("spacer")),null,16)):d("",!0),!t.loaderDisabled&&t.showLoader&&f.d_loading?(o(),l("div",r({key:1,class:p.loaderClass},t.ptm("loader")),[t.$slots&&t.$slots.loader?(o(!0),l(c,{key:0},u(f.loaderArr,(function(e,i){return a(t.$slots,"loader",{key:i,options:p.getLoaderOptions(i,p.isBoth()&&{numCols:t.d_numItemsInViewport.cols})})})),128)):d("",!0),a(t.$slots,"loadingicon",{},(function(){return[m(g,r({spin:"",class:"p-virtualscroller-loading-icon"},t.ptm("loadingIcon")),null,16)]}))],16)):d("",!0)],16,I))};export{S as default};
|
|
1
|
+
import t from"primevue/icons/spinner";import{DomHandler as e}from"primevue/utils";import i from"primevue/basecomponent";import{useStyle as s}from"primevue/usestyle";import{resolveComponent as n,openBlock as o,createElementBlock as l,mergeProps as r,renderSlot as a,createElementVNode as h,Fragment as c,renderList as u,createCommentVNode as d,createVNode as m}from"vue";var f=s("\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n",{name:"virtualscroller",manual:!0});function p(t){return p="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},p(t)}function g(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function y(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?g(Object(i),!0).forEach((function(e){v(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):g(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function v(t,e,i){return(e=w(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function w(t){var e=z(t,"string");return"symbol"===p(e)?e:String(e)}function z(t,e){if("object"!==p(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!==p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var S={name:"VirtualScroller",extends:{name:"BaseVirtualScroller",extends:i,props:{id:{type:String,default:null},style:null,class:null,items:{type:Array,default:null},itemSize:{type:[Number,Array],default:0},scrollHeight:null,scrollWidth:null,orientation:{type:String,default:"vertical"},numToleratedItems:{type:Number,default:null},delay:{type:Number,default:0},resizeDelay:{type:Number,default:10},lazy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loaderDisabled:{type:Boolean,default:!1},columns:{type:Array,default:null},loading:{type:Boolean,default:!1},showSpacer:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!1},tabindex:{type:Number,default:0},inline:{type:Boolean,default:!1},step:{type:Number,default:0},appendOnly:{type:Boolean,default:!1},autoSize:{type:Boolean,default:!1}},css:{loadStyle:f.load},provide:function(){return{$parentInstance:this}}},emits:["update:numToleratedItems","scroll","scroll-index-change","lazy-load"],data:function(){return{first:this.isBoth()?{rows:0,cols:0}:0,last:this.isBoth()?{rows:0,cols:0}:0,page:this.isBoth()?{rows:0,cols:0}:0,numItemsInViewport:this.isBoth()?{rows:0,cols:0}:0,lastScrollPos:this.isBoth()?{top:0,left:0}:0,d_numToleratedItems:this.numToleratedItems,d_loading:this.loading,loaderArr:[],spacerStyle:{},contentStyle:{}}},element:null,content:null,lastScrollPos:null,scrollTimeout:null,resizeTimeout:null,defaultWidth:0,defaultHeight:0,defaultContentWidth:0,defaultContentHeight:0,isRangeChanged:!1,lazyLoadState:{},resizeListener:null,initialized:!1,watch:{numToleratedItems:function(t){this.d_numToleratedItems=t},loading:function(t){this.d_loading=t},items:function(t,e){e&&e.length===(t||[]).length||(this.init(),this.calculateAutoSize())},itemSize:function(){this.init(),this.calculateAutoSize()},orientation:function(){this.lastScrollPos=this.isBoth()?{top:0,left:0}:0},scrollHeight:function(){this.init(),this.calculateAutoSize()},scrollWidth:function(){this.init(),this.calculateAutoSize()}},mounted:function(){this.viewInit(),this.lastScrollPos=this.isBoth()?{top:0,left:0}:0,this.lazyLoadState=this.lazyLoadState||{}},updated:function(){!this.initialized&&this.viewInit()},unmounted:function(){this.unbindResizeListener(),this.initialized=!1},methods:{viewInit:function(){e.isVisible(this.element)&&(this.setContentEl(this.content),this.init(),this.bindResizeListener(),this.defaultWidth=e.getWidth(this.element),this.defaultHeight=e.getHeight(this.element),this.defaultContentWidth=e.getWidth(this.content),this.defaultContentHeight=e.getHeight(this.content),this.initialized=!0)},init:function(){this.disabled||(this.setSize(),this.calculateOptions(),this.setSpacerSize())},isVertical:function(){return"vertical"===this.orientation},isHorizontal:function(){return"horizontal"===this.orientation},isBoth:function(){return"both"===this.orientation},scrollTo:function(t){this.lastScrollPos=this.both?{top:0,left:0}:0,this.element&&this.element.scrollTo(t)},scrollToIndex:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",s=this.isBoth(),n=this.isHorizontal(),o=this.first,l=this.calculateNumItems().numToleratedItems,r=this.getContentPosition(),a=this.itemSize,h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<=(arguments.length>1?arguments[1]:void 0)?0:t},c=function(t,e,i){return t*e+i},u=function(){return e.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:i})},d=s?{rows:0,cols:0}:0,m=!1;s?(u(c((d={rows:h(t[0],l[0]),cols:h(t[1],l[1])}).cols,a[1],r.left),c(d.rows,a[0],r.top)),m=d.rows!==o.rows||d.cols!==o.cols):(d=h(t,l),n?u(c(d,a,r.left),0):u(0,c(d,a,r.top)),m=d!==o),this.isRangeChanged=m,this.first=d},scrollInView:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(e){var n=this.isBoth(),o=this.isHorizontal(),l=this.getRenderedRange(),r=l.first,a=l.viewport,h=function(){return i.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:s})},c="to-end"===e;if("to-start"===e){if(n)a.first.rows-r.rows>t[0]?h(a.first.cols*this.itemSize[1],(a.first.rows-1)*this.itemSize[0]):a.first.cols-r.cols>t[1]&&h((a.first.cols-1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.first-r>t){var u=(a.first-1)*this.itemSize;o?h(u,0):h(0,u)}}else if(c)if(n)a.last.rows-r.rows<=t[0]+1?h(a.first.cols*this.itemSize[1],(a.first.rows+1)*this.itemSize[0]):a.last.cols-r.cols<=t[1]+1&&h((a.first.cols+1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.last-r<=t+1){var d=(a.first+1)*this.itemSize;o?h(d,0):h(0,d)}}else this.scrollToIndex(t,s)},getRenderedRange:function(){var t=function(t,e){return Math.floor(t/(e||t))},e=this.first,i=0;if(this.element){var s=this.isBoth(),n=this.isHorizontal(),o=this.element.scrollTop,l=o.scrollTop,r=o.scrollLeft;if(s)i={rows:(e={rows:t(l,this.itemSize[0]),cols:t(r,this.itemSize[1])}).rows+this.numItemsInViewport.rows,cols:e.cols+this.numItemsInViewport.cols};else i=(e=t(n?r:l,this.itemSize))+this.numItemsInViewport}return{first:this.first,last:this.last,viewport:{first:e,last:i}}},calculateNumItems:function(){var t=this.isBoth(),e=this.isHorizontal(),i=this.itemSize,s=this.getContentPosition(),n=this.element?this.element.offsetWidth-s.left:0,o=this.element?this.element.offsetHeight-s.top:0,l=function(t,e){return Math.ceil(t/(e||t))},r=function(t){return Math.ceil(t/2)},a=t?{rows:l(o,i[0]),cols:l(n,i[1])}:l(e?n:o,i);return{numItemsInViewport:a,numToleratedItems:this.d_numToleratedItems||(t?[r(a.rows),r(a.cols)]:r(a))}},calculateOptions:function(){var t=this,e=this.isBoth(),i=this.first,s=this.calculateNumItems(),n=s.numItemsInViewport,o=s.numToleratedItems,l=function(e,i,s){return t.getLast(e+i+(e<s?2:3)*s,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},r=e?{rows:l(i.rows,n.rows,o[0]),cols:l(i.cols,n.cols,o[1],!0)}:l(i,n,o);this.last=r,this.numItemsInViewport=n,this.d_numToleratedItems=o,this.$emit("update:numToleratedItems",this.d_numToleratedItems),this.showLoader&&(this.loaderArr=e?Array.from({length:n.rows}).map((function(){return Array.from({length:n.cols})})):Array.from({length:n})),this.lazy&&Promise.resolve().then((function(){t.lazyLoadState={first:t.step?e?{rows:0,cols:i.cols}:0:i,last:Math.min(t.step?t.step:r,t.items.length)},t.$emit("lazy-load",t.lazyLoadState)}))},calculateAutoSize:function(){var t=this;this.autoSize&&!this.d_loading&&Promise.resolve().then((function(){if(t.content){var i=t.isBoth(),s=t.isHorizontal(),n=t.isVertical();t.content.style.minHeight=t.content.style.minWidth="auto",t.content.style.position="relative",t.element.style.contain="none";var o=[e.getWidth(t.content),e.getHeight(t.content)],l=o[1];o[0]!==t.defaultContentWidth&&(t.element.style.width=""),l!==t.defaultContentHeight&&(t.element.style.height="");var r=[e.getWidth(t.element),e.getHeight(t.element)],a=r[0],h=r[1];(i||s)&&(t.element.style.width=a<t.defaultWidth?a+"px":t.scrollWidth||t.defaultWidth+"px"),(i||n)&&(t.element.style.height=h<t.defaultHeight?h+"px":t.scrollHeight||t.defaultHeight+"px"),t.content.style.minHeight=t.content.style.minWidth="",t.content.style.position="",t.element.style.contain=""}}))},getLast:function(){return this.items?Math.min((arguments.length>1?arguments[1]:void 0)?(this.columns||this.items[0]).length:this.items.length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},getContentPosition:function(){if(this.content){var t=getComputedStyle(this.content),e=parseFloat(t.paddingLeft)+Math.max(parseFloat(t.left)||0,0),i=parseFloat(t.paddingRight)+Math.max(parseFloat(t.right)||0,0),s=parseFloat(t.paddingTop)+Math.max(parseFloat(t.top)||0,0),n=parseFloat(t.paddingBottom)+Math.max(parseFloat(t.bottom)||0,0);return{left:e,right:i,top:s,bottom:n,x:e+i,y:s+n}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},setSize:function(){var t=this;if(this.element){var e=this.isBoth(),i=this.isHorizontal(),s=this.element.parentElement,n=this.scrollWidth||"".concat(this.element.offsetWidth||s.offsetWidth,"px"),o=this.scrollHeight||"".concat(this.element.offsetHeight||s.offsetHeight,"px"),l=function(e,i){return t.element.style[e]=i};e||i?(l("height",o),l("width",n)):l("height",o)}},setSpacerSize:function(){var t=this,e=this.items;if(e){var i=this.isBoth(),s=this.isHorizontal(),n=this.getContentPosition(),o=function(e,i,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.spacerStyle=y(y({},t.spacerStyle),v({},"".concat(e),(i||[]).length*s+n+"px"))};i?(o("height",e,this.itemSize[0],n.y),o("width",this.columns||e[1],this.itemSize[1],n.x)):s?o("width",this.columns||e,this.itemSize,n.x):o("height",e,this.itemSize,n.y)}},setContentPosition:function(t){var e=this;if(this.content&&!this.appendOnly){var i=this.isBoth(),s=this.isHorizontal(),n=t?t.first:this.first,o=function(t,e){return t*e},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.contentStyle=y(y({},e.contentStyle),{transform:"translate3d(".concat(t,"px, ").concat(i,"px, 0)")})};if(i)l(o(n.cols,this.itemSize[1]),o(n.rows,this.itemSize[0]));else{var r=o(n,this.itemSize);s?l(r,0):l(0,r)}}},onScrollPositionChange:function(t){var e=this,i=t.target,s=this.isBoth(),n=this.isHorizontal(),o=this.getContentPosition(),l=function(t,e){return t?t>e?t-e:t:0},r=function(t,e){return Math.floor(t/(e||t))},a=function(t,e,i,s,n,o){return t<=n?n:o?i-s-n:e+n-1},h=function(t,e,i,s,n,o,l){return t<=o?0:Math.max(0,l?t<e?i:t-o:t>e?i:t-2*o)},c=function(t,i,s,n,o,l){var r=i+n+2*o;return t>=o&&(r+=o+1),e.getLast(r,l)},u=l(i.scrollTop,o.top),d=l(i.scrollLeft,o.left),m=s?{rows:0,cols:0}:0,f=this.last,p=!1,g=this.lastScrollPos;if(s){var y=this.lastScrollPos.top<=u,v=this.lastScrollPos.left<=d;if(!this.appendOnly||this.appendOnly&&(y||v)){var w={rows:r(u,this.itemSize[0]),cols:r(d,this.itemSize[1])},z={rows:a(w.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],y),cols:a(w.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],v)};m={rows:h(w.rows,z.rows,this.first.rows,0,0,this.d_numToleratedItems[0],y),cols:h(w.cols,z.cols,this.first.cols,0,0,this.d_numToleratedItems[1],v)},f={rows:c(w.rows,m.rows,0,this.numItemsInViewport.rows,this.d_numToleratedItems[0]),cols:c(w.cols,m.cols,0,this.numItemsInViewport.cols,this.d_numToleratedItems[1],!0)},p=m.rows!==this.first.rows||f.rows!==this.last.rows||m.cols!==this.first.cols||f.cols!==this.last.cols||this.isRangeChanged,g={top:u,left:d}}}else{var S=n?d:u,I=this.lastScrollPos<=S;if(!this.appendOnly||this.appendOnly&&I){var b=r(S,this.itemSize);f=c(b,m=h(b,a(b,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,I),this.first,0,0,this.d_numToleratedItems,I),0,this.numItemsInViewport,this.d_numToleratedItems),p=m!==this.first||f!==this.last||this.isRangeChanged,g=S}}return{first:m,last:f,isRangeChanged:p,scrollPos:g}},onScrollChange:function(t){var e=this.onScrollPositionChange(t),i=e.first,s=e.last,n=e.scrollPos;if(e.isRangeChanged){var o={first:i,last:s};if(this.setContentPosition(o),this.first=i,this.last=s,this.lastScrollPos=n,this.$emit("scroll-index-change",o),this.lazy&&this.isPageChanged(i)){var l={first:this.step?Math.min(this.getPageByFirst(i)*this.step,this.items.length-this.step):i,last:Math.min(this.step?(this.getPageByFirst(i)+1)*this.step:s,this.items.length)};(this.lazyLoadState.first!==l.first||this.lazyLoadState.last!==l.last)&&this.$emit("lazy-load",l),this.lazyLoadState=l}}},onScroll:function(t){var e=this;if(this.$emit("scroll",t),this.delay&&this.isPageChanged()){if(this.scrollTimeout&&clearTimeout(this.scrollTimeout),!this.d_loading&&this.showLoader)(this.onScrollPositionChange(t).isRangeChanged||!!this.step&&this.isPageChanged())&&(this.d_loading=!0);this.scrollTimeout=setTimeout((function(){e.onScrollChange(t),!e.d_loading||!e.showLoader||e.lazy&&void 0!==e.loading||(e.d_loading=!1,e.page=e.getPageByFirst())}),this.delay)}else this.onScrollChange(t)},onResize:function(){var t=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((function(){if(e.isVisible(t.element)){var i=t.isBoth(),s=t.isVertical(),n=t.isHorizontal(),o=[e.getWidth(t.element),e.getHeight(t.element)],l=o[0],r=o[1],a=l!==t.defaultWidth,h=r!==t.defaultHeight;(i?a||h:n?a:!!s&&h)&&(t.d_numToleratedItems=t.numToleratedItems,t.defaultWidth=l,t.defaultHeight=r,t.defaultContentWidth=e.getWidth(t.content),t.defaultContentHeight=e.getHeight(t.content),t.init())}}),this.resizeDelay)},bindResizeListener:function(){this.resizeListener||(this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener),window.addEventListener("orientationchange",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),window.removeEventListener("orientationchange",this.resizeListener),this.resizeListener=null)},getOptions:function(t){var e=(this.items||[]).length,i=this.isBoth()?this.first.rows+t:this.first+t;return{index:i,count:e,first:0===i,last:i===e-1,even:i%2==0,odd:i%2!=0}},getLoaderOptions:function(t,e){var i=this.loaderArr.length;return y({index:t,count:i,first:0===t,last:t===i-1,even:t%2==0,odd:t%2!=0},e)},getPageByFirst:function(t){return Math.floor(((null!=t?t:this.first)+4*this.d_numToleratedItems)/(this.step||1))},isPageChanged:function(t){return!this.step||this.page!==this.getPageByFirst(null!=t?t:this.first)},setContentEl:function(t){this.content=t||this.content||e.findSingle(this.element,'[data-pc-section="content"]')},elementRef:function(t){this.element=t},contentRef:function(t){this.content=t}},computed:{containerClass:function(){return["p-virtualscroller",this.class,{"p-virtualscroller-inline":this.inline,"p-virtualscroller-both p-both-scroll":this.isBoth(),"p-virtualscroller-horizontal p-horizontal-scroll":this.isHorizontal()}]},contentClass:function(){return["p-virtualscroller-content",{"p-virtualscroller-loading":this.d_loading}]},loaderClass:function(){return["p-virtualscroller-loader",{"p-component-overlay":!this.$slots.loader}]},loadedItems:function(){var t=this;return this.items&&!this.d_loading?this.isBoth()?this.items.slice(this.appendOnly?0:this.first.rows,this.last.rows).map((function(e){return t.columns?e:e.slice(t.appendOnly?0:t.first.cols,t.last.cols)})):this.isHorizontal()&&this.columns?this.items:this.items.slice(this.appendOnly?0:this.first,this.last):[]},loadedRows:function(){return this.d_loading?this.loaderDisabled?this.loaderArr:[]:this.loadedItems},loadedColumns:function(){if(this.columns){var t=this.isBoth(),e=this.isHorizontal();if(t||e)return this.d_loading&&this.loaderDisabled?t?this.loaderArr[0]:this.loaderArr:this.columns.slice(t?this.first.cols:this.first,t?this.last.cols:this.last)}return this.columns}},components:{SpinnerIcon:t}},I=["tabindex"];S.render=function(t,e,i,s,f,p){var g=n("SpinnerIcon");return t.disabled?(o(),l(c,{key:1},[a(t.$slots,"default"),a(t.$slots,"content",{items:t.items,rows:t.items,columns:p.loadedColumns})],64)):(o(),l("div",r({key:0,ref:p.elementRef,class:p.containerClass,tabindex:t.tabindex,style:t.style,onScroll:e[0]||(e[0]=function(){return p.onScroll&&p.onScroll.apply(p,arguments)})},t.ptm("root"),{"data-pc-name":"virtualscroller"}),[a(t.$slots,"content",{styleClass:p.contentClass,items:p.loadedItems,getItemOptions:p.getOptions,loading:f.d_loading,getLoaderOptions:p.getLoaderOptions,itemSize:t.itemSize,rows:p.loadedRows,columns:p.loadedColumns,contentRef:p.contentRef,spacerStyle:f.spacerStyle,contentStyle:f.contentStyle,vertical:p.isVertical(),horizontal:p.isHorizontal(),both:p.isBoth()},(function(){return[h("div",r({ref:p.contentRef,class:p.contentClass,style:f.contentStyle},t.ptm("content")),[(o(!0),l(c,null,u(p.loadedItems,(function(e,i){return a(t.$slots,"item",{key:i,item:e,options:p.getOptions(i)})})),128))],16)]})),t.showSpacer?(o(),l("div",r({key:0,class:"p-virtualscroller-spacer",style:f.spacerStyle},t.ptm("spacer")),null,16)):d("",!0),!t.loaderDisabled&&t.showLoader&&f.d_loading?(o(),l("div",r({key:1,class:p.loaderClass},t.ptm("loader")),[t.$slots&&t.$slots.loader?(o(!0),l(c,{key:0},u(f.loaderArr,(function(e,i){return a(t.$slots,"loader",{key:i,options:p.getLoaderOptions(i,p.isBoth()&&{numCols:t.d_numItemsInViewport.cols})})})),128)):d("",!0),a(t.$slots,"loadingicon",{},(function(){return[m(g,r({spin:"",class:"p-virtualscroller-loading-icon"},t.ptm("loadingIcon")),null,16)]}))],16)):d("",!0)],16,I))};export{S as default};
|
|
@@ -9,7 +9,8 @@ this.primevue.virtualscroller = (function (SpinnerIcon, utils, BaseComponent, us
|
|
|
9
9
|
|
|
10
10
|
var styles = "\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n";
|
|
11
11
|
var _useStyle = usestyle.useStyle(styles, {
|
|
12
|
-
name: 'virtualscroller'
|
|
12
|
+
name: 'virtualscroller',
|
|
13
|
+
manual: true
|
|
13
14
|
}),
|
|
14
15
|
loadStyle = _useStyle.load;
|
|
15
16
|
var script$1 = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.virtualscroller=function(t,e,i,s,n){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var l=o(t),r=o(i),a=s.useStyle("\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n",{name:"virtualscroller"});function h(t){return h="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},h(t)}function c(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?c(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function d(t,e,i){return(e=m(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function m(t){var e=f(t,"string");return"symbol"===h(e)?e:String(e)}function f(t,e){if("object"!==h(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!==h(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var p={name:"VirtualScroller",extends:{name:"BaseVirtualScroller",extends:r.default,props:{id:{type:String,default:null},style:null,class:null,items:{type:Array,default:null},itemSize:{type:[Number,Array],default:0},scrollHeight:null,scrollWidth:null,orientation:{type:String,default:"vertical"},numToleratedItems:{type:Number,default:null},delay:{type:Number,default:0},resizeDelay:{type:Number,default:10},lazy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loaderDisabled:{type:Boolean,default:!1},columns:{type:Array,default:null},loading:{type:Boolean,default:!1},showSpacer:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!1},tabindex:{type:Number,default:0},inline:{type:Boolean,default:!1},step:{type:Number,default:0},appendOnly:{type:Boolean,default:!1},autoSize:{type:Boolean,default:!1}},css:{loadStyle:a.load},provide:function(){return{$parentInstance:this}}},emits:["update:numToleratedItems","scroll","scroll-index-change","lazy-load"],data:function(){return{first:this.isBoth()?{rows:0,cols:0}:0,last:this.isBoth()?{rows:0,cols:0}:0,page:this.isBoth()?{rows:0,cols:0}:0,numItemsInViewport:this.isBoth()?{rows:0,cols:0}:0,lastScrollPos:this.isBoth()?{top:0,left:0}:0,d_numToleratedItems:this.numToleratedItems,d_loading:this.loading,loaderArr:[],spacerStyle:{},contentStyle:{}}},element:null,content:null,lastScrollPos:null,scrollTimeout:null,resizeTimeout:null,defaultWidth:0,defaultHeight:0,defaultContentWidth:0,defaultContentHeight:0,isRangeChanged:!1,lazyLoadState:{},resizeListener:null,initialized:!1,watch:{numToleratedItems:function(t){this.d_numToleratedItems=t},loading:function(t){this.d_loading=t},items:function(t,e){e&&e.length===(t||[]).length||(this.init(),this.calculateAutoSize())},itemSize:function(){this.init(),this.calculateAutoSize()},orientation:function(){this.lastScrollPos=this.isBoth()?{top:0,left:0}:0},scrollHeight:function(){this.init(),this.calculateAutoSize()},scrollWidth:function(){this.init(),this.calculateAutoSize()}},mounted:function(){this.viewInit(),this.lastScrollPos=this.isBoth()?{top:0,left:0}:0,this.lazyLoadState=this.lazyLoadState||{}},updated:function(){!this.initialized&&this.viewInit()},unmounted:function(){this.unbindResizeListener(),this.initialized=!1},methods:{viewInit:function(){e.DomHandler.isVisible(this.element)&&(this.setContentEl(this.content),this.init(),this.bindResizeListener(),this.defaultWidth=e.DomHandler.getWidth(this.element),this.defaultHeight=e.DomHandler.getHeight(this.element),this.defaultContentWidth=e.DomHandler.getWidth(this.content),this.defaultContentHeight=e.DomHandler.getHeight(this.content),this.initialized=!0)},init:function(){this.disabled||(this.setSize(),this.calculateOptions(),this.setSpacerSize())},isVertical:function(){return"vertical"===this.orientation},isHorizontal:function(){return"horizontal"===this.orientation},isBoth:function(){return"both"===this.orientation},scrollTo:function(t){this.lastScrollPos=this.both?{top:0,left:0}:0,this.element&&this.element.scrollTo(t)},scrollToIndex:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",s=this.isBoth(),n=this.isHorizontal(),o=this.first,l=this.calculateNumItems().numToleratedItems,r=this.getContentPosition(),a=this.itemSize,h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<=(arguments.length>1?arguments[1]:void 0)?0:t},c=function(t,e,i){return t*e+i},u=function(){return e.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:i})},d=s?{rows:0,cols:0}:0,m=!1;s?(u(c((d={rows:h(t[0],l[0]),cols:h(t[1],l[1])}).cols,a[1],r.left),c(d.rows,a[0],r.top)),m=d.rows!==o.rows||d.cols!==o.cols):(d=h(t,l),n?u(c(d,a,r.left),0):u(0,c(d,a,r.top)),m=d!==o),this.isRangeChanged=m,this.first=d},scrollInView:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(e){var n=this.isBoth(),o=this.isHorizontal(),l=this.getRenderedRange(),r=l.first,a=l.viewport,h=function(){return i.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:s})},c="to-end"===e;if("to-start"===e){if(n)a.first.rows-r.rows>t[0]?h(a.first.cols*this.itemSize[1],(a.first.rows-1)*this.itemSize[0]):a.first.cols-r.cols>t[1]&&h((a.first.cols-1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.first-r>t){var u=(a.first-1)*this.itemSize;o?h(u,0):h(0,u)}}else if(c)if(n)a.last.rows-r.rows<=t[0]+1?h(a.first.cols*this.itemSize[1],(a.first.rows+1)*this.itemSize[0]):a.last.cols-r.cols<=t[1]+1&&h((a.first.cols+1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.last-r<=t+1){var d=(a.first+1)*this.itemSize;o?h(d,0):h(0,d)}}else this.scrollToIndex(t,s)},getRenderedRange:function(){var t=function(t,e){return Math.floor(t/(e||t))},e=this.first,i=0;if(this.element){var s=this.isBoth(),n=this.isHorizontal(),o=this.element.scrollTop,l=o.scrollTop,r=o.scrollLeft;if(s)i={rows:(e={rows:t(l,this.itemSize[0]),cols:t(r,this.itemSize[1])}).rows+this.numItemsInViewport.rows,cols:e.cols+this.numItemsInViewport.cols};else i=(e=t(n?r:l,this.itemSize))+this.numItemsInViewport}return{first:this.first,last:this.last,viewport:{first:e,last:i}}},calculateNumItems:function(){var t=this.isBoth(),e=this.isHorizontal(),i=this.itemSize,s=this.getContentPosition(),n=this.element?this.element.offsetWidth-s.left:0,o=this.element?this.element.offsetHeight-s.top:0,l=function(t,e){return Math.ceil(t/(e||t))},r=function(t){return Math.ceil(t/2)},a=t?{rows:l(o,i[0]),cols:l(n,i[1])}:l(e?n:o,i);return{numItemsInViewport:a,numToleratedItems:this.d_numToleratedItems||(t?[r(a.rows),r(a.cols)]:r(a))}},calculateOptions:function(){var t=this,e=this.isBoth(),i=this.first,s=this.calculateNumItems(),n=s.numItemsInViewport,o=s.numToleratedItems,l=function(e,i,s){return t.getLast(e+i+(e<s?2:3)*s,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},r=e?{rows:l(i.rows,n.rows,o[0]),cols:l(i.cols,n.cols,o[1],!0)}:l(i,n,o);this.last=r,this.numItemsInViewport=n,this.d_numToleratedItems=o,this.$emit("update:numToleratedItems",this.d_numToleratedItems),this.showLoader&&(this.loaderArr=e?Array.from({length:n.rows}).map((function(){return Array.from({length:n.cols})})):Array.from({length:n})),this.lazy&&Promise.resolve().then((function(){t.lazyLoadState={first:t.step?e?{rows:0,cols:i.cols}:0:i,last:Math.min(t.step?t.step:r,t.items.length)},t.$emit("lazy-load",t.lazyLoadState)}))},calculateAutoSize:function(){var t=this;this.autoSize&&!this.d_loading&&Promise.resolve().then((function(){if(t.content){var i=t.isBoth(),s=t.isHorizontal(),n=t.isVertical();t.content.style.minHeight=t.content.style.minWidth="auto",t.content.style.position="relative",t.element.style.contain="none";var o=[e.DomHandler.getWidth(t.content),e.DomHandler.getHeight(t.content)],l=o[1];o[0]!==t.defaultContentWidth&&(t.element.style.width=""),l!==t.defaultContentHeight&&(t.element.style.height="");var r=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],a=r[0],h=r[1];(i||s)&&(t.element.style.width=a<t.defaultWidth?a+"px":t.scrollWidth||t.defaultWidth+"px"),(i||n)&&(t.element.style.height=h<t.defaultHeight?h+"px":t.scrollHeight||t.defaultHeight+"px"),t.content.style.minHeight=t.content.style.minWidth="",t.content.style.position="",t.element.style.contain=""}}))},getLast:function(){return this.items?Math.min((arguments.length>1?arguments[1]:void 0)?(this.columns||this.items[0]).length:this.items.length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},getContentPosition:function(){if(this.content){var t=getComputedStyle(this.content),e=parseFloat(t.paddingLeft)+Math.max(parseFloat(t.left)||0,0),i=parseFloat(t.paddingRight)+Math.max(parseFloat(t.right)||0,0),s=parseFloat(t.paddingTop)+Math.max(parseFloat(t.top)||0,0),n=parseFloat(t.paddingBottom)+Math.max(parseFloat(t.bottom)||0,0);return{left:e,right:i,top:s,bottom:n,x:e+i,y:s+n}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},setSize:function(){var t=this;if(this.element){var e=this.isBoth(),i=this.isHorizontal(),s=this.element.parentElement,n=this.scrollWidth||"".concat(this.element.offsetWidth||s.offsetWidth,"px"),o=this.scrollHeight||"".concat(this.element.offsetHeight||s.offsetHeight,"px"),l=function(e,i){return t.element.style[e]=i};e||i?(l("height",o),l("width",n)):l("height",o)}},setSpacerSize:function(){var t=this,e=this.items;if(e){var i=this.isBoth(),s=this.isHorizontal(),n=this.getContentPosition(),o=function(e,i,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.spacerStyle=u(u({},t.spacerStyle),d({},"".concat(e),(i||[]).length*s+n+"px"))};i?(o("height",e,this.itemSize[0],n.y),o("width",this.columns||e[1],this.itemSize[1],n.x)):s?o("width",this.columns||e,this.itemSize,n.x):o("height",e,this.itemSize,n.y)}},setContentPosition:function(t){var e=this;if(this.content&&!this.appendOnly){var i=this.isBoth(),s=this.isHorizontal(),n=t?t.first:this.first,o=function(t,e){return t*e},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.contentStyle=u(u({},e.contentStyle),{transform:"translate3d(".concat(t,"px, ").concat(i,"px, 0)")})};if(i)l(o(n.cols,this.itemSize[1]),o(n.rows,this.itemSize[0]));else{var r=o(n,this.itemSize);s?l(r,0):l(0,r)}}},onScrollPositionChange:function(t){var e=this,i=t.target,s=this.isBoth(),n=this.isHorizontal(),o=this.getContentPosition(),l=function(t,e){return t?t>e?t-e:t:0},r=function(t,e){return Math.floor(t/(e||t))},a=function(t,e,i,s,n,o){return t<=n?n:o?i-s-n:e+n-1},h=function(t,e,i,s,n,o,l){return t<=o?0:Math.max(0,l?t<e?i:t-o:t>e?i:t-2*o)},c=function(t,i,s,n,o,l){var r=i+n+2*o;return t>=o&&(r+=o+1),e.getLast(r,l)},u=l(i.scrollTop,o.top),d=l(i.scrollLeft,o.left),m=s?{rows:0,cols:0}:0,f=this.last,p=!1,g=this.lastScrollPos;if(s){var y=this.lastScrollPos.top<=u,v=this.lastScrollPos.left<=d;if(!this.appendOnly||this.appendOnly&&(y||v)){var w={rows:r(u,this.itemSize[0]),cols:r(d,this.itemSize[1])},S={rows:a(w.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],y),cols:a(w.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],v)};m={rows:h(w.rows,S.rows,this.first.rows,0,0,this.d_numToleratedItems[0],y),cols:h(w.cols,S.cols,this.first.cols,0,0,this.d_numToleratedItems[1],v)},f={rows:c(w.rows,m.rows,0,this.numItemsInViewport.rows,this.d_numToleratedItems[0]),cols:c(w.cols,m.cols,0,this.numItemsInViewport.cols,this.d_numToleratedItems[1],!0)},p=m.rows!==this.first.rows||f.rows!==this.last.rows||m.cols!==this.first.cols||f.cols!==this.last.cols||this.isRangeChanged,g={top:u,left:d}}}else{var z=n?d:u,I=this.lastScrollPos<=z;if(!this.appendOnly||this.appendOnly&&I){var b=r(z,this.itemSize);f=c(b,m=h(b,a(b,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,I),this.first,0,0,this.d_numToleratedItems,I),0,this.numItemsInViewport,this.d_numToleratedItems),p=m!==this.first||f!==this.last||this.isRangeChanged,g=z}}return{first:m,last:f,isRangeChanged:p,scrollPos:g}},onScrollChange:function(t){var e=this.onScrollPositionChange(t),i=e.first,s=e.last,n=e.scrollPos;if(e.isRangeChanged){var o={first:i,last:s};if(this.setContentPosition(o),this.first=i,this.last=s,this.lastScrollPos=n,this.$emit("scroll-index-change",o),this.lazy&&this.isPageChanged(i)){var l={first:this.step?Math.min(this.getPageByFirst(i)*this.step,this.items.length-this.step):i,last:Math.min(this.step?(this.getPageByFirst(i)+1)*this.step:s,this.items.length)};(this.lazyLoadState.first!==l.first||this.lazyLoadState.last!==l.last)&&this.$emit("lazy-load",l),this.lazyLoadState=l}}},onScroll:function(t){var e=this;if(this.$emit("scroll",t),this.delay&&this.isPageChanged()){if(this.scrollTimeout&&clearTimeout(this.scrollTimeout),!this.d_loading&&this.showLoader)(this.onScrollPositionChange(t).isRangeChanged||!!this.step&&this.isPageChanged())&&(this.d_loading=!0);this.scrollTimeout=setTimeout((function(){e.onScrollChange(t),!e.d_loading||!e.showLoader||e.lazy&&void 0!==e.loading||(e.d_loading=!1,e.page=e.getPageByFirst())}),this.delay)}else this.onScrollChange(t)},onResize:function(){var t=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((function(){if(e.DomHandler.isVisible(t.element)){var i=t.isBoth(),s=t.isVertical(),n=t.isHorizontal(),o=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],l=o[0],r=o[1],a=l!==t.defaultWidth,h=r!==t.defaultHeight;(i?a||h:n?a:!!s&&h)&&(t.d_numToleratedItems=t.numToleratedItems,t.defaultWidth=l,t.defaultHeight=r,t.defaultContentWidth=e.DomHandler.getWidth(t.content),t.defaultContentHeight=e.DomHandler.getHeight(t.content),t.init())}}),this.resizeDelay)},bindResizeListener:function(){this.resizeListener||(this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener),window.addEventListener("orientationchange",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),window.removeEventListener("orientationchange",this.resizeListener),this.resizeListener=null)},getOptions:function(t){var e=(this.items||[]).length,i=this.isBoth()?this.first.rows+t:this.first+t;return{index:i,count:e,first:0===i,last:i===e-1,even:i%2==0,odd:i%2!=0}},getLoaderOptions:function(t,e){var i=this.loaderArr.length;return u({index:t,count:i,first:0===t,last:t===i-1,even:t%2==0,odd:t%2!=0},e)},getPageByFirst:function(t){return Math.floor(((null!=t?t:this.first)+4*this.d_numToleratedItems)/(this.step||1))},isPageChanged:function(t){return!this.step||this.page!==this.getPageByFirst(null!=t?t:this.first)},setContentEl:function(t){this.content=t||this.content||e.DomHandler.findSingle(this.element,'[data-pc-section="content"]')},elementRef:function(t){this.element=t},contentRef:function(t){this.content=t}},computed:{containerClass:function(){return["p-virtualscroller",this.class,{"p-virtualscroller-inline":this.inline,"p-virtualscroller-both p-both-scroll":this.isBoth(),"p-virtualscroller-horizontal p-horizontal-scroll":this.isHorizontal()}]},contentClass:function(){return["p-virtualscroller-content",{"p-virtualscroller-loading":this.d_loading}]},loaderClass:function(){return["p-virtualscroller-loader",{"p-component-overlay":!this.$slots.loader}]},loadedItems:function(){var t=this;return this.items&&!this.d_loading?this.isBoth()?this.items.slice(this.appendOnly?0:this.first.rows,this.last.rows).map((function(e){return t.columns?e:e.slice(t.appendOnly?0:t.first.cols,t.last.cols)})):this.isHorizontal()&&this.columns?this.items:this.items.slice(this.appendOnly?0:this.first,this.last):[]},loadedRows:function(){return this.d_loading?this.loaderDisabled?this.loaderArr:[]:this.loadedItems},loadedColumns:function(){if(this.columns){var t=this.isBoth(),e=this.isHorizontal();if(t||e)return this.d_loading&&this.loaderDisabled?t?this.loaderArr[0]:this.loaderArr:this.columns.slice(t?this.first.cols:this.first,t?this.last.cols:this.last)}return this.columns}},components:{SpinnerIcon:l.default}},g=["tabindex"];return p.render=function(t,e,i,s,o,l){var r=n.resolveComponent("SpinnerIcon");return t.disabled?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.renderSlot(t.$slots,"default"),n.renderSlot(t.$slots,"content",{items:t.items,rows:t.items,columns:l.loadedColumns})],64)):(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,ref:l.elementRef,class:l.containerClass,tabindex:t.tabindex,style:t.style,onScroll:e[0]||(e[0]=function(){return l.onScroll&&l.onScroll.apply(l,arguments)})},t.ptm("root"),{"data-pc-name":"virtualscroller"}),[n.renderSlot(t.$slots,"content",{styleClass:l.contentClass,items:l.loadedItems,getItemOptions:l.getOptions,loading:o.d_loading,getLoaderOptions:l.getLoaderOptions,itemSize:t.itemSize,rows:l.loadedRows,columns:l.loadedColumns,contentRef:l.contentRef,spacerStyle:o.spacerStyle,contentStyle:o.contentStyle,vertical:l.isVertical(),horizontal:l.isHorizontal(),both:l.isBoth()},(function(){return[n.createElementVNode("div",n.mergeProps({ref:l.contentRef,class:l.contentClass,style:o.contentStyle},t.ptm("content")),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.loadedItems,(function(e,i){return n.renderSlot(t.$slots,"item",{key:i,item:e,options:l.getOptions(i)})})),128))],16)]})),t.showSpacer?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,class:"p-virtualscroller-spacer",style:o.spacerStyle},t.ptm("spacer")),null,16)):n.createCommentVNode("",!0),!t.loaderDisabled&&t.showLoader&&o.d_loading?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:1,class:l.loaderClass},t.ptm("loader")),[t.$slots&&t.$slots.loader?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(o.loaderArr,(function(e,i){return n.renderSlot(t.$slots,"loader",{key:i,options:l.getLoaderOptions(i,l.isBoth()&&{numCols:t.d_numItemsInViewport.cols})})})),128)):n.createCommentVNode("",!0),n.renderSlot(t.$slots,"loadingicon",{},(function(){return[n.createVNode(r,n.mergeProps({spin:"",class:"p-virtualscroller-loading-icon"},t.ptm("loadingIcon")),null,16)]}))],16)):n.createCommentVNode("",!0)],16,g))},p}(primevue.icons.spinner,primevue.utils,primevue.basecomponent,primevue.usestyle,Vue);
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.virtualscroller=function(t,e,i,s,n){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var l=o(t),r=o(i),a=s.useStyle("\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /* contain: content; */\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller .p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-loading-icon.p-icon {\n width: 2rem;\n height: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n",{name:"virtualscroller",manual:!0});function h(t){return h="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},h(t)}function c(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?c(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function d(t,e,i){return(e=m(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function m(t){var e=f(t,"string");return"symbol"===h(e)?e:String(e)}function f(t,e){if("object"!==h(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!==h(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var p={name:"VirtualScroller",extends:{name:"BaseVirtualScroller",extends:r.default,props:{id:{type:String,default:null},style:null,class:null,items:{type:Array,default:null},itemSize:{type:[Number,Array],default:0},scrollHeight:null,scrollWidth:null,orientation:{type:String,default:"vertical"},numToleratedItems:{type:Number,default:null},delay:{type:Number,default:0},resizeDelay:{type:Number,default:10},lazy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loaderDisabled:{type:Boolean,default:!1},columns:{type:Array,default:null},loading:{type:Boolean,default:!1},showSpacer:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!1},tabindex:{type:Number,default:0},inline:{type:Boolean,default:!1},step:{type:Number,default:0},appendOnly:{type:Boolean,default:!1},autoSize:{type:Boolean,default:!1}},css:{loadStyle:a.load},provide:function(){return{$parentInstance:this}}},emits:["update:numToleratedItems","scroll","scroll-index-change","lazy-load"],data:function(){return{first:this.isBoth()?{rows:0,cols:0}:0,last:this.isBoth()?{rows:0,cols:0}:0,page:this.isBoth()?{rows:0,cols:0}:0,numItemsInViewport:this.isBoth()?{rows:0,cols:0}:0,lastScrollPos:this.isBoth()?{top:0,left:0}:0,d_numToleratedItems:this.numToleratedItems,d_loading:this.loading,loaderArr:[],spacerStyle:{},contentStyle:{}}},element:null,content:null,lastScrollPos:null,scrollTimeout:null,resizeTimeout:null,defaultWidth:0,defaultHeight:0,defaultContentWidth:0,defaultContentHeight:0,isRangeChanged:!1,lazyLoadState:{},resizeListener:null,initialized:!1,watch:{numToleratedItems:function(t){this.d_numToleratedItems=t},loading:function(t){this.d_loading=t},items:function(t,e){e&&e.length===(t||[]).length||(this.init(),this.calculateAutoSize())},itemSize:function(){this.init(),this.calculateAutoSize()},orientation:function(){this.lastScrollPos=this.isBoth()?{top:0,left:0}:0},scrollHeight:function(){this.init(),this.calculateAutoSize()},scrollWidth:function(){this.init(),this.calculateAutoSize()}},mounted:function(){this.viewInit(),this.lastScrollPos=this.isBoth()?{top:0,left:0}:0,this.lazyLoadState=this.lazyLoadState||{}},updated:function(){!this.initialized&&this.viewInit()},unmounted:function(){this.unbindResizeListener(),this.initialized=!1},methods:{viewInit:function(){e.DomHandler.isVisible(this.element)&&(this.setContentEl(this.content),this.init(),this.bindResizeListener(),this.defaultWidth=e.DomHandler.getWidth(this.element),this.defaultHeight=e.DomHandler.getHeight(this.element),this.defaultContentWidth=e.DomHandler.getWidth(this.content),this.defaultContentHeight=e.DomHandler.getHeight(this.content),this.initialized=!0)},init:function(){this.disabled||(this.setSize(),this.calculateOptions(),this.setSpacerSize())},isVertical:function(){return"vertical"===this.orientation},isHorizontal:function(){return"horizontal"===this.orientation},isBoth:function(){return"both"===this.orientation},scrollTo:function(t){this.lastScrollPos=this.both?{top:0,left:0}:0,this.element&&this.element.scrollTo(t)},scrollToIndex:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",s=this.isBoth(),n=this.isHorizontal(),o=this.first,l=this.calculateNumItems().numToleratedItems,r=this.getContentPosition(),a=this.itemSize,h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<=(arguments.length>1?arguments[1]:void 0)?0:t},c=function(t,e,i){return t*e+i},u=function(){return e.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:i})},d=s?{rows:0,cols:0}:0,m=!1;s?(u(c((d={rows:h(t[0],l[0]),cols:h(t[1],l[1])}).cols,a[1],r.left),c(d.rows,a[0],r.top)),m=d.rows!==o.rows||d.cols!==o.cols):(d=h(t,l),n?u(c(d,a,r.left),0):u(0,c(d,a,r.top)),m=d!==o),this.isRangeChanged=m,this.first=d},scrollInView:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(e){var n=this.isBoth(),o=this.isHorizontal(),l=this.getRenderedRange(),r=l.first,a=l.viewport,h=function(){return i.scrollTo({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:s})},c="to-end"===e;if("to-start"===e){if(n)a.first.rows-r.rows>t[0]?h(a.first.cols*this.itemSize[1],(a.first.rows-1)*this.itemSize[0]):a.first.cols-r.cols>t[1]&&h((a.first.cols-1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.first-r>t){var u=(a.first-1)*this.itemSize;o?h(u,0):h(0,u)}}else if(c)if(n)a.last.rows-r.rows<=t[0]+1?h(a.first.cols*this.itemSize[1],(a.first.rows+1)*this.itemSize[0]):a.last.cols-r.cols<=t[1]+1&&h((a.first.cols+1)*this.itemSize[1],a.first.rows*this.itemSize[0]);else if(a.last-r<=t+1){var d=(a.first+1)*this.itemSize;o?h(d,0):h(0,d)}}else this.scrollToIndex(t,s)},getRenderedRange:function(){var t=function(t,e){return Math.floor(t/(e||t))},e=this.first,i=0;if(this.element){var s=this.isBoth(),n=this.isHorizontal(),o=this.element.scrollTop,l=o.scrollTop,r=o.scrollLeft;if(s)i={rows:(e={rows:t(l,this.itemSize[0]),cols:t(r,this.itemSize[1])}).rows+this.numItemsInViewport.rows,cols:e.cols+this.numItemsInViewport.cols};else i=(e=t(n?r:l,this.itemSize))+this.numItemsInViewport}return{first:this.first,last:this.last,viewport:{first:e,last:i}}},calculateNumItems:function(){var t=this.isBoth(),e=this.isHorizontal(),i=this.itemSize,s=this.getContentPosition(),n=this.element?this.element.offsetWidth-s.left:0,o=this.element?this.element.offsetHeight-s.top:0,l=function(t,e){return Math.ceil(t/(e||t))},r=function(t){return Math.ceil(t/2)},a=t?{rows:l(o,i[0]),cols:l(n,i[1])}:l(e?n:o,i);return{numItemsInViewport:a,numToleratedItems:this.d_numToleratedItems||(t?[r(a.rows),r(a.cols)]:r(a))}},calculateOptions:function(){var t=this,e=this.isBoth(),i=this.first,s=this.calculateNumItems(),n=s.numItemsInViewport,o=s.numToleratedItems,l=function(e,i,s){return t.getLast(e+i+(e<s?2:3)*s,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},r=e?{rows:l(i.rows,n.rows,o[0]),cols:l(i.cols,n.cols,o[1],!0)}:l(i,n,o);this.last=r,this.numItemsInViewport=n,this.d_numToleratedItems=o,this.$emit("update:numToleratedItems",this.d_numToleratedItems),this.showLoader&&(this.loaderArr=e?Array.from({length:n.rows}).map((function(){return Array.from({length:n.cols})})):Array.from({length:n})),this.lazy&&Promise.resolve().then((function(){t.lazyLoadState={first:t.step?e?{rows:0,cols:i.cols}:0:i,last:Math.min(t.step?t.step:r,t.items.length)},t.$emit("lazy-load",t.lazyLoadState)}))},calculateAutoSize:function(){var t=this;this.autoSize&&!this.d_loading&&Promise.resolve().then((function(){if(t.content){var i=t.isBoth(),s=t.isHorizontal(),n=t.isVertical();t.content.style.minHeight=t.content.style.minWidth="auto",t.content.style.position="relative",t.element.style.contain="none";var o=[e.DomHandler.getWidth(t.content),e.DomHandler.getHeight(t.content)],l=o[1];o[0]!==t.defaultContentWidth&&(t.element.style.width=""),l!==t.defaultContentHeight&&(t.element.style.height="");var r=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],a=r[0],h=r[1];(i||s)&&(t.element.style.width=a<t.defaultWidth?a+"px":t.scrollWidth||t.defaultWidth+"px"),(i||n)&&(t.element.style.height=h<t.defaultHeight?h+"px":t.scrollHeight||t.defaultHeight+"px"),t.content.style.minHeight=t.content.style.minWidth="",t.content.style.position="",t.element.style.contain=""}}))},getLast:function(){return this.items?Math.min((arguments.length>1?arguments[1]:void 0)?(this.columns||this.items[0]).length:this.items.length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},getContentPosition:function(){if(this.content){var t=getComputedStyle(this.content),e=parseFloat(t.paddingLeft)+Math.max(parseFloat(t.left)||0,0),i=parseFloat(t.paddingRight)+Math.max(parseFloat(t.right)||0,0),s=parseFloat(t.paddingTop)+Math.max(parseFloat(t.top)||0,0),n=parseFloat(t.paddingBottom)+Math.max(parseFloat(t.bottom)||0,0);return{left:e,right:i,top:s,bottom:n,x:e+i,y:s+n}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},setSize:function(){var t=this;if(this.element){var e=this.isBoth(),i=this.isHorizontal(),s=this.element.parentElement,n=this.scrollWidth||"".concat(this.element.offsetWidth||s.offsetWidth,"px"),o=this.scrollHeight||"".concat(this.element.offsetHeight||s.offsetHeight,"px"),l=function(e,i){return t.element.style[e]=i};e||i?(l("height",o),l("width",n)):l("height",o)}},setSpacerSize:function(){var t=this,e=this.items;if(e){var i=this.isBoth(),s=this.isHorizontal(),n=this.getContentPosition(),o=function(e,i,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.spacerStyle=u(u({},t.spacerStyle),d({},"".concat(e),(i||[]).length*s+n+"px"))};i?(o("height",e,this.itemSize[0],n.y),o("width",this.columns||e[1],this.itemSize[1],n.x)):s?o("width",this.columns||e,this.itemSize,n.x):o("height",e,this.itemSize,n.y)}},setContentPosition:function(t){var e=this;if(this.content&&!this.appendOnly){var i=this.isBoth(),s=this.isHorizontal(),n=t?t.first:this.first,o=function(t,e){return t*e},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.contentStyle=u(u({},e.contentStyle),{transform:"translate3d(".concat(t,"px, ").concat(i,"px, 0)")})};if(i)l(o(n.cols,this.itemSize[1]),o(n.rows,this.itemSize[0]));else{var r=o(n,this.itemSize);s?l(r,0):l(0,r)}}},onScrollPositionChange:function(t){var e=this,i=t.target,s=this.isBoth(),n=this.isHorizontal(),o=this.getContentPosition(),l=function(t,e){return t?t>e?t-e:t:0},r=function(t,e){return Math.floor(t/(e||t))},a=function(t,e,i,s,n,o){return t<=n?n:o?i-s-n:e+n-1},h=function(t,e,i,s,n,o,l){return t<=o?0:Math.max(0,l?t<e?i:t-o:t>e?i:t-2*o)},c=function(t,i,s,n,o,l){var r=i+n+2*o;return t>=o&&(r+=o+1),e.getLast(r,l)},u=l(i.scrollTop,o.top),d=l(i.scrollLeft,o.left),m=s?{rows:0,cols:0}:0,f=this.last,p=!1,g=this.lastScrollPos;if(s){var y=this.lastScrollPos.top<=u,v=this.lastScrollPos.left<=d;if(!this.appendOnly||this.appendOnly&&(y||v)){var w={rows:r(u,this.itemSize[0]),cols:r(d,this.itemSize[1])},S={rows:a(w.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],y),cols:a(w.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],v)};m={rows:h(w.rows,S.rows,this.first.rows,0,0,this.d_numToleratedItems[0],y),cols:h(w.cols,S.cols,this.first.cols,0,0,this.d_numToleratedItems[1],v)},f={rows:c(w.rows,m.rows,0,this.numItemsInViewport.rows,this.d_numToleratedItems[0]),cols:c(w.cols,m.cols,0,this.numItemsInViewport.cols,this.d_numToleratedItems[1],!0)},p=m.rows!==this.first.rows||f.rows!==this.last.rows||m.cols!==this.first.cols||f.cols!==this.last.cols||this.isRangeChanged,g={top:u,left:d}}}else{var z=n?d:u,I=this.lastScrollPos<=z;if(!this.appendOnly||this.appendOnly&&I){var b=r(z,this.itemSize);f=c(b,m=h(b,a(b,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,I),this.first,0,0,this.d_numToleratedItems,I),0,this.numItemsInViewport,this.d_numToleratedItems),p=m!==this.first||f!==this.last||this.isRangeChanged,g=z}}return{first:m,last:f,isRangeChanged:p,scrollPos:g}},onScrollChange:function(t){var e=this.onScrollPositionChange(t),i=e.first,s=e.last,n=e.scrollPos;if(e.isRangeChanged){var o={first:i,last:s};if(this.setContentPosition(o),this.first=i,this.last=s,this.lastScrollPos=n,this.$emit("scroll-index-change",o),this.lazy&&this.isPageChanged(i)){var l={first:this.step?Math.min(this.getPageByFirst(i)*this.step,this.items.length-this.step):i,last:Math.min(this.step?(this.getPageByFirst(i)+1)*this.step:s,this.items.length)};(this.lazyLoadState.first!==l.first||this.lazyLoadState.last!==l.last)&&this.$emit("lazy-load",l),this.lazyLoadState=l}}},onScroll:function(t){var e=this;if(this.$emit("scroll",t),this.delay&&this.isPageChanged()){if(this.scrollTimeout&&clearTimeout(this.scrollTimeout),!this.d_loading&&this.showLoader)(this.onScrollPositionChange(t).isRangeChanged||!!this.step&&this.isPageChanged())&&(this.d_loading=!0);this.scrollTimeout=setTimeout((function(){e.onScrollChange(t),!e.d_loading||!e.showLoader||e.lazy&&void 0!==e.loading||(e.d_loading=!1,e.page=e.getPageByFirst())}),this.delay)}else this.onScrollChange(t)},onResize:function(){var t=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((function(){if(e.DomHandler.isVisible(t.element)){var i=t.isBoth(),s=t.isVertical(),n=t.isHorizontal(),o=[e.DomHandler.getWidth(t.element),e.DomHandler.getHeight(t.element)],l=o[0],r=o[1],a=l!==t.defaultWidth,h=r!==t.defaultHeight;(i?a||h:n?a:!!s&&h)&&(t.d_numToleratedItems=t.numToleratedItems,t.defaultWidth=l,t.defaultHeight=r,t.defaultContentWidth=e.DomHandler.getWidth(t.content),t.defaultContentHeight=e.DomHandler.getHeight(t.content),t.init())}}),this.resizeDelay)},bindResizeListener:function(){this.resizeListener||(this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener),window.addEventListener("orientationchange",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),window.removeEventListener("orientationchange",this.resizeListener),this.resizeListener=null)},getOptions:function(t){var e=(this.items||[]).length,i=this.isBoth()?this.first.rows+t:this.first+t;return{index:i,count:e,first:0===i,last:i===e-1,even:i%2==0,odd:i%2!=0}},getLoaderOptions:function(t,e){var i=this.loaderArr.length;return u({index:t,count:i,first:0===t,last:t===i-1,even:t%2==0,odd:t%2!=0},e)},getPageByFirst:function(t){return Math.floor(((null!=t?t:this.first)+4*this.d_numToleratedItems)/(this.step||1))},isPageChanged:function(t){return!this.step||this.page!==this.getPageByFirst(null!=t?t:this.first)},setContentEl:function(t){this.content=t||this.content||e.DomHandler.findSingle(this.element,'[data-pc-section="content"]')},elementRef:function(t){this.element=t},contentRef:function(t){this.content=t}},computed:{containerClass:function(){return["p-virtualscroller",this.class,{"p-virtualscroller-inline":this.inline,"p-virtualscroller-both p-both-scroll":this.isBoth(),"p-virtualscroller-horizontal p-horizontal-scroll":this.isHorizontal()}]},contentClass:function(){return["p-virtualscroller-content",{"p-virtualscroller-loading":this.d_loading}]},loaderClass:function(){return["p-virtualscroller-loader",{"p-component-overlay":!this.$slots.loader}]},loadedItems:function(){var t=this;return this.items&&!this.d_loading?this.isBoth()?this.items.slice(this.appendOnly?0:this.first.rows,this.last.rows).map((function(e){return t.columns?e:e.slice(t.appendOnly?0:t.first.cols,t.last.cols)})):this.isHorizontal()&&this.columns?this.items:this.items.slice(this.appendOnly?0:this.first,this.last):[]},loadedRows:function(){return this.d_loading?this.loaderDisabled?this.loaderArr:[]:this.loadedItems},loadedColumns:function(){if(this.columns){var t=this.isBoth(),e=this.isHorizontal();if(t||e)return this.d_loading&&this.loaderDisabled?t?this.loaderArr[0]:this.loaderArr:this.columns.slice(t?this.first.cols:this.first,t?this.last.cols:this.last)}return this.columns}},components:{SpinnerIcon:l.default}},g=["tabindex"];return p.render=function(t,e,i,s,o,l){var r=n.resolveComponent("SpinnerIcon");return t.disabled?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.renderSlot(t.$slots,"default"),n.renderSlot(t.$slots,"content",{items:t.items,rows:t.items,columns:l.loadedColumns})],64)):(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,ref:l.elementRef,class:l.containerClass,tabindex:t.tabindex,style:t.style,onScroll:e[0]||(e[0]=function(){return l.onScroll&&l.onScroll.apply(l,arguments)})},t.ptm("root"),{"data-pc-name":"virtualscroller"}),[n.renderSlot(t.$slots,"content",{styleClass:l.contentClass,items:l.loadedItems,getItemOptions:l.getOptions,loading:o.d_loading,getLoaderOptions:l.getLoaderOptions,itemSize:t.itemSize,rows:l.loadedRows,columns:l.loadedColumns,contentRef:l.contentRef,spacerStyle:o.spacerStyle,contentStyle:o.contentStyle,vertical:l.isVertical(),horizontal:l.isHorizontal(),both:l.isBoth()},(function(){return[n.createElementVNode("div",n.mergeProps({ref:l.contentRef,class:l.contentClass,style:o.contentStyle},t.ptm("content")),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.loadedItems,(function(e,i){return n.renderSlot(t.$slots,"item",{key:i,item:e,options:l.getOptions(i)})})),128))],16)]})),t.showSpacer?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,class:"p-virtualscroller-spacer",style:o.spacerStyle},t.ptm("spacer")),null,16)):n.createCommentVNode("",!0),!t.loaderDisabled&&t.showLoader&&o.d_loading?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:1,class:l.loaderClass},t.ptm("loader")),[t.$slots&&t.$slots.loader?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(o.loaderArr,(function(e,i){return n.renderSlot(t.$slots,"loader",{key:i,options:l.getLoaderOptions(i,l.isBoth()&&{numCols:t.d_numItemsInViewport.cols})})})),128)):n.createCommentVNode("",!0),n.renderSlot(t.$slots,"loadingicon",{},(function(){return[n.createVNode(r,n.mergeProps({spin:"",class:"p-virtualscroller-loading-icon"},t.ptm("loadingIcon")),null,16)]}))],16)):n.createCommentVNode("",!0)],16,g))},p}(primevue.icons.spinner,primevue.utils,primevue.basecomponent,primevue.usestyle,Vue);
|