primereact 10.0.0 → 10.0.2
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/README.md +1 -1
- package/accordion/accordion.esm.js +0 -1
- package/api/api.esm.js +0 -1
- package/autocomplete/autocomplete.esm.js +8 -7
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/avatar/avatar.esm.js +0 -1
- package/avatargroup/avatargroup.esm.js +0 -1
- package/badge/badge.esm.js +0 -1
- package/blockui/blockui.esm.js +3 -1
- package/blockui/blockui.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +0 -1
- package/button/button.esm.js +0 -1
- package/calendar/calendar.esm.js +2 -1
- package/calendar/calendar.esm.min.js +1 -1
- package/card/card.esm.js +0 -1
- package/carousel/carousel.esm.js +7 -8
- package/carousel/carousel.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +0 -1
- package/chart/chart.esm.js +0 -1
- package/checkbox/checkbox.esm.js +0 -1
- package/chip/chip.esm.js +0 -1
- package/chips/chips.esm.js +0 -1
- package/colorpicker/colorpicker.esm.js +0 -1
- package/column/column.esm.js +0 -1
- package/columngroup/columngroup.esm.js +0 -1
- package/componentbase/componentbase.cjs.js +12 -7
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.js +23 -13
- package/componentbase/componentbase.esm.min.js +1 -1
- package/componentbase/componentbase.js +12 -7
- package/componentbase/componentbase.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +0 -1
- package/confirmpopup/confirmpopup.esm.js +0 -1
- package/contextmenu/contextmenu.esm.js +0 -1
- package/core/core.js +12 -7
- package/core/core.min.js +1 -1
- package/csstransition/csstransition.esm.js +0 -1
- package/datascroller/datascroller.esm.js +0 -1
- package/datatable/datatable.esm.js +0 -1
- package/dataview/dataview.esm.js +0 -1
- package/deferredcontent/deferredcontent.esm.js +0 -1
- package/dialog/dialog.esm.js +2 -1
- package/dialog/dialog.esm.min.js +1 -1
- package/divider/divider.esm.js +0 -1
- package/dock/dock.esm.js +0 -1
- package/dropdown/dropdown.esm.js +0 -1
- package/editor/editor.esm.js +0 -1
- package/fieldset/fieldset.esm.js +0 -1
- package/fileupload/fileupload.esm.js +0 -1
- package/galleria/galleria.esm.js +11 -7
- package/galleria/galleria.esm.min.js +1 -1
- package/hooks/hooks.esm.js +0 -6
- package/iconbase/iconbase.esm.js +0 -1
- package/icons/angledoubledown/index.esm.js +0 -1
- package/icons/angledoubleleft/index.esm.js +0 -1
- package/icons/angledoubleright/index.esm.js +0 -1
- package/icons/angledoubleup/index.esm.js +0 -1
- package/icons/angledown/index.esm.js +0 -1
- package/icons/angleleft/index.esm.js +0 -1
- package/icons/angleright/index.esm.js +0 -1
- package/icons/angleup/index.esm.js +0 -1
- package/icons/arrowdown/index.esm.js +0 -1
- package/icons/arrowup/index.esm.js +0 -1
- package/icons/ban/index.esm.js +0 -1
- package/icons/bars/index.esm.js +0 -1
- package/icons/calendar/index.esm.js +0 -1
- package/icons/check/index.esm.js +0 -1
- package/icons/chevrondown/index.esm.js +0 -1
- package/icons/chevronleft/index.esm.js +0 -1
- package/icons/chevronright/index.esm.js +0 -1
- package/icons/chevronup/index.esm.js +0 -1
- package/icons/download/index.esm.js +0 -1
- package/icons/exclamationtriangle/index.esm.js +0 -1
- package/icons/eye/index.esm.js +0 -1
- package/icons/eyeslash/index.esm.js +0 -1
- package/icons/filter/index.esm.js +0 -1
- package/icons/filterslash/index.esm.js +0 -1
- package/icons/infocircle/index.esm.js +0 -1
- package/icons/minus/index.esm.js +0 -1
- package/icons/pencil/index.esm.js +0 -1
- package/icons/plus/index.esm.js +0 -1
- package/icons/refresh/index.esm.js +0 -1
- package/icons/search/index.esm.js +0 -1
- package/icons/searchminus/index.esm.js +0 -1
- package/icons/searchplus/index.esm.js +0 -1
- package/icons/sortalt/index.esm.js +0 -1
- package/icons/sortamountdown/index.esm.js +0 -1
- package/icons/sortamountupalt/index.esm.js +0 -1
- package/icons/spinner/index.esm.js +0 -1
- package/icons/star/index.esm.js +0 -1
- package/icons/starfill/index.esm.js +0 -1
- package/icons/thlarge/index.esm.js +0 -1
- package/icons/times/index.esm.js +0 -1
- package/icons/timescircle/index.esm.js +0 -1
- package/icons/trash/index.esm.js +0 -1
- package/icons/undo/index.esm.js +0 -1
- package/icons/upload/index.esm.js +0 -1
- package/icons/windowmaximize/index.esm.js +0 -1
- package/icons/windowminimize/index.esm.js +0 -1
- package/image/image.esm.js +2 -1
- package/image/image.esm.min.js +1 -1
- package/inplace/inplace.esm.js +0 -1
- package/inputmask/inputmask.esm.js +0 -1
- package/inputnumber/inputnumber.esm.js +0 -1
- package/inputswitch/inputswitch.esm.js +0 -1
- package/inputtext/inputtext.esm.js +0 -1
- package/inputtextarea/inputtextarea.esm.js +0 -1
- package/keyfilter/keyfilter.esm.js +0 -1
- package/knob/knob.esm.js +0 -1
- package/listbox/listbox.esm.js +0 -1
- package/megamenu/megamenu.esm.js +0 -1
- package/mention/mention.esm.js +0 -1
- package/menu/menu.esm.js +0 -1
- package/menubar/menubar.esm.js +0 -1
- package/message/message.esm.js +0 -1
- package/messages/messages.esm.js +1 -2
- package/messages/messages.esm.min.js +1 -1
- package/multiselect/multiselect.esm.js +0 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +0 -1
- package/orderlist/orderlist.esm.js +9 -5
- package/orderlist/orderlist.esm.min.js +1 -1
- package/organizationchart/organizationchart.esm.js +0 -1
- package/overlaypanel/overlaypanel.esm.js +0 -1
- package/overlayservice/overlayservice.esm.js +0 -1
- package/package.json +2 -2
- package/paginator/paginator.esm.js +0 -1
- package/panel/panel.esm.js +0 -1
- package/panelmenu/panelmenu.esm.js +0 -1
- package/passthrough/index.esm.js +0 -1
- package/passthrough/tailwind/index.cjs.js +2 -4
- package/passthrough/tailwind/index.cjs.min.js +1 -1
- package/passthrough/tailwind/index.esm.js +149 -148
- package/passthrough/tailwind/index.esm.min.js +1 -1
- package/passthrough/tailwind/index.js +2 -4
- package/passthrough/tailwind/index.min.js +1 -1
- package/password/password.esm.js +0 -1
- package/picklist/picklist.esm.js +0 -1
- package/portal/portal.esm.js +0 -1
- package/primereact.all.cjs.js +12 -7
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +70 -42
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +12 -7
- package/primereact.all.min.js +1 -1
- package/progressbar/progressbar.esm.js +0 -1
- package/progressspinner/progressspinner.esm.js +0 -1
- package/radiobutton/radiobutton.esm.js +0 -1
- package/rating/rating.esm.js +0 -1
- package/ripple/ripple.esm.js +0 -1
- package/row/row.esm.js +0 -1
- package/scrollpanel/scrollpanel.esm.js +0 -1
- package/scrolltop/scrolltop.esm.js +0 -1
- package/selectbutton/selectbutton.esm.js +0 -1
- package/sidebar/sidebar.esm.js +2 -1
- package/sidebar/sidebar.esm.min.js +1 -1
- package/skeleton/skeleton.esm.js +0 -1
- package/slidemenu/slidemenu.esm.js +0 -1
- package/slider/slider.esm.js +0 -1
- package/speeddial/speeddial.esm.js +0 -1
- package/splitbutton/splitbutton.esm.js +0 -1
- package/splitter/splitter.esm.js +0 -1
- package/steps/steps.esm.js +0 -1
- package/styleclass/styleclass.esm.js +0 -1
- package/tabmenu/tabmenu.esm.js +0 -1
- package/tabview/tabview.esm.js +0 -1
- package/tag/tag.esm.js +0 -1
- package/terminal/terminal.esm.js +0 -1
- package/terminalservice/terminalservice.esm.js +0 -1
- package/tieredmenu/tieredmenu.esm.js +0 -1
- package/timeline/timeline.esm.js +0 -1
- package/toast/toast.esm.js +0 -1
- package/togglebutton/togglebutton.esm.js +0 -1
- package/toolbar/toolbar.esm.js +0 -1
- package/tooltip/tooltip.esm.js +0 -1
- package/tree/tree.esm.js +0 -1
- package/treeselect/treeselect.esm.js +0 -1
- package/treetable/treetable.esm.js +0 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +0 -1
- package/utils/utils.esm.js +0 -1
- package/virtualscroller/virtualscroller.esm.js +0 -1
- package/web-types.json +1 -1
- package/accordion/accordion.esm.min.mjs +0 -1
- package/accordion/accordion.esm.mjs +0 -420
- package/api/api.esm.min.mjs +0 -1
- package/api/api.esm.mjs +0 -943
- package/autocomplete/autocomplete.esm.min.mjs +0 -1
- package/autocomplete/autocomplete.esm.mjs +0 -1128
- package/avatar/avatar.esm.min.mjs +0 -1
- package/avatar/avatar.esm.mjs +0 -244
- package/avatargroup/avatargroup.esm.min.mjs +0 -1
- package/avatargroup/avatargroup.esm.mjs +0 -54
- package/badge/badge.esm.min.mjs +0 -1
- package/badge/badge.esm.mjs +0 -109
- package/blockui/blockui.esm.min.mjs +0 -1
- package/blockui/blockui.esm.mjs +0 -267
- package/breadcrumb/breadcrumb.esm.min.mjs +0 -1
- package/breadcrumb/breadcrumb.esm.mjs +0 -350
- package/button/button.esm.min.mjs +0 -1
- package/button/button.esm.mjs +0 -294
- package/calendar/calendar.esm.min.mjs +0 -1
- package/calendar/calendar.esm.mjs +0 -3474
- package/card/card.esm.min.mjs +0 -1
- package/card/card.esm.mjs +0 -97
- package/carousel/carousel.esm.min.mjs +0 -1
- package/carousel/carousel.esm.mjs +0 -800
- package/cascadeselect/cascadeselect.esm.min.mjs +0 -1
- package/cascadeselect/cascadeselect.esm.mjs +0 -818
- package/chart/chart.esm.min.mjs +0 -1
- package/chart/chart.esm.mjs +0 -154
- package/checkbox/checkbox.esm.min.mjs +0 -1
- package/checkbox/checkbox.esm.mjs +0 -356
- package/chip/chip.esm.min.mjs +0 -1
- package/chip/chip.esm.mjs +0 -247
- package/chips/chips.esm.min.mjs +0 -1
- package/chips/chips.esm.mjs +0 -500
- package/colorpicker/colorpicker.esm.min.mjs +0 -1
- package/colorpicker/colorpicker.esm.mjs +0 -787
- package/column/column.esm.min.mjs +0 -1
- package/column/column.esm.mjs +0 -7
- package/columngroup/columngroup.esm.min.mjs +0 -1
- package/columngroup/columngroup.esm.mjs +0 -5
- package/componentbase/componentbase.esm.min.mjs +0 -1
- package/componentbase/componentbase.esm.mjs +0 -328
- package/confirmdialog/confirmdialog.esm.min.mjs +0 -1
- package/confirmdialog/confirmdialog.esm.mjs +0 -375
- package/confirmpopup/confirmpopup.esm.min.mjs +0 -1
- package/confirmpopup/confirmpopup.esm.mjs +0 -609
- package/contextmenu/contextmenu.esm.min.mjs +0 -1
- package/contextmenu/contextmenu.esm.mjs +0 -663
- package/csstransition/csstransition.esm.min.mjs +0 -1
- package/csstransition/csstransition.esm.mjs +0 -137
- package/datascroller/datascroller.esm.min.mjs +0 -1
- package/datascroller/datascroller.esm.mjs +0 -319
- package/datatable/datatable.esm.min.mjs +0 -1
- package/datatable/datatable.esm.mjs +0 -6635
- package/dataview/dataview.esm.min.mjs +0 -1
- package/dataview/dataview.esm.mjs +0 -505
- package/deferredcontent/deferredcontent.esm.min.mjs +0 -1
- package/deferredcontent/deferredcontent.esm.mjs +0 -132
- package/dialog/dialog.esm.min.mjs +0 -1
- package/dialog/dialog.esm.mjs +0 -984
- package/divider/divider.esm.min.mjs +0 -1
- package/divider/divider.esm.mjs +0 -78
- package/dock/dock.esm.min.mjs +0 -1
- package/dock/dock.esm.mjs +0 -347
- package/dropdown/dropdown.esm.min.mjs +0 -1
- package/dropdown/dropdown.esm.mjs +0 -1379
- package/editor/editor.esm.min.mjs +0 -1
- package/editor/editor.esm.mjs +0 -337
- package/fieldset/fieldset.esm.min.mjs +0 -1
- package/fieldset/fieldset.esm.mjs +0 -269
- package/fileupload/fileupload.esm.min.mjs +0 -1
- package/fileupload/fileupload.esm.mjs +0 -1004
- package/galleria/galleria.esm.min.mjs +0 -1
- package/galleria/galleria.esm.mjs +0 -1094
- package/hooks/hooks.esm.min.mjs +0 -1
- package/hooks/hooks.esm.mjs +0 -1036
- package/iconbase/iconbase.esm.min.mjs +0 -1
- package/iconbase/iconbase.esm.mjs +0 -32
- package/icons/angledoubledown/index.esm.min.mjs +0 -1
- package/icons/angledoubledown/index.esm.mjs +0 -38
- package/icons/angledoubleleft/index.esm.min.mjs +0 -1
- package/icons/angledoubleleft/index.esm.mjs +0 -38
- package/icons/angledoubleright/index.esm.min.mjs +0 -1
- package/icons/angledoubleright/index.esm.mjs +0 -38
- package/icons/angledoubleup/index.esm.min.mjs +0 -1
- package/icons/angledoubleup/index.esm.mjs +0 -38
- package/icons/angledown/index.esm.min.mjs +0 -1
- package/icons/angledown/index.esm.mjs +0 -36
- package/icons/angleleft/index.esm.min.mjs +0 -1
- package/icons/angleleft/index.esm.mjs +0 -36
- package/icons/angleright/index.esm.min.mjs +0 -1
- package/icons/angleright/index.esm.mjs +0 -36
- package/icons/angleup/index.esm.min.mjs +0 -1
- package/icons/angleup/index.esm.mjs +0 -36
- package/icons/arrowdown/index.esm.min.mjs +0 -1
- package/icons/arrowdown/index.esm.mjs +0 -660
- package/icons/arrowup/index.esm.min.mjs +0 -1
- package/icons/arrowup/index.esm.mjs +0 -660
- package/icons/ban/index.esm.min.mjs +0 -1
- package/icons/ban/index.esm.mjs +0 -658
- package/icons/bars/index.esm.min.mjs +0 -1
- package/icons/bars/index.esm.mjs +0 -38
- package/icons/calendar/index.esm.min.mjs +0 -1
- package/icons/calendar/index.esm.mjs +0 -36
- package/icons/check/index.esm.min.mjs +0 -1
- package/icons/check/index.esm.mjs +0 -36
- package/icons/chevrondown/index.esm.min.mjs +0 -1
- package/icons/chevrondown/index.esm.mjs +0 -36
- package/icons/chevronleft/index.esm.min.mjs +0 -1
- package/icons/chevronleft/index.esm.mjs +0 -36
- package/icons/chevronright/index.esm.min.mjs +0 -1
- package/icons/chevronright/index.esm.mjs +0 -36
- package/icons/chevronup/index.esm.min.mjs +0 -1
- package/icons/chevronup/index.esm.mjs +0 -36
- package/icons/download/index.esm.min.mjs +0 -1
- package/icons/download/index.esm.mjs +0 -660
- package/icons/exclamationtriangle/index.esm.min.mjs +0 -1
- package/icons/exclamationtriangle/index.esm.mjs +0 -664
- package/icons/eye/index.esm.min.mjs +0 -1
- package/icons/eye/index.esm.mjs +0 -38
- package/icons/eyeslash/index.esm.min.mjs +0 -1
- package/icons/eyeslash/index.esm.mjs +0 -660
- package/icons/filter/index.esm.min.mjs +0 -1
- package/icons/filter/index.esm.mjs +0 -658
- package/icons/filterslash/index.esm.min.mjs +0 -1
- package/icons/filterslash/index.esm.mjs +0 -660
- package/icons/infocircle/index.esm.min.mjs +0 -1
- package/icons/infocircle/index.esm.mjs +0 -660
- package/icons/minus/index.esm.min.mjs +0 -1
- package/icons/minus/index.esm.mjs +0 -36
- package/icons/pencil/index.esm.min.mjs +0 -1
- package/icons/pencil/index.esm.mjs +0 -658
- package/icons/plus/index.esm.min.mjs +0 -1
- package/icons/plus/index.esm.mjs +0 -658
- package/icons/refresh/index.esm.min.mjs +0 -1
- package/icons/refresh/index.esm.mjs +0 -660
- package/icons/search/index.esm.min.mjs +0 -1
- package/icons/search/index.esm.mjs +0 -660
- package/icons/searchminus/index.esm.min.mjs +0 -1
- package/icons/searchminus/index.esm.mjs +0 -660
- package/icons/searchplus/index.esm.min.mjs +0 -1
- package/icons/searchplus/index.esm.mjs +0 -660
- package/icons/sortalt/index.esm.min.mjs +0 -1
- package/icons/sortalt/index.esm.mjs +0 -667
- package/icons/sortamountdown/index.esm.min.mjs +0 -1
- package/icons/sortamountdown/index.esm.mjs +0 -673
- package/icons/sortamountupalt/index.esm.min.mjs +0 -1
- package/icons/sortamountupalt/index.esm.mjs +0 -673
- package/icons/spinner/index.esm.min.mjs +0 -1
- package/icons/spinner/index.esm.mjs +0 -658
- package/icons/star/index.esm.min.mjs +0 -1
- package/icons/star/index.esm.mjs +0 -658
- package/icons/starfill/index.esm.min.mjs +0 -1
- package/icons/starfill/index.esm.mjs +0 -658
- package/icons/thlarge/index.esm.min.mjs +0 -1
- package/icons/thlarge/index.esm.mjs +0 -660
- package/icons/times/index.esm.min.mjs +0 -1
- package/icons/times/index.esm.mjs +0 -36
- package/icons/timescircle/index.esm.min.mjs +0 -1
- package/icons/timescircle/index.esm.mjs +0 -660
- package/icons/trash/index.esm.min.mjs +0 -1
- package/icons/trash/index.esm.mjs +0 -660
- package/icons/undo/index.esm.min.mjs +0 -1
- package/icons/undo/index.esm.mjs +0 -660
- package/icons/upload/index.esm.min.mjs +0 -1
- package/icons/upload/index.esm.mjs +0 -660
- package/icons/windowmaximize/index.esm.min.mjs +0 -1
- package/icons/windowmaximize/index.esm.mjs +0 -660
- package/icons/windowminimize/index.esm.min.mjs +0 -1
- package/icons/windowminimize/index.esm.mjs +0 -660
- package/image/image.esm.min.mjs +0 -1
- package/image/image.esm.mjs +0 -1163
- package/inplace/inplace.esm.min.mjs +0 -1
- package/inplace/inplace.esm.mjs +0 -242
- package/inputmask/inputmask.esm.min.mjs +0 -1
- package/inputmask/inputmask.esm.mjs +0 -559
- package/inputnumber/inputnumber.esm.min.mjs +0 -1
- package/inputnumber/inputnumber.esm.mjs +0 -1208
- package/inputswitch/inputswitch.esm.min.mjs +0 -1
- package/inputswitch/inputswitch.esm.mjs +0 -290
- package/inputtext/inputtext.esm.min.mjs +0 -1
- package/inputtext/inputtext.esm.mjs +0 -170
- package/inputtextarea/inputtextarea.esm.min.mjs +0 -1
- package/inputtextarea/inputtextarea.esm.mjs +0 -219
- package/keyfilter/keyfilter.esm.min.mjs +0 -1
- package/keyfilter/keyfilter.esm.mjs +0 -107
- package/knob/knob.esm.min.mjs +0 -1
- package/knob/knob.esm.mjs +0 -317
- package/listbox/listbox.esm.min.mjs +0 -1
- package/listbox/listbox.esm.mjs +0 -809
- package/megamenu/megamenu.esm.min.mjs +0 -1
- package/megamenu/megamenu.esm.mjs +0 -715
- package/mention/mention.esm.min.mjs +0 -1
- package/mention/mention.esm.mjs +0 -770
- package/menu/menu.esm.min.mjs +0 -1
- package/menu/menu.esm.mjs +0 -484
- package/menubar/menubar.esm.min.mjs +0 -1
- package/menubar/menubar.esm.mjs +0 -583
- package/message/message.esm.min.mjs +0 -1
- package/message/message.esm.mjs +0 -168
- package/messages/messages.esm.min.mjs +0 -1
- package/messages/messages.esm.mjs +0 -438
- package/multiselect/multiselect.esm.min.mjs +0 -1
- package/multiselect/multiselect.esm.mjs +0 -1723
- package/multistatecheckbox/multistatecheckbox.esm.min.mjs +0 -1
- package/multistatecheckbox/multistatecheckbox.esm.mjs +0 -351
- package/orderlist/orderlist.esm.min.mjs +0 -1
- package/orderlist/orderlist.esm.mjs +0 -820
- package/organizationchart/organizationchart.esm.min.mjs +0 -1
- package/organizationchart/organizationchart.esm.mjs +0 -479
- package/overlaypanel/overlaypanel.esm.min.mjs +0 -1
- package/overlaypanel/overlaypanel.esm.mjs +0 -515
- package/overlayservice/overlayservice.esm.min.mjs +0 -1
- package/overlayservice/overlayservice.esm.mjs +0 -6
- package/paginator/paginator.esm.min.mjs +0 -1
- package/paginator/paginator.esm.mjs +0 -932
- package/panel/panel.esm.min.mjs +0 -1
- package/panel/panel.esm.mjs +0 -315
- package/panelmenu/panelmenu.esm.min.mjs +0 -1
- package/panelmenu/panelmenu.esm.mjs +0 -644
- package/passthrough/index.esm.min.mjs +0 -1
- package/passthrough/index.esm.mjs +0 -70
- package/passthrough/tailwind/index.esm.min.mjs +0 -1
- package/passthrough/tailwind/index.esm.mjs +0 -3513
- package/password/password.esm.min.mjs +0 -1
- package/password/password.esm.mjs +0 -566
- package/picklist/picklist.esm.min.mjs +0 -1
- package/picklist/picklist.esm.mjs +0 -1118
- package/portal/portal.esm.min.mjs +0 -1
- package/portal/portal.esm.mjs +0 -109
- package/primereact.all.esm.min.mjs +0 -1
- package/primereact.all.esm.mjs +0 -51669
- package/progressbar/progressbar.esm.min.mjs +0 -1
- package/progressbar/progressbar.esm.mjs +0 -189
- package/progressspinner/progressspinner.esm.min.mjs +0 -1
- package/progressspinner/progressspinner.esm.mjs +0 -87
- package/radiobutton/radiobutton.esm.min.mjs +0 -1
- package/radiobutton/radiobutton.esm.mjs +0 -328
- package/rating/rating.esm.min.mjs +0 -1
- package/rating/rating.esm.mjs +0 -272
- package/ripple/ripple.esm.min.mjs +0 -1
- package/ripple/ripple.esm.mjs +0 -99
- package/row/row.esm.min.mjs +0 -1
- package/row/row.esm.mjs +0 -35
- package/scrollpanel/scrollpanel.esm.min.mjs +0 -1
- package/scrollpanel/scrollpanel.esm.mjs +0 -209
- package/scrolltop/scrolltop.esm.min.mjs +0 -1
- package/scrolltop/scrolltop.esm.mjs +0 -268
- package/selectbutton/selectbutton.esm.min.mjs +0 -1
- package/selectbutton/selectbutton.esm.mjs +0 -326
- package/sidebar/sidebar.esm.min.mjs +0 -1
- package/sidebar/sidebar.esm.mjs +0 -544
- package/skeleton/skeleton.esm.min.mjs +0 -1
- package/skeleton/skeleton.esm.mjs +0 -124
- package/slidemenu/slidemenu.esm.min.mjs +0 -1
- package/slidemenu/slidemenu.esm.mjs +0 -688
- package/slider/slider.esm.min.mjs +0 -1
- package/slider/slider.esm.mjs +0 -477
- package/speeddial/speeddial.esm.min.mjs +0 -1
- package/speeddial/speeddial.esm.mjs +0 -520
- package/splitbutton/splitbutton.esm.min.mjs +0 -1
- package/splitbutton/splitbutton.esm.mjs +0 -544
- package/splitter/splitter.esm.min.mjs +0 -1
- package/splitter/splitter.esm.mjs +0 -465
- package/steps/steps.esm.min.mjs +0 -1
- package/steps/steps.esm.mjs +0 -293
- package/styleclass/styleclass.esm.min.mjs +0 -1
- package/styleclass/styleclass.esm.mjs +0 -268
- package/tabmenu/tabmenu.esm.min.mjs +0 -1
- package/tabmenu/tabmenu.esm.mjs +0 -331
- package/tabview/tabview.esm.min.mjs +0 -1
- package/tabview/tabview.esm.mjs +0 -677
- package/tag/tag.esm.min.mjs +0 -1
- package/tag/tag.esm.mjs +0 -116
- package/terminal/terminal.esm.min.mjs +0 -1
- package/terminal/terminal.esm.mjs +0 -279
- package/terminalservice/terminalservice.esm.min.mjs +0 -1
- package/terminalservice/terminalservice.esm.mjs +0 -6
- package/tieredmenu/tieredmenu.esm.min.mjs +0 -1
- package/tieredmenu/tieredmenu.esm.mjs +0 -698
- package/timeline/timeline.esm.min.mjs +0 -1
- package/timeline/timeline.esm.mjs +0 -163
- package/toast/toast.esm.min.mjs +0 -1
- package/toast/toast.esm.mjs +0 -738
- package/togglebutton/togglebutton.esm.min.mjs +0 -1
- package/togglebutton/togglebutton.esm.mjs +0 -216
- package/toolbar/toolbar.esm.min.mjs +0 -1
- package/toolbar/toolbar.esm.mjs +0 -78
- package/tooltip/tooltip.esm.min.mjs +0 -1
- package/tooltip/tooltip.esm.mjs +0 -695
- package/tree/tree.esm.min.mjs +0 -1
- package/tree/tree.esm.mjs +0 -1402
- package/treeselect/treeselect.esm.min.mjs +0 -1
- package/treeselect/treeselect.esm.mjs +0 -929
- package/treetable/treetable.esm.min.mjs +0 -1
- package/treetable/treetable.esm.mjs +0 -3093
- package/tristatecheckbox/tristatecheckbox.esm.min.mjs +0 -1
- package/tristatecheckbox/tristatecheckbox.esm.mjs +0 -291
- package/utils/utils.esm.min.mjs +0 -1
- package/utils/utils.esm.mjs +0 -2382
- package/virtualscroller/virtualscroller.esm.min.mjs +0 -1
- package/virtualscroller/virtualscroller.esm.mjs +0 -971
package/utils/utils.esm.mjs
DELETED
|
@@ -1,2382 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
function _arrayWithHoles(arr) {
|
|
5
|
-
if (Array.isArray(arr)) return arr;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function _iterableToArrayLimit(r, l) {
|
|
9
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10
|
-
if (null != t) {
|
|
11
|
-
var e,
|
|
12
|
-
n,
|
|
13
|
-
i,
|
|
14
|
-
u,
|
|
15
|
-
a = [],
|
|
16
|
-
f = !0,
|
|
17
|
-
o = !1;
|
|
18
|
-
try {
|
|
19
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
20
|
-
if (Object(t) !== t) return;
|
|
21
|
-
f = !1;
|
|
22
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
23
|
-
} catch (r) {
|
|
24
|
-
o = !0, n = r;
|
|
25
|
-
} finally {
|
|
26
|
-
try {
|
|
27
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
28
|
-
} finally {
|
|
29
|
-
if (o) throw n;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return a;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _arrayLikeToArray$2(arr, len) {
|
|
37
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
38
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
39
|
-
return arr2;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _unsupportedIterableToArray$2(o, minLen) {
|
|
43
|
-
if (!o) return;
|
|
44
|
-
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
|
|
45
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
46
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
47
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
48
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _nonIterableRest() {
|
|
52
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function _slicedToArray(arr, i) {
|
|
56
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _typeof(o) {
|
|
60
|
-
"@babel/helpers - typeof";
|
|
61
|
-
|
|
62
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
63
|
-
return typeof o;
|
|
64
|
-
} : function (o) {
|
|
65
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
66
|
-
}, _typeof(o);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function classNames() {
|
|
70
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
71
|
-
args[_key] = arguments[_key];
|
|
72
|
-
}
|
|
73
|
-
if (args) {
|
|
74
|
-
var classes = [];
|
|
75
|
-
for (var i = 0; i < args.length; i++) {
|
|
76
|
-
var className = args[i];
|
|
77
|
-
if (!className) continue;
|
|
78
|
-
var type = _typeof(className);
|
|
79
|
-
if (type === 'string' || type === 'number') {
|
|
80
|
-
classes.push(className);
|
|
81
|
-
} else if (type === 'object') {
|
|
82
|
-
var _classes = Array.isArray(className) ? className : Object.entries(className).map(function (_ref) {
|
|
83
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
84
|
-
key = _ref2[0],
|
|
85
|
-
value = _ref2[1];
|
|
86
|
-
return !!value ? key : null;
|
|
87
|
-
});
|
|
88
|
-
classes = _classes.length ? classes.concat(_classes.filter(function (c) {
|
|
89
|
-
return !!c;
|
|
90
|
-
})) : classes;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return classes.join(' ').trim();
|
|
94
|
-
}
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _arrayWithoutHoles(arr) {
|
|
99
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function _iterableToArray(iter) {
|
|
103
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function _nonIterableSpread() {
|
|
107
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function _toConsumableArray(arr) {
|
|
111
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function _classCallCheck(instance, Constructor) {
|
|
115
|
-
if (!(instance instanceof Constructor)) {
|
|
116
|
-
throw new TypeError("Cannot call a class as a function");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function _toPrimitive(input, hint) {
|
|
121
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
122
|
-
var prim = input[Symbol.toPrimitive];
|
|
123
|
-
if (prim !== undefined) {
|
|
124
|
-
var res = prim.call(input, hint || "default");
|
|
125
|
-
if (_typeof(res) !== "object") return res;
|
|
126
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
127
|
-
}
|
|
128
|
-
return (hint === "string" ? String : Number)(input);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function _toPropertyKey(arg) {
|
|
132
|
-
var key = _toPrimitive(arg, "string");
|
|
133
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function _defineProperties(target, props) {
|
|
137
|
-
for (var i = 0; i < props.length; i++) {
|
|
138
|
-
var descriptor = props[i];
|
|
139
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
140
|
-
descriptor.configurable = true;
|
|
141
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
142
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
146
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
147
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
148
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
149
|
-
writable: false
|
|
150
|
-
});
|
|
151
|
-
return Constructor;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function _defineProperty(obj, key, value) {
|
|
155
|
-
key = _toPropertyKey(key);
|
|
156
|
-
if (key in obj) {
|
|
157
|
-
Object.defineProperty(obj, key, {
|
|
158
|
-
value: value,
|
|
159
|
-
enumerable: true,
|
|
160
|
-
configurable: true,
|
|
161
|
-
writable: true
|
|
162
|
-
});
|
|
163
|
-
} else {
|
|
164
|
-
obj[key] = value;
|
|
165
|
-
}
|
|
166
|
-
return obj;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
170
|
-
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
171
|
-
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
172
|
-
var DomHandler = /*#__PURE__*/function () {
|
|
173
|
-
function DomHandler() {
|
|
174
|
-
_classCallCheck(this, DomHandler);
|
|
175
|
-
}
|
|
176
|
-
_createClass(DomHandler, null, [{
|
|
177
|
-
key: "innerWidth",
|
|
178
|
-
value: function innerWidth(el) {
|
|
179
|
-
if (el) {
|
|
180
|
-
var width = el.offsetWidth;
|
|
181
|
-
var style = getComputedStyle(el);
|
|
182
|
-
width += parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
183
|
-
return width;
|
|
184
|
-
}
|
|
185
|
-
return 0;
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
key: "width",
|
|
189
|
-
value: function width(el) {
|
|
190
|
-
if (el) {
|
|
191
|
-
var width = el.offsetWidth;
|
|
192
|
-
var style = getComputedStyle(el);
|
|
193
|
-
width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
194
|
-
return width;
|
|
195
|
-
}
|
|
196
|
-
return 0;
|
|
197
|
-
}
|
|
198
|
-
}, {
|
|
199
|
-
key: "getBrowserLanguage",
|
|
200
|
-
value: function getBrowserLanguage() {
|
|
201
|
-
return navigator.userLanguage || navigator.languages && navigator.languages.length && navigator.languages[0] || navigator.language || navigator.browserLanguage || navigator.systemLanguage || 'en';
|
|
202
|
-
}
|
|
203
|
-
}, {
|
|
204
|
-
key: "getWindowScrollTop",
|
|
205
|
-
value: function getWindowScrollTop() {
|
|
206
|
-
var doc = document.documentElement;
|
|
207
|
-
return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
208
|
-
}
|
|
209
|
-
}, {
|
|
210
|
-
key: "getWindowScrollLeft",
|
|
211
|
-
value: function getWindowScrollLeft() {
|
|
212
|
-
var doc = document.documentElement;
|
|
213
|
-
return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
|
|
214
|
-
}
|
|
215
|
-
}, {
|
|
216
|
-
key: "getOuterWidth",
|
|
217
|
-
value: function getOuterWidth(el, margin) {
|
|
218
|
-
if (el) {
|
|
219
|
-
var width = el.getBoundingClientRect().width || el.offsetWidth;
|
|
220
|
-
if (margin) {
|
|
221
|
-
var style = getComputedStyle(el);
|
|
222
|
-
width += parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
223
|
-
}
|
|
224
|
-
return width;
|
|
225
|
-
}
|
|
226
|
-
return 0;
|
|
227
|
-
}
|
|
228
|
-
}, {
|
|
229
|
-
key: "getOuterHeight",
|
|
230
|
-
value: function getOuterHeight(el, margin) {
|
|
231
|
-
if (el) {
|
|
232
|
-
var height = el.getBoundingClientRect().height || el.offsetHeight;
|
|
233
|
-
if (margin) {
|
|
234
|
-
var style = getComputedStyle(el);
|
|
235
|
-
height += parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
236
|
-
}
|
|
237
|
-
return height;
|
|
238
|
-
}
|
|
239
|
-
return 0;
|
|
240
|
-
}
|
|
241
|
-
}, {
|
|
242
|
-
key: "getClientHeight",
|
|
243
|
-
value: function getClientHeight(el, margin) {
|
|
244
|
-
if (el) {
|
|
245
|
-
var height = el.clientHeight;
|
|
246
|
-
if (margin) {
|
|
247
|
-
var style = getComputedStyle(el);
|
|
248
|
-
height += parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
249
|
-
}
|
|
250
|
-
return height;
|
|
251
|
-
}
|
|
252
|
-
return 0;
|
|
253
|
-
}
|
|
254
|
-
}, {
|
|
255
|
-
key: "getClientWidth",
|
|
256
|
-
value: function getClientWidth(el, margin) {
|
|
257
|
-
if (el) {
|
|
258
|
-
var width = el.clientWidth;
|
|
259
|
-
if (margin) {
|
|
260
|
-
var style = getComputedStyle(el);
|
|
261
|
-
width += parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
262
|
-
}
|
|
263
|
-
return width;
|
|
264
|
-
}
|
|
265
|
-
return 0;
|
|
266
|
-
}
|
|
267
|
-
}, {
|
|
268
|
-
key: "getViewport",
|
|
269
|
-
value: function getViewport() {
|
|
270
|
-
var win = window,
|
|
271
|
-
d = document,
|
|
272
|
-
e = d.documentElement,
|
|
273
|
-
g = d.getElementsByTagName('body')[0],
|
|
274
|
-
w = win.innerWidth || e.clientWidth || g.clientWidth,
|
|
275
|
-
h = win.innerHeight || e.clientHeight || g.clientHeight;
|
|
276
|
-
return {
|
|
277
|
-
width: w,
|
|
278
|
-
height: h
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
}, {
|
|
282
|
-
key: "getOffset",
|
|
283
|
-
value: function getOffset(el) {
|
|
284
|
-
if (el) {
|
|
285
|
-
var rect = el.getBoundingClientRect();
|
|
286
|
-
return {
|
|
287
|
-
top: rect.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0),
|
|
288
|
-
left: rect.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0)
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
return {
|
|
292
|
-
top: 'auto',
|
|
293
|
-
left: 'auto'
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
}, {
|
|
297
|
-
key: "index",
|
|
298
|
-
value: function index(element) {
|
|
299
|
-
if (element) {
|
|
300
|
-
var children = element.parentNode.childNodes;
|
|
301
|
-
var num = 0;
|
|
302
|
-
for (var i = 0; i < children.length; i++) {
|
|
303
|
-
if (children[i] === element) return num;
|
|
304
|
-
if (children[i].nodeType === 1) num++;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return -1;
|
|
308
|
-
}
|
|
309
|
-
}, {
|
|
310
|
-
key: "addMultipleClasses",
|
|
311
|
-
value: function addMultipleClasses(element, className) {
|
|
312
|
-
if (element && className) {
|
|
313
|
-
if (element.classList) {
|
|
314
|
-
var styles = className.split(' ');
|
|
315
|
-
for (var i = 0; i < styles.length; i++) {
|
|
316
|
-
element.classList.add(styles[i]);
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
var _styles = className.split(' ');
|
|
320
|
-
for (var _i = 0; _i < _styles.length; _i++) {
|
|
321
|
-
element.className += ' ' + _styles[_i];
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}, {
|
|
327
|
-
key: "removeMultipleClasses",
|
|
328
|
-
value: function removeMultipleClasses(element, className) {
|
|
329
|
-
if (element && className) {
|
|
330
|
-
if (element.classList) {
|
|
331
|
-
var styles = className.split(' ');
|
|
332
|
-
for (var i = 0; i < styles.length; i++) {
|
|
333
|
-
element.classList.remove(styles[i]);
|
|
334
|
-
}
|
|
335
|
-
} else {
|
|
336
|
-
var _styles2 = className.split(' ');
|
|
337
|
-
for (var _i2 = 0; _i2 < _styles2.length; _i2++) {
|
|
338
|
-
element.className = element.className.replace(new RegExp('(^|\\b)' + _styles2[_i2].split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}, {
|
|
344
|
-
key: "addClass",
|
|
345
|
-
value: function addClass(element, className) {
|
|
346
|
-
if (element && className) {
|
|
347
|
-
if (element.classList) element.classList.add(className);else element.className += ' ' + className;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}, {
|
|
351
|
-
key: "removeClass",
|
|
352
|
-
value: function removeClass(element, className) {
|
|
353
|
-
if (element && className) {
|
|
354
|
-
if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}, {
|
|
358
|
-
key: "hasClass",
|
|
359
|
-
value: function hasClass(element, className) {
|
|
360
|
-
if (element) {
|
|
361
|
-
if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
|
|
362
|
-
}
|
|
363
|
-
return false;
|
|
364
|
-
}
|
|
365
|
-
}, {
|
|
366
|
-
key: "addStyles",
|
|
367
|
-
value: function addStyles(element) {
|
|
368
|
-
var styles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
369
|
-
if (element) {
|
|
370
|
-
Object.entries(styles).forEach(function (_ref) {
|
|
371
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
372
|
-
key = _ref2[0],
|
|
373
|
-
value = _ref2[1];
|
|
374
|
-
return element.style[key] = value;
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}, {
|
|
379
|
-
key: "find",
|
|
380
|
-
value: function find(element, selector) {
|
|
381
|
-
return element ? Array.from(element.querySelectorAll(selector)) : [];
|
|
382
|
-
}
|
|
383
|
-
}, {
|
|
384
|
-
key: "findSingle",
|
|
385
|
-
value: function findSingle(element, selector) {
|
|
386
|
-
if (element) {
|
|
387
|
-
return element.querySelector(selector);
|
|
388
|
-
}
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
}, {
|
|
392
|
-
key: "setAttributes",
|
|
393
|
-
value: function setAttributes(element) {
|
|
394
|
-
var _this = this;
|
|
395
|
-
var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
396
|
-
if (element) {
|
|
397
|
-
var computedStyles = function computedStyles(rule, value) {
|
|
398
|
-
var _element$$attrs, _element$$attrs2;
|
|
399
|
-
var styles = element !== null && element !== void 0 && (_element$$attrs = element.$attrs) !== null && _element$$attrs !== void 0 && _element$$attrs[rule] ? [element === null || element === void 0 || (_element$$attrs2 = element.$attrs) === null || _element$$attrs2 === void 0 ? void 0 : _element$$attrs2[rule]] : [];
|
|
400
|
-
return [value].flat().reduce(function (cv, v) {
|
|
401
|
-
if (v !== null && v !== undefined) {
|
|
402
|
-
var type = _typeof(v);
|
|
403
|
-
if (type === 'string' || type === 'number') {
|
|
404
|
-
cv.push(v);
|
|
405
|
-
} else if (type === 'object') {
|
|
406
|
-
var _cv = Array.isArray(v) ? computedStyles(rule, v) : Object.entries(v).map(function (_ref3) {
|
|
407
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
408
|
-
_k = _ref4[0],
|
|
409
|
-
_v = _ref4[1];
|
|
410
|
-
return rule === 'style' && (!!_v || _v === 0) ? "".concat(_k.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(), ":").concat(_v) : !!_v ? _k : undefined;
|
|
411
|
-
});
|
|
412
|
-
cv = _cv.length ? cv.concat(_cv.filter(function (c) {
|
|
413
|
-
return !!c;
|
|
414
|
-
})) : cv;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
return cv;
|
|
418
|
-
}, styles);
|
|
419
|
-
};
|
|
420
|
-
Object.entries(attributes).forEach(function (_ref5) {
|
|
421
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
422
|
-
key = _ref6[0],
|
|
423
|
-
value = _ref6[1];
|
|
424
|
-
if (value !== undefined && value !== null) {
|
|
425
|
-
var matchedEvent = key.match(/^on(.+)/);
|
|
426
|
-
if (matchedEvent) {
|
|
427
|
-
element.addEventListener(matchedEvent[1].toLowerCase(), value);
|
|
428
|
-
} else if (key === 'p-bind') {
|
|
429
|
-
_this.setAttributes(element, value);
|
|
430
|
-
} else {
|
|
431
|
-
value = key === 'class' ? _toConsumableArray(new Set(computedStyles('class', value))).join(' ').trim() : key === 'style' ? computedStyles('style', value).join(';').trim() : value;
|
|
432
|
-
(element.$attrs = element.$attrs || {}) && (element.$attrs[key] = value);
|
|
433
|
-
element.setAttribute(key, value);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}, {
|
|
440
|
-
key: "getAttribute",
|
|
441
|
-
value: function getAttribute(element, name) {
|
|
442
|
-
if (element) {
|
|
443
|
-
var value = element.getAttribute(name);
|
|
444
|
-
if (!isNaN(value)) {
|
|
445
|
-
return +value;
|
|
446
|
-
}
|
|
447
|
-
if (value === 'true' || value === 'false') {
|
|
448
|
-
return value === 'true';
|
|
449
|
-
}
|
|
450
|
-
return value;
|
|
451
|
-
}
|
|
452
|
-
return undefined;
|
|
453
|
-
}
|
|
454
|
-
}, {
|
|
455
|
-
key: "isAttributeEquals",
|
|
456
|
-
value: function isAttributeEquals(element, name, value) {
|
|
457
|
-
return element ? this.getAttribute(element, name) === value : false;
|
|
458
|
-
}
|
|
459
|
-
}, {
|
|
460
|
-
key: "isAttributeNotEquals",
|
|
461
|
-
value: function isAttributeNotEquals(element, name, value) {
|
|
462
|
-
return !this.isAttributeEquals(element, name, value);
|
|
463
|
-
}
|
|
464
|
-
}, {
|
|
465
|
-
key: "getHeight",
|
|
466
|
-
value: function getHeight(el) {
|
|
467
|
-
if (el) {
|
|
468
|
-
var height = el.offsetHeight;
|
|
469
|
-
var style = getComputedStyle(el);
|
|
470
|
-
height -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
|
471
|
-
return height;
|
|
472
|
-
}
|
|
473
|
-
return 0;
|
|
474
|
-
}
|
|
475
|
-
}, {
|
|
476
|
-
key: "getWidth",
|
|
477
|
-
value: function getWidth(el) {
|
|
478
|
-
if (el) {
|
|
479
|
-
var width = el.offsetWidth;
|
|
480
|
-
var style = getComputedStyle(el);
|
|
481
|
-
width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth);
|
|
482
|
-
return width;
|
|
483
|
-
}
|
|
484
|
-
return 0;
|
|
485
|
-
}
|
|
486
|
-
}, {
|
|
487
|
-
key: "alignOverlay",
|
|
488
|
-
value: function alignOverlay(overlay, target, appendTo) {
|
|
489
|
-
var calculateMinWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
490
|
-
if (overlay && target) {
|
|
491
|
-
if (appendTo === 'self') {
|
|
492
|
-
this.relativePosition(overlay, target);
|
|
493
|
-
} else {
|
|
494
|
-
calculateMinWidth && (overlay.style.minWidth = DomHandler.getOuterWidth(target) + 'px');
|
|
495
|
-
this.absolutePosition(overlay, target);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}, {
|
|
500
|
-
key: "absolutePosition",
|
|
501
|
-
value: function absolutePosition(element, target) {
|
|
502
|
-
var align = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'left';
|
|
503
|
-
if (element && target) {
|
|
504
|
-
var elementDimensions = element.offsetParent ? {
|
|
505
|
-
width: element.offsetWidth,
|
|
506
|
-
height: element.offsetHeight
|
|
507
|
-
} : this.getHiddenElementDimensions(element);
|
|
508
|
-
var elementOuterHeight = elementDimensions.height;
|
|
509
|
-
var elementOuterWidth = elementDimensions.width;
|
|
510
|
-
var targetOuterHeight = target.offsetHeight;
|
|
511
|
-
var targetOuterWidth = target.offsetWidth;
|
|
512
|
-
var targetOffset = target.getBoundingClientRect();
|
|
513
|
-
var windowScrollTop = this.getWindowScrollTop();
|
|
514
|
-
var windowScrollLeft = this.getWindowScrollLeft();
|
|
515
|
-
var viewport = this.getViewport();
|
|
516
|
-
var top, left;
|
|
517
|
-
if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) {
|
|
518
|
-
top = targetOffset.top + windowScrollTop - elementOuterHeight;
|
|
519
|
-
if (top < 0) {
|
|
520
|
-
top = windowScrollTop;
|
|
521
|
-
}
|
|
522
|
-
element.style.transformOrigin = 'bottom';
|
|
523
|
-
} else {
|
|
524
|
-
top = targetOuterHeight + targetOffset.top + windowScrollTop;
|
|
525
|
-
element.style.transformOrigin = 'top';
|
|
526
|
-
}
|
|
527
|
-
var targetOffsetPx = targetOffset.left;
|
|
528
|
-
var alignOffset = align === 'left' ? 0 : elementOuterWidth - targetOuterWidth;
|
|
529
|
-
if (targetOffsetPx + targetOuterWidth + elementOuterWidth > viewport.width) left = Math.max(0, targetOffsetPx + windowScrollLeft + targetOuterWidth - elementOuterWidth);else left = targetOffsetPx - alignOffset + windowScrollLeft;
|
|
530
|
-
element.style.top = top + 'px';
|
|
531
|
-
element.style.left = left + 'px';
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}, {
|
|
535
|
-
key: "relativePosition",
|
|
536
|
-
value: function relativePosition(element, target) {
|
|
537
|
-
if (element && target) {
|
|
538
|
-
var elementDimensions = element.offsetParent ? {
|
|
539
|
-
width: element.offsetWidth,
|
|
540
|
-
height: element.offsetHeight
|
|
541
|
-
} : this.getHiddenElementDimensions(element);
|
|
542
|
-
var targetHeight = target.offsetHeight;
|
|
543
|
-
var targetOffset = target.getBoundingClientRect();
|
|
544
|
-
var viewport = this.getViewport();
|
|
545
|
-
var top, left;
|
|
546
|
-
if (targetOffset.top + targetHeight + elementDimensions.height > viewport.height) {
|
|
547
|
-
top = -1 * elementDimensions.height;
|
|
548
|
-
if (targetOffset.top + top < 0) {
|
|
549
|
-
top = -1 * targetOffset.top;
|
|
550
|
-
}
|
|
551
|
-
element.style.transformOrigin = 'bottom';
|
|
552
|
-
} else {
|
|
553
|
-
top = targetHeight;
|
|
554
|
-
element.style.transformOrigin = 'top';
|
|
555
|
-
}
|
|
556
|
-
if (elementDimensions.width > viewport.width) {
|
|
557
|
-
// element wider then viewport and cannot fit on screen (align at left side of viewport)
|
|
558
|
-
left = targetOffset.left * -1;
|
|
559
|
-
} else if (targetOffset.left + elementDimensions.width > viewport.width) {
|
|
560
|
-
// element wider then viewport but can be fit on screen (align at right side of viewport)
|
|
561
|
-
left = (targetOffset.left + elementDimensions.width - viewport.width) * -1;
|
|
562
|
-
} else {
|
|
563
|
-
// element fits on screen (align with target)
|
|
564
|
-
left = 0;
|
|
565
|
-
}
|
|
566
|
-
element.style.top = top + 'px';
|
|
567
|
-
element.style.left = left + 'px';
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}, {
|
|
571
|
-
key: "flipfitCollision",
|
|
572
|
-
value: function flipfitCollision(element, target) {
|
|
573
|
-
var _this2 = this;
|
|
574
|
-
var my = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'left top';
|
|
575
|
-
var at = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'left bottom';
|
|
576
|
-
var callback = arguments.length > 4 ? arguments[4] : undefined;
|
|
577
|
-
if (element && target) {
|
|
578
|
-
var targetOffset = target.getBoundingClientRect();
|
|
579
|
-
var viewport = this.getViewport();
|
|
580
|
-
var myArr = my.split(' ');
|
|
581
|
-
var atArr = at.split(' ');
|
|
582
|
-
var getPositionValue = function getPositionValue(arr, isOffset) {
|
|
583
|
-
return isOffset ? +arr.substring(arr.search(/(\+|-)/g)) || 0 : arr.substring(0, arr.search(/(\+|-)/g)) || arr;
|
|
584
|
-
};
|
|
585
|
-
var position = {
|
|
586
|
-
my: {
|
|
587
|
-
x: getPositionValue(myArr[0]),
|
|
588
|
-
y: getPositionValue(myArr[1] || myArr[0]),
|
|
589
|
-
offsetX: getPositionValue(myArr[0], true),
|
|
590
|
-
offsetY: getPositionValue(myArr[1] || myArr[0], true)
|
|
591
|
-
},
|
|
592
|
-
at: {
|
|
593
|
-
x: getPositionValue(atArr[0]),
|
|
594
|
-
y: getPositionValue(atArr[1] || atArr[0]),
|
|
595
|
-
offsetX: getPositionValue(atArr[0], true),
|
|
596
|
-
offsetY: getPositionValue(atArr[1] || atArr[0], true)
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
var myOffset = {
|
|
600
|
-
left: function left() {
|
|
601
|
-
var totalOffset = position.my.offsetX + position.at.offsetX;
|
|
602
|
-
return totalOffset + targetOffset.left + (position.my.x === 'left' ? 0 : -1 * (position.my.x === 'center' ? _this2.getOuterWidth(element) / 2 : _this2.getOuterWidth(element)));
|
|
603
|
-
},
|
|
604
|
-
top: function top() {
|
|
605
|
-
var totalOffset = position.my.offsetY + position.at.offsetY;
|
|
606
|
-
return totalOffset + targetOffset.top + (position.my.y === 'top' ? 0 : -1 * (position.my.y === 'center' ? _this2.getOuterHeight(element) / 2 : _this2.getOuterHeight(element)));
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
var alignWithAt = {
|
|
610
|
-
count: {
|
|
611
|
-
x: 0,
|
|
612
|
-
y: 0
|
|
613
|
-
},
|
|
614
|
-
left: function left() {
|
|
615
|
-
var left = myOffset.left();
|
|
616
|
-
var scrollLeft = DomHandler.getWindowScrollLeft();
|
|
617
|
-
element.style.left = left + scrollLeft + 'px';
|
|
618
|
-
if (this.count.x === 2) {
|
|
619
|
-
element.style.left = scrollLeft + 'px';
|
|
620
|
-
this.count.x = 0;
|
|
621
|
-
} else if (left < 0) {
|
|
622
|
-
this.count.x++;
|
|
623
|
-
position.my.x = 'left';
|
|
624
|
-
position.at.x = 'right';
|
|
625
|
-
position.my.offsetX *= -1;
|
|
626
|
-
position.at.offsetX *= -1;
|
|
627
|
-
this.right();
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
right: function right() {
|
|
631
|
-
var left = myOffset.left() + DomHandler.getOuterWidth(target);
|
|
632
|
-
var scrollLeft = DomHandler.getWindowScrollLeft();
|
|
633
|
-
element.style.left = left + scrollLeft + 'px';
|
|
634
|
-
if (this.count.x === 2) {
|
|
635
|
-
element.style.left = viewport.width - DomHandler.getOuterWidth(element) + scrollLeft + 'px';
|
|
636
|
-
this.count.x = 0;
|
|
637
|
-
} else if (left + DomHandler.getOuterWidth(element) > viewport.width) {
|
|
638
|
-
this.count.x++;
|
|
639
|
-
position.my.x = 'right';
|
|
640
|
-
position.at.x = 'left';
|
|
641
|
-
position.my.offsetX *= -1;
|
|
642
|
-
position.at.offsetX *= -1;
|
|
643
|
-
this.left();
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
top: function top() {
|
|
647
|
-
var top = myOffset.top();
|
|
648
|
-
var scrollTop = DomHandler.getWindowScrollTop();
|
|
649
|
-
element.style.top = top + scrollTop + 'px';
|
|
650
|
-
if (this.count.y === 2) {
|
|
651
|
-
element.style.left = scrollTop + 'px';
|
|
652
|
-
this.count.y = 0;
|
|
653
|
-
} else if (top < 0) {
|
|
654
|
-
this.count.y++;
|
|
655
|
-
position.my.y = 'top';
|
|
656
|
-
position.at.y = 'bottom';
|
|
657
|
-
position.my.offsetY *= -1;
|
|
658
|
-
position.at.offsetY *= -1;
|
|
659
|
-
this.bottom();
|
|
660
|
-
}
|
|
661
|
-
},
|
|
662
|
-
bottom: function bottom() {
|
|
663
|
-
var top = myOffset.top() + DomHandler.getOuterHeight(target);
|
|
664
|
-
var scrollTop = DomHandler.getWindowScrollTop();
|
|
665
|
-
element.style.top = top + scrollTop + 'px';
|
|
666
|
-
if (this.count.y === 2) {
|
|
667
|
-
element.style.left = viewport.height - DomHandler.getOuterHeight(element) + scrollTop + 'px';
|
|
668
|
-
this.count.y = 0;
|
|
669
|
-
} else if (top + DomHandler.getOuterHeight(target) > viewport.height) {
|
|
670
|
-
this.count.y++;
|
|
671
|
-
position.my.y = 'bottom';
|
|
672
|
-
position.at.y = 'top';
|
|
673
|
-
position.my.offsetY *= -1;
|
|
674
|
-
position.at.offsetY *= -1;
|
|
675
|
-
this.top();
|
|
676
|
-
}
|
|
677
|
-
},
|
|
678
|
-
center: function center(axis) {
|
|
679
|
-
if (axis === 'y') {
|
|
680
|
-
var top = myOffset.top() + DomHandler.getOuterHeight(target) / 2;
|
|
681
|
-
element.style.top = top + DomHandler.getWindowScrollTop() + 'px';
|
|
682
|
-
if (top < 0) {
|
|
683
|
-
this.bottom();
|
|
684
|
-
} else if (top + DomHandler.getOuterHeight(target) > viewport.height) {
|
|
685
|
-
this.top();
|
|
686
|
-
}
|
|
687
|
-
} else {
|
|
688
|
-
var left = myOffset.left() + DomHandler.getOuterWidth(target) / 2;
|
|
689
|
-
element.style.left = left + DomHandler.getWindowScrollLeft() + 'px';
|
|
690
|
-
if (left < 0) {
|
|
691
|
-
this.left();
|
|
692
|
-
} else if (left + DomHandler.getOuterWidth(element) > viewport.width) {
|
|
693
|
-
this.right();
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
alignWithAt[position.at.x]('x');
|
|
699
|
-
alignWithAt[position.at.y]('y');
|
|
700
|
-
if (this.isFunction(callback)) {
|
|
701
|
-
callback(position);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}, {
|
|
706
|
-
key: "findCollisionPosition",
|
|
707
|
-
value: function findCollisionPosition(position) {
|
|
708
|
-
if (position) {
|
|
709
|
-
var isAxisY = position === 'top' || position === 'bottom';
|
|
710
|
-
var myXPosition = position === 'left' ? 'right' : 'left';
|
|
711
|
-
var myYPosition = position === 'top' ? 'bottom' : 'top';
|
|
712
|
-
if (isAxisY) {
|
|
713
|
-
return {
|
|
714
|
-
axis: 'y',
|
|
715
|
-
my: "center ".concat(myYPosition),
|
|
716
|
-
at: "center ".concat(position)
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
return {
|
|
720
|
-
axis: 'x',
|
|
721
|
-
my: "".concat(myXPosition, " center"),
|
|
722
|
-
at: "".concat(position, " center")
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}, {
|
|
727
|
-
key: "getParents",
|
|
728
|
-
value: function getParents(element) {
|
|
729
|
-
var parents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
730
|
-
return element['parentNode'] === null ? parents : this.getParents(element.parentNode, parents.concat([element.parentNode]));
|
|
731
|
-
}
|
|
732
|
-
}, {
|
|
733
|
-
key: "getScrollableParents",
|
|
734
|
-
value: function getScrollableParents(element) {
|
|
735
|
-
var hideOverlaysOnDocumentScrolling = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
736
|
-
var scrollableParents = [];
|
|
737
|
-
if (element) {
|
|
738
|
-
var parents = this.getParents(element);
|
|
739
|
-
var overflowRegex = /(auto|scroll)/;
|
|
740
|
-
var overflowCheck = function overflowCheck(node) {
|
|
741
|
-
var styleDeclaration = node ? getComputedStyle(node) : null;
|
|
742
|
-
return styleDeclaration && (overflowRegex.test(styleDeclaration.getPropertyValue('overflow')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflowX')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflowY')));
|
|
743
|
-
};
|
|
744
|
-
var addScrollableParent = function addScrollableParent(node) {
|
|
745
|
-
if (hideOverlaysOnDocumentScrolling) {
|
|
746
|
-
// nodeType 9 is for document element
|
|
747
|
-
scrollableParents.push(node.nodeName === 'BODY' || node.nodeName === 'HTML' || node.nodeType === 9 ? window : node);
|
|
748
|
-
} else {
|
|
749
|
-
scrollableParents.push(node);
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
var _iterator = _createForOfIteratorHelper$1(parents),
|
|
753
|
-
_step;
|
|
754
|
-
try {
|
|
755
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
756
|
-
var parent = _step.value;
|
|
757
|
-
var scrollSelectors = parent.nodeType === 1 && parent.dataset['scrollselectors'];
|
|
758
|
-
if (scrollSelectors) {
|
|
759
|
-
var selectors = scrollSelectors.split(',');
|
|
760
|
-
var _iterator2 = _createForOfIteratorHelper$1(selectors),
|
|
761
|
-
_step2;
|
|
762
|
-
try {
|
|
763
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
764
|
-
var selector = _step2.value;
|
|
765
|
-
var el = this.findSingle(parent, selector);
|
|
766
|
-
if (el && overflowCheck(el)) {
|
|
767
|
-
addScrollableParent(el);
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
} catch (err) {
|
|
771
|
-
_iterator2.e(err);
|
|
772
|
-
} finally {
|
|
773
|
-
_iterator2.f();
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// BODY
|
|
778
|
-
if (parent.nodeType === 1 && overflowCheck(parent)) {
|
|
779
|
-
addScrollableParent(parent);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
} catch (err) {
|
|
783
|
-
_iterator.e(err);
|
|
784
|
-
} finally {
|
|
785
|
-
_iterator.f();
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
// we should always at least have the body or window
|
|
790
|
-
if (!scrollableParents.some(function (node) {
|
|
791
|
-
return node === document.body || node === window;
|
|
792
|
-
})) {
|
|
793
|
-
scrollableParents.push(window);
|
|
794
|
-
}
|
|
795
|
-
return scrollableParents;
|
|
796
|
-
}
|
|
797
|
-
}, {
|
|
798
|
-
key: "getHiddenElementOuterHeight",
|
|
799
|
-
value: function getHiddenElementOuterHeight(element) {
|
|
800
|
-
if (element) {
|
|
801
|
-
element.style.visibility = 'hidden';
|
|
802
|
-
element.style.display = 'block';
|
|
803
|
-
var elementHeight = element.offsetHeight;
|
|
804
|
-
element.style.display = 'none';
|
|
805
|
-
element.style.visibility = 'visible';
|
|
806
|
-
return elementHeight;
|
|
807
|
-
}
|
|
808
|
-
return 0;
|
|
809
|
-
}
|
|
810
|
-
}, {
|
|
811
|
-
key: "getHiddenElementOuterWidth",
|
|
812
|
-
value: function getHiddenElementOuterWidth(element) {
|
|
813
|
-
if (element) {
|
|
814
|
-
element.style.visibility = 'hidden';
|
|
815
|
-
element.style.display = 'block';
|
|
816
|
-
var elementWidth = element.offsetWidth;
|
|
817
|
-
element.style.display = 'none';
|
|
818
|
-
element.style.visibility = 'visible';
|
|
819
|
-
return elementWidth;
|
|
820
|
-
}
|
|
821
|
-
return 0;
|
|
822
|
-
}
|
|
823
|
-
}, {
|
|
824
|
-
key: "getHiddenElementDimensions",
|
|
825
|
-
value: function getHiddenElementDimensions(element) {
|
|
826
|
-
var dimensions = {};
|
|
827
|
-
if (element) {
|
|
828
|
-
element.style.visibility = 'hidden';
|
|
829
|
-
element.style.display = 'block';
|
|
830
|
-
dimensions.width = element.offsetWidth;
|
|
831
|
-
dimensions.height = element.offsetHeight;
|
|
832
|
-
element.style.display = 'none';
|
|
833
|
-
element.style.visibility = 'visible';
|
|
834
|
-
}
|
|
835
|
-
return dimensions;
|
|
836
|
-
}
|
|
837
|
-
}, {
|
|
838
|
-
key: "fadeIn",
|
|
839
|
-
value: function fadeIn(element, duration) {
|
|
840
|
-
if (element) {
|
|
841
|
-
element.style.opacity = 0;
|
|
842
|
-
var last = +new Date();
|
|
843
|
-
var opacity = 0;
|
|
844
|
-
var tick = function tick() {
|
|
845
|
-
opacity = +element.style.opacity + (new Date().getTime() - last) / duration;
|
|
846
|
-
element.style.opacity = opacity;
|
|
847
|
-
last = +new Date();
|
|
848
|
-
if (+opacity < 1) {
|
|
849
|
-
window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 16);
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
tick();
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}, {
|
|
856
|
-
key: "fadeOut",
|
|
857
|
-
value: function fadeOut(element, duration) {
|
|
858
|
-
if (element) {
|
|
859
|
-
var opacity = 1,
|
|
860
|
-
interval = 50,
|
|
861
|
-
gap = interval / duration;
|
|
862
|
-
var fading = setInterval(function () {
|
|
863
|
-
opacity -= gap;
|
|
864
|
-
if (opacity <= 0) {
|
|
865
|
-
opacity = 0;
|
|
866
|
-
clearInterval(fading);
|
|
867
|
-
}
|
|
868
|
-
element.style.opacity = opacity;
|
|
869
|
-
}, interval);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
}, {
|
|
873
|
-
key: "getUserAgent",
|
|
874
|
-
value: function getUserAgent() {
|
|
875
|
-
return navigator.userAgent;
|
|
876
|
-
}
|
|
877
|
-
}, {
|
|
878
|
-
key: "isIOS",
|
|
879
|
-
value: function isIOS() {
|
|
880
|
-
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window['MSStream'];
|
|
881
|
-
}
|
|
882
|
-
}, {
|
|
883
|
-
key: "isAndroid",
|
|
884
|
-
value: function isAndroid() {
|
|
885
|
-
return /(android)/i.test(navigator.userAgent);
|
|
886
|
-
}
|
|
887
|
-
}, {
|
|
888
|
-
key: "isChrome",
|
|
889
|
-
value: function isChrome() {
|
|
890
|
-
return /(chrome)/i.test(navigator.userAgent);
|
|
891
|
-
}
|
|
892
|
-
}, {
|
|
893
|
-
key: "isClient",
|
|
894
|
-
value: function isClient() {
|
|
895
|
-
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
896
|
-
}
|
|
897
|
-
}, {
|
|
898
|
-
key: "isTouchDevice",
|
|
899
|
-
value: function isTouchDevice() {
|
|
900
|
-
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
901
|
-
}
|
|
902
|
-
}, {
|
|
903
|
-
key: "isFunction",
|
|
904
|
-
value: function isFunction(obj) {
|
|
905
|
-
return !!(obj && obj.constructor && obj.call && obj.apply);
|
|
906
|
-
}
|
|
907
|
-
}, {
|
|
908
|
-
key: "appendChild",
|
|
909
|
-
value: function appendChild(element, target) {
|
|
910
|
-
if (this.isElement(target)) target.appendChild(element);else if (target.el && target.el.nativeElement) target.el.nativeElement.appendChild(element);else throw new Error('Cannot append ' + target + ' to ' + element);
|
|
911
|
-
}
|
|
912
|
-
}, {
|
|
913
|
-
key: "removeChild",
|
|
914
|
-
value: function removeChild(element, target) {
|
|
915
|
-
if (this.isElement(target)) target.removeChild(element);else if (target.el && target.el.nativeElement) target.el.nativeElement.removeChild(element);else throw new Error('Cannot remove ' + element + ' from ' + target);
|
|
916
|
-
}
|
|
917
|
-
}, {
|
|
918
|
-
key: "isElement",
|
|
919
|
-
value: function isElement(obj) {
|
|
920
|
-
return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? obj instanceof HTMLElement : obj && _typeof(obj) === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string';
|
|
921
|
-
}
|
|
922
|
-
}, {
|
|
923
|
-
key: "scrollInView",
|
|
924
|
-
value: function scrollInView(container, item) {
|
|
925
|
-
var borderTopValue = getComputedStyle(container).getPropertyValue('borderTopWidth');
|
|
926
|
-
var borderTop = borderTopValue ? parseFloat(borderTopValue) : 0;
|
|
927
|
-
var paddingTopValue = getComputedStyle(container).getPropertyValue('paddingTop');
|
|
928
|
-
var paddingTop = paddingTopValue ? parseFloat(paddingTopValue) : 0;
|
|
929
|
-
var containerRect = container.getBoundingClientRect();
|
|
930
|
-
var itemRect = item.getBoundingClientRect();
|
|
931
|
-
var offset = itemRect.top + document.body.scrollTop - (containerRect.top + document.body.scrollTop) - borderTop - paddingTop;
|
|
932
|
-
var scroll = container.scrollTop;
|
|
933
|
-
var elementHeight = container.clientHeight;
|
|
934
|
-
var itemHeight = this.getOuterHeight(item);
|
|
935
|
-
if (offset < 0) {
|
|
936
|
-
container.scrollTop = scroll + offset;
|
|
937
|
-
} else if (offset + itemHeight > elementHeight) {
|
|
938
|
-
container.scrollTop = scroll + offset - elementHeight + itemHeight;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}, {
|
|
942
|
-
key: "clearSelection",
|
|
943
|
-
value: function clearSelection() {
|
|
944
|
-
if (window.getSelection) {
|
|
945
|
-
if (window.getSelection().empty) {
|
|
946
|
-
window.getSelection().empty();
|
|
947
|
-
} else if (window.getSelection().removeAllRanges && window.getSelection().rangeCount > 0 && window.getSelection().getRangeAt(0).getClientRects().length > 0) {
|
|
948
|
-
window.getSelection().removeAllRanges();
|
|
949
|
-
}
|
|
950
|
-
} else if (document['selection'] && document['selection'].empty) {
|
|
951
|
-
try {
|
|
952
|
-
document['selection'].empty();
|
|
953
|
-
} catch (error) {
|
|
954
|
-
//ignore IE bug
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}, {
|
|
959
|
-
key: "calculateScrollbarWidth",
|
|
960
|
-
value: function calculateScrollbarWidth(el) {
|
|
961
|
-
if (el) {
|
|
962
|
-
var style = getComputedStyle(el);
|
|
963
|
-
return el.offsetWidth - el.clientWidth - parseFloat(style.borderLeftWidth) - parseFloat(style.borderRightWidth);
|
|
964
|
-
} else {
|
|
965
|
-
if (this.calculatedScrollbarWidth != null) return this.calculatedScrollbarWidth;
|
|
966
|
-
var scrollDiv = document.createElement('div');
|
|
967
|
-
scrollDiv.className = 'p-scrollbar-measure';
|
|
968
|
-
document.body.appendChild(scrollDiv);
|
|
969
|
-
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
|
970
|
-
document.body.removeChild(scrollDiv);
|
|
971
|
-
this.calculatedScrollbarWidth = scrollbarWidth;
|
|
972
|
-
return scrollbarWidth;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
}, {
|
|
976
|
-
key: "getBrowser",
|
|
977
|
-
value: function getBrowser() {
|
|
978
|
-
if (!this.browser) {
|
|
979
|
-
var matched = this.resolveUserAgent();
|
|
980
|
-
this.browser = {};
|
|
981
|
-
if (matched.browser) {
|
|
982
|
-
this.browser[matched.browser] = true;
|
|
983
|
-
this.browser['version'] = matched.version;
|
|
984
|
-
}
|
|
985
|
-
if (this.browser['chrome']) {
|
|
986
|
-
this.browser['webkit'] = true;
|
|
987
|
-
} else if (this.browser['webkit']) {
|
|
988
|
-
this.browser['safari'] = true;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
return this.browser;
|
|
992
|
-
}
|
|
993
|
-
}, {
|
|
994
|
-
key: "resolveUserAgent",
|
|
995
|
-
value: function resolveUserAgent() {
|
|
996
|
-
var ua = navigator.userAgent.toLowerCase();
|
|
997
|
-
var match = /(chrome)[ ]([\w.]+)/.exec(ua) || /(webkit)[ ]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ ]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
|
|
998
|
-
return {
|
|
999
|
-
browser: match[1] || '',
|
|
1000
|
-
version: match[2] || '0'
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
}, {
|
|
1004
|
-
key: "isVisible",
|
|
1005
|
-
value: function isVisible(element) {
|
|
1006
|
-
// https://stackoverflow.com/a/59096915/502366 (in future use IntersectionObserver)
|
|
1007
|
-
return element && (element.clientHeight !== 0 || element.getClientRects().length !== 0 || getComputedStyle(element).display !== 'none');
|
|
1008
|
-
}
|
|
1009
|
-
}, {
|
|
1010
|
-
key: "isExist",
|
|
1011
|
-
value: function isExist(element) {
|
|
1012
|
-
return !!(element !== null && typeof element !== 'undefined' && element.nodeName && element.parentNode);
|
|
1013
|
-
}
|
|
1014
|
-
}, {
|
|
1015
|
-
key: "getFocusableElements",
|
|
1016
|
-
value: function getFocusableElements(element) {
|
|
1017
|
-
var selector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1018
|
-
var focusableElements = DomHandler.find(element, "button:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])".concat(selector, ",\n [href][clientHeight][clientWidth]:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n input:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n select:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n textarea:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n [tabIndex]:not([tabIndex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n [contenteditable]:not([tabIndex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector));
|
|
1019
|
-
var visibleFocusableElements = [];
|
|
1020
|
-
var _iterator3 = _createForOfIteratorHelper$1(focusableElements),
|
|
1021
|
-
_step3;
|
|
1022
|
-
try {
|
|
1023
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1024
|
-
var focusableElement = _step3.value;
|
|
1025
|
-
if (getComputedStyle(focusableElement).display !== 'none' && getComputedStyle(focusableElement).visibility !== 'hidden') visibleFocusableElements.push(focusableElement);
|
|
1026
|
-
}
|
|
1027
|
-
} catch (err) {
|
|
1028
|
-
_iterator3.e(err);
|
|
1029
|
-
} finally {
|
|
1030
|
-
_iterator3.f();
|
|
1031
|
-
}
|
|
1032
|
-
return visibleFocusableElements;
|
|
1033
|
-
}
|
|
1034
|
-
}, {
|
|
1035
|
-
key: "getFirstFocusableElement",
|
|
1036
|
-
value: function getFirstFocusableElement(element, selector) {
|
|
1037
|
-
var focusableElements = DomHandler.getFocusableElements(element, selector);
|
|
1038
|
-
return focusableElements.length > 0 ? focusableElements[0] : null;
|
|
1039
|
-
}
|
|
1040
|
-
}, {
|
|
1041
|
-
key: "getLastFocusableElement",
|
|
1042
|
-
value: function getLastFocusableElement(element, selector) {
|
|
1043
|
-
var focusableElements = DomHandler.getFocusableElements(element, selector);
|
|
1044
|
-
return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : null;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
/**
|
|
1048
|
-
* Focus an input element if it does not already have focus.
|
|
1049
|
-
*
|
|
1050
|
-
* @param {HTMLElement} el a HTML element
|
|
1051
|
-
* @param {boolean} scrollTo flag to control whether to scroll to the element, false by default
|
|
1052
|
-
*/
|
|
1053
|
-
}, {
|
|
1054
|
-
key: "focus",
|
|
1055
|
-
value: function focus(el, scrollTo) {
|
|
1056
|
-
var preventScroll = scrollTo === undefined ? true : !scrollTo;
|
|
1057
|
-
el && document.activeElement !== el && el.focus({
|
|
1058
|
-
preventScroll: preventScroll
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
/**
|
|
1063
|
-
* Focus the first focusable element if it does not already have focus.
|
|
1064
|
-
*
|
|
1065
|
-
* @param {HTMLElement} el a HTML element
|
|
1066
|
-
* @param {boolean} scrollTo flag to control whether to scroll to the element, false by default
|
|
1067
|
-
* @return {HTMLElement | undefined} the first focusable HTML element found
|
|
1068
|
-
*/
|
|
1069
|
-
}, {
|
|
1070
|
-
key: "focusFirstElement",
|
|
1071
|
-
value: function focusFirstElement(el, scrollTo) {
|
|
1072
|
-
if (!el) return;
|
|
1073
|
-
var firstFocusableElement = DomHandler.getFirstFocusableElement(el);
|
|
1074
|
-
firstFocusableElement && DomHandler.focus(firstFocusableElement, scrollTo);
|
|
1075
|
-
return firstFocusableElement;
|
|
1076
|
-
}
|
|
1077
|
-
}, {
|
|
1078
|
-
key: "getCursorOffset",
|
|
1079
|
-
value: function getCursorOffset(el, prevText, nextText, currentText) {
|
|
1080
|
-
if (el) {
|
|
1081
|
-
var style = getComputedStyle(el);
|
|
1082
|
-
var ghostDiv = document.createElement('div');
|
|
1083
|
-
ghostDiv.style.position = 'absolute';
|
|
1084
|
-
ghostDiv.style.top = '0px';
|
|
1085
|
-
ghostDiv.style.left = '0px';
|
|
1086
|
-
ghostDiv.style.visibility = 'hidden';
|
|
1087
|
-
ghostDiv.style.pointerEvents = 'none';
|
|
1088
|
-
ghostDiv.style.overflow = style.overflow;
|
|
1089
|
-
ghostDiv.style.width = style.width;
|
|
1090
|
-
ghostDiv.style.height = style.height;
|
|
1091
|
-
ghostDiv.style.padding = style.padding;
|
|
1092
|
-
ghostDiv.style.border = style.border;
|
|
1093
|
-
ghostDiv.style.overflowWrap = style.overflowWrap;
|
|
1094
|
-
ghostDiv.style.whiteSpace = style.whiteSpace;
|
|
1095
|
-
ghostDiv.style.lineHeight = style.lineHeight;
|
|
1096
|
-
ghostDiv.innerHTML = prevText.replace(/\r\n|\r|\n/g, '<br />');
|
|
1097
|
-
var ghostSpan = document.createElement('span');
|
|
1098
|
-
ghostSpan.textContent = currentText;
|
|
1099
|
-
ghostDiv.appendChild(ghostSpan);
|
|
1100
|
-
var text = document.createTextNode(nextText);
|
|
1101
|
-
ghostDiv.appendChild(text);
|
|
1102
|
-
document.body.appendChild(ghostDiv);
|
|
1103
|
-
var offsetLeft = ghostSpan.offsetLeft,
|
|
1104
|
-
offsetTop = ghostSpan.offsetTop,
|
|
1105
|
-
clientHeight = ghostSpan.clientHeight;
|
|
1106
|
-
document.body.removeChild(ghostDiv);
|
|
1107
|
-
return {
|
|
1108
|
-
left: Math.abs(offsetLeft - el.scrollLeft),
|
|
1109
|
-
top: Math.abs(offsetTop - el.scrollTop) + clientHeight
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
return {
|
|
1113
|
-
top: 'auto',
|
|
1114
|
-
left: 'auto'
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
|
-
}, {
|
|
1118
|
-
key: "invokeElementMethod",
|
|
1119
|
-
value: function invokeElementMethod(element, methodName, args) {
|
|
1120
|
-
element[methodName].apply(element, args);
|
|
1121
|
-
}
|
|
1122
|
-
}, {
|
|
1123
|
-
key: "isClickable",
|
|
1124
|
-
value: function isClickable(element) {
|
|
1125
|
-
var targetNode = element.nodeName;
|
|
1126
|
-
var parentNode = element.parentElement && element.parentElement.nodeName;
|
|
1127
|
-
return targetNode === 'INPUT' || targetNode === 'TEXTAREA' || targetNode === 'BUTTON' || targetNode === 'A' || parentNode === 'INPUT' || parentNode === 'TEXTAREA' || parentNode === 'BUTTON' || parentNode === 'A' || this.hasClass(element, 'p-button') || this.hasClass(element.parentElement, 'p-button') || this.hasClass(element.parentElement, 'p-checkbox') || this.hasClass(element.parentElement, 'p-radiobutton');
|
|
1128
|
-
}
|
|
1129
|
-
}, {
|
|
1130
|
-
key: "applyStyle",
|
|
1131
|
-
value: function applyStyle(element, style) {
|
|
1132
|
-
if (typeof style === 'string') {
|
|
1133
|
-
element.style.cssText = this.style;
|
|
1134
|
-
} else {
|
|
1135
|
-
for (var prop in this.style) {
|
|
1136
|
-
element.style[prop] = style[prop];
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
}, {
|
|
1141
|
-
key: "exportCSV",
|
|
1142
|
-
value: function exportCSV(csv, filename) {
|
|
1143
|
-
var blob = new Blob([csv], {
|
|
1144
|
-
type: 'application/csv;charset=utf-8;'
|
|
1145
|
-
});
|
|
1146
|
-
if (window.navigator.msSaveOrOpenBlob) {
|
|
1147
|
-
navigator.msSaveOrOpenBlob(blob, filename + '.csv');
|
|
1148
|
-
} else {
|
|
1149
|
-
var isDownloaded = DomHandler.saveAs({
|
|
1150
|
-
name: filename + '.csv',
|
|
1151
|
-
src: URL.createObjectURL(blob)
|
|
1152
|
-
});
|
|
1153
|
-
if (!isDownloaded) {
|
|
1154
|
-
csv = 'data:text/csv;charset=utf-8,' + csv;
|
|
1155
|
-
window.open(encodeURI(csv));
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
}, {
|
|
1160
|
-
key: "saveAs",
|
|
1161
|
-
value: function saveAs(file) {
|
|
1162
|
-
if (file) {
|
|
1163
|
-
var link = document.createElement('a');
|
|
1164
|
-
if (link.download !== undefined) {
|
|
1165
|
-
var name = file.name,
|
|
1166
|
-
src = file.src;
|
|
1167
|
-
link.setAttribute('href', src);
|
|
1168
|
-
link.setAttribute('download', name);
|
|
1169
|
-
link.style.display = 'none';
|
|
1170
|
-
document.body.appendChild(link);
|
|
1171
|
-
link.click();
|
|
1172
|
-
document.body.removeChild(link);
|
|
1173
|
-
return true;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
return false;
|
|
1177
|
-
}
|
|
1178
|
-
}, {
|
|
1179
|
-
key: "createInlineStyle",
|
|
1180
|
-
value: function createInlineStyle(nonce) {
|
|
1181
|
-
var styleElement = document.createElement('style');
|
|
1182
|
-
DomHandler.addNonce(styleElement, nonce);
|
|
1183
|
-
document.head.appendChild(styleElement);
|
|
1184
|
-
return styleElement;
|
|
1185
|
-
}
|
|
1186
|
-
}, {
|
|
1187
|
-
key: "removeInlineStyle",
|
|
1188
|
-
value: function removeInlineStyle(styleElement) {
|
|
1189
|
-
if (this.isExist(styleElement)) {
|
|
1190
|
-
try {
|
|
1191
|
-
document.head.removeChild(styleElement);
|
|
1192
|
-
} catch (error) {
|
|
1193
|
-
// style element may have already been removed in a fast refresh
|
|
1194
|
-
}
|
|
1195
|
-
styleElement = null;
|
|
1196
|
-
}
|
|
1197
|
-
return styleElement;
|
|
1198
|
-
}
|
|
1199
|
-
}, {
|
|
1200
|
-
key: "addNonce",
|
|
1201
|
-
value: function addNonce(styleElement, nonce) {
|
|
1202
|
-
try {
|
|
1203
|
-
if (!nonce) {
|
|
1204
|
-
nonce = process.env.REACT_APP_CSS_NONCE;
|
|
1205
|
-
}
|
|
1206
|
-
} catch (error) {
|
|
1207
|
-
// NOOP
|
|
1208
|
-
}
|
|
1209
|
-
nonce && styleElement.setAttribute('nonce', nonce);
|
|
1210
|
-
}
|
|
1211
|
-
}, {
|
|
1212
|
-
key: "getTargetElement",
|
|
1213
|
-
value: function getTargetElement(target) {
|
|
1214
|
-
if (!target) return null;
|
|
1215
|
-
if (target === 'document') {
|
|
1216
|
-
return document;
|
|
1217
|
-
} else if (target === 'window') {
|
|
1218
|
-
return window;
|
|
1219
|
-
} else if (_typeof(target) === 'object' && target.hasOwnProperty('current')) {
|
|
1220
|
-
return this.isExist(target.current) ? target.current : null;
|
|
1221
|
-
} else {
|
|
1222
|
-
var isFunction = function isFunction(obj) {
|
|
1223
|
-
return !!(obj && obj.constructor && obj.call && obj.apply);
|
|
1224
|
-
};
|
|
1225
|
-
var element = isFunction(target) ? target() : target;
|
|
1226
|
-
return element && element.nodeType === 9 || this.isExist(element) ? element : null;
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
/**
|
|
1231
|
-
* Get the attribute names for an element and sorts them alpha for comparison
|
|
1232
|
-
*/
|
|
1233
|
-
}, {
|
|
1234
|
-
key: "getAttributeNames",
|
|
1235
|
-
value: function getAttributeNames(node) {
|
|
1236
|
-
var index, rv, attrs;
|
|
1237
|
-
rv = [];
|
|
1238
|
-
attrs = node.attributes;
|
|
1239
|
-
for (index = 0; index < attrs.length; ++index) {
|
|
1240
|
-
rv.push(attrs[index].nodeName);
|
|
1241
|
-
}
|
|
1242
|
-
rv.sort();
|
|
1243
|
-
return rv;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
/**
|
|
1247
|
-
* Compare two elements for equality. Even will compare if the style element
|
|
1248
|
-
* is out of order for example:
|
|
1249
|
-
*
|
|
1250
|
-
* elem1 = style="color: red; font-size: 28px"
|
|
1251
|
-
* elem2 = style="font-size: 28px; color: red"
|
|
1252
|
-
*/
|
|
1253
|
-
}, {
|
|
1254
|
-
key: "isEqualElement",
|
|
1255
|
-
value: function isEqualElement(elm1, elm2) {
|
|
1256
|
-
var attrs1, attrs2, name, node1, node2;
|
|
1257
|
-
|
|
1258
|
-
// Compare attributes without order sensitivity
|
|
1259
|
-
attrs1 = DomHandler.getAttributeNames(elm1);
|
|
1260
|
-
attrs2 = DomHandler.getAttributeNames(elm2);
|
|
1261
|
-
if (attrs1.join(',') !== attrs2.join(',')) {
|
|
1262
|
-
// console.log("Found nodes with different sets of attributes; not equiv");
|
|
1263
|
-
return false;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
// ...and values
|
|
1267
|
-
// unless you want to compare DOM0 event handlers
|
|
1268
|
-
// (onclick="...")
|
|
1269
|
-
for (var index = 0; index < attrs1.length; ++index) {
|
|
1270
|
-
name = attrs1[index];
|
|
1271
|
-
if (name === 'style') {
|
|
1272
|
-
var astyle = elm1.style;
|
|
1273
|
-
var bstyle = elm2.style;
|
|
1274
|
-
var rexDigitsOnly = /^\d+$/;
|
|
1275
|
-
for (var _i3 = 0, _Object$keys = Object.keys(astyle); _i3 < _Object$keys.length; _i3++) {
|
|
1276
|
-
var key = _Object$keys[_i3];
|
|
1277
|
-
if (!rexDigitsOnly.test(key) && astyle[key] !== bstyle[key]) {
|
|
1278
|
-
// Not equivalent, stop
|
|
1279
|
-
//console.log("Found nodes with mis-matched values for attribute '" + name + "'; not equiv");
|
|
1280
|
-
return false;
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
} else {
|
|
1284
|
-
if (elm1.getAttribute(name) !== elm2.getAttribute(name)) {
|
|
1285
|
-
// console.log("Found nodes with mis-matched values for attribute '" + name + "'; not equiv");
|
|
1286
|
-
return false;
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
// Walk the children
|
|
1292
|
-
for (node1 = elm1.firstChild, node2 = elm2.firstChild; node1 && node2; node1 = node1.nextSibling, node2 = node2.nextSibling) {
|
|
1293
|
-
if (node1.nodeType !== node2.nodeType) {
|
|
1294
|
-
// display("Found nodes of different types; not equiv");
|
|
1295
|
-
return false;
|
|
1296
|
-
}
|
|
1297
|
-
if (node1.nodeType === 1) {
|
|
1298
|
-
// Element
|
|
1299
|
-
if (!DomHandler.isEqualElement(node1, node2)) {
|
|
1300
|
-
return false;
|
|
1301
|
-
}
|
|
1302
|
-
} else if (node1.nodeValue !== node2.nodeValue) {
|
|
1303
|
-
// console.log("Found nodes with mis-matched nodeValues; not equiv");
|
|
1304
|
-
return false;
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
if (node1 || node2) {
|
|
1308
|
-
// One of the elements had more nodes than the other
|
|
1309
|
-
// console.log("Found more children of one element than the other; not equivalent");
|
|
1310
|
-
return false;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
// Seem the same
|
|
1314
|
-
return true;
|
|
1315
|
-
}
|
|
1316
|
-
}]);
|
|
1317
|
-
return DomHandler;
|
|
1318
|
-
}();
|
|
1319
|
-
/**
|
|
1320
|
-
* All data- properties like data-test-id
|
|
1321
|
-
*/
|
|
1322
|
-
_defineProperty(DomHandler, "DATA_PROPS", ['data-']);
|
|
1323
|
-
/**
|
|
1324
|
-
* All ARIA properties like aria-label and focus-target for https://www.npmjs.com/package/@q42/floating-focus-a11y
|
|
1325
|
-
*/
|
|
1326
|
-
_defineProperty(DomHandler, "ARIA_PROPS", ['aria', 'focus-target']);
|
|
1327
|
-
|
|
1328
|
-
function EventBus() {
|
|
1329
|
-
var allHandlers = new Map();
|
|
1330
|
-
return {
|
|
1331
|
-
on: function on(type, handler) {
|
|
1332
|
-
var handlers = allHandlers.get(type);
|
|
1333
|
-
if (!handlers) handlers = [handler];else handlers.push(handler);
|
|
1334
|
-
allHandlers.set(type, handlers);
|
|
1335
|
-
},
|
|
1336
|
-
off: function off(type, handler) {
|
|
1337
|
-
var handlers = allHandlers.get(type);
|
|
1338
|
-
handlers && handlers.splice(handlers.indexOf(handler) >>> 0, 1);
|
|
1339
|
-
},
|
|
1340
|
-
emit: function emit(type, evt) {
|
|
1341
|
-
var handlers = allHandlers.get(type);
|
|
1342
|
-
handlers && handlers.slice().forEach(function (handler) {
|
|
1343
|
-
return handler(evt);
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
};
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
function _extends() {
|
|
1350
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1351
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1352
|
-
var source = arguments[i];
|
|
1353
|
-
for (var key in source) {
|
|
1354
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1355
|
-
target[key] = source[key];
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
return target;
|
|
1360
|
-
};
|
|
1361
|
-
return _extends.apply(this, arguments);
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
1365
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1366
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
1367
|
-
var ObjectUtils = /*#__PURE__*/function () {
|
|
1368
|
-
function ObjectUtils() {
|
|
1369
|
-
_classCallCheck(this, ObjectUtils);
|
|
1370
|
-
}
|
|
1371
|
-
_createClass(ObjectUtils, null, [{
|
|
1372
|
-
key: "equals",
|
|
1373
|
-
value: function equals(obj1, obj2, field) {
|
|
1374
|
-
if (field && obj1 && _typeof(obj1) === 'object' && obj2 && _typeof(obj2) === 'object') return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field);else return this.deepEquals(obj1, obj2);
|
|
1375
|
-
}
|
|
1376
|
-
}, {
|
|
1377
|
-
key: "deepEquals",
|
|
1378
|
-
value: function deepEquals(a, b) {
|
|
1379
|
-
if (a === b) return true;
|
|
1380
|
-
if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') {
|
|
1381
|
-
var arrA = Array.isArray(a),
|
|
1382
|
-
arrB = Array.isArray(b),
|
|
1383
|
-
i,
|
|
1384
|
-
length,
|
|
1385
|
-
key;
|
|
1386
|
-
if (arrA && arrB) {
|
|
1387
|
-
length = a.length;
|
|
1388
|
-
if (length !== b.length) return false;
|
|
1389
|
-
for (i = length; i-- !== 0;) if (!this.deepEquals(a[i], b[i])) return false;
|
|
1390
|
-
return true;
|
|
1391
|
-
}
|
|
1392
|
-
if (arrA !== arrB) return false;
|
|
1393
|
-
var dateA = a instanceof Date,
|
|
1394
|
-
dateB = b instanceof Date;
|
|
1395
|
-
if (dateA !== dateB) return false;
|
|
1396
|
-
if (dateA && dateB) return a.getTime() === b.getTime();
|
|
1397
|
-
var regexpA = a instanceof RegExp,
|
|
1398
|
-
regexpB = b instanceof RegExp;
|
|
1399
|
-
if (regexpA !== regexpB) return false;
|
|
1400
|
-
if (regexpA && regexpB) return a.toString() === b.toString();
|
|
1401
|
-
var keys = Object.keys(a);
|
|
1402
|
-
length = keys.length;
|
|
1403
|
-
if (length !== Object.keys(b).length) return false;
|
|
1404
|
-
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
1405
|
-
for (i = length; i-- !== 0;) {
|
|
1406
|
-
key = keys[i];
|
|
1407
|
-
if (!this.deepEquals(a[key], b[key])) return false;
|
|
1408
|
-
}
|
|
1409
|
-
return true;
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
/*eslint no-self-compare: "off"*/
|
|
1413
|
-
return a !== a && b !== b;
|
|
1414
|
-
}
|
|
1415
|
-
}, {
|
|
1416
|
-
key: "resolveFieldData",
|
|
1417
|
-
value: function resolveFieldData(data, field) {
|
|
1418
|
-
if (!data || !field) {
|
|
1419
|
-
// short circuit if there is nothing to resolve
|
|
1420
|
-
return null;
|
|
1421
|
-
}
|
|
1422
|
-
try {
|
|
1423
|
-
var value = data[field];
|
|
1424
|
-
if (this.isNotEmpty(value)) return value;
|
|
1425
|
-
} catch (_unused) {
|
|
1426
|
-
// Performance optimization: https://github.com/primefaces/primereact/issues/4797
|
|
1427
|
-
// do nothing and continue to other methods to resolve field data
|
|
1428
|
-
}
|
|
1429
|
-
if (Object.keys(data).length) {
|
|
1430
|
-
if (this.isFunction(field)) {
|
|
1431
|
-
return field(data);
|
|
1432
|
-
} else if (this.isNotEmpty(data[field])) {
|
|
1433
|
-
return data[field];
|
|
1434
|
-
} else if (field.indexOf('.') === -1) {
|
|
1435
|
-
return data[field];
|
|
1436
|
-
} else {
|
|
1437
|
-
var fields = field.split('.');
|
|
1438
|
-
var _value = data;
|
|
1439
|
-
for (var i = 0, len = fields.length; i < len; ++i) {
|
|
1440
|
-
if (_value == null) {
|
|
1441
|
-
return null;
|
|
1442
|
-
}
|
|
1443
|
-
_value = _value[fields[i]];
|
|
1444
|
-
}
|
|
1445
|
-
return _value;
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
return null;
|
|
1449
|
-
}
|
|
1450
|
-
}, {
|
|
1451
|
-
key: "findDiffKeys",
|
|
1452
|
-
value: function findDiffKeys(obj1, obj2) {
|
|
1453
|
-
if (!obj1 || !obj2) {
|
|
1454
|
-
return {};
|
|
1455
|
-
}
|
|
1456
|
-
return Object.keys(obj1).filter(function (key) {
|
|
1457
|
-
return !obj2.hasOwnProperty(key);
|
|
1458
|
-
}).reduce(function (result, current) {
|
|
1459
|
-
result[current] = obj1[current];
|
|
1460
|
-
return result;
|
|
1461
|
-
}, {});
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
/**
|
|
1465
|
-
* Removes keys from a JSON object that start with a string such as "data" to get all "data-id" type properties.
|
|
1466
|
-
*
|
|
1467
|
-
* @param {any} obj the JSON object to reduce
|
|
1468
|
-
* @param {string[]} startsWiths the string(s) to check if the property starts with this key
|
|
1469
|
-
* @returns the JSON object containing only the key/values that match the startsWith string
|
|
1470
|
-
*/
|
|
1471
|
-
}, {
|
|
1472
|
-
key: "reduceKeys",
|
|
1473
|
-
value: function reduceKeys(obj, startsWiths) {
|
|
1474
|
-
var result = {};
|
|
1475
|
-
if (!obj || !startsWiths || startsWiths.length === 0) {
|
|
1476
|
-
return result;
|
|
1477
|
-
}
|
|
1478
|
-
Object.keys(obj).filter(function (key) {
|
|
1479
|
-
return startsWiths.some(function (value) {
|
|
1480
|
-
return key.startsWith(value);
|
|
1481
|
-
});
|
|
1482
|
-
}).forEach(function (key) {
|
|
1483
|
-
result[key] = obj[key];
|
|
1484
|
-
delete obj[key];
|
|
1485
|
-
});
|
|
1486
|
-
return result;
|
|
1487
|
-
}
|
|
1488
|
-
}, {
|
|
1489
|
-
key: "reorderArray",
|
|
1490
|
-
value: function reorderArray(value, from, to) {
|
|
1491
|
-
if (value && from !== to) {
|
|
1492
|
-
if (to >= value.length) {
|
|
1493
|
-
to %= value.length;
|
|
1494
|
-
from %= value.length;
|
|
1495
|
-
}
|
|
1496
|
-
value.splice(to, 0, value.splice(from, 1)[0]);
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
}, {
|
|
1500
|
-
key: "findIndexInList",
|
|
1501
|
-
value: function findIndexInList(value, list, dataKey) {
|
|
1502
|
-
var _this = this;
|
|
1503
|
-
if (list) {
|
|
1504
|
-
return dataKey ? list.findIndex(function (item) {
|
|
1505
|
-
return _this.equals(item, value, dataKey);
|
|
1506
|
-
}) : list.findIndex(function (item) {
|
|
1507
|
-
return item === value;
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
return -1;
|
|
1511
|
-
}
|
|
1512
|
-
}, {
|
|
1513
|
-
key: "getJSXElement",
|
|
1514
|
-
value: function getJSXElement(obj) {
|
|
1515
|
-
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1516
|
-
params[_key - 1] = arguments[_key];
|
|
1517
|
-
}
|
|
1518
|
-
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
1519
|
-
}
|
|
1520
|
-
}, {
|
|
1521
|
-
key: "getItemValue",
|
|
1522
|
-
value: function getItemValue(obj) {
|
|
1523
|
-
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1524
|
-
params[_key2 - 1] = arguments[_key2];
|
|
1525
|
-
}
|
|
1526
|
-
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
1527
|
-
}
|
|
1528
|
-
}, {
|
|
1529
|
-
key: "getProp",
|
|
1530
|
-
value: function getProp(props) {
|
|
1531
|
-
var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1532
|
-
var defaultProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1533
|
-
var value = props ? props[prop] : undefined;
|
|
1534
|
-
return value === undefined ? defaultProps[prop] : value;
|
|
1535
|
-
}
|
|
1536
|
-
}, {
|
|
1537
|
-
key: "getPropCaseInsensitive",
|
|
1538
|
-
value: function getPropCaseInsensitive(props, prop) {
|
|
1539
|
-
var defaultProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1540
|
-
var fkey = this.toFlatCase(prop);
|
|
1541
|
-
for (var key in props) {
|
|
1542
|
-
if (props.hasOwnProperty(key) && this.toFlatCase(key) === fkey) {
|
|
1543
|
-
return props[key];
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
for (var _key3 in defaultProps) {
|
|
1547
|
-
if (defaultProps.hasOwnProperty(_key3) && this.toFlatCase(_key3) === fkey) {
|
|
1548
|
-
return defaultProps[_key3];
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
return undefined; // Property not found
|
|
1552
|
-
}
|
|
1553
|
-
}, {
|
|
1554
|
-
key: "getMergedProps",
|
|
1555
|
-
value: function getMergedProps(props, defaultProps) {
|
|
1556
|
-
return Object.assign({}, defaultProps, props);
|
|
1557
|
-
}
|
|
1558
|
-
}, {
|
|
1559
|
-
key: "getDiffProps",
|
|
1560
|
-
value: function getDiffProps(props, defaultProps) {
|
|
1561
|
-
return this.findDiffKeys(props, defaultProps);
|
|
1562
|
-
}
|
|
1563
|
-
}, {
|
|
1564
|
-
key: "getPropValue",
|
|
1565
|
-
value: function getPropValue(obj) {
|
|
1566
|
-
for (var _len3 = arguments.length, params = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {
|
|
1567
|
-
params[_key4 - 1] = arguments[_key4];
|
|
1568
|
-
}
|
|
1569
|
-
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
1570
|
-
}
|
|
1571
|
-
}, {
|
|
1572
|
-
key: "getComponentProp",
|
|
1573
|
-
value: function getComponentProp(component) {
|
|
1574
|
-
var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1575
|
-
var defaultProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1576
|
-
return this.isNotEmpty(component) ? this.getProp(component.props, prop, defaultProps) : undefined;
|
|
1577
|
-
}
|
|
1578
|
-
}, {
|
|
1579
|
-
key: "getComponentProps",
|
|
1580
|
-
value: function getComponentProps(component, defaultProps) {
|
|
1581
|
-
return this.isNotEmpty(component) ? this.getMergedProps(component.props, defaultProps) : undefined;
|
|
1582
|
-
}
|
|
1583
|
-
}, {
|
|
1584
|
-
key: "getComponentDiffProps",
|
|
1585
|
-
value: function getComponentDiffProps(component, defaultProps) {
|
|
1586
|
-
return this.isNotEmpty(component) ? this.getDiffProps(component.props, defaultProps) : undefined;
|
|
1587
|
-
}
|
|
1588
|
-
}, {
|
|
1589
|
-
key: "isValidChild",
|
|
1590
|
-
value: function isValidChild(child, type, validTypes) {
|
|
1591
|
-
/* eslint-disable */
|
|
1592
|
-
if (child) {
|
|
1593
|
-
var childType = this.getComponentProp(child, '__TYPE') || (child.type ? child.type.displayName : undefined);
|
|
1594
|
-
var isValid = childType === type;
|
|
1595
|
-
try {
|
|
1596
|
-
var messageTypes; if ("production" !== 'production' && !isValid) ;
|
|
1597
|
-
} catch (error) {
|
|
1598
|
-
// NOOP
|
|
1599
|
-
}
|
|
1600
|
-
return isValid;
|
|
1601
|
-
}
|
|
1602
|
-
return false;
|
|
1603
|
-
/* eslint-enable */
|
|
1604
|
-
}
|
|
1605
|
-
}, {
|
|
1606
|
-
key: "getRefElement",
|
|
1607
|
-
value: function getRefElement(ref) {
|
|
1608
|
-
if (ref) {
|
|
1609
|
-
return _typeof(ref) === 'object' && ref.hasOwnProperty('current') ? ref.current : ref;
|
|
1610
|
-
}
|
|
1611
|
-
return null;
|
|
1612
|
-
}
|
|
1613
|
-
}, {
|
|
1614
|
-
key: "combinedRefs",
|
|
1615
|
-
value: function combinedRefs(innerRef, forwardRef) {
|
|
1616
|
-
if (innerRef && forwardRef) {
|
|
1617
|
-
if (typeof forwardRef === 'function') {
|
|
1618
|
-
forwardRef(innerRef.current);
|
|
1619
|
-
} else {
|
|
1620
|
-
forwardRef.current = innerRef.current;
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
}, {
|
|
1625
|
-
key: "removeAccents",
|
|
1626
|
-
value: function removeAccents(str) {
|
|
1627
|
-
if (str && str.search(/[\xC0-\xFF]/g) > -1) {
|
|
1628
|
-
str = str.replace(/[\xC0-\xC5]/g, 'A').replace(/[\xC6]/g, 'AE').replace(/[\xC7]/g, 'C').replace(/[\xC8-\xCB]/g, 'E').replace(/[\xCC-\xCF]/g, 'I').replace(/[\xD0]/g, 'D').replace(/[\xD1]/g, 'N').replace(/[\xD2-\xD6\xD8]/g, 'O').replace(/[\xD9-\xDC]/g, 'U').replace(/[\xDD]/g, 'Y').replace(/[\xDE]/g, 'P').replace(/[\xE0-\xE5]/g, 'a').replace(/[\xE6]/g, 'ae').replace(/[\xE7]/g, 'c').replace(/[\xE8-\xEB]/g, 'e').replace(/[\xEC-\xEF]/g, 'i').replace(/[\xF1]/g, 'n').replace(/[\xF2-\xF6\xF8]/g, 'o').replace(/[\xF9-\xFC]/g, 'u').replace(/[\xFE]/g, 'p').replace(/[\xFD\xFF]/g, 'y');
|
|
1629
|
-
}
|
|
1630
|
-
return str;
|
|
1631
|
-
}
|
|
1632
|
-
}, {
|
|
1633
|
-
key: "toFlatCase",
|
|
1634
|
-
value: function toFlatCase(str) {
|
|
1635
|
-
// convert snake, kebab, camel and pascal cases to flat case
|
|
1636
|
-
return this.isNotEmpty(str) && this.isString(str) ? str.replace(/(-|_)/g, '').toLowerCase() : str;
|
|
1637
|
-
}
|
|
1638
|
-
}, {
|
|
1639
|
-
key: "toCapitalCase",
|
|
1640
|
-
value: function toCapitalCase(str) {
|
|
1641
|
-
return this.isNotEmpty(str) && this.isString(str) ? str[0].toUpperCase() + str.slice(1) : str;
|
|
1642
|
-
}
|
|
1643
|
-
}, {
|
|
1644
|
-
key: "trim",
|
|
1645
|
-
value: function trim(value) {
|
|
1646
|
-
// trim only if the value is actually a string
|
|
1647
|
-
return this.isNotEmpty(value) && this.isString(value) ? value.trim() : value;
|
|
1648
|
-
}
|
|
1649
|
-
}, {
|
|
1650
|
-
key: "isEmpty",
|
|
1651
|
-
value: function isEmpty(value) {
|
|
1652
|
-
return value === null || value === undefined || value === '' || Array.isArray(value) && value.length === 0 || !(value instanceof Date) && _typeof(value) === 'object' && Object.keys(value).length === 0;
|
|
1653
|
-
}
|
|
1654
|
-
}, {
|
|
1655
|
-
key: "isNotEmpty",
|
|
1656
|
-
value: function isNotEmpty(value) {
|
|
1657
|
-
return !this.isEmpty(value);
|
|
1658
|
-
}
|
|
1659
|
-
}, {
|
|
1660
|
-
key: "isFunction",
|
|
1661
|
-
value: function isFunction(value) {
|
|
1662
|
-
return !!(value && value.constructor && value.call && value.apply);
|
|
1663
|
-
}
|
|
1664
|
-
}, {
|
|
1665
|
-
key: "isObject",
|
|
1666
|
-
value: function isObject(value) {
|
|
1667
|
-
return value !== null && value instanceof Object && value.constructor === Object;
|
|
1668
|
-
}
|
|
1669
|
-
}, {
|
|
1670
|
-
key: "isDate",
|
|
1671
|
-
value: function isDate(value) {
|
|
1672
|
-
return value !== null && value instanceof Date && value.constructor === Date;
|
|
1673
|
-
}
|
|
1674
|
-
}, {
|
|
1675
|
-
key: "isArray",
|
|
1676
|
-
value: function isArray(value) {
|
|
1677
|
-
return value !== null && Array.isArray(value);
|
|
1678
|
-
}
|
|
1679
|
-
}, {
|
|
1680
|
-
key: "isString",
|
|
1681
|
-
value: function isString(value) {
|
|
1682
|
-
return value !== null && typeof value === 'string';
|
|
1683
|
-
}
|
|
1684
|
-
}, {
|
|
1685
|
-
key: "isPrintableCharacter",
|
|
1686
|
-
value: function isPrintableCharacter() {
|
|
1687
|
-
var _char = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1688
|
-
return this.isNotEmpty(_char) && _char.length === 1 && _char.match(/\S| /);
|
|
1689
|
-
}
|
|
1690
|
-
}, {
|
|
1691
|
-
key: "isLetter",
|
|
1692
|
-
value: function isLetter(_char2) {
|
|
1693
|
-
return _char2 && (_char2.toUpperCase() != _char2.toLowerCase() || _char2.codePointAt(0) > 127);
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
/**
|
|
1697
|
-
* Firefox-v103 does not currently support the "findLast" method. It is stated that this method will be supported with Firefox-v104.
|
|
1698
|
-
* https://caniuse.com/mdn-javascript_builtins_array_findlast
|
|
1699
|
-
*/
|
|
1700
|
-
}, {
|
|
1701
|
-
key: "findLast",
|
|
1702
|
-
value: function findLast(arr, callback) {
|
|
1703
|
-
var item;
|
|
1704
|
-
if (this.isNotEmpty(arr)) {
|
|
1705
|
-
try {
|
|
1706
|
-
item = arr.findLast(callback);
|
|
1707
|
-
} catch (_unused2) {
|
|
1708
|
-
item = _toConsumableArray(arr).reverse().find(callback);
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
return item;
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
/**
|
|
1715
|
-
* Firefox-v103 does not currently support the "findLastIndex" method. It is stated that this method will be supported with Firefox-v104.
|
|
1716
|
-
* https://caniuse.com/mdn-javascript_builtins_array_findlastindex
|
|
1717
|
-
*/
|
|
1718
|
-
}, {
|
|
1719
|
-
key: "findLastIndex",
|
|
1720
|
-
value: function findLastIndex(arr, callback) {
|
|
1721
|
-
var index = -1;
|
|
1722
|
-
if (this.isNotEmpty(arr)) {
|
|
1723
|
-
try {
|
|
1724
|
-
index = arr.findLastIndex(callback);
|
|
1725
|
-
} catch (_unused3) {
|
|
1726
|
-
index = arr.lastIndexOf(_toConsumableArray(arr).reverse().find(callback));
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
return index;
|
|
1730
|
-
}
|
|
1731
|
-
}, {
|
|
1732
|
-
key: "sort",
|
|
1733
|
-
value: function sort(value1, value2) {
|
|
1734
|
-
var order = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1735
|
-
var comparator = arguments.length > 3 ? arguments[3] : undefined;
|
|
1736
|
-
var nullSortOrder = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
1737
|
-
var result = this.compare(value1, value2, comparator, order);
|
|
1738
|
-
var finalSortOrder = order;
|
|
1739
|
-
|
|
1740
|
-
// nullSortOrder == 1 means Excel like sort nulls at bottom
|
|
1741
|
-
if (this.isEmpty(value1) || this.isEmpty(value2)) {
|
|
1742
|
-
finalSortOrder = nullSortOrder === 1 ? order : nullSortOrder;
|
|
1743
|
-
}
|
|
1744
|
-
return finalSortOrder * result;
|
|
1745
|
-
}
|
|
1746
|
-
}, {
|
|
1747
|
-
key: "compare",
|
|
1748
|
-
value: function compare(value1, value2, comparator) {
|
|
1749
|
-
var order = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
1750
|
-
var result = -1;
|
|
1751
|
-
var emptyValue1 = this.isEmpty(value1);
|
|
1752
|
-
var emptyValue2 = this.isEmpty(value2);
|
|
1753
|
-
if (emptyValue1 && emptyValue2) result = 0;else if (emptyValue1) result = order;else if (emptyValue2) result = -order;else if (typeof value1 === 'string' && typeof value2 === 'string') result = comparator(value1, value2);else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
1754
|
-
return result;
|
|
1755
|
-
}
|
|
1756
|
-
}, {
|
|
1757
|
-
key: "localeComparator",
|
|
1758
|
-
value: function localeComparator(locale) {
|
|
1759
|
-
//performance gain using Int.Collator. It is not recommended to use localeCompare against large arrays.
|
|
1760
|
-
return new Intl.Collator(locale, {
|
|
1761
|
-
numeric: true
|
|
1762
|
-
}).compare;
|
|
1763
|
-
}
|
|
1764
|
-
}, {
|
|
1765
|
-
key: "findChildrenByKey",
|
|
1766
|
-
value: function findChildrenByKey(data, key) {
|
|
1767
|
-
var _iterator = _createForOfIteratorHelper(data),
|
|
1768
|
-
_step;
|
|
1769
|
-
try {
|
|
1770
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1771
|
-
var item = _step.value;
|
|
1772
|
-
if (item.key === key) {
|
|
1773
|
-
return item.children || [];
|
|
1774
|
-
} else if (item.children) {
|
|
1775
|
-
var result = this.findChildrenByKey(item.children, key);
|
|
1776
|
-
if (result.length > 0) {
|
|
1777
|
-
return result;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
} catch (err) {
|
|
1782
|
-
_iterator.e(err);
|
|
1783
|
-
} finally {
|
|
1784
|
-
_iterator.f();
|
|
1785
|
-
}
|
|
1786
|
-
return [];
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
/**
|
|
1790
|
-
* This function takes mutates and object with a new value given
|
|
1791
|
-
* a specific field. This will handle deeply nested fields that
|
|
1792
|
-
* need to be modified or created.
|
|
1793
|
-
*
|
|
1794
|
-
* e.g:
|
|
1795
|
-
* data = {
|
|
1796
|
-
* nested: {
|
|
1797
|
-
* foo: "bar"
|
|
1798
|
-
* }
|
|
1799
|
-
* }
|
|
1800
|
-
*
|
|
1801
|
-
* field = "nested.foo"
|
|
1802
|
-
* value = "baz"
|
|
1803
|
-
*
|
|
1804
|
-
* The function will mutate data to be
|
|
1805
|
-
* e.g:
|
|
1806
|
-
* data = {
|
|
1807
|
-
* nested: {
|
|
1808
|
-
* foo: "baz"
|
|
1809
|
-
* }
|
|
1810
|
-
* }
|
|
1811
|
-
*
|
|
1812
|
-
* @param {object} data the object to be modified
|
|
1813
|
-
* @param {string} field the field in the object to replace
|
|
1814
|
-
* @param {any} value the value to have replaced in the field
|
|
1815
|
-
*/
|
|
1816
|
-
}, {
|
|
1817
|
-
key: "mutateFieldData",
|
|
1818
|
-
value: function mutateFieldData(data, field, value) {
|
|
1819
|
-
if (_typeof(data) !== 'object' || typeof field !== 'string') {
|
|
1820
|
-
// short circuit if there is nothing to resolve
|
|
1821
|
-
return;
|
|
1822
|
-
}
|
|
1823
|
-
var fields = field.split('.');
|
|
1824
|
-
var obj = data;
|
|
1825
|
-
for (var i = 0, len = fields.length; i < len; ++i) {
|
|
1826
|
-
// Check if we are on the last field
|
|
1827
|
-
if (i + 1 - len === 0) {
|
|
1828
|
-
obj[fields[i]] = value;
|
|
1829
|
-
break;
|
|
1830
|
-
}
|
|
1831
|
-
if (!obj[fields[i]]) {
|
|
1832
|
-
obj[fields[i]] = {};
|
|
1833
|
-
}
|
|
1834
|
-
obj = obj[fields[i]];
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
}]);
|
|
1838
|
-
return ObjectUtils;
|
|
1839
|
-
}();
|
|
1840
|
-
|
|
1841
|
-
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1842
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1843
|
-
var IconUtils = /*#__PURE__*/function () {
|
|
1844
|
-
function IconUtils() {
|
|
1845
|
-
_classCallCheck(this, IconUtils);
|
|
1846
|
-
}
|
|
1847
|
-
_createClass(IconUtils, null, [{
|
|
1848
|
-
key: "getJSXIcon",
|
|
1849
|
-
value: function getJSXIcon(icon) {
|
|
1850
|
-
var iconProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1851
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1852
|
-
var content = null;
|
|
1853
|
-
if (icon !== null) {
|
|
1854
|
-
var iconType = _typeof(icon);
|
|
1855
|
-
var className = classNames(iconProps.className, iconType === 'string' && icon);
|
|
1856
|
-
content = /*#__PURE__*/React.createElement("span", _extends({}, iconProps, {
|
|
1857
|
-
className: className
|
|
1858
|
-
}));
|
|
1859
|
-
if (iconType !== 'string') {
|
|
1860
|
-
var defaultContentOptions = _objectSpread$2({
|
|
1861
|
-
iconProps: iconProps,
|
|
1862
|
-
element: content
|
|
1863
|
-
}, options);
|
|
1864
|
-
return ObjectUtils.getJSXElement(icon, defaultContentOptions);
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
return content;
|
|
1868
|
-
}
|
|
1869
|
-
}]);
|
|
1870
|
-
return IconUtils;
|
|
1871
|
-
}();
|
|
1872
|
-
|
|
1873
|
-
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1874
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1875
|
-
function mask(el, options) {
|
|
1876
|
-
var defaultOptions = {
|
|
1877
|
-
mask: null,
|
|
1878
|
-
slotChar: '_',
|
|
1879
|
-
autoClear: true,
|
|
1880
|
-
unmask: false,
|
|
1881
|
-
readOnly: false,
|
|
1882
|
-
onComplete: null,
|
|
1883
|
-
onChange: null,
|
|
1884
|
-
onFocus: null,
|
|
1885
|
-
onBlur: null
|
|
1886
|
-
};
|
|
1887
|
-
options = _objectSpread$1(_objectSpread$1({}, defaultOptions), options);
|
|
1888
|
-
var tests, partialPosition, len, firstNonMaskPos, defs, androidChrome, lastRequiredNonMaskPos, oldVal, focusText, caretTimeoutId, buffer, defaultBuffer;
|
|
1889
|
-
var caret = function caret(first, last) {
|
|
1890
|
-
var range, begin, end;
|
|
1891
|
-
if (!el.offsetParent || el !== document.activeElement) {
|
|
1892
|
-
return;
|
|
1893
|
-
}
|
|
1894
|
-
if (typeof first === 'number') {
|
|
1895
|
-
begin = first;
|
|
1896
|
-
end = typeof last === 'number' ? last : begin;
|
|
1897
|
-
if (el.setSelectionRange) {
|
|
1898
|
-
el.setSelectionRange(begin, end);
|
|
1899
|
-
} else if (el['createTextRange']) {
|
|
1900
|
-
range = el['createTextRange']();
|
|
1901
|
-
range.collapse(true);
|
|
1902
|
-
range.moveEnd('character', end);
|
|
1903
|
-
range.moveStart('character', begin);
|
|
1904
|
-
range.select();
|
|
1905
|
-
}
|
|
1906
|
-
} else {
|
|
1907
|
-
if (el.setSelectionRange) {
|
|
1908
|
-
begin = el.selectionStart;
|
|
1909
|
-
end = el.selectionEnd;
|
|
1910
|
-
} else if (document['selection'] && document['selection'].createRange) {
|
|
1911
|
-
range = document['selection'].createRange();
|
|
1912
|
-
begin = 0 - range.duplicate().moveStart('character', -100000);
|
|
1913
|
-
end = begin + range.text.length;
|
|
1914
|
-
}
|
|
1915
|
-
return {
|
|
1916
|
-
begin: begin,
|
|
1917
|
-
end: end
|
|
1918
|
-
};
|
|
1919
|
-
}
|
|
1920
|
-
};
|
|
1921
|
-
var isCompleted = function isCompleted() {
|
|
1922
|
-
for (var i = firstNonMaskPos; i <= lastRequiredNonMaskPos; i++) {
|
|
1923
|
-
if (tests[i] && buffer[i] === getPlaceholder(i)) {
|
|
1924
|
-
return false;
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
return true;
|
|
1928
|
-
};
|
|
1929
|
-
var getPlaceholder = function getPlaceholder(i) {
|
|
1930
|
-
if (i < options.slotChar.length) {
|
|
1931
|
-
return options.slotChar.charAt(i);
|
|
1932
|
-
}
|
|
1933
|
-
return options.slotChar.charAt(0);
|
|
1934
|
-
};
|
|
1935
|
-
var getValue = function getValue() {
|
|
1936
|
-
return options.unmask ? getUnmaskedValue() : el && el.value;
|
|
1937
|
-
};
|
|
1938
|
-
var seekNext = function seekNext(pos) {
|
|
1939
|
-
while (++pos < len && !tests[pos]);
|
|
1940
|
-
return pos;
|
|
1941
|
-
};
|
|
1942
|
-
var seekPrev = function seekPrev(pos) {
|
|
1943
|
-
while (--pos >= 0 && !tests[pos]);
|
|
1944
|
-
return pos;
|
|
1945
|
-
};
|
|
1946
|
-
var shiftL = function shiftL(begin, end) {
|
|
1947
|
-
var i, j;
|
|
1948
|
-
if (begin < 0) {
|
|
1949
|
-
return;
|
|
1950
|
-
}
|
|
1951
|
-
for (i = begin, j = seekNext(end); i < len; i++) {
|
|
1952
|
-
if (tests[i]) {
|
|
1953
|
-
if (j < len && tests[i].test(buffer[j])) {
|
|
1954
|
-
buffer[i] = buffer[j];
|
|
1955
|
-
buffer[j] = getPlaceholder(j);
|
|
1956
|
-
} else {
|
|
1957
|
-
break;
|
|
1958
|
-
}
|
|
1959
|
-
j = seekNext(j);
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
writeBuffer();
|
|
1963
|
-
caret(Math.max(firstNonMaskPos, begin));
|
|
1964
|
-
};
|
|
1965
|
-
var shiftR = function shiftR(pos) {
|
|
1966
|
-
var i, c, j, t;
|
|
1967
|
-
for (i = pos, c = getPlaceholder(pos); i < len; i++) {
|
|
1968
|
-
if (tests[i]) {
|
|
1969
|
-
j = seekNext(i);
|
|
1970
|
-
t = buffer[i];
|
|
1971
|
-
buffer[i] = c;
|
|
1972
|
-
if (j < len && tests[j].test(t)) {
|
|
1973
|
-
c = t;
|
|
1974
|
-
} else {
|
|
1975
|
-
break;
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
};
|
|
1980
|
-
var handleAndroidInput = function handleAndroidInput(e) {
|
|
1981
|
-
var curVal = el.value;
|
|
1982
|
-
var pos = caret();
|
|
1983
|
-
if (oldVal && oldVal.length && oldVal.length > curVal.length) {
|
|
1984
|
-
// a deletion or backspace happened
|
|
1985
|
-
checkVal(true);
|
|
1986
|
-
while (pos.begin > 0 && !tests[pos.begin - 1]) pos.begin--;
|
|
1987
|
-
if (pos.begin === 0) {
|
|
1988
|
-
while (pos.begin < firstNonMaskPos && !tests[pos.begin]) pos.begin++;
|
|
1989
|
-
}
|
|
1990
|
-
caret(pos.begin, pos.begin);
|
|
1991
|
-
} else {
|
|
1992
|
-
checkVal(true);
|
|
1993
|
-
while (pos.begin < len && !tests[pos.begin]) pos.begin++;
|
|
1994
|
-
caret(pos.begin, pos.begin);
|
|
1995
|
-
}
|
|
1996
|
-
if (options.onComplete && isCompleted()) {
|
|
1997
|
-
options.onComplete({
|
|
1998
|
-
originalEvent: e,
|
|
1999
|
-
value: getValue()
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
};
|
|
2003
|
-
var onBlur = function onBlur(e) {
|
|
2004
|
-
checkVal();
|
|
2005
|
-
options.onBlur && options.onBlur(e);
|
|
2006
|
-
updateModel(e);
|
|
2007
|
-
if (el.value !== focusText) {
|
|
2008
|
-
var event = document.createEvent('HTMLEvents');
|
|
2009
|
-
event.initEvent('change', true, false);
|
|
2010
|
-
el.dispatchEvent(event);
|
|
2011
|
-
}
|
|
2012
|
-
};
|
|
2013
|
-
var onKeyDown = function onKeyDown(e) {
|
|
2014
|
-
if (options.readOnly) {
|
|
2015
|
-
return;
|
|
2016
|
-
}
|
|
2017
|
-
var k = e.which || e.keyCode,
|
|
2018
|
-
pos,
|
|
2019
|
-
begin,
|
|
2020
|
-
end;
|
|
2021
|
-
oldVal = el.value;
|
|
2022
|
-
|
|
2023
|
-
//backspace, delete, and escape get special treatment
|
|
2024
|
-
if (k === 8 || k === 46 || DomHandler.isIOS() && k === 127) {
|
|
2025
|
-
pos = caret();
|
|
2026
|
-
begin = pos.begin;
|
|
2027
|
-
end = pos.end;
|
|
2028
|
-
if (end - begin === 0) {
|
|
2029
|
-
begin = k !== 46 ? seekPrev(begin) : end = seekNext(begin - 1);
|
|
2030
|
-
end = k === 46 ? seekNext(end) : end;
|
|
2031
|
-
}
|
|
2032
|
-
clearBuffer(begin, end);
|
|
2033
|
-
shiftL(begin, end - 1);
|
|
2034
|
-
updateModel(e);
|
|
2035
|
-
e.preventDefault();
|
|
2036
|
-
} else if (k === 13) {
|
|
2037
|
-
// enter
|
|
2038
|
-
onBlur(e);
|
|
2039
|
-
updateModel(e);
|
|
2040
|
-
} else if (k === 27) {
|
|
2041
|
-
// escape
|
|
2042
|
-
el.value = focusText;
|
|
2043
|
-
caret(0, checkVal());
|
|
2044
|
-
updateModel(e);
|
|
2045
|
-
e.preventDefault();
|
|
2046
|
-
}
|
|
2047
|
-
};
|
|
2048
|
-
var onKeyPress = function onKeyPress(e) {
|
|
2049
|
-
if (options.readOnly) {
|
|
2050
|
-
return;
|
|
2051
|
-
}
|
|
2052
|
-
var k = e.which || e.keyCode,
|
|
2053
|
-
pos = caret(),
|
|
2054
|
-
p,
|
|
2055
|
-
c,
|
|
2056
|
-
next,
|
|
2057
|
-
completed;
|
|
2058
|
-
if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {
|
|
2059
|
-
//Ignore
|
|
2060
|
-
return;
|
|
2061
|
-
} else if (k && k !== 13) {
|
|
2062
|
-
if (pos.end - pos.begin !== 0) {
|
|
2063
|
-
clearBuffer(pos.begin, pos.end);
|
|
2064
|
-
shiftL(pos.begin, pos.end - 1);
|
|
2065
|
-
}
|
|
2066
|
-
p = seekNext(pos.begin - 1);
|
|
2067
|
-
if (p < len) {
|
|
2068
|
-
c = String.fromCharCode(k);
|
|
2069
|
-
if (tests[p].test(c)) {
|
|
2070
|
-
shiftR(p);
|
|
2071
|
-
buffer[p] = c;
|
|
2072
|
-
writeBuffer();
|
|
2073
|
-
next = seekNext(p);
|
|
2074
|
-
if (DomHandler.isAndroid()) {
|
|
2075
|
-
//Path for CSP Violation on FireFox OS 1.1
|
|
2076
|
-
var proxy = function proxy() {
|
|
2077
|
-
caret(next);
|
|
2078
|
-
};
|
|
2079
|
-
setTimeout(proxy, 0);
|
|
2080
|
-
} else {
|
|
2081
|
-
caret(next);
|
|
2082
|
-
}
|
|
2083
|
-
if (pos.begin <= lastRequiredNonMaskPos) {
|
|
2084
|
-
completed = isCompleted();
|
|
2085
|
-
}
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
e.preventDefault();
|
|
2089
|
-
}
|
|
2090
|
-
updateModel(e);
|
|
2091
|
-
if (options.onComplete && completed) {
|
|
2092
|
-
options.onComplete({
|
|
2093
|
-
originalEvent: e,
|
|
2094
|
-
value: getValue()
|
|
2095
|
-
});
|
|
2096
|
-
}
|
|
2097
|
-
};
|
|
2098
|
-
var clearBuffer = function clearBuffer(start, end) {
|
|
2099
|
-
var i;
|
|
2100
|
-
for (i = start; i < end && i < len; i++) {
|
|
2101
|
-
if (tests[i]) {
|
|
2102
|
-
buffer[i] = getPlaceholder(i);
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2105
|
-
};
|
|
2106
|
-
var writeBuffer = function writeBuffer() {
|
|
2107
|
-
el.value = buffer.join('');
|
|
2108
|
-
};
|
|
2109
|
-
var checkVal = function checkVal(allow) {
|
|
2110
|
-
//try to place characters where they belong
|
|
2111
|
-
var test = el.value,
|
|
2112
|
-
lastMatch = -1,
|
|
2113
|
-
i,
|
|
2114
|
-
c,
|
|
2115
|
-
pos;
|
|
2116
|
-
for (i = 0, pos = 0; i < len; i++) {
|
|
2117
|
-
if (tests[i]) {
|
|
2118
|
-
buffer[i] = getPlaceholder(i);
|
|
2119
|
-
while (pos++ < test.length) {
|
|
2120
|
-
c = test.charAt(pos - 1);
|
|
2121
|
-
if (tests[i].test(c)) {
|
|
2122
|
-
buffer[i] = c;
|
|
2123
|
-
lastMatch = i;
|
|
2124
|
-
break;
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
if (pos > test.length) {
|
|
2128
|
-
clearBuffer(i + 1, len);
|
|
2129
|
-
break;
|
|
2130
|
-
}
|
|
2131
|
-
} else {
|
|
2132
|
-
if (buffer[i] === test.charAt(pos)) {
|
|
2133
|
-
pos++;
|
|
2134
|
-
}
|
|
2135
|
-
if (i < partialPosition) {
|
|
2136
|
-
lastMatch = i;
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
if (allow) {
|
|
2141
|
-
writeBuffer();
|
|
2142
|
-
} else if (lastMatch + 1 < partialPosition) {
|
|
2143
|
-
if (options.autoClear || buffer.join('') === defaultBuffer) {
|
|
2144
|
-
// Invalid value. Remove it and replace it with the
|
|
2145
|
-
// mask, which is the default behavior.
|
|
2146
|
-
if (el.value) el.value = '';
|
|
2147
|
-
clearBuffer(0, len);
|
|
2148
|
-
} else {
|
|
2149
|
-
// Invalid value, but we opt to show the value to the
|
|
2150
|
-
// user and allow them to correct their mistake.
|
|
2151
|
-
writeBuffer();
|
|
2152
|
-
}
|
|
2153
|
-
} else {
|
|
2154
|
-
writeBuffer();
|
|
2155
|
-
el.value = el.value.substring(0, lastMatch + 1);
|
|
2156
|
-
}
|
|
2157
|
-
return partialPosition ? i : firstNonMaskPos;
|
|
2158
|
-
};
|
|
2159
|
-
var onFocus = function onFocus(e) {
|
|
2160
|
-
if (options.readOnly) {
|
|
2161
|
-
return;
|
|
2162
|
-
}
|
|
2163
|
-
clearTimeout(caretTimeoutId);
|
|
2164
|
-
var pos;
|
|
2165
|
-
focusText = el.value;
|
|
2166
|
-
pos = checkVal();
|
|
2167
|
-
caretTimeoutId = setTimeout(function () {
|
|
2168
|
-
if (el !== document.activeElement) {
|
|
2169
|
-
return;
|
|
2170
|
-
}
|
|
2171
|
-
writeBuffer();
|
|
2172
|
-
if (pos === options.mask.replace('?', '').length) {
|
|
2173
|
-
caret(0, pos);
|
|
2174
|
-
} else {
|
|
2175
|
-
caret(pos);
|
|
2176
|
-
}
|
|
2177
|
-
}, 10);
|
|
2178
|
-
if (options.onFocus) {
|
|
2179
|
-
options.onFocus(e);
|
|
2180
|
-
}
|
|
2181
|
-
};
|
|
2182
|
-
var onInput = function onInput(event) {
|
|
2183
|
-
if (androidChrome) handleAndroidInput(event);else handleInputChange(event);
|
|
2184
|
-
};
|
|
2185
|
-
var handleInputChange = function handleInputChange(e) {
|
|
2186
|
-
if (options.readOnly) {
|
|
2187
|
-
return;
|
|
2188
|
-
}
|
|
2189
|
-
var pos = checkVal(true);
|
|
2190
|
-
caret(pos);
|
|
2191
|
-
updateModel(e);
|
|
2192
|
-
if (options.onComplete && isCompleted()) {
|
|
2193
|
-
options.onComplete({
|
|
2194
|
-
originalEvent: e,
|
|
2195
|
-
value: getValue()
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
};
|
|
2199
|
-
var getUnmaskedValue = function getUnmaskedValue() {
|
|
2200
|
-
var unmaskedBuffer = [];
|
|
2201
|
-
for (var i = 0; i < buffer.length; i++) {
|
|
2202
|
-
var c = buffer[i];
|
|
2203
|
-
if (tests[i] && c !== getPlaceholder(i)) {
|
|
2204
|
-
unmaskedBuffer.push(c);
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
return unmaskedBuffer.join('');
|
|
2208
|
-
};
|
|
2209
|
-
var updateModel = function updateModel(e) {
|
|
2210
|
-
if (options.onChange) {
|
|
2211
|
-
var val = getValue().replace(options.slotChar, '');
|
|
2212
|
-
options.onChange({
|
|
2213
|
-
originalEvent: e,
|
|
2214
|
-
value: defaultBuffer !== val ? val : ''
|
|
2215
|
-
});
|
|
2216
|
-
}
|
|
2217
|
-
};
|
|
2218
|
-
var bindEvents = function bindEvents() {
|
|
2219
|
-
el.addEventListener('focus', onFocus);
|
|
2220
|
-
el.addEventListener('blur', onBlur);
|
|
2221
|
-
el.addEventListener('keydown', onKeyDown);
|
|
2222
|
-
el.addEventListener('keypress', onKeyPress);
|
|
2223
|
-
el.addEventListener('input', onInput);
|
|
2224
|
-
el.addEventListener('paste', handleInputChange);
|
|
2225
|
-
};
|
|
2226
|
-
var unbindEvents = function unbindEvents() {
|
|
2227
|
-
el.removeEventListener('focus', onFocus);
|
|
2228
|
-
el.removeEventListener('blur', onBlur);
|
|
2229
|
-
el.removeEventListener('keydown', onKeyDown);
|
|
2230
|
-
el.removeEventListener('keypress', onKeyPress);
|
|
2231
|
-
el.removeEventListener('input', onInput);
|
|
2232
|
-
el.removeEventListener('paste', handleInputChange);
|
|
2233
|
-
};
|
|
2234
|
-
var init = function init() {
|
|
2235
|
-
tests = [];
|
|
2236
|
-
partialPosition = options.mask.length;
|
|
2237
|
-
len = options.mask.length;
|
|
2238
|
-
firstNonMaskPos = null;
|
|
2239
|
-
defs = {
|
|
2240
|
-
9: '[0-9]',
|
|
2241
|
-
a: '[A-Za-z]',
|
|
2242
|
-
'*': '[A-Za-z0-9]'
|
|
2243
|
-
};
|
|
2244
|
-
androidChrome = DomHandler.isChrome() && DomHandler.isAndroid();
|
|
2245
|
-
var maskTokens = options.mask.split('');
|
|
2246
|
-
for (var i = 0; i < maskTokens.length; i++) {
|
|
2247
|
-
var c = maskTokens[i];
|
|
2248
|
-
if (c === '?') {
|
|
2249
|
-
len--;
|
|
2250
|
-
partialPosition = i;
|
|
2251
|
-
} else if (defs[c]) {
|
|
2252
|
-
tests.push(new RegExp(defs[c]));
|
|
2253
|
-
if (firstNonMaskPos === null) {
|
|
2254
|
-
firstNonMaskPos = tests.length - 1;
|
|
2255
|
-
}
|
|
2256
|
-
if (i < partialPosition) {
|
|
2257
|
-
lastRequiredNonMaskPos = tests.length - 1;
|
|
2258
|
-
}
|
|
2259
|
-
} else {
|
|
2260
|
-
tests.push(null);
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
buffer = [];
|
|
2264
|
-
for (var _i = 0; _i < maskTokens.length; _i++) {
|
|
2265
|
-
var _c = maskTokens[_i];
|
|
2266
|
-
if (_c !== '?') {
|
|
2267
|
-
if (defs[_c]) buffer.push(getPlaceholder(_i));else buffer.push(_c);
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
defaultBuffer = buffer.join('');
|
|
2271
|
-
};
|
|
2272
|
-
if (el && options.mask) {
|
|
2273
|
-
init();
|
|
2274
|
-
bindEvents();
|
|
2275
|
-
}
|
|
2276
|
-
return {
|
|
2277
|
-
init: init,
|
|
2278
|
-
bindEvents: bindEvents,
|
|
2279
|
-
unbindEvents: unbindEvents,
|
|
2280
|
-
updateModel: updateModel,
|
|
2281
|
-
getValue: getValue
|
|
2282
|
-
};
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2286
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2287
|
-
function mergeProps() {
|
|
2288
|
-
for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2289
|
-
props[_key] = arguments[_key];
|
|
2290
|
-
}
|
|
2291
|
-
if (props) {
|
|
2292
|
-
var isFn = function isFn(o) {
|
|
2293
|
-
return !!(o && o.constructor && o.call && o.apply);
|
|
2294
|
-
};
|
|
2295
|
-
return props.reduce(function (merged, ps) {
|
|
2296
|
-
var _loop = function _loop() {
|
|
2297
|
-
var value = ps[key];
|
|
2298
|
-
if (key === 'style') {
|
|
2299
|
-
merged['style'] = _objectSpread(_objectSpread({}, merged['style']), ps['style']);
|
|
2300
|
-
} else if (key === 'className') {
|
|
2301
|
-
var newClassname = [merged['className'], ps['className']].join(' ').trim();
|
|
2302
|
-
var isEmpty = newClassname === null || newClassname === undefined || newClassname === '';
|
|
2303
|
-
merged['className'] = isEmpty ? undefined : newClassname;
|
|
2304
|
-
} else if (isFn(value)) {
|
|
2305
|
-
var fn = merged[key];
|
|
2306
|
-
merged[key] = fn ? function () {
|
|
2307
|
-
fn.apply(void 0, arguments);
|
|
2308
|
-
value.apply(void 0, arguments);
|
|
2309
|
-
} : value;
|
|
2310
|
-
} else {
|
|
2311
|
-
merged[key] = value;
|
|
2312
|
-
}
|
|
2313
|
-
};
|
|
2314
|
-
for (var key in ps) {
|
|
2315
|
-
_loop();
|
|
2316
|
-
}
|
|
2317
|
-
return merged;
|
|
2318
|
-
}, {});
|
|
2319
|
-
}
|
|
2320
|
-
return undefined;
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
var lastId = 0;
|
|
2324
|
-
function UniqueComponentId() {
|
|
2325
|
-
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'pr_id_';
|
|
2326
|
-
lastId++;
|
|
2327
|
-
return "".concat(prefix).concat(lastId);
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2330
|
-
function handler() {
|
|
2331
|
-
var zIndexes = [];
|
|
2332
|
-
var generateZIndex = function generateZIndex(key, autoZIndex) {
|
|
2333
|
-
var baseZIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 999;
|
|
2334
|
-
var lastZIndex = getLastZIndex(key, autoZIndex, baseZIndex);
|
|
2335
|
-
var newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1;
|
|
2336
|
-
zIndexes.push({
|
|
2337
|
-
key: key,
|
|
2338
|
-
value: newZIndex
|
|
2339
|
-
});
|
|
2340
|
-
return newZIndex;
|
|
2341
|
-
};
|
|
2342
|
-
var revertZIndex = function revertZIndex(zIndex) {
|
|
2343
|
-
zIndexes = zIndexes.filter(function (obj) {
|
|
2344
|
-
return obj.value !== zIndex;
|
|
2345
|
-
});
|
|
2346
|
-
};
|
|
2347
|
-
var getCurrentZIndex = function getCurrentZIndex(key, autoZIndex) {
|
|
2348
|
-
return getLastZIndex(key, autoZIndex).value;
|
|
2349
|
-
};
|
|
2350
|
-
var getLastZIndex = function getLastZIndex(key, autoZIndex) {
|
|
2351
|
-
var baseZIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
2352
|
-
return _toConsumableArray(zIndexes).reverse().find(function (obj) {
|
|
2353
|
-
return autoZIndex ? true : obj.key === key;
|
|
2354
|
-
}) || {
|
|
2355
|
-
key: key,
|
|
2356
|
-
value: baseZIndex
|
|
2357
|
-
};
|
|
2358
|
-
};
|
|
2359
|
-
var getZIndex = function getZIndex(el) {
|
|
2360
|
-
return el ? parseInt(el.style.zIndex, 10) || 0 : 0;
|
|
2361
|
-
};
|
|
2362
|
-
return {
|
|
2363
|
-
get: getZIndex,
|
|
2364
|
-
set: function set(key, el, autoZIndex, baseZIndex) {
|
|
2365
|
-
if (el) {
|
|
2366
|
-
el.style.zIndex = String(generateZIndex(key, autoZIndex, baseZIndex));
|
|
2367
|
-
}
|
|
2368
|
-
},
|
|
2369
|
-
clear: function clear(el) {
|
|
2370
|
-
if (el) {
|
|
2371
|
-
revertZIndex(ZIndexUtils.get(el));
|
|
2372
|
-
el.style.zIndex = '';
|
|
2373
|
-
}
|
|
2374
|
-
},
|
|
2375
|
-
getCurrent: function getCurrent(key, autoZIndex) {
|
|
2376
|
-
return getCurrentZIndex(key, autoZIndex);
|
|
2377
|
-
}
|
|
2378
|
-
};
|
|
2379
|
-
}
|
|
2380
|
-
var ZIndexUtils = handler();
|
|
2381
|
-
|
|
2382
|
-
export { DomHandler, EventBus, IconUtils, ObjectUtils, UniqueComponentId, ZIndexUtils, classNames, mask, mergeProps };
|