primereact 10.0.0 → 10.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 +1 -1
- package/componentbase/componentbase.cjs.js +12 -7
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.min.mjs +1 -1
- package/componentbase/componentbase.esm.mjs +12 -7
- package/componentbase/componentbase.js +12 -7
- package/componentbase/componentbase.min.js +1 -1
- package/core/core.js +12 -7
- package/core/core.min.js +1 -1
- package/package.json +1 -1
- package/primereact.all.cjs.js +12 -7
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.min.mjs +1 -1
- package/primereact.all.esm.mjs +12 -7
- package/primereact.all.js +12 -7
- package/primereact.all.min.js +1 -1
- package/web-types.json +1 -1
- package/accordion/accordion.esm.js +0 -421
- package/accordion/accordion.esm.min.js +0 -1
- package/api/api.esm.js +0 -944
- package/api/api.esm.min.js +0 -1
- package/autocomplete/autocomplete.esm.js +0 -1127
- package/autocomplete/autocomplete.esm.min.js +0 -1
- package/avatar/avatar.esm.js +0 -245
- package/avatar/avatar.esm.min.js +0 -1
- package/avatargroup/avatargroup.esm.js +0 -55
- package/avatargroup/avatargroup.esm.min.js +0 -1
- package/badge/badge.esm.js +0 -110
- package/badge/badge.esm.min.js +0 -1
- package/blockui/blockui.esm.js +0 -265
- package/blockui/blockui.esm.min.js +0 -1
- package/breadcrumb/breadcrumb.esm.js +0 -351
- package/breadcrumb/breadcrumb.esm.min.js +0 -1
- package/button/button.esm.js +0 -295
- package/button/button.esm.min.js +0 -1
- package/calendar/calendar.esm.js +0 -3473
- package/calendar/calendar.esm.min.js +0 -1
- package/card/card.esm.js +0 -98
- package/card/card.esm.min.js +0 -1
- package/carousel/carousel.esm.js +0 -801
- package/carousel/carousel.esm.min.js +0 -1
- package/cascadeselect/cascadeselect.esm.js +0 -819
- package/cascadeselect/cascadeselect.esm.min.js +0 -1
- package/chart/chart.esm.js +0 -155
- package/chart/chart.esm.min.js +0 -1
- package/checkbox/checkbox.esm.js +0 -357
- package/checkbox/checkbox.esm.min.js +0 -1
- package/chip/chip.esm.js +0 -248
- package/chip/chip.esm.min.js +0 -1
- package/chips/chips.esm.js +0 -501
- package/chips/chips.esm.min.js +0 -1
- package/colorpicker/colorpicker.esm.js +0 -788
- package/colorpicker/colorpicker.esm.min.js +0 -1
- package/column/column.esm.js +0 -8
- package/column/column.esm.min.js +0 -1
- package/columngroup/columngroup.esm.js +0 -6
- package/columngroup/columngroup.esm.min.js +0 -1
- package/componentbase/componentbase.esm.js +0 -323
- package/componentbase/componentbase.esm.min.js +0 -1
- package/confirmdialog/confirmdialog.esm.js +0 -376
- package/confirmdialog/confirmdialog.esm.min.js +0 -1
- package/confirmpopup/confirmpopup.esm.js +0 -610
- package/confirmpopup/confirmpopup.esm.min.js +0 -1
- package/contextmenu/contextmenu.esm.js +0 -664
- package/contextmenu/contextmenu.esm.min.js +0 -1
- package/csstransition/csstransition.esm.js +0 -138
- package/csstransition/csstransition.esm.min.js +0 -1
- package/datascroller/datascroller.esm.js +0 -320
- package/datascroller/datascroller.esm.min.js +0 -1
- package/datatable/datatable.esm.js +0 -6636
- package/datatable/datatable.esm.min.js +0 -1
- package/dataview/dataview.esm.js +0 -506
- package/dataview/dataview.esm.min.js +0 -1
- package/deferredcontent/deferredcontent.esm.js +0 -133
- package/deferredcontent/deferredcontent.esm.min.js +0 -1
- package/dialog/dialog.esm.js +0 -983
- package/dialog/dialog.esm.min.js +0 -1
- package/divider/divider.esm.js +0 -79
- package/divider/divider.esm.min.js +0 -1
- package/dock/dock.esm.js +0 -348
- package/dock/dock.esm.min.js +0 -1
- package/dropdown/dropdown.esm.js +0 -1380
- package/dropdown/dropdown.esm.min.js +0 -1
- package/editor/editor.esm.js +0 -338
- package/editor/editor.esm.min.js +0 -1
- package/fieldset/fieldset.esm.js +0 -270
- package/fieldset/fieldset.esm.min.js +0 -1
- package/fileupload/fileupload.esm.js +0 -1005
- package/fileupload/fileupload.esm.min.js +0 -1
- package/galleria/galleria.esm.js +0 -1090
- package/galleria/galleria.esm.min.js +0 -1
- package/hooks/hooks.esm.js +0 -1042
- package/hooks/hooks.esm.min.js +0 -1
- package/iconbase/iconbase.esm.js +0 -33
- package/iconbase/iconbase.esm.min.js +0 -1
- package/icons/angledoubledown/index.esm.js +0 -39
- package/icons/angledoubledown/index.esm.min.js +0 -1
- package/icons/angledoubleleft/index.esm.js +0 -39
- package/icons/angledoubleleft/index.esm.min.js +0 -1
- package/icons/angledoubleright/index.esm.js +0 -39
- package/icons/angledoubleright/index.esm.min.js +0 -1
- package/icons/angledoubleup/index.esm.js +0 -39
- package/icons/angledoubleup/index.esm.min.js +0 -1
- package/icons/angledown/index.esm.js +0 -37
- package/icons/angledown/index.esm.min.js +0 -1
- package/icons/angleleft/index.esm.js +0 -37
- package/icons/angleleft/index.esm.min.js +0 -1
- package/icons/angleright/index.esm.js +0 -37
- package/icons/angleright/index.esm.min.js +0 -1
- package/icons/angleup/index.esm.js +0 -37
- package/icons/angleup/index.esm.min.js +0 -1
- package/icons/arrowdown/index.esm.js +0 -661
- package/icons/arrowdown/index.esm.min.js +0 -1
- package/icons/arrowup/index.esm.js +0 -661
- package/icons/arrowup/index.esm.min.js +0 -1
- package/icons/ban/index.esm.js +0 -659
- package/icons/ban/index.esm.min.js +0 -1
- package/icons/bars/index.esm.js +0 -39
- package/icons/bars/index.esm.min.js +0 -1
- package/icons/calendar/index.esm.js +0 -37
- package/icons/calendar/index.esm.min.js +0 -1
- package/icons/check/index.esm.js +0 -37
- package/icons/check/index.esm.min.js +0 -1
- package/icons/chevrondown/index.esm.js +0 -37
- package/icons/chevrondown/index.esm.min.js +0 -1
- package/icons/chevronleft/index.esm.js +0 -37
- package/icons/chevronleft/index.esm.min.js +0 -1
- package/icons/chevronright/index.esm.js +0 -37
- package/icons/chevronright/index.esm.min.js +0 -1
- package/icons/chevronup/index.esm.js +0 -37
- package/icons/chevronup/index.esm.min.js +0 -1
- package/icons/download/index.esm.js +0 -661
- package/icons/download/index.esm.min.js +0 -1
- package/icons/exclamationtriangle/index.esm.js +0 -665
- package/icons/exclamationtriangle/index.esm.min.js +0 -1
- package/icons/eye/index.esm.js +0 -39
- package/icons/eye/index.esm.min.js +0 -1
- package/icons/eyeslash/index.esm.js +0 -661
- package/icons/eyeslash/index.esm.min.js +0 -1
- package/icons/filter/index.esm.js +0 -659
- package/icons/filter/index.esm.min.js +0 -1
- package/icons/filterslash/index.esm.js +0 -661
- package/icons/filterslash/index.esm.min.js +0 -1
- package/icons/infocircle/index.esm.js +0 -661
- package/icons/infocircle/index.esm.min.js +0 -1
- package/icons/minus/index.esm.js +0 -37
- package/icons/minus/index.esm.min.js +0 -1
- package/icons/pencil/index.esm.js +0 -659
- package/icons/pencil/index.esm.min.js +0 -1
- package/icons/plus/index.esm.js +0 -659
- package/icons/plus/index.esm.min.js +0 -1
- package/icons/refresh/index.esm.js +0 -661
- package/icons/refresh/index.esm.min.js +0 -1
- package/icons/search/index.esm.js +0 -661
- package/icons/search/index.esm.min.js +0 -1
- package/icons/searchminus/index.esm.js +0 -661
- package/icons/searchminus/index.esm.min.js +0 -1
- package/icons/searchplus/index.esm.js +0 -661
- package/icons/searchplus/index.esm.min.js +0 -1
- package/icons/sortalt/index.esm.js +0 -668
- package/icons/sortalt/index.esm.min.js +0 -1
- package/icons/sortamountdown/index.esm.js +0 -674
- package/icons/sortamountdown/index.esm.min.js +0 -1
- package/icons/sortamountupalt/index.esm.js +0 -674
- package/icons/sortamountupalt/index.esm.min.js +0 -1
- package/icons/spinner/index.esm.js +0 -659
- package/icons/spinner/index.esm.min.js +0 -1
- package/icons/star/index.esm.js +0 -659
- package/icons/star/index.esm.min.js +0 -1
- package/icons/starfill/index.esm.js +0 -659
- package/icons/starfill/index.esm.min.js +0 -1
- package/icons/thlarge/index.esm.js +0 -661
- package/icons/thlarge/index.esm.min.js +0 -1
- package/icons/times/index.esm.js +0 -37
- package/icons/times/index.esm.min.js +0 -1
- package/icons/timescircle/index.esm.js +0 -661
- package/icons/timescircle/index.esm.min.js +0 -1
- package/icons/trash/index.esm.js +0 -661
- package/icons/trash/index.esm.min.js +0 -1
- package/icons/undo/index.esm.js +0 -661
- package/icons/undo/index.esm.min.js +0 -1
- package/icons/upload/index.esm.js +0 -661
- package/icons/upload/index.esm.min.js +0 -1
- package/icons/windowmaximize/index.esm.js +0 -661
- package/icons/windowmaximize/index.esm.min.js +0 -1
- package/icons/windowminimize/index.esm.js +0 -661
- package/icons/windowminimize/index.esm.min.js +0 -1
- package/image/image.esm.js +0 -1162
- package/image/image.esm.min.js +0 -1
- package/inplace/inplace.esm.js +0 -243
- package/inplace/inplace.esm.min.js +0 -1
- package/inputmask/inputmask.esm.js +0 -560
- package/inputmask/inputmask.esm.min.js +0 -1
- package/inputnumber/inputnumber.esm.js +0 -1209
- package/inputnumber/inputnumber.esm.min.js +0 -1
- package/inputswitch/inputswitch.esm.js +0 -291
- package/inputswitch/inputswitch.esm.min.js +0 -1
- package/inputtext/inputtext.esm.js +0 -171
- package/inputtext/inputtext.esm.min.js +0 -1
- package/inputtextarea/inputtextarea.esm.js +0 -220
- package/inputtextarea/inputtextarea.esm.min.js +0 -1
- package/keyfilter/keyfilter.esm.js +0 -108
- package/keyfilter/keyfilter.esm.min.js +0 -1
- package/knob/knob.esm.js +0 -318
- package/knob/knob.esm.min.js +0 -1
- package/listbox/listbox.esm.js +0 -810
- package/listbox/listbox.esm.min.js +0 -1
- package/megamenu/megamenu.esm.js +0 -716
- package/megamenu/megamenu.esm.min.js +0 -1
- package/mention/mention.esm.js +0 -771
- package/mention/mention.esm.min.js +0 -1
- package/menu/menu.esm.js +0 -485
- package/menu/menu.esm.min.js +0 -1
- package/menubar/menubar.esm.js +0 -584
- package/menubar/menubar.esm.min.js +0 -1
- package/message/message.esm.js +0 -169
- package/message/message.esm.min.js +0 -1
- package/messages/messages.esm.js +0 -439
- package/messages/messages.esm.min.js +0 -1
- package/multiselect/multiselect.esm.js +0 -1724
- package/multiselect/multiselect.esm.min.js +0 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +0 -352
- package/multistatecheckbox/multistatecheckbox.esm.min.js +0 -1
- package/orderlist/orderlist.esm.js +0 -816
- package/orderlist/orderlist.esm.min.js +0 -1
- package/organizationchart/organizationchart.esm.js +0 -480
- package/organizationchart/organizationchart.esm.min.js +0 -1
- package/overlaypanel/overlaypanel.esm.js +0 -516
- package/overlaypanel/overlaypanel.esm.min.js +0 -1
- package/overlayservice/overlayservice.esm.js +0 -7
- package/overlayservice/overlayservice.esm.min.js +0 -1
- package/paginator/paginator.esm.js +0 -933
- package/paginator/paginator.esm.min.js +0 -1
- package/panel/panel.esm.js +0 -316
- package/panel/panel.esm.min.js +0 -1
- package/panelmenu/panelmenu.esm.js +0 -645
- package/panelmenu/panelmenu.esm.min.js +0 -1
- package/passthrough/index.esm.js +0 -71
- package/passthrough/index.esm.min.js +0 -1
- package/passthrough/tailwind/index.esm.js +0 -3509
- package/passthrough/tailwind/index.esm.min.js +0 -1
- package/password/password.esm.js +0 -567
- package/password/password.esm.min.js +0 -1
- package/picklist/picklist.esm.js +0 -1119
- package/picklist/picklist.esm.min.js +0 -1
- package/portal/portal.esm.js +0 -110
- package/portal/portal.esm.min.js +0 -1
- package/primereact.all.esm.js +0 -51646
- package/primereact.all.esm.min.js +0 -1
- package/progressbar/progressbar.esm.js +0 -190
- package/progressbar/progressbar.esm.min.js +0 -1
- package/progressspinner/progressspinner.esm.js +0 -88
- package/progressspinner/progressspinner.esm.min.js +0 -1
- package/radiobutton/radiobutton.esm.js +0 -329
- package/radiobutton/radiobutton.esm.min.js +0 -1
- package/rating/rating.esm.js +0 -273
- package/rating/rating.esm.min.js +0 -1
- package/ripple/ripple.esm.js +0 -100
- package/ripple/ripple.esm.min.js +0 -1
- package/row/row.esm.js +0 -36
- package/row/row.esm.min.js +0 -1
- package/scrollpanel/scrollpanel.esm.js +0 -210
- package/scrollpanel/scrollpanel.esm.min.js +0 -1
- package/scrolltop/scrolltop.esm.js +0 -269
- package/scrolltop/scrolltop.esm.min.js +0 -1
- package/selectbutton/selectbutton.esm.js +0 -327
- package/selectbutton/selectbutton.esm.min.js +0 -1
- package/sidebar/sidebar.esm.js +0 -543
- package/sidebar/sidebar.esm.min.js +0 -1
- package/skeleton/skeleton.esm.js +0 -125
- package/skeleton/skeleton.esm.min.js +0 -1
- package/slidemenu/slidemenu.esm.js +0 -689
- package/slidemenu/slidemenu.esm.min.js +0 -1
- package/slider/slider.esm.js +0 -478
- package/slider/slider.esm.min.js +0 -1
- package/speeddial/speeddial.esm.js +0 -521
- package/speeddial/speeddial.esm.min.js +0 -1
- package/splitbutton/splitbutton.esm.js +0 -545
- package/splitbutton/splitbutton.esm.min.js +0 -1
- package/splitter/splitter.esm.js +0 -466
- package/splitter/splitter.esm.min.js +0 -1
- package/steps/steps.esm.js +0 -294
- package/steps/steps.esm.min.js +0 -1
- package/styleclass/styleclass.esm.js +0 -269
- package/styleclass/styleclass.esm.min.js +0 -1
- package/tabmenu/tabmenu.esm.js +0 -332
- package/tabmenu/tabmenu.esm.min.js +0 -1
- package/tabview/tabview.esm.js +0 -678
- package/tabview/tabview.esm.min.js +0 -1
- package/tag/tag.esm.js +0 -117
- package/tag/tag.esm.min.js +0 -1
- package/terminal/terminal.esm.js +0 -280
- package/terminal/terminal.esm.min.js +0 -1
- package/terminalservice/terminalservice.esm.js +0 -7
- package/terminalservice/terminalservice.esm.min.js +0 -1
- package/tieredmenu/tieredmenu.esm.js +0 -699
- package/tieredmenu/tieredmenu.esm.min.js +0 -1
- package/timeline/timeline.esm.js +0 -164
- package/timeline/timeline.esm.min.js +0 -1
- package/toast/toast.esm.js +0 -739
- package/toast/toast.esm.min.js +0 -1
- package/togglebutton/togglebutton.esm.js +0 -217
- package/togglebutton/togglebutton.esm.min.js +0 -1
- package/toolbar/toolbar.esm.js +0 -79
- package/toolbar/toolbar.esm.min.js +0 -1
- package/tooltip/tooltip.esm.js +0 -696
- package/tooltip/tooltip.esm.min.js +0 -1
- package/tree/tree.esm.js +0 -1403
- package/tree/tree.esm.min.js +0 -1
- package/treeselect/treeselect.esm.js +0 -930
- package/treeselect/treeselect.esm.min.js +0 -1
- package/treetable/treetable.esm.js +0 -3094
- package/treetable/treetable.esm.min.js +0 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +0 -292
- package/tristatecheckbox/tristatecheckbox.esm.min.js +0 -1
- package/utils/utils.esm.js +0 -2383
- package/utils/utils.esm.min.js +0 -1
- package/virtualscroller/virtualscroller.esm.js +0 -972
- package/virtualscroller/virtualscroller.esm.min.js +0 -1
|
@@ -1,610 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import PrimeReact, { PrimeReactContext, localeOption } from 'primereact/api';
|
|
5
|
-
import { Button } from 'primereact/button';
|
|
6
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
7
|
-
import { CSSTransition } from 'primereact/csstransition';
|
|
8
|
-
import { useOverlayListener, useUpdateEffect, useUnmountEffect as useUnmountEffect$1 } from 'primereact/hooks';
|
|
9
|
-
import { OverlayService } from 'primereact/overlayservice';
|
|
10
|
-
import { Portal } from 'primereact/portal';
|
|
11
|
-
import { classNames, DomHandler, ObjectUtils, ZIndexUtils, mergeProps, IconUtils } from 'primereact/utils';
|
|
12
|
-
|
|
13
|
-
function _extends() {
|
|
14
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
15
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
-
var source = arguments[i];
|
|
17
|
-
for (var key in source) {
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19
|
-
target[key] = source[key];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return target;
|
|
24
|
-
};
|
|
25
|
-
return _extends.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _arrayWithHoles(arr) {
|
|
29
|
-
if (Array.isArray(arr)) return arr;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _iterableToArrayLimit(r, l) {
|
|
33
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
34
|
-
if (null != t) {
|
|
35
|
-
var e,
|
|
36
|
-
n,
|
|
37
|
-
i,
|
|
38
|
-
u,
|
|
39
|
-
a = [],
|
|
40
|
-
f = !0,
|
|
41
|
-
o = !1;
|
|
42
|
-
try {
|
|
43
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
44
|
-
if (Object(t) !== t) return;
|
|
45
|
-
f = !1;
|
|
46
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
47
|
-
} catch (r) {
|
|
48
|
-
o = !0, n = r;
|
|
49
|
-
} finally {
|
|
50
|
-
try {
|
|
51
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
52
|
-
} finally {
|
|
53
|
-
if (o) throw n;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return a;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _arrayLikeToArray(arr, len) {
|
|
61
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
62
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
63
|
-
return arr2;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
67
|
-
if (!o) return;
|
|
68
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
69
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
70
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
71
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
72
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function _nonIterableRest() {
|
|
76
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function _slicedToArray(arr, i) {
|
|
80
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function _typeof(o) {
|
|
84
|
-
"@babel/helpers - typeof";
|
|
85
|
-
|
|
86
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
87
|
-
return typeof o;
|
|
88
|
-
} : function (o) {
|
|
89
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
90
|
-
}, _typeof(o);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function _toPrimitive(input, hint) {
|
|
94
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
95
|
-
var prim = input[Symbol.toPrimitive];
|
|
96
|
-
if (prim !== undefined) {
|
|
97
|
-
var res = prim.call(input, hint || "default");
|
|
98
|
-
if (_typeof(res) !== "object") return res;
|
|
99
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
100
|
-
}
|
|
101
|
-
return (hint === "string" ? String : Number)(input);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function _toPropertyKey(arg) {
|
|
105
|
-
var key = _toPrimitive(arg, "string");
|
|
106
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function _defineProperty(obj, key, value) {
|
|
110
|
-
key = _toPropertyKey(key);
|
|
111
|
-
if (key in obj) {
|
|
112
|
-
Object.defineProperty(obj, key, {
|
|
113
|
-
value: value,
|
|
114
|
-
enumerable: true,
|
|
115
|
-
configurable: true,
|
|
116
|
-
writable: true
|
|
117
|
-
});
|
|
118
|
-
} else {
|
|
119
|
-
obj[key] = value;
|
|
120
|
-
}
|
|
121
|
-
return obj;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
var styles = "\n@layer primereact {\n .p-confirm-popup-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: \" \";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n";
|
|
125
|
-
var classes = {
|
|
126
|
-
root: function root(_ref) {
|
|
127
|
-
var context = _ref.context,
|
|
128
|
-
getPropValue = _ref.getPropValue;
|
|
129
|
-
return classNames('p-confirm-popup p-component', getPropValue('className'), {
|
|
130
|
-
'p-input-filled': context && context.inputStyle === 'filled' || PrimeReact.inputStyle === 'filled',
|
|
131
|
-
'p-ripple-disabled': context && context.ripple === false || PrimeReact.ripple === false
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
acceptButton: function acceptButton(_ref2) {
|
|
135
|
-
var getPropValue = _ref2.getPropValue;
|
|
136
|
-
return classNames('p-confirm-popup-accept p-button-sm', getPropValue('acceptClassName'));
|
|
137
|
-
},
|
|
138
|
-
rejectButton: function rejectButton(_ref3) {
|
|
139
|
-
var getPropValue = _ref3.getPropValue;
|
|
140
|
-
return classNames('p-confirm-popup-reject p-button-sm', {
|
|
141
|
-
'p-button-text': !getPropValue('rejectClassName')
|
|
142
|
-
}, getPropValue('rejectClassName'));
|
|
143
|
-
},
|
|
144
|
-
content: 'p-confirm-popup-content',
|
|
145
|
-
icon: 'p-confirm-popup-icon',
|
|
146
|
-
message: 'p-confirm-popup-message',
|
|
147
|
-
footer: 'p-confirm-popup-footer',
|
|
148
|
-
transition: 'p-connected-overlay'
|
|
149
|
-
};
|
|
150
|
-
var ConfirmPopupBase = ComponentBase.extend({
|
|
151
|
-
defaultProps: {
|
|
152
|
-
__TYPE: 'ConfirmPopup',
|
|
153
|
-
tagKey: undefined,
|
|
154
|
-
target: null,
|
|
155
|
-
visible: false,
|
|
156
|
-
message: null,
|
|
157
|
-
rejectLabel: null,
|
|
158
|
-
acceptLabel: null,
|
|
159
|
-
icon: null,
|
|
160
|
-
rejectIcon: null,
|
|
161
|
-
acceptIcon: null,
|
|
162
|
-
rejectClassName: null,
|
|
163
|
-
acceptClassName: null,
|
|
164
|
-
className: null,
|
|
165
|
-
style: null,
|
|
166
|
-
appendTo: null,
|
|
167
|
-
dismissable: true,
|
|
168
|
-
footer: null,
|
|
169
|
-
onShow: null,
|
|
170
|
-
onHide: null,
|
|
171
|
-
accept: null,
|
|
172
|
-
reject: null,
|
|
173
|
-
transitionOptions: null,
|
|
174
|
-
children: undefined,
|
|
175
|
-
closeOnEscape: true
|
|
176
|
-
},
|
|
177
|
-
css: {
|
|
178
|
-
classes: classes,
|
|
179
|
-
styles: styles
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
var usePrevious = function usePrevious(newValue) {
|
|
184
|
-
var ref = React.useRef(undefined);
|
|
185
|
-
React.useEffect(function () {
|
|
186
|
-
ref.current = newValue;
|
|
187
|
-
});
|
|
188
|
-
return ref.current;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
/* eslint-disable */
|
|
192
|
-
var useUnmountEffect = function useUnmountEffect(fn) {
|
|
193
|
-
return React.useEffect(function () {
|
|
194
|
-
return fn;
|
|
195
|
-
}, []);
|
|
196
|
-
};
|
|
197
|
-
/* eslint-enable */
|
|
198
|
-
|
|
199
|
-
/* eslint-disable */
|
|
200
|
-
var useEventListener = function useEventListener(_ref) {
|
|
201
|
-
var _ref$target = _ref.target,
|
|
202
|
-
target = _ref$target === void 0 ? 'document' : _ref$target,
|
|
203
|
-
type = _ref.type,
|
|
204
|
-
listener = _ref.listener,
|
|
205
|
-
options = _ref.options,
|
|
206
|
-
_ref$when = _ref.when,
|
|
207
|
-
when = _ref$when === void 0 ? true : _ref$when;
|
|
208
|
-
var targetRef = React.useRef(null);
|
|
209
|
-
var listenerRef = React.useRef(null);
|
|
210
|
-
var prevListener = usePrevious(listener);
|
|
211
|
-
var prevOptions = usePrevious(options);
|
|
212
|
-
var bind = function bind() {
|
|
213
|
-
var bindOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
214
|
-
if (ObjectUtils.isNotEmpty(bindOptions.target)) {
|
|
215
|
-
unbind();
|
|
216
|
-
(bindOptions.when || when) && (targetRef.current = DomHandler.getTargetElement(bindOptions.target));
|
|
217
|
-
}
|
|
218
|
-
if (!listenerRef.current && targetRef.current) {
|
|
219
|
-
listenerRef.current = function (event) {
|
|
220
|
-
return listener && listener(event);
|
|
221
|
-
};
|
|
222
|
-
targetRef.current.addEventListener(type, listenerRef.current, options);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
var unbind = function unbind() {
|
|
226
|
-
if (listenerRef.current) {
|
|
227
|
-
targetRef.current.removeEventListener(type, listenerRef.current, options);
|
|
228
|
-
listenerRef.current = null;
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
React.useEffect(function () {
|
|
232
|
-
if (when) {
|
|
233
|
-
targetRef.current = DomHandler.getTargetElement(target);
|
|
234
|
-
} else {
|
|
235
|
-
unbind();
|
|
236
|
-
targetRef.current = null;
|
|
237
|
-
}
|
|
238
|
-
}, [target, when]);
|
|
239
|
-
React.useEffect(function () {
|
|
240
|
-
// to properly compare functions we can implicitly converting the function to it's body's text as a String
|
|
241
|
-
if (listenerRef.current && ('' + prevListener !== '' + listener || prevOptions !== options)) {
|
|
242
|
-
unbind();
|
|
243
|
-
when && bind();
|
|
244
|
-
}
|
|
245
|
-
}, [listener, options, when]);
|
|
246
|
-
useUnmountEffect(function () {
|
|
247
|
-
unbind();
|
|
248
|
-
});
|
|
249
|
-
return [bind, unbind];
|
|
250
|
-
};
|
|
251
|
-
/* eslint-enable */
|
|
252
|
-
|
|
253
|
-
var useOnEscapeKey = function useOnEscapeKey(ref, condition, callback) {
|
|
254
|
-
var handleEsc = function handleEsc(event) {
|
|
255
|
-
if (event.key === 'Esc' || event.key === 'Escape') {
|
|
256
|
-
event.stopImmediatePropagation();
|
|
257
|
-
callback(event);
|
|
258
|
-
}
|
|
259
|
-
return;
|
|
260
|
-
};
|
|
261
|
-
var _useEventListener = useEventListener({
|
|
262
|
-
type: 'keydown',
|
|
263
|
-
listener: handleEsc
|
|
264
|
-
}),
|
|
265
|
-
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
266
|
-
bindKeyDownListener = _useEventListener2[0],
|
|
267
|
-
unbindKeyDownListener = _useEventListener2[1];
|
|
268
|
-
React.useEffect(function () {
|
|
269
|
-
if (!condition) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
if (!ref.current) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
bindKeyDownListener();
|
|
276
|
-
return function () {
|
|
277
|
-
unbindKeyDownListener();
|
|
278
|
-
};
|
|
279
|
-
});
|
|
280
|
-
return [ref, callback];
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
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; }
|
|
284
|
-
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; }
|
|
285
|
-
var confirmPopup = function confirmPopup() {
|
|
286
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
287
|
-
props = _objectSpread(_objectSpread({}, props), {
|
|
288
|
-
visible: props.visible === undefined ? true : props.visible
|
|
289
|
-
});
|
|
290
|
-
props.visible && OverlayService.emit('confirm-popup', props);
|
|
291
|
-
var show = function show() {
|
|
292
|
-
var updatedProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
293
|
-
OverlayService.emit('confirm-popup', _objectSpread(_objectSpread(_objectSpread({}, props), updatedProps), {
|
|
294
|
-
visible: true
|
|
295
|
-
}));
|
|
296
|
-
};
|
|
297
|
-
var hide = function hide() {
|
|
298
|
-
OverlayService.emit('confirm-popup', {
|
|
299
|
-
visible: false
|
|
300
|
-
});
|
|
301
|
-
};
|
|
302
|
-
return {
|
|
303
|
-
show: show,
|
|
304
|
-
hide: hide
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
var ConfirmPopup = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
308
|
-
var context = React.useContext(PrimeReactContext);
|
|
309
|
-
var props = ConfirmPopupBase.getProps(inProps, context);
|
|
310
|
-
var _React$useState = React.useState(props.visible),
|
|
311
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
312
|
-
visibleState = _React$useState2[0],
|
|
313
|
-
setVisibleState = _React$useState2[1];
|
|
314
|
-
var _React$useState3 = React.useState(false),
|
|
315
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
316
|
-
reshowState = _React$useState4[0],
|
|
317
|
-
setReshowState = _React$useState4[1];
|
|
318
|
-
var metaData = {
|
|
319
|
-
props: props,
|
|
320
|
-
state: {
|
|
321
|
-
visible: visibleState,
|
|
322
|
-
reshow: reshowState
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
var _ConfirmPopupBase$set = ConfirmPopupBase.setMetaData(metaData),
|
|
326
|
-
ptm = _ConfirmPopupBase$set.ptm,
|
|
327
|
-
cx = _ConfirmPopupBase$set.cx,
|
|
328
|
-
isUnstyled = _ConfirmPopupBase$set.isUnstyled;
|
|
329
|
-
useHandleStyle(ConfirmPopupBase.css.styles, isUnstyled, {
|
|
330
|
-
name: 'confirmpopup'
|
|
331
|
-
});
|
|
332
|
-
var overlayRef = React.useRef(null);
|
|
333
|
-
var acceptBtnRef = React.useRef(null);
|
|
334
|
-
var isPanelClicked = React.useRef(false);
|
|
335
|
-
var overlayEventListener = React.useRef(null);
|
|
336
|
-
var confirmProps = React.useRef(null);
|
|
337
|
-
var focusElementOnHide = React.useRef(null);
|
|
338
|
-
var isCallbackExecuting = React.useRef(false);
|
|
339
|
-
var getCurrentProps = function getCurrentProps() {
|
|
340
|
-
return confirmProps.current || props;
|
|
341
|
-
};
|
|
342
|
-
var getPropValue = function getPropValue(key) {
|
|
343
|
-
return (confirmProps.current || props)[key];
|
|
344
|
-
};
|
|
345
|
-
var callbackFromProp = function callbackFromProp(key) {
|
|
346
|
-
for (var _len = arguments.length, param = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
347
|
-
param[_key - 1] = arguments[_key];
|
|
348
|
-
}
|
|
349
|
-
return ObjectUtils.getPropValue(getPropValue(key), param);
|
|
350
|
-
};
|
|
351
|
-
var acceptLabel = getPropValue('acceptLabel') || localeOption('accept');
|
|
352
|
-
var rejectLabel = getPropValue('rejectLabel') || localeOption('reject');
|
|
353
|
-
useOnEscapeKey(overlayRef, props.dismissable && props.closeOnEscape, function (event) {
|
|
354
|
-
hide('hide');
|
|
355
|
-
});
|
|
356
|
-
var _useOverlayListener = useOverlayListener({
|
|
357
|
-
target: getPropValue('target'),
|
|
358
|
-
overlay: overlayRef,
|
|
359
|
-
listener: function listener(event, _ref) {
|
|
360
|
-
var type = _ref.type,
|
|
361
|
-
valid = _ref.valid;
|
|
362
|
-
if (valid) {
|
|
363
|
-
type === 'outside' ? props.dismissable && !isPanelClicked.current && hide('hide') : hide('hide');
|
|
364
|
-
}
|
|
365
|
-
isPanelClicked.current = false;
|
|
366
|
-
},
|
|
367
|
-
when: visibleState
|
|
368
|
-
}),
|
|
369
|
-
_useOverlayListener2 = _slicedToArray(_useOverlayListener, 2),
|
|
370
|
-
bindOverlayListener = _useOverlayListener2[0],
|
|
371
|
-
unbindOverlayListener = _useOverlayListener2[1];
|
|
372
|
-
var onPanelClick = function onPanelClick(event) {
|
|
373
|
-
isPanelClicked.current = true;
|
|
374
|
-
OverlayService.emit('overlay-click', {
|
|
375
|
-
originalEvent: event,
|
|
376
|
-
target: getPropValue('target')
|
|
377
|
-
});
|
|
378
|
-
};
|
|
379
|
-
var accept = function accept() {
|
|
380
|
-
if (!isCallbackExecuting.current) {
|
|
381
|
-
isCallbackExecuting.current = true;
|
|
382
|
-
callbackFromProp('accept');
|
|
383
|
-
hide('accept');
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
var reject = function reject() {
|
|
387
|
-
if (!isCallbackExecuting.current) {
|
|
388
|
-
isCallbackExecuting.current = true;
|
|
389
|
-
callbackFromProp('reject');
|
|
390
|
-
hide('reject');
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
var show = function show() {
|
|
394
|
-
// Remember the focused element before we opened the dialog
|
|
395
|
-
// so we can return focus to it once we close the dialog.
|
|
396
|
-
focusElementOnHide.current = document.activeElement;
|
|
397
|
-
setVisibleState(true);
|
|
398
|
-
setReshowState(false);
|
|
399
|
-
isCallbackExecuting.current = false;
|
|
400
|
-
overlayEventListener.current = function (e) {
|
|
401
|
-
!isOutsideClicked(e.target) && (isPanelClicked.current = true);
|
|
402
|
-
};
|
|
403
|
-
OverlayService.on('overlay-click', overlayEventListener.current);
|
|
404
|
-
};
|
|
405
|
-
var hide = function hide(result) {
|
|
406
|
-
setVisibleState(false);
|
|
407
|
-
OverlayService.off('overlay-click', overlayEventListener.current);
|
|
408
|
-
overlayEventListener.current = null;
|
|
409
|
-
if (result) {
|
|
410
|
-
callbackFromProp('onHide', result);
|
|
411
|
-
}
|
|
412
|
-
DomHandler.focus(focusElementOnHide.current);
|
|
413
|
-
focusElementOnHide.current = null;
|
|
414
|
-
};
|
|
415
|
-
var onEnter = function onEnter() {
|
|
416
|
-
ZIndexUtils.set('overlay', overlayRef.current, context && context.autoZIndex || PrimeReact.autoZIndex, context && context.zIndex['overlay'] || PrimeReact.zIndex['overlay']);
|
|
417
|
-
DomHandler.addStyles(overlayRef.current, {
|
|
418
|
-
position: 'absolute',
|
|
419
|
-
top: '50%',
|
|
420
|
-
left: '50%',
|
|
421
|
-
marginTop: '10px'
|
|
422
|
-
});
|
|
423
|
-
align();
|
|
424
|
-
};
|
|
425
|
-
var onEntered = function onEntered() {
|
|
426
|
-
bindOverlayListener();
|
|
427
|
-
if (acceptBtnRef.current) {
|
|
428
|
-
acceptBtnRef.current.focus();
|
|
429
|
-
}
|
|
430
|
-
callbackFromProp('onShow');
|
|
431
|
-
};
|
|
432
|
-
var onExit = function onExit() {
|
|
433
|
-
unbindOverlayListener();
|
|
434
|
-
};
|
|
435
|
-
var onExited = function onExited() {
|
|
436
|
-
ZIndexUtils.clear(overlayRef.current);
|
|
437
|
-
isPanelClicked.current = false;
|
|
438
|
-
};
|
|
439
|
-
var align = function align() {
|
|
440
|
-
if (getPropValue('target')) {
|
|
441
|
-
DomHandler.absolutePosition(overlayRef.current, getPropValue('target'));
|
|
442
|
-
var containerOffset = DomHandler.getOffset(overlayRef.current);
|
|
443
|
-
var targetOffset = DomHandler.getOffset(getPropValue('target'));
|
|
444
|
-
var arrowLeft = 0;
|
|
445
|
-
if (containerOffset.left < targetOffset.left) {
|
|
446
|
-
arrowLeft = targetOffset.left - containerOffset.left;
|
|
447
|
-
}
|
|
448
|
-
overlayRef.current.style.setProperty('--overlayArrowLeft', "".concat(arrowLeft, "px"));
|
|
449
|
-
if (containerOffset.top < targetOffset.top) {
|
|
450
|
-
!isUnstyled() && DomHandler.addClass(overlayRef.current, 'p-confirm-popup-flipped');
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
var isOutsideClicked = function isOutsideClicked(target) {
|
|
455
|
-
return overlayRef && overlayRef.current && !(overlayRef.current.isSameNode(target) || overlayRef.current.contains(target));
|
|
456
|
-
};
|
|
457
|
-
var confirm = function confirm(updatedProps) {
|
|
458
|
-
if (updatedProps.tagKey === props.tagKey) {
|
|
459
|
-
var isVisibleChanged = visibleState !== updatedProps.visible;
|
|
460
|
-
var targetChanged = getPropValue('target') !== updatedProps.target;
|
|
461
|
-
if (targetChanged && !props.target) {
|
|
462
|
-
hide();
|
|
463
|
-
confirmProps.current = updatedProps;
|
|
464
|
-
setReshowState(true);
|
|
465
|
-
} else if (isVisibleChanged) {
|
|
466
|
-
confirmProps.current = updatedProps;
|
|
467
|
-
updatedProps.visible ? show() : hide();
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
React.useEffect(function () {
|
|
472
|
-
props.visible ? show() : hide();
|
|
473
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
474
|
-
}, [props.visible]);
|
|
475
|
-
React.useEffect(function () {
|
|
476
|
-
if (!props.target && !props.message) {
|
|
477
|
-
OverlayService.on('confirm-popup', confirm);
|
|
478
|
-
}
|
|
479
|
-
return function () {
|
|
480
|
-
OverlayService.off('confirm-popup', confirm);
|
|
481
|
-
};
|
|
482
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
483
|
-
}, [props.target]);
|
|
484
|
-
useUpdateEffect(function () {
|
|
485
|
-
reshowState && show();
|
|
486
|
-
}, [reshowState]);
|
|
487
|
-
useUnmountEffect$1(function () {
|
|
488
|
-
if (overlayEventListener.current) {
|
|
489
|
-
OverlayService.off('overlay-click', overlayEventListener.current);
|
|
490
|
-
overlayEventListener.current = null;
|
|
491
|
-
}
|
|
492
|
-
OverlayService.off('confirm-popup', confirm);
|
|
493
|
-
ZIndexUtils.clear(overlayRef.current);
|
|
494
|
-
});
|
|
495
|
-
React.useImperativeHandle(ref, function () {
|
|
496
|
-
return {
|
|
497
|
-
props: props,
|
|
498
|
-
confirm: confirm
|
|
499
|
-
};
|
|
500
|
-
});
|
|
501
|
-
var createContent = function createContent() {
|
|
502
|
-
var currentProps = getCurrentProps();
|
|
503
|
-
var message = ObjectUtils.getJSXElement(getPropValue('message'), currentProps);
|
|
504
|
-
var iconProps = mergeProps({
|
|
505
|
-
className: cx('icon')
|
|
506
|
-
}, ptm('icon'));
|
|
507
|
-
var icon = IconUtils.getJSXIcon(getPropValue('icon'), _objectSpread({}, iconProps), {
|
|
508
|
-
props: currentProps
|
|
509
|
-
});
|
|
510
|
-
var messageProps = mergeProps({
|
|
511
|
-
className: cx('message')
|
|
512
|
-
}, ptm('message'));
|
|
513
|
-
var contentProps = mergeProps({
|
|
514
|
-
className: cx('content')
|
|
515
|
-
}, ptm('content'));
|
|
516
|
-
return /*#__PURE__*/React.createElement("div", contentProps, icon, /*#__PURE__*/React.createElement("span", messageProps, message));
|
|
517
|
-
};
|
|
518
|
-
var createFooter = function createFooter() {
|
|
519
|
-
var acceptClassName = classNames('p-confirm-popup-accept p-button-sm', getPropValue('acceptClassName'));
|
|
520
|
-
var rejectClassName = classNames('p-confirm-popup-reject p-button-sm', {
|
|
521
|
-
'p-button-text': !getPropValue('rejectClassName')
|
|
522
|
-
}, getPropValue('rejectClassName'));
|
|
523
|
-
var footerProps = mergeProps({
|
|
524
|
-
className: cx('footer')
|
|
525
|
-
}, ptm('footer'));
|
|
526
|
-
var rejectButtonProps = mergeProps({
|
|
527
|
-
label: rejectLabel,
|
|
528
|
-
icon: getPropValue('rejectIcon'),
|
|
529
|
-
className: cx('rejectButton', {
|
|
530
|
-
getPropValue: getPropValue
|
|
531
|
-
}),
|
|
532
|
-
onClick: reject,
|
|
533
|
-
pt: ptm('rejectButton'),
|
|
534
|
-
unstyled: props.unstyled,
|
|
535
|
-
__parentMetadata: {
|
|
536
|
-
parent: metaData
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
var acceptButtonProps = mergeProps({
|
|
540
|
-
ref: acceptBtnRef,
|
|
541
|
-
label: acceptLabel,
|
|
542
|
-
icon: getPropValue('acceptIcon'),
|
|
543
|
-
className: cx('acceptButton', {
|
|
544
|
-
getPropValue: getPropValue
|
|
545
|
-
}),
|
|
546
|
-
onClick: accept,
|
|
547
|
-
pt: ptm('acceptButton'),
|
|
548
|
-
unstyled: props.unstyled,
|
|
549
|
-
__parentMetadata: {
|
|
550
|
-
parent: metaData
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
var content = /*#__PURE__*/React.createElement("div", footerProps, /*#__PURE__*/React.createElement(Button, rejectButtonProps), /*#__PURE__*/React.createElement(Button, acceptButtonProps));
|
|
554
|
-
if (getPropValue('footer')) {
|
|
555
|
-
var defaultContentOptions = {
|
|
556
|
-
accept: accept,
|
|
557
|
-
reject: reject,
|
|
558
|
-
className: 'p-confirm-popup-footer',
|
|
559
|
-
acceptClassName: acceptClassName,
|
|
560
|
-
rejectClassName: rejectClassName,
|
|
561
|
-
acceptLabel: acceptLabel,
|
|
562
|
-
rejectLabel: rejectLabel,
|
|
563
|
-
element: content,
|
|
564
|
-
props: getCurrentProps()
|
|
565
|
-
};
|
|
566
|
-
return ObjectUtils.getJSXElement(getPropValue('footer'), defaultContentOptions);
|
|
567
|
-
}
|
|
568
|
-
return content;
|
|
569
|
-
};
|
|
570
|
-
var createElement = function createElement() {
|
|
571
|
-
var content = createContent();
|
|
572
|
-
var footer = createFooter();
|
|
573
|
-
var rootProps = mergeProps({
|
|
574
|
-
ref: overlayRef,
|
|
575
|
-
id: getPropValue('id'),
|
|
576
|
-
className: cx('root', {
|
|
577
|
-
context: context,
|
|
578
|
-
getPropValue: getPropValue
|
|
579
|
-
}),
|
|
580
|
-
style: getPropValue('style'),
|
|
581
|
-
onClick: onPanelClick
|
|
582
|
-
}, ConfirmPopupBase.getOtherProps(props), ptm('root'));
|
|
583
|
-
var transitionProps = mergeProps({
|
|
584
|
-
classNames: cx('transition'),
|
|
585
|
-
"in": visibleState,
|
|
586
|
-
timeout: {
|
|
587
|
-
enter: 120,
|
|
588
|
-
exit: 100
|
|
589
|
-
},
|
|
590
|
-
options: getPropValue('transitionOptions'),
|
|
591
|
-
unmountOnExit: true,
|
|
592
|
-
onEnter: onEnter,
|
|
593
|
-
onEntered: onEntered,
|
|
594
|
-
onExit: onExit,
|
|
595
|
-
onExited: onExited
|
|
596
|
-
}, ptm('transition'));
|
|
597
|
-
return /*#__PURE__*/React.createElement(CSSTransition, _extends({
|
|
598
|
-
nodeRef: overlayRef
|
|
599
|
-
}, transitionProps), /*#__PURE__*/React.createElement("div", rootProps, content, footer));
|
|
600
|
-
};
|
|
601
|
-
var element = createElement();
|
|
602
|
-
return /*#__PURE__*/React.createElement(Portal, {
|
|
603
|
-
element: element,
|
|
604
|
-
appendTo: getPropValue('appendTo'),
|
|
605
|
-
visible: getPropValue('visible')
|
|
606
|
-
});
|
|
607
|
-
}));
|
|
608
|
-
ConfirmPopup.displayName = 'ConfirmPopup';
|
|
609
|
-
|
|
610
|
-
export { ConfirmPopup, confirmPopup };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import t,{PrimeReactContext as n,localeOption as r}from"primereact/api";import{Button as o}from"primereact/button";import{ComponentBase as c,useHandleStyle as i}from"primereact/componentbase";import{CSSTransition as u}from"primereact/csstransition";import{useOverlayListener as p,useUpdateEffect as a,useUnmountEffect as l}from"primereact/hooks";import{OverlayService as s}from"primereact/overlayservice";import{Portal as f}from"primereact/portal";import{classNames as m,DomHandler as b,ObjectUtils as d,ZIndexUtils as v,mergeProps as y,IconUtils as g}from"primereact/utils";function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j.apply(this,arguments)}function h(e){if(Array.isArray(e))return e}function E(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c,i,u=[],p=!0,a=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;p=!1}else for(;!(p=(r=c.call(n)).done)&&(u.push(r.value),u.length!==t);p=!0);}catch(e){a=!0,o=e}finally{try{if(!p&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(a)throw o}}return u}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t){if(e){if("string"==typeof e)return O(e,t);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)?O(e,t):void 0}}function P(){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 S(e,t){return h(e)||E(e,t)||w(e,t)||P()}function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function N(e,t){if("object"!==x(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function C(e){var t=N(e,"string");return"symbol"===x(t)?t:String(t)}var I=c.extend({defaultProps:{__TYPE:"ConfirmPopup",tagKey:void 0,target:null,visible:!1,message:null,rejectLabel:null,acceptLabel:null,icon:null,rejectIcon:null,acceptIcon:null,rejectClassName:null,acceptClassName:null,className:null,style:null,appendTo:null,dismissable:!0,footer:null,onShow:null,onHide:null,accept:null,reject:null,transitionOptions:null,children:void 0,closeOnEscape:!0},css:{classes:{root:function(e){var n=e.context;return m("p-confirm-popup p-component",(0,e.getPropValue)("className"),{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===t.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===t.ripple})},acceptButton:function(e){return m("p-confirm-popup-accept p-button-sm",(0,e.getPropValue)("acceptClassName"))},rejectButton:function(e){var t=e.getPropValue;return m("p-confirm-popup-reject p-button-sm",{"p-button-text":!t("rejectClassName")},t("rejectClassName"))},content:"p-confirm-popup-content",icon:"p-confirm-popup-icon",message:"p-confirm-popup-message",footer:"p-confirm-popup-footer",transition:"p-connected-overlay"},styles:'\n@layer primereact {\n .p-confirm-popup-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n'}}),k=function(t){var n=e.useRef(void 0);return e.useEffect((function(){n.current=t})),n.current},R=function(t,n,r){var o,c,i,u,p,a,l,s,f,m,v,y,g,j,h,E=(u=void 0===(i=(o={type:"keydown",listener:function(e){"Esc"!==e.key&&"Escape"!==e.key||(e.stopImmediatePropagation(),r(e))}}).target)?"document":i,p=o.type,a=o.listener,l=o.options,f=void 0===(s=o.when)||s,m=e.useRef(null),v=e.useRef(null),y=k(a),g=k(l),j=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d.isNotEmpty(e.target)&&(h(),(e.when||f)&&(m.current=b.getTargetElement(e.target))),!v.current&&m.current&&(v.current=function(e){return a&&a(e)},m.current.addEventListener(p,v.current,l))},h=function(){v.current&&(m.current.removeEventListener(p,v.current,l),v.current=null)},e.useEffect((function(){f?m.current=b.getTargetElement(u):(h(),m.current=null)}),[u,f]),e.useEffect((function(){!v.current||""+y==""+a&&g===l||(h(),f&&j())}),[a,l,f]),c=function(){h()},e.useEffect((function(){return c}),[]),[j,h]),O=S(E,2),w=O[0],P=O[1];return e.useEffect((function(){if(n&&t.current)return w(),function(){P()}})),[t,r]};function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){var r,o,c;r=e,c=n[t],(o=C(o=t))in r?Object.defineProperty(r,o,{value:c,enumerable:!0,configurable:!0,writable:!0}):r[o]=c})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var T=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=A(A({},e),{visible:void 0===e.visible||e.visible})).visible&&s.emit("confirm-popup",e);return{show:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s.emit("confirm-popup",A(A(A({},e),t),{visible:!0}))},hide:function(){s.emit("confirm-popup",{visible:!1})}}},V=e.memo(e.forwardRef((function(c,h){var E=e.useContext(n),O=I.getProps(c,E),w=S(e.useState(O.visible),2),P=w[0],x=w[1],N=S(e.useState(!1),2),C=N[0],k=N[1],L={props:O,state:{visible:P,reshow:C}},T=I.setMetaData(L),V=T.ptm,B=T.cx,_=T.isUnstyled;i(I.css.styles,_,{name:"confirmpopup"});var D=e.useRef(null),M=e.useRef(null),H=e.useRef(!1),J=e.useRef(null),K=e.useRef(null),U=e.useRef(null),X=e.useRef(!1),z=function(){return K.current||O},Z=function(e){return(K.current||O)[e]},Y=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return d.getPropValue(Z(e),n)},$=Z("acceptLabel")||r("accept"),q=Z("rejectLabel")||r("reject");R(D,O.dismissable&&O.closeOnEscape,(function(e){re("hide")}));var F=S(p({target:Z("target"),overlay:D,listener:function(e,t){t.valid&&("outside"===t.type?O.dismissable&&!H.current&&re("hide"):re("hide")),H.current=!1},when:P}),2),G=F[0],Q=F[1],W=function(e){H.current=!0,s.emit("overlay-click",{originalEvent:e,target:Z("target")})},ee=function(){X.current||(X.current=!0,Y("accept"),re("accept"))},te=function(){X.current||(X.current=!0,Y("reject"),re("reject"))},ne=function(){U.current=document.activeElement,x(!0),k(!1),X.current=!1,J.current=function(e){!ae(e.target)&&(H.current=!0)},s.on("overlay-click",J.current)},re=function(e){x(!1),s.off("overlay-click",J.current),J.current=null,e&&Y("onHide",e),b.focus(U.current),U.current=null},oe=function(){v.set("overlay",D.current,E&&E.autoZIndex||t.autoZIndex,E&&E.zIndex.overlay||t.zIndex.overlay),b.addStyles(D.current,{position:"absolute",top:"50%",left:"50%",marginTop:"10px"}),pe()},ce=function(){G(),M.current&&M.current.focus(),Y("onShow")},ie=function(){Q()},ue=function(){v.clear(D.current),H.current=!1},pe=function(){if(Z("target")){b.absolutePosition(D.current,Z("target"));var e=b.getOffset(D.current),t=b.getOffset(Z("target")),n=0;e.left<t.left&&(n=t.left-e.left),D.current.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&!_()&&b.addClass(D.current,"p-confirm-popup-flipped")}},ae=function(e){return D&&D.current&&!(D.current.isSameNode(e)||D.current.contains(e))},le=function(e){if(e.tagKey===O.tagKey){var t=P!==e.visible;Z("target")!==e.target&&!O.target?(re(),K.current=e,k(!0)):t&&(K.current=e,e.visible?ne():re())}};e.useEffect((function(){O.visible?ne():re()}),[O.visible]),e.useEffect((function(){return O.target||O.message||s.on("confirm-popup",le),function(){s.off("confirm-popup",le)}}),[O.target]),a((function(){C&&ne()}),[C]),l((function(){J.current&&(s.off("overlay-click",J.current),J.current=null),s.off("confirm-popup",le),v.clear(D.current)})),e.useImperativeHandle(h,(function(){return{props:O,confirm:le}}));var se,fe,me,be,de,ve,ye,ge,je,he,Ee=function(){var t=m("p-confirm-popup-accept p-button-sm",Z("acceptClassName")),n=m("p-confirm-popup-reject p-button-sm",{"p-button-text":!Z("rejectClassName")},Z("rejectClassName")),r=y({className:B("footer")},V("footer")),c=y({label:q,icon:Z("rejectIcon"),className:B("rejectButton",{getPropValue:Z}),onClick:te,pt:V("rejectButton"),unstyled:O.unstyled,__parentMetadata:{parent:L}}),i=y({ref:M,label:$,icon:Z("acceptIcon"),className:B("acceptButton",{getPropValue:Z}),onClick:ee,pt:V("acceptButton"),unstyled:O.unstyled,__parentMetadata:{parent:L}}),u=e.createElement("div",r,e.createElement(o,c),e.createElement(o,i));if(Z("footer")){var p={accept:ee,reject:te,className:"p-confirm-popup-footer",acceptClassName:t,rejectClassName:n,acceptLabel:$,rejectLabel:q,element:u,props:z()};return d.getJSXElement(Z("footer"),p)}return u},Oe=(se=z(),fe=d.getJSXElement(Z("message"),se),me=y({className:B("icon")},V("icon")),be=g.getJSXIcon(Z("icon"),A({},me),{props:se}),de=y({className:B("message")},V("message")),ve=y({className:B("content")},V("content")),ye=e.createElement("div",ve,be,e.createElement("span",de,fe)),ge=Ee(),je=y({ref:D,id:Z("id"),className:B("root",{context:E,getPropValue:Z}),style:Z("style"),onClick:W},I.getOtherProps(O),V("root")),he=y({classNames:B("transition"),in:P,timeout:{enter:120,exit:100},options:Z("transitionOptions"),unmountOnExit:!0,onEnter:oe,onEntered:ce,onExit:ie,onExited:ue},V("transition")),e.createElement(u,j({nodeRef:D},he),e.createElement("div",je,ye,ge)));return e.createElement(f,{element:Oe,appendTo:Z("appendTo"),visible:Z("visible")})})));V.displayName="ConfirmPopup";export{V as ConfirmPopup,T as confirmPopup};
|