primereact 8.0.0-rc.1 → 8.0.1
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 +8 -5
- package/accordion/accordion.cjs.js +1 -1
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.d.ts +2 -0
- package/accordion/accordion.esm.js +1 -1
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +1 -1
- package/accordion/accordion.min.js +1 -1
- package/api/api.cjs.js +2 -5
- package/api/api.cjs.min.js +1 -1
- package/api/api.esm.js +2 -5
- package/api/api.esm.min.js +1 -1
- package/api/api.js +2 -5
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +5 -0
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +2 -1
- package/autocomplete/autocomplete.esm.js +5 -0
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +5 -0
- package/autocomplete/autocomplete.min.js +1 -1
- package/avatar/avatar.d.ts +1 -0
- package/avatargroup/avatargroup.d.ts +1 -0
- package/badge/badge.d.ts +1 -0
- package/blockui/blockui.d.ts +1 -0
- package/breadcrumb/breadcrumb.cjs.js +7 -5
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.d.ts +1 -0
- package/breadcrumb/breadcrumb.esm.js +8 -6
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +7 -5
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/button/button.cjs.js +3 -1
- package/button/button.cjs.min.js +1 -1
- package/button/button.d.ts +1 -0
- package/button/button.esm.js +3 -1
- package/button/button.esm.min.js +1 -1
- package/button/button.js +3 -1
- package/button/button.min.css +1 -1
- package/button/button.min.js +1 -1
- package/calendar/calendar.cjs.js +314 -151
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +8 -0
- package/calendar/calendar.esm.js +314 -151
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +315 -152
- package/calendar/calendar.min.css +1 -1
- package/calendar/calendar.min.js +1 -1
- package/captcha/captcha.d.ts +1 -0
- package/card/card.d.ts +1 -0
- package/carousel/carousel.cjs.js +4 -4
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.d.ts +1 -0
- package/carousel/carousel.esm.js +4 -4
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +4 -4
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +4 -2
- package/chart/chart.d.ts +1 -0
- package/checkbox/checkbox.cjs.js +5 -13
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.d.ts +2 -2
- package/checkbox/checkbox.esm.js +5 -13
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +5 -13
- package/checkbox/checkbox.min.js +1 -1
- package/chip/chip.d.ts +1 -0
- package/chips/chips.cjs.js +6 -2
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.d.ts +1 -0
- package/chips/chips.esm.js +6 -2
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +6 -2
- package/chips/chips.min.js +1 -1
- package/colorpicker/colorpicker.d.ts +1 -0
- package/column/column.d.ts +2 -1
- package/columngroup/columngroup.d.ts +3 -1
- package/common/common.min.css +1 -1
- package/confirmdialog/confirmdialog.cjs.js +2 -2
- package/confirmdialog/confirmdialog.d.ts +1 -0
- package/confirmdialog/confirmdialog.esm.js +2 -2
- package/confirmdialog/confirmdialog.js +2 -2
- package/confirmpopup/confirmpopup.cjs.js +2 -2
- package/confirmpopup/confirmpopup.d.ts +1 -0
- package/confirmpopup/confirmpopup.esm.js +2 -2
- package/confirmpopup/confirmpopup.js +2 -2
- package/contextmenu/contextmenu.cjs.js +6 -2
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.d.ts +1 -0
- package/contextmenu/contextmenu.esm.js +7 -3
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +6 -2
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +249 -134
- package/core/core.min.js +10 -10
- package/datascroller/datascroller.d.ts +1 -0
- package/datatable/datatable.cjs.js +13 -11
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +2 -1
- package/datatable/datatable.esm.js +13 -11
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +13 -11
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.d.ts +2 -0
- package/deferredcontent/deferredcontent.d.ts +1 -0
- package/dialog/dialog.d.ts +1 -0
- package/divider/divider.d.ts +1 -0
- package/dock/dock.cjs.js +5 -3
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.d.ts +1 -0
- package/dock/dock.esm.js +6 -4
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +5 -3
- package/dock/dock.min.js +1 -1
- package/dropdown/dropdown.cjs.js +2 -6
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +4 -2
- package/dropdown/dropdown.esm.js +2 -6
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +2 -6
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.d.ts +1 -0
- package/fieldset/fieldset.d.ts +1 -0
- package/fileupload/fileupload.d.ts +2 -1
- package/fullcalendar/fullcalendar.d.ts +1 -0
- package/galleria/galleria.d.ts +1 -0
- package/gmap/gmap.cjs.js +27 -12
- package/gmap/gmap.cjs.min.js +1 -1
- package/gmap/gmap.d.ts +1 -0
- package/gmap/gmap.esm.js +27 -12
- package/gmap/gmap.esm.min.js +1 -1
- package/gmap/gmap.js +27 -12
- package/gmap/gmap.min.js +1 -1
- package/hooks/hooks.cjs.js +52 -0
- package/hooks/hooks.cjs.min.js +1 -1
- package/hooks/hooks.d.ts +7 -5
- package/hooks/hooks.esm.js +52 -1
- package/hooks/hooks.esm.min.js +1 -1
- package/hooks/hooks.js +52 -0
- package/hooks/hooks.min.js +1 -1
- package/image/image.d.ts +1 -0
- package/inplace/inplace.d.ts +7 -2
- package/inputmask/inputmask.cjs.js +2 -2
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.d.ts +1 -1
- package/inputmask/inputmask.esm.js +2 -2
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +2 -2
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +8 -5
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.d.ts +1 -0
- package/inputnumber/inputnumber.esm.js +8 -5
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +8 -5
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/inputswitch.cjs.js +7 -10
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.d.ts +2 -1
- package/inputswitch/inputswitch.esm.js +7 -10
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +7 -10
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/inputtext.cjs.js +12 -2
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.d.ts +1 -0
- package/inputtext/inputtext.esm.js +12 -2
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +12 -2
- package/inputtext/inputtext.min.js +1 -1
- package/inputtextarea/inputtextarea.d.ts +1 -0
- package/keyfilter/keyfilter.cjs.js +54 -1
- package/keyfilter/keyfilter.cjs.min.js +1 -1
- package/keyfilter/keyfilter.esm.js +54 -1
- package/keyfilter/keyfilter.esm.min.js +1 -1
- package/keyfilter/keyfilter.js +146 -93
- package/keyfilter/keyfilter.min.js +1 -1
- package/knob/knob.d.ts +1 -0
- package/listbox/listbox.d.ts +4 -2
- package/megamenu/megamenu.cjs.js +8 -5
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.d.ts +1 -0
- package/megamenu/megamenu.esm.js +9 -6
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +8 -5
- package/megamenu/megamenu.min.js +1 -1
- package/mention/mention.d.ts +1 -0
- package/menu/menu.cjs.js +4 -2
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.d.ts +1 -0
- package/menu/menu.esm.js +5 -3
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +4 -2
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.cjs.js +6 -2
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.d.ts +1 -0
- package/menubar/menubar.esm.js +7 -3
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +6 -2
- package/menubar/menubar.min.js +1 -1
- package/menuitem/menuitem.d.ts +0 -2
- package/message/message.d.ts +1 -0
- package/messages/messages.d.ts +1 -0
- package/multiselect/multiselect.cjs.js +5 -13
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +4 -2
- package/multiselect/multiselect.esm.js +5 -13
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +5 -13
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.d.ts +1 -0
- package/orderlist/orderlist.d.ts +1 -0
- package/organizationchart/organizationchart.d.ts +1 -0
- package/overlaypanel/overlaypanel.d.ts +1 -0
- package/package.json +6 -5
- package/paginator/paginator.cjs.js +11 -5
- package/paginator/paginator.d.ts +1 -0
- package/paginator/paginator.esm.js +11 -5
- package/paginator/paginator.js +11 -5
- package/panel/panel.d.ts +1 -0
- package/panelmenu/panelmenu.cjs.js +12 -6
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.d.ts +1 -0
- package/panelmenu/panelmenu.esm.js +13 -7
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +12 -6
- package/panelmenu/panelmenu.min.js +1 -1
- package/password/password.d.ts +1 -0
- package/picklist/picklist.d.ts +1 -0
- package/primereact.all.cjs.js +580 -275
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +580 -276
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +580 -275
- package/primereact.all.min.js +1 -1
- package/progressbar/progressbar.d.ts +1 -0
- package/progressspinner/progressspinner.d.ts +2 -1
- package/radiobutton/radiobutton.d.ts +2 -1
- package/rating/rating.d.ts +1 -0
- package/resources/primereact.css +197 -176
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +61 -13
- package/resources/themes/arya-green/theme.css +61 -13
- package/resources/themes/arya-orange/theme.css +61 -13
- package/resources/themes/arya-purple/theme.css +61 -13
- package/resources/themes/bootstrap4-dark-blue/theme.css +61 -13
- package/resources/themes/bootstrap4-dark-purple/theme.css +61 -13
- package/resources/themes/bootstrap4-light-blue/theme.css +61 -13
- package/resources/themes/bootstrap4-light-purple/theme.css +61 -13
- package/resources/themes/fluent-light/theme.css +61 -13
- package/resources/themes/lara-dark-blue/theme.css +61 -13
- package/resources/themes/lara-dark-indigo/theme.css +61 -13
- package/resources/themes/lara-dark-purple/theme.css +61 -13
- package/resources/themes/lara-dark-teal/theme.css +61 -13
- package/resources/themes/lara-light-blue/theme.css +61 -13
- package/resources/themes/lara-light-indigo/theme.css +61 -13
- package/resources/themes/lara-light-purple/theme.css +61 -13
- package/resources/themes/lara-light-teal/theme.css +61 -13
- package/resources/themes/luna-amber/theme.css +61 -13
- package/resources/themes/luna-blue/theme.css +61 -13
- package/resources/themes/luna-green/theme.css +61 -13
- package/resources/themes/luna-pink/theme.css +61 -13
- package/resources/themes/md-dark-deeppurple/theme.css +64 -13
- package/resources/themes/md-dark-indigo/theme.css +64 -13
- package/resources/themes/md-light-deeppurple/theme.css +64 -13
- package/resources/themes/md-light-indigo/theme.css +64 -13
- package/resources/themes/mdc-dark-deeppurple/theme.css +64 -13
- package/resources/themes/mdc-dark-indigo/theme.css +64 -13
- package/resources/themes/mdc-light-deeppurple/theme.css +64 -13
- package/resources/themes/mdc-light-indigo/theme.css +64 -13
- package/resources/themes/nova/theme.css +61 -13
- package/resources/themes/nova-accent/theme.css +61 -13
- package/resources/themes/nova-alt/theme.css +61 -13
- package/resources/themes/rhea/theme.css +61 -13
- package/resources/themes/saga-blue/theme.css +61 -13
- package/resources/themes/saga-green/theme.css +61 -13
- package/resources/themes/saga-orange/theme.css +61 -13
- package/resources/themes/saga-purple/theme.css +61 -13
- package/resources/themes/tailwind-light/theme.css +60 -12
- package/resources/themes/vela-blue/theme.css +61 -13
- package/resources/themes/vela-green/theme.css +61 -13
- package/resources/themes/vela-orange/theme.css +61 -13
- package/resources/themes/vela-purple/theme.css +61 -13
- package/ripple/ripple.cjs.js +1 -0
- package/ripple/ripple.cjs.min.js +1 -1
- package/ripple/ripple.d.ts +3 -1
- package/ripple/ripple.esm.js +1 -0
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +1 -0
- package/ripple/ripple.min.js +1 -1
- package/row/row.d.ts +1 -0
- package/scrollpanel/scrollpanel.d.ts +1 -0
- package/scrolltop/scrolltop.d.ts +1 -0
- package/selectbutton/selectbutton.d.ts +4 -2
- package/selectitem/selectitem.d.ts +2 -0
- package/sidebar/sidebar.d.ts +1 -0
- package/skeleton/skeleton.d.ts +1 -0
- package/slidemenu/slidemenu.cjs.js +6 -2
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.d.ts +1 -0
- package/slidemenu/slidemenu.esm.js +7 -3
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +6 -2
- package/slidemenu/slidemenu.min.js +1 -1
- package/slider/slider.d.ts +1 -0
- package/speeddial/speeddial.cjs.js +10 -5
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.d.ts +1 -0
- package/speeddial/speeddial.esm.js +11 -6
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +10 -5
- package/speeddial/speeddial.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +5 -3
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.d.ts +1 -0
- package/splitbutton/splitbutton.esm.js +6 -4
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +5 -3
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/splitter.d.ts +2 -0
- package/steps/steps.cjs.js +8 -1
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.d.ts +1 -0
- package/steps/steps.esm.js +9 -2
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +8 -1
- package/steps/steps.min.js +1 -1
- package/styleclass/styleclass.d.ts +1 -0
- package/tabmenu/tabmenu.cjs.js +4 -3
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.d.ts +1 -0
- package/tabmenu/tabmenu.esm.js +5 -4
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +4 -3
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabview/tabview.d.ts +2 -0
- package/tag/tag.d.ts +1 -0
- package/terminal/terminal.d.ts +1 -0
- package/tieredmenu/tieredmenu.cjs.js +6 -3
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.d.ts +1 -0
- package/tieredmenu/tieredmenu.esm.js +7 -4
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +6 -3
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/timeline.d.ts +1 -0
- package/toast/toast.d.ts +1 -0
- package/togglebutton/togglebutton.cjs.js +3 -3
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.d.ts +1 -1
- package/togglebutton/togglebutton.esm.js +3 -3
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +3 -3
- package/togglebutton/togglebutton.min.js +1 -1
- package/toolbar/toolbar.d.ts +1 -0
- package/tooltip/tooltip.d.ts +1 -0
- package/tree/tree.d.ts +1 -0
- package/treeselect/treeselect.cjs.js +0 -1
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.d.ts +6 -6
- package/treeselect/treeselect.esm.js +0 -1
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +0 -1
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.d.ts +2 -1
- package/tristatecheckbox/tristatecheckbox.d.ts +1 -0
- package/utils/utils.cjs.js +11 -8
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +11 -8
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +11 -8
- package/utils/utils.min.js +1 -1
- package/virtualscroller/virtualscroller.d.ts +1 -0
- package/web-types.json +7 -19
package/gmap/gmap.cjs.js
CHANGED
|
@@ -130,23 +130,16 @@ var GMap = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.for
|
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
hooks.useMountEffect(function () {
|
|
138
|
-
initMap();
|
|
139
|
-
});
|
|
140
|
-
hooks.useUpdateEffect(function () {
|
|
141
|
-
if (prevOverlays.current) {
|
|
142
|
-
var _iterator2 = _createForOfIteratorHelper(prevOverlays.current),
|
|
133
|
+
var removeOverlays = function removeOverlays(overlays) {
|
|
134
|
+
if (overlays) {
|
|
135
|
+
var _iterator2 = _createForOfIteratorHelper(overlays),
|
|
143
136
|
_step2;
|
|
144
137
|
|
|
145
138
|
try {
|
|
146
139
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
147
140
|
var overlay = _step2.value;
|
|
148
|
-
google.maps.event.clearInstanceListeners(overlay);
|
|
149
141
|
overlay.setMap(null);
|
|
142
|
+
unbindOverlayEvents(overlay);
|
|
150
143
|
}
|
|
151
144
|
} catch (err) {
|
|
152
145
|
_iterator2.e(err);
|
|
@@ -154,9 +147,31 @@ var GMap = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.for
|
|
|
154
147
|
_iterator2.f();
|
|
155
148
|
}
|
|
156
149
|
}
|
|
150
|
+
};
|
|
157
151
|
|
|
152
|
+
var unbindOverlayEvents = function unbindOverlayEvents(overlay) {
|
|
153
|
+
google.maps.event.clearListeners(overlay, 'click');
|
|
154
|
+
|
|
155
|
+
if (overlay.getDraggable()) {
|
|
156
|
+
google.maps.event.clearListeners(overlay, 'dragstart');
|
|
157
|
+
google.maps.event.clearListeners(overlay, 'drag');
|
|
158
|
+
google.maps.event.clearListeners(overlay, 'dragend');
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var getMap = function getMap() {
|
|
163
|
+
return map.current;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
hooks.useMountEffect(function () {
|
|
167
|
+
initMap();
|
|
168
|
+
});
|
|
169
|
+
hooks.useUpdateEffect(function () {
|
|
158
170
|
initOverlays(props.overlays);
|
|
159
|
-
|
|
171
|
+
return function () {
|
|
172
|
+
removeOverlays(prevOverlays.current);
|
|
173
|
+
};
|
|
174
|
+
});
|
|
160
175
|
React__namespace.useImperativeHandle(ref, function () {
|
|
161
176
|
return {
|
|
162
177
|
getMap: getMap
|
package/gmap/gmap.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("primereact/hooks"),n=require("primereact/utils");function t(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),r.default=e,Object.freeze(r)}var a=t(e);function o(){return o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},o.apply(this,arguments)}function l(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var t=0,a=function(){};return{s:a,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:a}}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 o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function u(e,r){if(e){if("string"==typeof e)return i(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,r):void 0}}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}var c=a.memo(a.forwardRef((function(e,t){var u=a.useRef(null),i=a.useRef(null),f=a.useRef(null),s=function(e){if(e){var r,n=l(e);try{for(n.s();!(r=n.n()).done;){var t=r.value;t.setMap(i.current),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("primereact/hooks"),n=require("primereact/utils");function t(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),r.default=e,Object.freeze(r)}var a=t(e);function o(){return o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},o.apply(this,arguments)}function l(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var t=0,a=function(){};return{s:a,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:a}}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 o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function u(e,r){if(e){if("string"==typeof e)return i(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,r):void 0}}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}var c=a.memo(a.forwardRef((function(e,t){var u=a.useRef(null),i=a.useRef(null),f=a.useRef(null),s=function(e){if(e){var r,n=l(e);try{for(n.s();!(r=n.n()).done;){var t=r.value;t.setMap(i.current),d(t)}}catch(e){n.e(e)}finally{n.f()}f.current=e}},d=function(r){r.addListener("click",(function(n){e.onOverlayClick&&e.onOverlayClick({originalEvent:n,overlay:r,map:i.current})})),r.getDraggable()&&p(r)},p=function(r){v(r,"dragstart",e.onOverlayDragStart),v(r,"drag",e.onOverlayDrag),v(r,"dragend",e.onOverlayDragEnd)},g=function(e,r){i.current.addListener(e,(function(e){r&&r(e)}))},v=function(e,r,n){e.addListener(r,(function(r){n&&n({originalEvent:r,overlay:e,map:i.current})}))},y=function(e){if(e){var r,n=l(e);try{for(n.s();!(r=n.n()).done;){var t=r.value;t.setMap(null),m(t)}}catch(e){n.e(e)}finally{n.f()}}},m=function(e){google.maps.event.clearListeners(e,"click"),e.getDraggable()&&(google.maps.event.clearListeners(e,"dragstart"),google.maps.event.clearListeners(e,"drag"),google.maps.event.clearListeners(e,"dragend"))},b=function(){return i.current};r.useMountEffect((function(){i.current=new google.maps.Map(u.current,e.options),e.onMapReady&&e.onMapReady({map:i.current}),s(e.overlays),g("click",e.onMapClick),g("dragend",e.onMapDragEnd),g("zoom_changed",e.onZoomChanged)})),r.useUpdateEffect((function(){return s(e.overlays),function(){y(f.current)}})),a.useImperativeHandle(t,(function(){return{getMap:b}}));var O=n.ObjectUtils.findDiffKeys(e,c.defaultProps);return a.createElement("div",o({ref:u,style:e.style,className:e.className},O))})));c.displayName="GMap",c.defaultProps={__TYPE:"GMap",options:null,overlays:null,style:null,className:null,onMapReady:null,onMapClick:null,onMapDragEnd:null,onZoomChanged:null,onOverlayDragStart:null,onOverlayDrag:null,onOverlayDragEnd:null,onOverlayClick:null},exports.GMap=c;
|
package/gmap/gmap.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface GMapProps {
|
|
|
19
19
|
onOverlayDrag?(event: React.SyntheticEvent): void;
|
|
20
20
|
onOverlayDragEnd?(event: React.SyntheticEvent): void;
|
|
21
21
|
onOverlayClick?(e: GMapEventParams): void;
|
|
22
|
+
children?: React.ReactNode;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export declare class GMap extends React.Component<GMapProps, any> { }
|
package/gmap/gmap.esm.js
CHANGED
|
@@ -106,23 +106,16 @@ var GMap = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (prop
|
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
useMountEffect(function () {
|
|
114
|
-
initMap();
|
|
115
|
-
});
|
|
116
|
-
useUpdateEffect(function () {
|
|
117
|
-
if (prevOverlays.current) {
|
|
118
|
-
var _iterator2 = _createForOfIteratorHelper(prevOverlays.current),
|
|
109
|
+
var removeOverlays = function removeOverlays(overlays) {
|
|
110
|
+
if (overlays) {
|
|
111
|
+
var _iterator2 = _createForOfIteratorHelper(overlays),
|
|
119
112
|
_step2;
|
|
120
113
|
|
|
121
114
|
try {
|
|
122
115
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
123
116
|
var overlay = _step2.value;
|
|
124
|
-
google.maps.event.clearInstanceListeners(overlay);
|
|
125
117
|
overlay.setMap(null);
|
|
118
|
+
unbindOverlayEvents(overlay);
|
|
126
119
|
}
|
|
127
120
|
} catch (err) {
|
|
128
121
|
_iterator2.e(err);
|
|
@@ -130,9 +123,31 @@ var GMap = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (prop
|
|
|
130
123
|
_iterator2.f();
|
|
131
124
|
}
|
|
132
125
|
}
|
|
126
|
+
};
|
|
133
127
|
|
|
128
|
+
var unbindOverlayEvents = function unbindOverlayEvents(overlay) {
|
|
129
|
+
google.maps.event.clearListeners(overlay, 'click');
|
|
130
|
+
|
|
131
|
+
if (overlay.getDraggable()) {
|
|
132
|
+
google.maps.event.clearListeners(overlay, 'dragstart');
|
|
133
|
+
google.maps.event.clearListeners(overlay, 'drag');
|
|
134
|
+
google.maps.event.clearListeners(overlay, 'dragend');
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
var getMap = function getMap() {
|
|
139
|
+
return map.current;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
useMountEffect(function () {
|
|
143
|
+
initMap();
|
|
144
|
+
});
|
|
145
|
+
useUpdateEffect(function () {
|
|
134
146
|
initOverlays(props.overlays);
|
|
135
|
-
|
|
147
|
+
return function () {
|
|
148
|
+
removeOverlays(prevOverlays.current);
|
|
149
|
+
};
|
|
150
|
+
});
|
|
136
151
|
React.useImperativeHandle(ref, function () {
|
|
137
152
|
return {
|
|
138
153
|
getMap: getMap
|
package/gmap/gmap.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as n from"react";import{useMountEffect as r,useUpdateEffect as e}from"primereact/hooks";import{ObjectUtils as t}from"primereact/utils";function a(){return a=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}return n},a.apply(this,arguments)}function o(n,r){var e="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!e){if(Array.isArray(n)||(e=l(n))||r&&n&&"number"==typeof n.length){e&&(n=e);var t=0,a=function(){};return{s:a,n:function(){return t>=n.length?{done:!0}:{done:!1,value:n[t++]}},e:function(n){throw n},f:a}}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 o,
|
|
1
|
+
import*as n from"react";import{useMountEffect as r,useUpdateEffect as e}from"primereact/hooks";import{ObjectUtils as t}from"primereact/utils";function a(){return a=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}return n},a.apply(this,arguments)}function o(n,r){var e="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!e){if(Array.isArray(n)||(e=l(n))||r&&n&&"number"==typeof n.length){e&&(n=e);var t=0,a=function(){};return{s:a,n:function(){return t>=n.length?{done:!0}:{done:!1,value:n[t++]}},e:function(n){throw n},f:a}}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 o,i=!0,u=!1;return{s:function(){e=e.call(n)},n:function(){var n=e.next();return i=n.done,n},e:function(n){u=!0,o=n},f:function(){try{i||null==e.return||e.return()}finally{if(u)throw o}}}}function l(n,r){if(n){if("string"==typeof n)return i(n,r);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(n,r):void 0}}function i(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,t=new Array(r);e<r;e++)t[e]=n[e];return t}var u=n.memo(n.forwardRef((function(l,i){var c=n.useRef(null),f=n.useRef(null),s=n.useRef(null),p=function(n){if(n){var r,e=o(n);try{for(e.s();!(r=e.n()).done;){var t=r.value;t.setMap(f.current),g(t)}}catch(n){e.e(n)}finally{e.f()}s.current=n}},g=function(n){n.addListener("click",(function(r){l.onOverlayClick&&l.onOverlayClick({originalEvent:r,overlay:n,map:f.current})})),n.getDraggable()&&d(n)},d=function(n){v(n,"dragstart",l.onOverlayDragStart),v(n,"drag",l.onOverlayDrag),v(n,"dragend",l.onOverlayDragEnd)},y=function(n,r){f.current.addListener(n,(function(n){r&&r(n)}))},v=function(n,r,e){n.addListener(r,(function(r){e&&e({originalEvent:r,overlay:n,map:f.current})}))},m=function(n){if(n){var r,e=o(n);try{for(e.s();!(r=e.n()).done;){var t=r.value;t.setMap(null),h(t)}}catch(n){e.e(n)}finally{e.f()}}},h=function(n){google.maps.event.clearListeners(n,"click"),n.getDraggable()&&(google.maps.event.clearListeners(n,"dragstart"),google.maps.event.clearListeners(n,"drag"),google.maps.event.clearListeners(n,"dragend"))},b=function(){return f.current};r((function(){f.current=new google.maps.Map(c.current,l.options),l.onMapReady&&l.onMapReady({map:f.current}),p(l.overlays),y("click",l.onMapClick),y("dragend",l.onMapDragEnd),y("zoom_changed",l.onZoomChanged)})),e((function(){return p(l.overlays),function(){m(s.current)}})),n.useImperativeHandle(i,(function(){return{getMap:b}}));var M=t.findDiffKeys(l,u.defaultProps);return n.createElement("div",a({ref:c,style:l.style,className:l.className},M))})));u.displayName="GMap",u.defaultProps={__TYPE:"GMap",options:null,overlays:null,style:null,className:null,onMapReady:null,onMapClick:null,onMapDragEnd:null,onZoomChanged:null,onOverlayDragStart:null,onOverlayDrag:null,onOverlayDragEnd:null,onOverlayClick:null};export{u as GMap};
|
package/gmap/gmap.js
CHANGED
|
@@ -126,23 +126,16 @@ this.primereact.gmap = (function (exports, React, hooks, utils) {
|
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
hooks.useMountEffect(function () {
|
|
134
|
-
initMap();
|
|
135
|
-
});
|
|
136
|
-
hooks.useUpdateEffect(function () {
|
|
137
|
-
if (prevOverlays.current) {
|
|
138
|
-
var _iterator2 = _createForOfIteratorHelper(prevOverlays.current),
|
|
129
|
+
var removeOverlays = function removeOverlays(overlays) {
|
|
130
|
+
if (overlays) {
|
|
131
|
+
var _iterator2 = _createForOfIteratorHelper(overlays),
|
|
139
132
|
_step2;
|
|
140
133
|
|
|
141
134
|
try {
|
|
142
135
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
143
136
|
var overlay = _step2.value;
|
|
144
|
-
google.maps.event.clearInstanceListeners(overlay);
|
|
145
137
|
overlay.setMap(null);
|
|
138
|
+
unbindOverlayEvents(overlay);
|
|
146
139
|
}
|
|
147
140
|
} catch (err) {
|
|
148
141
|
_iterator2.e(err);
|
|
@@ -150,9 +143,31 @@ this.primereact.gmap = (function (exports, React, hooks, utils) {
|
|
|
150
143
|
_iterator2.f();
|
|
151
144
|
}
|
|
152
145
|
}
|
|
146
|
+
};
|
|
153
147
|
|
|
148
|
+
var unbindOverlayEvents = function unbindOverlayEvents(overlay) {
|
|
149
|
+
google.maps.event.clearListeners(overlay, 'click');
|
|
150
|
+
|
|
151
|
+
if (overlay.getDraggable()) {
|
|
152
|
+
google.maps.event.clearListeners(overlay, 'dragstart');
|
|
153
|
+
google.maps.event.clearListeners(overlay, 'drag');
|
|
154
|
+
google.maps.event.clearListeners(overlay, 'dragend');
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var getMap = function getMap() {
|
|
159
|
+
return map.current;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
hooks.useMountEffect(function () {
|
|
163
|
+
initMap();
|
|
164
|
+
});
|
|
165
|
+
hooks.useUpdateEffect(function () {
|
|
154
166
|
initOverlays(props.overlays);
|
|
155
|
-
|
|
167
|
+
return function () {
|
|
168
|
+
removeOverlays(prevOverlays.current);
|
|
169
|
+
};
|
|
170
|
+
});
|
|
156
171
|
React__namespace.useImperativeHandle(ref, function () {
|
|
157
172
|
return {
|
|
158
173
|
getMap: getMap
|
package/gmap/gmap.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.gmap=function(e,n,r,t){"use strict";function a(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var o=a(n);function l(){return l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},l.apply(this,arguments)}function u(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var t=0,a=function(){};return{s:a,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:a}}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 o,l=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return l=e.done,e},e:function(e){u=!0,o=e},f:function(){try{l||null==r.return||r.return()}finally{if(u)throw o}}}}function i(e,n){if(e){if("string"==typeof e)return c(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,n):void 0}}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}var f=o.memo(o.forwardRef((function(e,n){var a=o.useRef(null),i=o.useRef(null),c=o.useRef(null),s=function(e){if(e){var n,r=u(e);try{for(r.s();!(n=r.n()).done;){var t=n.value;t.setMap(i.current),p(t)}}catch(e){r.e(e)}finally{r.f()}c.current=e}},p=function(n){n.addListener("click",(function(r){e.onOverlayClick&&e.onOverlayClick({originalEvent:r,overlay:n,map:i.current})})),n.getDraggable()&&
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.gmap=function(e,n,r,t){"use strict";function a(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var o=a(n);function l(){return l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},l.apply(this,arguments)}function u(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var t=0,a=function(){};return{s:a,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:a}}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 o,l=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return l=e.done,e},e:function(e){u=!0,o=e},f:function(){try{l||null==r.return||r.return()}finally{if(u)throw o}}}}function i(e,n){if(e){if("string"==typeof e)return c(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,n):void 0}}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}var f=o.memo(o.forwardRef((function(e,n){var a=o.useRef(null),i=o.useRef(null),c=o.useRef(null),s=function(e){if(e){var n,r=u(e);try{for(r.s();!(n=r.n()).done;){var t=n.value;t.setMap(i.current),p(t)}}catch(e){r.e(e)}finally{r.f()}c.current=e}},p=function(n){n.addListener("click",(function(r){e.onOverlayClick&&e.onOverlayClick({originalEvent:r,overlay:n,map:i.current})})),n.getDraggable()&&d(n)},d=function(n){y(n,"dragstart",e.onOverlayDragStart),y(n,"drag",e.onOverlayDrag),y(n,"dragend",e.onOverlayDragEnd)},g=function(e,n){i.current.addListener(e,(function(e){n&&n(e)}))},y=function(e,n,r){e.addListener(n,(function(n){r&&r({originalEvent:n,overlay:e,map:i.current})}))},v=function(e){if(e){var n,r=u(e);try{for(r.s();!(n=r.n()).done;){var t=n.value;t.setMap(null),m(t)}}catch(e){r.e(e)}finally{r.f()}}},m=function(e){google.maps.event.clearListeners(e,"click"),e.getDraggable()&&(google.maps.event.clearListeners(e,"dragstart"),google.maps.event.clearListeners(e,"drag"),google.maps.event.clearListeners(e,"dragend"))},b=function(){return i.current};r.useMountEffect((function(){i.current=new google.maps.Map(a.current,e.options),e.onMapReady&&e.onMapReady({map:i.current}),s(e.overlays),g("click",e.onMapClick),g("dragend",e.onMapDragEnd),g("zoom_changed",e.onZoomChanged)})),r.useUpdateEffect((function(){return s(e.overlays),function(){v(c.current)}})),o.useImperativeHandle(n,(function(){return{getMap:b}}));var h=t.ObjectUtils.findDiffKeys(e,f.defaultProps);return o.createElement("div",l({ref:a,style:e.style,className:e.className},h))})));return f.displayName="GMap",f.defaultProps={__TYPE:"GMap",options:null,overlays:null,style:null,className:null,onMapReady:null,onMapClick:null,onMapDragEnd:null,onZoomChanged:null,onOverlayDragStart:null,onOverlayDrag:null,onOverlayDragEnd:null,onOverlayClick:null},e.GMap=f,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.hooks,primereact.utils);
|
package/hooks/hooks.cjs.js
CHANGED
|
@@ -372,6 +372,57 @@ var useInterval = function useInterval(fn) {
|
|
|
372
372
|
};
|
|
373
373
|
/* eslint-enable */
|
|
374
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Hook to wrap around useState that stores the value in the browser local/session storage.
|
|
377
|
+
*
|
|
378
|
+
* @param {any} initialValue the initial value to store
|
|
379
|
+
* @param {string} key the key to store the value in local/session storage
|
|
380
|
+
* @param {string} storage either 'local' or 'session' for what type of storage
|
|
381
|
+
* @returns a stateful value, and a function to update it.
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
var useStorage = function useStorage(initialValue, key) {
|
|
385
|
+
var storage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
|
|
386
|
+
// Since the local storage API isn't available in server-rendering environments,
|
|
387
|
+
// we check that typeof window !== 'undefined' to make SSR and SSG work properly.
|
|
388
|
+
var storageAvailable = typeof window !== 'undefined';
|
|
389
|
+
|
|
390
|
+
var _React$useState = React__namespace.useState(function () {
|
|
391
|
+
if (!storageAvailable) {
|
|
392
|
+
return initialValue;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
try {
|
|
396
|
+
var item = storage === 'local' ? window.localStorage.getItem(key) : window.sessionStorage.getItem(key);
|
|
397
|
+
return item ? JSON.parse(item) : initialValue;
|
|
398
|
+
} catch (error) {
|
|
399
|
+
// If error also return initialValue
|
|
400
|
+
return initialValue;
|
|
401
|
+
}
|
|
402
|
+
}),
|
|
403
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
404
|
+
storedValue = _React$useState2[0],
|
|
405
|
+
setStoredValue = _React$useState2[1];
|
|
406
|
+
|
|
407
|
+
var setValue = function setValue(value) {
|
|
408
|
+
try {
|
|
409
|
+
// Allow value to be a function so we have same API as useState
|
|
410
|
+
var valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
411
|
+
setStoredValue(valueToStore);
|
|
412
|
+
|
|
413
|
+
if (storageAvailable) {
|
|
414
|
+
var serializedValue = JSON.stringify(valueToStore);
|
|
415
|
+
storage === 'local' ? window.localStorage.setItem(key, serializedValue) : window.sessionStorage.setItem(key, serializedValue);
|
|
416
|
+
}
|
|
417
|
+
} catch (error) {
|
|
418
|
+
throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(key));
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
return [storedValue, setValue];
|
|
423
|
+
};
|
|
424
|
+
/* eslint-enable */
|
|
425
|
+
|
|
375
426
|
/* eslint-disable */
|
|
376
427
|
var useTimeout = function useTimeout(fn) {
|
|
377
428
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -410,6 +461,7 @@ exports.useOverlayListener = useOverlayListener;
|
|
|
410
461
|
exports.useOverlayScrollListener = useOverlayScrollListener;
|
|
411
462
|
exports.usePrevious = usePrevious;
|
|
412
463
|
exports.useResizeListener = useResizeListener;
|
|
464
|
+
exports.useStorage = useStorage;
|
|
413
465
|
exports.useTimeout = useTimeout;
|
|
414
466
|
exports.useUnmountEffect = useUnmountEffect;
|
|
415
467
|
exports.useUpdateEffect = useUpdateEffect;
|
package/hooks/hooks.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(e),u=function(e){var t=n.useRef(void 0);return n.useEffect((function(){t.current=e})),t.current},c=function(e){return n.useEffect((function(){return e}),[])},o=function(e){var r=e.target,o=void 0===r?"document":r,i=e.type,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(e),u=function(e){var t=n.useRef(void 0);return n.useEffect((function(){t.current=e})),t.current},c=function(e){return n.useEffect((function(){return e}),[])},o=function(e){var r=e.target,o=void 0===r?"document":r,i=e.type,l=e.listener,f=e.options,a=e.when,s=void 0===a||a,v=n.useRef(null),d=n.useRef(null),g=u(f),m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.ObjectUtils.isNotEmpty(e.target)&&(p(),(e.when||s)&&(v.current=t.DomHandler.getTargetElement(e.target))),!d.current&&v.current&&(d.current=function(e){return l&&l(e)},v.current.addEventListener(i,d.current,f))},p=function(){d.current&&(v.current.removeEventListener(i,d.current,f),d.current=null)};return n.useEffect((function(){s?v.current=t.DomHandler.getTargetElement(o):(p(),v.current=null)}),[o,s]),n.useEffect((function(){!d.current||d.current===l&&g===f||(p(),s&&m())}),[l,f]),c((function(){p()})),[m,p]};function i(e){if(Array.isArray(e))return e}function l(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,u,c=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);o=!0);}catch(e){i=!0,u=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw u}}return c}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(e,t){return i(e)||l(e,t)||a(e,t)||s()}var d=function(e){var r=e.target,o=e.listener,i=e.options,l=e.when,f=void 0===l||l,a=n.useRef(null),s=n.useRef(null),v=n.useRef([]),d=u(i),g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.ObjectUtils.isNotEmpty(e.target)&&(m(),(e.when||f)&&(a.current=t.DomHandler.getTargetElement(e.target))),!s.current&&a.current){var r=v.current=t.DomHandler.getScrollableParents(a.current);s.current=function(e){return o&&o(e)},r.forEach((function(e){return e.addEventListener("scroll",s.current,i)}))}},m=function(){s.current&&(v.current.forEach((function(e){return e.removeEventListener("scroll",s.current,i)})),s.current=null)};return n.useEffect((function(){f?a.current=t.DomHandler.getTargetElement(r):(m(),a.current=null)}),[r,f]),n.useEffect((function(){!s.current||s.current===o&&d===i||(m(),f&&g())}),[o,i]),c((function(){m()})),[g,m]},g=function(e){return o({target:"window",type:"resize",listener:e.listener})};exports.useEventListener=o,exports.useInterval=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],u=n.useRef(null),o=n.useRef(null),i=n.useCallback((function(){return clearInterval(u.current)}),[u.current]);return n.useEffect((function(){o.current=e})),n.useEffect((function(){if(r)return u.current=setInterval((function(){o.current()}),t),i;i()}),[t,r]),c((function(){i()})),[i]},exports.useMountEffect=function(e){return n.useEffect(e,[])},exports.useOverlayListener=function(e){var r=e.target,u=e.overlay,i=e.listener,l=e.when,f=void 0===l||l,a=n.useRef(null),s=n.useRef(null),m=v(o({type:"click",listener:function(e){i&&i(e,{type:"outside",valid:3!==e.which&&R(e)})}}),2),p=m[0],y=m[1],E=v(g({listener:function(e){i&&i(e,{type:"resize",valid:!t.DomHandler.isTouchDevice()})}}),2),h=E[0],w=E[1],b=v(d({target:a,listener:function(e){i&&i(e,{type:"scroll",valid:!0})}}),2),S=b[0],O=b[1],R=function(e){return a.current&&!(a.current.isSameNode(e.target)||a.current.contains(e.target)||s.current&&s.current.contains(e.target))},x=function(){y(),w(),O()};return n.useEffect((function(){f?(a.current=t.DomHandler.getTargetElement(r),s.current=t.DomHandler.getTargetElement(u)):(x(),a.current=s.current=null)}),[r,u,f]),n.useEffect((function(){x()}),[f]),c((function(){x()})),[function(){p(),h(),S()},x]},exports.useOverlayScrollListener=d,exports.usePrevious=u,exports.useResizeListener=g,exports.useStorage=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"local",u="undefined"!=typeof window,c=n.useState((function(){if(!u)return e;try{var n="local"===r?window.localStorage.getItem(t):window.sessionStorage.getItem(t);return n?JSON.parse(n):e}catch(t){return e}})),o=v(c,2),i=o[0],l=o[1],f=function(e){try{var n=e instanceof Function?e(i):e;if(l(n),u){var c=JSON.stringify(n);"local"===r?window.localStorage.setItem(t,c):window.sessionStorage.setItem(t,c)}}catch(e){throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(t))}};return[i,f]},exports.useTimeout=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],u=n.useRef(null),o=n.useRef(null),i=n.useCallback((function(){return clearTimeout(u.current)}),[u.current]);return n.useEffect((function(){o.current=e})),n.useEffect((function(){if(r)return u.current=setTimeout((function(){o.current()}),t),i;i()}),[t,r]),c((function(){i()})),[i]},exports.useUnmountEffect=c,exports.useUpdateEffect=function(e,t){var r=n.useRef(!1);return n.useEffect((function(){if(r.current)return e&&e();r.current=!0}),t)};
|
package/hooks/hooks.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
export type TargetType = 'document' | 'window' | Ref<HTMLElement> | undefined;
|
|
3
|
+
export type TargetType = 'document' | 'window' | React.Ref<HTMLElement> | undefined;
|
|
4
|
+
export type StorageType = 'local' | 'session';
|
|
4
5
|
|
|
5
6
|
interface EventOptions {
|
|
6
7
|
target?: TargetType;
|
|
@@ -22,12 +23,13 @@ interface ResizeEventOptions {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export declare function usePrevious(value: any): any;
|
|
25
|
-
export declare function useMountEffect(effect: EffectCallback): void;
|
|
26
|
-
export declare function useUpdateEffect(effect: EffectCallback, deps?: DependencyList): void;
|
|
27
|
-
export declare function useUnmountEffect(effect: EffectCallback): void;
|
|
26
|
+
export declare function useMountEffect(effect: React.EffectCallback): void;
|
|
27
|
+
export declare function useUpdateEffect(effect: React.EffectCallback, deps?: React.DependencyList): void;
|
|
28
|
+
export declare function useUnmountEffect(effect: React.EffectCallback): void;
|
|
28
29
|
export declare function useEventListener(options: EventOptions): any[];
|
|
29
30
|
export declare function useOverlayListener(options: OverlayEventOptions): any[];
|
|
30
31
|
export declare function useOverlayScrollListener(options: EventOptions): any[];
|
|
31
32
|
export declare function useResizeListener(options: ResizeEventOptions): any[];
|
|
32
33
|
export declare function useInterval(fn: any, delay?: number, when?: boolean): any[];
|
|
33
34
|
export declare function useTimeout(fn: any, delay?: number, when?: boolean): any[];
|
|
35
|
+
export declare function useStorage<S>(initialValue: S, key: string, storage?: StorageType): [S, React.Dispatch<React.SetStateAction<S>>];
|
package/hooks/hooks.esm.js
CHANGED
|
@@ -348,6 +348,57 @@ var useInterval = function useInterval(fn) {
|
|
|
348
348
|
};
|
|
349
349
|
/* eslint-enable */
|
|
350
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Hook to wrap around useState that stores the value in the browser local/session storage.
|
|
353
|
+
*
|
|
354
|
+
* @param {any} initialValue the initial value to store
|
|
355
|
+
* @param {string} key the key to store the value in local/session storage
|
|
356
|
+
* @param {string} storage either 'local' or 'session' for what type of storage
|
|
357
|
+
* @returns a stateful value, and a function to update it.
|
|
358
|
+
*/
|
|
359
|
+
|
|
360
|
+
var useStorage = function useStorage(initialValue, key) {
|
|
361
|
+
var storage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
|
|
362
|
+
// Since the local storage API isn't available in server-rendering environments,
|
|
363
|
+
// we check that typeof window !== 'undefined' to make SSR and SSG work properly.
|
|
364
|
+
var storageAvailable = typeof window !== 'undefined';
|
|
365
|
+
|
|
366
|
+
var _React$useState = React.useState(function () {
|
|
367
|
+
if (!storageAvailable) {
|
|
368
|
+
return initialValue;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
try {
|
|
372
|
+
var item = storage === 'local' ? window.localStorage.getItem(key) : window.sessionStorage.getItem(key);
|
|
373
|
+
return item ? JSON.parse(item) : initialValue;
|
|
374
|
+
} catch (error) {
|
|
375
|
+
// If error also return initialValue
|
|
376
|
+
return initialValue;
|
|
377
|
+
}
|
|
378
|
+
}),
|
|
379
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
380
|
+
storedValue = _React$useState2[0],
|
|
381
|
+
setStoredValue = _React$useState2[1];
|
|
382
|
+
|
|
383
|
+
var setValue = function setValue(value) {
|
|
384
|
+
try {
|
|
385
|
+
// Allow value to be a function so we have same API as useState
|
|
386
|
+
var valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
387
|
+
setStoredValue(valueToStore);
|
|
388
|
+
|
|
389
|
+
if (storageAvailable) {
|
|
390
|
+
var serializedValue = JSON.stringify(valueToStore);
|
|
391
|
+
storage === 'local' ? window.localStorage.setItem(key, serializedValue) : window.sessionStorage.setItem(key, serializedValue);
|
|
392
|
+
}
|
|
393
|
+
} catch (error) {
|
|
394
|
+
throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(key));
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
return [storedValue, setValue];
|
|
399
|
+
};
|
|
400
|
+
/* eslint-enable */
|
|
401
|
+
|
|
351
402
|
/* eslint-disable */
|
|
352
403
|
var useTimeout = function useTimeout(fn) {
|
|
353
404
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -379,4 +430,4 @@ var useTimeout = function useTimeout(fn) {
|
|
|
379
430
|
};
|
|
380
431
|
/* eslint-enable */
|
|
381
432
|
|
|
382
|
-
export { useEventListener, useInterval, useMountEffect, useOverlayListener, useOverlayScrollListener, usePrevious, useResizeListener, useTimeout, useUnmountEffect, useUpdateEffect };
|
|
433
|
+
export { useEventListener, useInterval, useMountEffect, useOverlayListener, useOverlayScrollListener, usePrevious, useResizeListener, useStorage, useTimeout, useUnmountEffect, useUpdateEffect };
|
package/hooks/hooks.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";import{DomHandler as e,ObjectUtils as n}from"primereact/utils";var r=function(e){var n=t.useRef(void 0);return t.useEffect((function(){n.current=e})),n.current},u=function(e){return t.useEffect(e,[])},c=function(e,n){var r=t.useRef(!1);return t.useEffect((function(){if(r.current)return e&&e();r.current=!0}),n)},
|
|
1
|
+
import*as t from"react";import{DomHandler as e,ObjectUtils as n}from"primereact/utils";var r=function(e){var n=t.useRef(void 0);return t.useEffect((function(){n.current=e})),n.current},u=function(e){return t.useEffect(e,[])},c=function(e,n){var r=t.useRef(!1);return t.useEffect((function(){if(r.current)return e&&e();r.current=!0}),n)},o=function(e){return t.useEffect((function(){return e}),[])},i=function(u){var c=u.target,i=void 0===c?"document":c,f=u.type,l=u.listener,a=u.options,s=u.when,v=void 0===s||s,g=t.useRef(null),d=t.useRef(null),m=r(a),y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.isNotEmpty(t.target)&&(h(),(t.when||v)&&(g.current=e.getTargetElement(t.target))),!d.current&&g.current&&(d.current=function(t){return l&&l(t)},g.current.addEventListener(f,d.current,a))},h=function(){d.current&&(g.current.removeEventListener(f,d.current,a),d.current=null)};return t.useEffect((function(){v?g.current=e.getTargetElement(i):(h(),g.current=null)}),[i,v]),t.useEffect((function(){!d.current||d.current===l&&m===a||(h(),v&&y())}),[l,a]),o((function(){h()})),[y,h]};function f(t){if(Array.isArray(t))return t}function l(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,u,c=[],o=!0,i=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(c.push(r.value),!e||c.length!==e);o=!0);}catch(t){i=!0,u=t}finally{try{o||null==n.return||n.return()}finally{if(i)throw u}}return c}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(t,e){return f(t)||l(t,e)||s(t,e)||v()}var d=function(u){var c=u.target,i=u.listener,f=u.options,l=u.when,a=void 0===l||l,s=t.useRef(null),v=t.useRef(null),g=t.useRef([]),d=r(f),m=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isNotEmpty(t.target)&&(y(),(t.when||a)&&(s.current=e.getTargetElement(t.target))),!v.current&&s.current){var r=g.current=e.getScrollableParents(s.current);v.current=function(t){return i&&i(t)},r.forEach((function(t){return t.addEventListener("scroll",v.current,f)}))}},y=function(){v.current&&(g.current.forEach((function(t){return t.removeEventListener("scroll",v.current,f)})),v.current=null)};return t.useEffect((function(){a?s.current=e.getTargetElement(c):(y(),s.current=null)}),[c,a]),t.useEffect((function(){!v.current||v.current===i&&d===f||(y(),a&&m())}),[i,f]),o((function(){y()})),[m,y]},m=function(t){return i({target:"window",type:"resize",listener:t.listener})},y=function(n){var r=n.target,u=n.overlay,c=n.listener,f=n.when,l=void 0===f||f,a=t.useRef(null),s=t.useRef(null),v=g(i({type:"click",listener:function(t){c&&c(t,{type:"outside",valid:3!==t.which&&T(t)})}}),2),y=v[0],h=v[1],E=g(m({listener:function(t){c&&c(t,{type:"resize",valid:!e.isTouchDevice()})}}),2),p=E[0],w=E[1],S=g(d({target:a,listener:function(t){c&&c(t,{type:"scroll",valid:!0})}}),2),R=S[0],b=S[1],T=function(t){return a.current&&!(a.current.isSameNode(t.target)||a.current.contains(t.target)||s.current&&s.current.contains(t.target))},I=function(){h(),w(),b()};return t.useEffect((function(){l?(a.current=e.getTargetElement(r),s.current=e.getTargetElement(u)):(I(),a.current=s.current=null)}),[r,u,l]),t.useEffect((function(){I()}),[l]),o((function(){I()})),[function(){y(),p(),R()},I]},h=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],u=t.useRef(null),c=t.useRef(null),i=t.useCallback((function(){return clearInterval(u.current)}),[u.current]);return t.useEffect((function(){c.current=e})),t.useEffect((function(){if(r)return u.current=setInterval((function(){c.current()}),n),i;i()}),[n,r]),o((function(){i()})),[i]},E=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"local",u="undefined"!=typeof window,c=t.useState((function(){if(!u)return e;try{var t="local"===r?window.localStorage.getItem(n):window.sessionStorage.getItem(n);return t?JSON.parse(t):e}catch(t){return e}})),o=g(c,2),i=o[0],f=o[1],l=function(t){try{var e=t instanceof Function?t(i):t;if(f(e),u){var c=JSON.stringify(e);"local"===r?window.localStorage.setItem(n,c):window.sessionStorage.setItem(n,c)}}catch(t){throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(n))}};return[i,l]},p=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],u=t.useRef(null),c=t.useRef(null),i=t.useCallback((function(){return clearTimeout(u.current)}),[u.current]);return t.useEffect((function(){c.current=e})),t.useEffect((function(){if(r)return u.current=setTimeout((function(){c.current()}),n),i;i()}),[n,r]),o((function(){i()})),[i]};export{i as useEventListener,h as useInterval,u as useMountEffect,y as useOverlayListener,d as useOverlayScrollListener,r as usePrevious,m as useResizeListener,E as useStorage,p as useTimeout,o as useUnmountEffect,c as useUpdateEffect};
|
package/hooks/hooks.js
CHANGED
|
@@ -369,6 +369,57 @@ this.primereact.hooks = (function (exports, React, utils) {
|
|
|
369
369
|
};
|
|
370
370
|
/* eslint-enable */
|
|
371
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Hook to wrap around useState that stores the value in the browser local/session storage.
|
|
374
|
+
*
|
|
375
|
+
* @param {any} initialValue the initial value to store
|
|
376
|
+
* @param {string} key the key to store the value in local/session storage
|
|
377
|
+
* @param {string} storage either 'local' or 'session' for what type of storage
|
|
378
|
+
* @returns a stateful value, and a function to update it.
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
var useStorage = function useStorage(initialValue, key) {
|
|
382
|
+
var storage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
|
|
383
|
+
// Since the local storage API isn't available in server-rendering environments,
|
|
384
|
+
// we check that typeof window !== 'undefined' to make SSR and SSG work properly.
|
|
385
|
+
var storageAvailable = typeof window !== 'undefined';
|
|
386
|
+
|
|
387
|
+
var _React$useState = React__namespace.useState(function () {
|
|
388
|
+
if (!storageAvailable) {
|
|
389
|
+
return initialValue;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
try {
|
|
393
|
+
var item = storage === 'local' ? window.localStorage.getItem(key) : window.sessionStorage.getItem(key);
|
|
394
|
+
return item ? JSON.parse(item) : initialValue;
|
|
395
|
+
} catch (error) {
|
|
396
|
+
// If error also return initialValue
|
|
397
|
+
return initialValue;
|
|
398
|
+
}
|
|
399
|
+
}),
|
|
400
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
401
|
+
storedValue = _React$useState2[0],
|
|
402
|
+
setStoredValue = _React$useState2[1];
|
|
403
|
+
|
|
404
|
+
var setValue = function setValue(value) {
|
|
405
|
+
try {
|
|
406
|
+
// Allow value to be a function so we have same API as useState
|
|
407
|
+
var valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
408
|
+
setStoredValue(valueToStore);
|
|
409
|
+
|
|
410
|
+
if (storageAvailable) {
|
|
411
|
+
var serializedValue = JSON.stringify(valueToStore);
|
|
412
|
+
storage === 'local' ? window.localStorage.setItem(key, serializedValue) : window.sessionStorage.setItem(key, serializedValue);
|
|
413
|
+
}
|
|
414
|
+
} catch (error) {
|
|
415
|
+
throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(key));
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
return [storedValue, setValue];
|
|
420
|
+
};
|
|
421
|
+
/* eslint-enable */
|
|
422
|
+
|
|
372
423
|
/* eslint-disable */
|
|
373
424
|
var useTimeout = function useTimeout(fn) {
|
|
374
425
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -407,6 +458,7 @@ this.primereact.hooks = (function (exports, React, utils) {
|
|
|
407
458
|
exports.useOverlayScrollListener = useOverlayScrollListener;
|
|
408
459
|
exports.usePrevious = usePrevious;
|
|
409
460
|
exports.useResizeListener = useResizeListener;
|
|
461
|
+
exports.useStorage = useStorage;
|
|
410
462
|
exports.useTimeout = useTimeout;
|
|
411
463
|
exports.useUnmountEffect = useUnmountEffect;
|
|
412
464
|
exports.useUpdateEffect = useUpdateEffect;
|
package/hooks/hooks.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.hooks=function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=n(t),c=function(e){var t=u.useRef(void 0);return u.useEffect((function(){t.current=e})),t.current},
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.hooks=function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=n(t),c=function(e){var t=u.useRef(void 0);return u.useEffect((function(){t.current=e})),t.current},o=function(e){return u.useEffect((function(){return e}),[])},i=function(e){var t=e.target,n=void 0===t?"document":t,i=e.type,l=e.listener,f=e.options,a=e.when,s=void 0===a||a,v=u.useRef(null),d=u.useRef(null),g=c(f),m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.ObjectUtils.isNotEmpty(e.target)&&(y(),(e.when||s)&&(v.current=r.DomHandler.getTargetElement(e.target))),!d.current&&v.current&&(d.current=function(e){return l&&l(e)},v.current.addEventListener(i,d.current,f))},y=function(){d.current&&(v.current.removeEventListener(i,d.current,f),d.current=null)};return u.useEffect((function(){s?v.current=r.DomHandler.getTargetElement(n):(y(),v.current=null)}),[n,s]),u.useEffect((function(){!d.current||d.current===l&&g===f||(y(),s&&m())}),[l,f]),o((function(){y()})),[m,y]};function l(e){if(Array.isArray(e))return e}function f(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,u,c=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);o=!0);}catch(e){i=!0,u=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw u}}return c}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){return l(e)||f(e,t)||s(e,t)||v()}var g=function(e){var t=e.target,n=e.listener,i=e.options,l=e.when,f=void 0===l||l,a=u.useRef(null),s=u.useRef(null),v=u.useRef([]),d=c(i),g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(r.ObjectUtils.isNotEmpty(e.target)&&(m(),(e.when||f)&&(a.current=r.DomHandler.getTargetElement(e.target))),!s.current&&a.current){var t=v.current=r.DomHandler.getScrollableParents(a.current);s.current=function(e){return n&&n(e)},t.forEach((function(e){return e.addEventListener("scroll",s.current,i)}))}},m=function(){s.current&&(v.current.forEach((function(e){return e.removeEventListener("scroll",s.current,i)})),s.current=null)};return u.useEffect((function(){f?a.current=r.DomHandler.getTargetElement(t):(m(),a.current=null)}),[t,f]),u.useEffect((function(){!s.current||s.current===n&&d===i||(m(),f&&g())}),[n,i]),o((function(){m()})),[g,m]},m=function(e){return i({target:"window",type:"resize",listener:e.listener})};return e.useEventListener=i,e.useInterval=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=u.useRef(null),c=u.useRef(null),i=u.useCallback((function(){return clearInterval(n.current)}),[n.current]);return u.useEffect((function(){c.current=e})),u.useEffect((function(){if(r)return n.current=setInterval((function(){c.current()}),t),i;i()}),[t,r]),o((function(){i()})),[i]},e.useMountEffect=function(e){return u.useEffect(e,[])},e.useOverlayListener=function(e){var t=e.target,n=e.overlay,c=e.listener,l=e.when,f=void 0===l||l,a=u.useRef(null),s=u.useRef(null),v=d(i({type:"click",listener:function(e){c&&c(e,{type:"outside",valid:3!==e.which&&O(e)})}}),2),y=v[0],h=v[1],E=d(m({listener:function(e){c&&c(e,{type:"resize",valid:!r.DomHandler.isTouchDevice()})}}),2),p=E[0],w=E[1],b=d(g({target:a,listener:function(e){c&&c(e,{type:"scroll",valid:!0})}}),2),S=b[0],R=b[1],O=function(e){return a.current&&!(a.current.isSameNode(e.target)||a.current.contains(e.target)||s.current&&s.current.contains(e.target))},j=function(){h(),w(),R()};return u.useEffect((function(){f?(a.current=r.DomHandler.getTargetElement(t),s.current=r.DomHandler.getTargetElement(n)):(j(),a.current=s.current=null)}),[t,n,f]),u.useEffect((function(){j()}),[f]),o((function(){j()})),[function(){y(),p(),S()},j]},e.useOverlayScrollListener=g,e.usePrevious=c,e.useResizeListener=m,e.useStorage=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"local",n="undefined"!=typeof window,c=u.useState((function(){if(!n)return e;try{var u="local"===r?window.localStorage.getItem(t):window.sessionStorage.getItem(t);return u?JSON.parse(u):e}catch(t){return e}})),o=d(c,2),i=o[0],l=o[1],f=function(e){try{var u=e instanceof Function?e(i):e;if(l(u),n){var c=JSON.stringify(u);"local"===r?window.localStorage.setItem(t,c):window.sessionStorage.setItem(t,c)}}catch(e){throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(t))}};return[i,f]},e.useTimeout=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=u.useRef(null),c=u.useRef(null),i=u.useCallback((function(){return clearTimeout(n.current)}),[n.current]);return u.useEffect((function(){c.current=e})),u.useEffect((function(){if(r)return n.current=setTimeout((function(){c.current()}),t),i;i()}),[t,r]),o((function(){i()})),[i]},e.useUnmountEffect=o,e.useUpdateEffect=function(e,t){var r=u.useRef(!1);return u.useEffect((function(){if(r.current)return e&&e();r.current=!0}),t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils);
|
package/image/image.d.ts
CHANGED
package/inplace/inplace.d.ts
CHANGED
|
@@ -16,12 +16,17 @@ export interface InplaceProps {
|
|
|
16
16
|
onOpen?(event: React.MouseEvent<HTMLElement>): void;
|
|
17
17
|
onClose?(event: React.MouseEvent<HTMLElement>): void;
|
|
18
18
|
onToggle?(e: InplaceToggleParams): void;
|
|
19
|
+
children?: React.ReactNode;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export declare class Inplace extends React.Component<InplaceProps, any> { }
|
|
22
23
|
|
|
23
24
|
// tslint:disable-next-line:max-classes-per-file
|
|
24
|
-
export declare class InplaceDisplay extends React.Component {
|
|
25
|
+
export declare class InplaceDisplay extends React.Component {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
25
28
|
|
|
26
29
|
// tslint:disable-next-line:max-classes-per-file
|
|
27
|
-
export declare class InplaceContent extends React.Component {
|
|
30
|
+
export declare class InplaceContent extends React.Component {
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
}
|
|
@@ -212,6 +212,8 @@ var InputMask = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespac
|
|
|
212
212
|
value: getValue()
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
|
+
|
|
216
|
+
updateModel(e);
|
|
215
217
|
};
|
|
216
218
|
|
|
217
219
|
var onBlur = function onBlur(e) {
|
|
@@ -604,7 +606,6 @@ var InputMask = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespac
|
|
|
604
606
|
onInput: onInput,
|
|
605
607
|
onPaste: handleInputChange,
|
|
606
608
|
required: props.required,
|
|
607
|
-
"aria-labelledby": props.ariaLabelledBy,
|
|
608
609
|
tooltip: props.tooltip,
|
|
609
610
|
tooltipOptions: props.tooltipOptions
|
|
610
611
|
}));
|
|
@@ -632,7 +633,6 @@ InputMask.defaultProps = {
|
|
|
632
633
|
required: false,
|
|
633
634
|
tooltip: null,
|
|
634
635
|
tooltipOptions: null,
|
|
635
|
-
ariaLabelledBy: null,
|
|
636
636
|
onComplete: null,
|
|
637
637
|
onChange: null,
|
|
638
638
|
onFocus: null,
|