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
package/steps/steps.esm.js
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { PrimeReactContext } from 'primereact/api';
|
|
5
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
6
|
-
import { useMountEffect } from 'primereact/hooks';
|
|
7
|
-
import { classNames, UniqueComponentId, mergeProps, IconUtils, ObjectUtils } from 'primereact/utils';
|
|
8
|
-
|
|
9
|
-
function _typeof(o) {
|
|
10
|
-
"@babel/helpers - typeof";
|
|
11
|
-
|
|
12
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
13
|
-
return typeof o;
|
|
14
|
-
} : function (o) {
|
|
15
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
16
|
-
}, _typeof(o);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function _toPrimitive(input, hint) {
|
|
20
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
21
|
-
var prim = input[Symbol.toPrimitive];
|
|
22
|
-
if (prim !== undefined) {
|
|
23
|
-
var res = prim.call(input, hint || "default");
|
|
24
|
-
if (_typeof(res) !== "object") return res;
|
|
25
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
26
|
-
}
|
|
27
|
-
return (hint === "string" ? String : Number)(input);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function _toPropertyKey(arg) {
|
|
31
|
-
var key = _toPrimitive(arg, "string");
|
|
32
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function _defineProperty(obj, key, value) {
|
|
36
|
-
key = _toPropertyKey(key);
|
|
37
|
-
if (key in obj) {
|
|
38
|
-
Object.defineProperty(obj, key, {
|
|
39
|
-
value: value,
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true
|
|
43
|
-
});
|
|
44
|
-
} else {
|
|
45
|
-
obj[key] = value;
|
|
46
|
-
}
|
|
47
|
-
return obj;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _arrayWithHoles(arr) {
|
|
51
|
-
if (Array.isArray(arr)) return arr;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _iterableToArrayLimit(r, l) {
|
|
55
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
56
|
-
if (null != t) {
|
|
57
|
-
var e,
|
|
58
|
-
n,
|
|
59
|
-
i,
|
|
60
|
-
u,
|
|
61
|
-
a = [],
|
|
62
|
-
f = !0,
|
|
63
|
-
o = !1;
|
|
64
|
-
try {
|
|
65
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
66
|
-
if (Object(t) !== t) return;
|
|
67
|
-
f = !1;
|
|
68
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
69
|
-
} catch (r) {
|
|
70
|
-
o = !0, n = r;
|
|
71
|
-
} finally {
|
|
72
|
-
try {
|
|
73
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
74
|
-
} finally {
|
|
75
|
-
if (o) throw n;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return a;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _arrayLikeToArray(arr, len) {
|
|
83
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
84
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
85
|
-
return arr2;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
89
|
-
if (!o) return;
|
|
90
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
91
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
92
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
93
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
94
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function _nonIterableRest() {
|
|
98
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function _slicedToArray(arr, i) {
|
|
102
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
var classes = {
|
|
106
|
-
icon: function icon(_ref) {
|
|
107
|
-
var item = _ref.item;
|
|
108
|
-
return classNames('p-menuitem-icon', item.icon);
|
|
109
|
-
},
|
|
110
|
-
label: 'p-steps-title',
|
|
111
|
-
step: 'p-steps-number',
|
|
112
|
-
action: 'p-menuitem-link',
|
|
113
|
-
menuitem: function menuitem(_ref2) {
|
|
114
|
-
var active = _ref2.active,
|
|
115
|
-
disabled = _ref2.disabled,
|
|
116
|
-
item = _ref2.item;
|
|
117
|
-
return classNames('p-steps-item', item.className, {
|
|
118
|
-
'p-highlight p-steps-current': active,
|
|
119
|
-
'p-disabled': disabled
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
root: function root(_ref3) {
|
|
123
|
-
var props = _ref3.props;
|
|
124
|
-
return classNames('p-steps p-component', {
|
|
125
|
-
'p-readonly': props.readOnly
|
|
126
|
-
}, props.className);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
var styles = "\n@layer primereact {\n .p-steps {\n position: relative;\n }\n \n .p-steps ul {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: flex;\n }\n \n .p-steps-item {\n position: relative;\n display: flex;\n justify-content: center;\n flex: 1 1 auto;\n }\n \n .p-steps-item .p-menuitem-link {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n text-decoration: none;\n }\n \n .p-steps.p-readonly .p-steps-item {\n cursor: auto;\n }\n \n .p-steps-item.p-steps-current .p-menuitem-link {\n cursor: default;\n }\n \n .p-steps-title {\n white-space: nowrap;\n }\n \n .p-steps-number {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .p-steps-title {\n display: block;\n }\n}\n";
|
|
130
|
-
var StepsBase = ComponentBase.extend({
|
|
131
|
-
defaultProps: {
|
|
132
|
-
__TYPE: 'Steps',
|
|
133
|
-
id: null,
|
|
134
|
-
model: null,
|
|
135
|
-
activeIndex: 0,
|
|
136
|
-
readOnly: true,
|
|
137
|
-
style: null,
|
|
138
|
-
className: null,
|
|
139
|
-
onSelect: null,
|
|
140
|
-
children: undefined
|
|
141
|
-
},
|
|
142
|
-
css: {
|
|
143
|
-
classes: classes,
|
|
144
|
-
styles: styles
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
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; }
|
|
149
|
-
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; }
|
|
150
|
-
var Steps = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
151
|
-
var context = React.useContext(PrimeReactContext);
|
|
152
|
-
var props = StepsBase.getProps(inProps, context);
|
|
153
|
-
var _React$useState = React.useState(props.id),
|
|
154
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
155
|
-
idState = _React$useState2[0],
|
|
156
|
-
setIdState = _React$useState2[1];
|
|
157
|
-
var elementRef = React.useRef(null);
|
|
158
|
-
var _StepsBase$setMetaDat = StepsBase.setMetaData({
|
|
159
|
-
props: props,
|
|
160
|
-
state: {
|
|
161
|
-
id: idState
|
|
162
|
-
}
|
|
163
|
-
}),
|
|
164
|
-
ptm = _StepsBase$setMetaDat.ptm,
|
|
165
|
-
cx = _StepsBase$setMetaDat.cx,
|
|
166
|
-
isUnstyled = _StepsBase$setMetaDat.isUnstyled;
|
|
167
|
-
useHandleStyle(StepsBase.css.styles, isUnstyled, {
|
|
168
|
-
name: 'steps'
|
|
169
|
-
});
|
|
170
|
-
var itemClick = function itemClick(event, item, index) {
|
|
171
|
-
if (props.readOnly || item.disabled) {
|
|
172
|
-
event.preventDefault();
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
if (props.onSelect) {
|
|
176
|
-
props.onSelect({
|
|
177
|
-
originalEvent: event,
|
|
178
|
-
item: item,
|
|
179
|
-
index: index
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
if (!item.url) {
|
|
183
|
-
event.preventDefault();
|
|
184
|
-
}
|
|
185
|
-
if (item.command) {
|
|
186
|
-
item.command({
|
|
187
|
-
originalEvent: event,
|
|
188
|
-
item: item,
|
|
189
|
-
index: index
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
var createItem = function createItem(item, index) {
|
|
194
|
-
if (item.visible === false) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
var key = item.id || idState + '_' + index;
|
|
198
|
-
var active = index === props.activeIndex;
|
|
199
|
-
var disabled = item.disabled || index !== props.activeIndex && props.readOnly;
|
|
200
|
-
var tabIndex = disabled ? -1 : '';
|
|
201
|
-
var iconClassName = classNames('p-menuitem-icon', item.icon);
|
|
202
|
-
var iconProps = mergeProps({
|
|
203
|
-
className: cx('icon', {
|
|
204
|
-
item: item
|
|
205
|
-
})
|
|
206
|
-
}, ptm('icon'));
|
|
207
|
-
var icon = IconUtils.getJSXIcon(item.icon, _objectSpread({}, iconProps), {
|
|
208
|
-
props: props
|
|
209
|
-
});
|
|
210
|
-
var labelProps = mergeProps({
|
|
211
|
-
className: cx('label')
|
|
212
|
-
}, ptm('label'));
|
|
213
|
-
var label = item.label && /*#__PURE__*/React.createElement("span", labelProps, item.label);
|
|
214
|
-
var stepProps = mergeProps({
|
|
215
|
-
className: cx('step')
|
|
216
|
-
}, ptm('step'));
|
|
217
|
-
var actionProps = mergeProps({
|
|
218
|
-
href: item.url || '#',
|
|
219
|
-
className: cx('action'),
|
|
220
|
-
role: 'presentation',
|
|
221
|
-
target: item.target,
|
|
222
|
-
onClick: function onClick(event) {
|
|
223
|
-
return itemClick(event, item, index);
|
|
224
|
-
},
|
|
225
|
-
tabIndex: tabIndex
|
|
226
|
-
}, ptm('action'));
|
|
227
|
-
var content = /*#__PURE__*/React.createElement("a", actionProps, /*#__PURE__*/React.createElement("span", stepProps, index + 1), icon, label);
|
|
228
|
-
if (item.template) {
|
|
229
|
-
var defaultContentOptions = {
|
|
230
|
-
onClick: function onClick(event) {
|
|
231
|
-
return itemClick(event, item, index);
|
|
232
|
-
},
|
|
233
|
-
className: 'p-menuitem-link',
|
|
234
|
-
labelClassName: 'p-steps-title',
|
|
235
|
-
numberClassName: 'p-steps-number',
|
|
236
|
-
iconClassName: iconClassName,
|
|
237
|
-
element: content,
|
|
238
|
-
props: props,
|
|
239
|
-
tabIndex: tabIndex,
|
|
240
|
-
active: active,
|
|
241
|
-
disabled: disabled
|
|
242
|
-
};
|
|
243
|
-
content = ObjectUtils.getJSXElement(item.template, item, defaultContentOptions);
|
|
244
|
-
}
|
|
245
|
-
var menuItemProps = mergeProps({
|
|
246
|
-
key: key,
|
|
247
|
-
id: key,
|
|
248
|
-
className: cx('menuitem', {
|
|
249
|
-
active: active,
|
|
250
|
-
disabled: disabled,
|
|
251
|
-
item: item
|
|
252
|
-
}),
|
|
253
|
-
style: item.style,
|
|
254
|
-
role: 'tab',
|
|
255
|
-
'aria-selected': active,
|
|
256
|
-
'aria-expanded': active
|
|
257
|
-
}, ptm('menuitem'));
|
|
258
|
-
return /*#__PURE__*/React.createElement("li", menuItemProps, content);
|
|
259
|
-
};
|
|
260
|
-
var createItems = function createItems() {
|
|
261
|
-
var menuProps = mergeProps({
|
|
262
|
-
role: 'tablist'
|
|
263
|
-
}, ptm('menu'));
|
|
264
|
-
if (props.model) {
|
|
265
|
-
var _items = props.model.map(createItem);
|
|
266
|
-
return /*#__PURE__*/React.createElement("ul", menuProps, _items);
|
|
267
|
-
}
|
|
268
|
-
return null;
|
|
269
|
-
};
|
|
270
|
-
useMountEffect(function () {
|
|
271
|
-
if (!idState) {
|
|
272
|
-
setIdState(UniqueComponentId());
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
React.useImperativeHandle(ref, function () {
|
|
276
|
-
return {
|
|
277
|
-
props: props,
|
|
278
|
-
getElement: function getElement() {
|
|
279
|
-
return elementRef.current;
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
});
|
|
283
|
-
var rootProps = mergeProps({
|
|
284
|
-
id: props.id,
|
|
285
|
-
ref: elementRef,
|
|
286
|
-
className: cx('root'),
|
|
287
|
-
style: props.style
|
|
288
|
-
}, StepsBase.getOtherProps(props), ptm('root'));
|
|
289
|
-
var items = createItems();
|
|
290
|
-
return /*#__PURE__*/React.createElement("div", rootProps, items);
|
|
291
|
-
}));
|
|
292
|
-
Steps.displayName = 'Steps';
|
|
293
|
-
|
|
294
|
-
export { Steps };
|
package/steps/steps.esm.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{PrimeReactContext as t}from"primereact/api";import{ComponentBase as n,useHandleStyle as r}from"primereact/componentbase";import{useMountEffect as i}from"primereact/hooks";import{classNames as l,UniqueComponentId as o,mergeProps as a,IconUtils as s,ObjectUtils as c}from"primereact/utils";function p(e){return p="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},p(e)}function u(e,t){if("object"!==p(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function m(e){var t=u(e,"string");return"symbol"===p(t)?t:String(t)}function f(e){if(Array.isArray(e))return e}function d(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,l,o,a=[],s=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function y(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 b(e,t){if(e){if("string"==typeof e)return y(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)?y(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.")}var g=n.extend({defaultProps:{__TYPE:"Steps",id:null,model:null,activeIndex:0,readOnly:!0,style:null,className:null,onSelect:null,children:void 0},css:{classes:{icon:function(e){return l("p-menuitem-icon",e.item.icon)},label:"p-steps-title",step:"p-steps-number",action:"p-menuitem-link",menuitem:function(e){return l("p-steps-item",e.item.className,{"p-highlight p-steps-current":e.active,"p-disabled":e.disabled})},root:function(e){var t=e.props;return l("p-steps p-component",{"p-readonly":t.readOnly},t.className)}},styles:"\n@layer primereact {\n .p-steps {\n position: relative;\n }\n \n .p-steps ul {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: flex;\n }\n \n .p-steps-item {\n position: relative;\n display: flex;\n justify-content: center;\n flex: 1 1 auto;\n }\n \n .p-steps-item .p-menuitem-link {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n text-decoration: none;\n }\n \n .p-steps.p-readonly .p-steps-item {\n cursor: auto;\n }\n \n .p-steps-item.p-steps-current .p-menuitem-link {\n cursor: default;\n }\n \n .p-steps-title {\n white-space: nowrap;\n }\n \n .p-steps-number {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .p-steps-title {\n display: block;\n }\n}\n"}});function O(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){var r,i,l;r=e,l=n[t],(i=m(i=t))in r?Object.defineProperty(r,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):r[i]=l})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var S=e.memo(e.forwardRef((function(n,p){var u,m,y=e.useContext(t),O=g.getProps(n,y),S=e.useState(O.id),j=(m=2,f(u=S)||d(u,m)||b(u,m)||v()),x=j[0],w=j[1],E=e.useRef(null),N=g.setMetaData({props:O,state:{id:x}}),P=N.ptm,k=N.cx;r(g.css.styles,N.isUnstyled,{name:"steps"});var I=function(e,t,n){O.readOnly||t.disabled?e.preventDefault():(O.onSelect&&O.onSelect({originalEvent:e,item:t,index:n}),t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t,index:n}))},C=function(t,n){if(!1===t.visible)return null;var r=t.id||x+"_"+n,i=n===O.activeIndex,o=t.disabled||n!==O.activeIndex&&O.readOnly,p=o?-1:"",u=l("p-menuitem-icon",t.icon),m=a({className:k("icon",{item:t})},P("icon")),f=s.getJSXIcon(t.icon,h({},m),{props:O}),d=a({className:k("label")},P("label")),y=t.label&&e.createElement("span",d,t.label),b=a({className:k("step")},P("step")),v=a({href:t.url||"#",className:k("action"),role:"presentation",target:t.target,onClick:function(e){return I(e,t,n)},tabIndex:p},P("action")),g=e.createElement("a",v,e.createElement("span",b,n+1),f,y);t.template&&(g=c.getJSXElement(t.template,t,{onClick:function(e){return I(e,t,n)},className:"p-menuitem-link",labelClassName:"p-steps-title",numberClassName:"p-steps-number",iconClassName:u,element:g,props:O,tabIndex:p,active:i,disabled:o}));var S=a({key:r,id:r,className:k("menuitem",{active:i,disabled:o,item:t}),style:t.style,role:"tab","aria-selected":i,"aria-expanded":i},P("menuitem"));return e.createElement("li",S,g)};i((function(){x||w(o())})),e.useImperativeHandle(p,(function(){return{props:O,getElement:function(){return E.current}}}));var D=a({id:O.id,ref:E,className:k("root"),style:O.style},g.getOtherProps(O),P("root")),A=function(){var t=a({role:"tablist"},P("menu"));if(O.model){var n=O.model.map(C);return e.createElement("ul",t,n)}return null}();return e.createElement("div",D,A)})));S.displayName="Steps";export{S as Steps};
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { useEventListener, useMountEffect, useUpdateEffect, useUnmountEffect } from 'primereact/hooks';
|
|
5
|
-
import { ObjectUtils, DomHandler } from 'primereact/utils';
|
|
6
|
-
import { PrimeReactContext } from 'primereact/api';
|
|
7
|
-
|
|
8
|
-
function _arrayWithHoles(arr) {
|
|
9
|
-
if (Array.isArray(arr)) return arr;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function _iterableToArrayLimit(r, l) {
|
|
13
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
14
|
-
if (null != t) {
|
|
15
|
-
var e,
|
|
16
|
-
n,
|
|
17
|
-
i,
|
|
18
|
-
u,
|
|
19
|
-
a = [],
|
|
20
|
-
f = !0,
|
|
21
|
-
o = !1;
|
|
22
|
-
try {
|
|
23
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
24
|
-
if (Object(t) !== t) return;
|
|
25
|
-
f = !1;
|
|
26
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
27
|
-
} catch (r) {
|
|
28
|
-
o = !0, n = r;
|
|
29
|
-
} finally {
|
|
30
|
-
try {
|
|
31
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
32
|
-
} finally {
|
|
33
|
-
if (o) throw n;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return a;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _arrayLikeToArray(arr, len) {
|
|
41
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
42
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
43
|
-
return arr2;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
47
|
-
if (!o) return;
|
|
48
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
49
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
50
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
51
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
52
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function _nonIterableRest() {
|
|
56
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _slicedToArray(arr, i) {
|
|
60
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
var StyleClassBase = {
|
|
64
|
-
defaultProps: {
|
|
65
|
-
__TYPE: 'StyleClass',
|
|
66
|
-
nodeRef: null,
|
|
67
|
-
selector: null,
|
|
68
|
-
enterClassName: null,
|
|
69
|
-
enterActiveClassName: null,
|
|
70
|
-
enterToClassName: null,
|
|
71
|
-
leaveClassName: null,
|
|
72
|
-
leaveActiveClassName: null,
|
|
73
|
-
leaveToClassName: null,
|
|
74
|
-
hideOnOutsideClick: false,
|
|
75
|
-
toggleClassName: null,
|
|
76
|
-
children: undefined
|
|
77
|
-
},
|
|
78
|
-
getProps: function getProps(props) {
|
|
79
|
-
return ObjectUtils.getMergedProps(props, StyleClassBase.defaultProps);
|
|
80
|
-
},
|
|
81
|
-
getOtherProps: function getOtherProps(props) {
|
|
82
|
-
return ObjectUtils.getDiffProps(props, StyleClassBase.defaultProps);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
var StyleClass = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
87
|
-
var context = React.useContext(PrimeReactContext);
|
|
88
|
-
var props = StyleClassBase.getProps(inProps, context);
|
|
89
|
-
var targetRef = React.useRef(null);
|
|
90
|
-
var animating = React.useRef(false);
|
|
91
|
-
var elementRef = React.useRef(null);
|
|
92
|
-
var _useEventListener = useEventListener({
|
|
93
|
-
type: 'animationend',
|
|
94
|
-
listener: function listener() {
|
|
95
|
-
DomHandler.removeClass(targetRef.current, props.enterActiveClassName);
|
|
96
|
-
if (props.enterToClassName) {
|
|
97
|
-
DomHandler.addClass(targetRef.current, props.enterToClassName);
|
|
98
|
-
}
|
|
99
|
-
unbindTargetEnterListener();
|
|
100
|
-
if (props.enterActiveClassName === 'slidedown') {
|
|
101
|
-
targetRef.current.style.maxHeight = '';
|
|
102
|
-
}
|
|
103
|
-
animating.current = false;
|
|
104
|
-
}
|
|
105
|
-
}),
|
|
106
|
-
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
107
|
-
bindTargetEnterListener = _useEventListener2[0],
|
|
108
|
-
unbindTargetEnterListener = _useEventListener2[1];
|
|
109
|
-
var _useEventListener3 = useEventListener({
|
|
110
|
-
type: 'animationend',
|
|
111
|
-
listener: function listener() {
|
|
112
|
-
DomHandler.removeClass(targetRef.current, props.leaveActiveClassName);
|
|
113
|
-
if (props.leaveToClassName) {
|
|
114
|
-
DomHandler.addClass(targetRef.current, props.leaveToClassName);
|
|
115
|
-
}
|
|
116
|
-
unbindTargetLeaveListener();
|
|
117
|
-
animating.current = false;
|
|
118
|
-
}
|
|
119
|
-
}),
|
|
120
|
-
_useEventListener4 = _slicedToArray(_useEventListener3, 2),
|
|
121
|
-
bindTargetLeaveListener = _useEventListener4[0],
|
|
122
|
-
unbindTargetLeaveListener = _useEventListener4[1];
|
|
123
|
-
var _useEventListener5 = useEventListener({
|
|
124
|
-
type: 'click',
|
|
125
|
-
listener: function listener(event) {
|
|
126
|
-
if (!isVisible(targetRef.current) || getComputedStyle(targetRef.current).getPropertyValue('position') === 'static') {
|
|
127
|
-
unbindDocumentClickListener();
|
|
128
|
-
} else if (isOutsideClick(event)) {
|
|
129
|
-
leave();
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
when: props.hideOnOutsideClick
|
|
133
|
-
}),
|
|
134
|
-
_useEventListener6 = _slicedToArray(_useEventListener5, 2),
|
|
135
|
-
bindDocumentClickListener = _useEventListener6[0],
|
|
136
|
-
unbindDocumentClickListener = _useEventListener6[1];
|
|
137
|
-
var _useEventListener7 = useEventListener({
|
|
138
|
-
type: 'click',
|
|
139
|
-
listener: function listener() {
|
|
140
|
-
targetRef.current = resolveTarget();
|
|
141
|
-
if (props.toggleClassName) {
|
|
142
|
-
if (DomHandler.hasClass(targetRef.current, props.toggleClassName)) DomHandler.removeClass(targetRef.current, props.toggleClassName);else DomHandler.addClass(targetRef.current, props.toggleClassName);
|
|
143
|
-
} else {
|
|
144
|
-
DomHandler.isVisible(targetRef.current) ? leave() : enter();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}),
|
|
148
|
-
_useEventListener8 = _slicedToArray(_useEventListener7, 2),
|
|
149
|
-
bindClickListener = _useEventListener8[0],
|
|
150
|
-
unbindClickListener = _useEventListener8[1];
|
|
151
|
-
var enter = function enter() {
|
|
152
|
-
if (props.enterActiveClassName) {
|
|
153
|
-
if (!animating.current) {
|
|
154
|
-
animating.current = true;
|
|
155
|
-
if (props.enterActiveClassName === 'slidedown') {
|
|
156
|
-
targetRef.current.style.height = '0px';
|
|
157
|
-
DomHandler.removeClass(targetRef.current, 'hidden');
|
|
158
|
-
targetRef.current.style.maxHeight = targetRef.current.scrollHeight + 'px';
|
|
159
|
-
DomHandler.addClass(targetRef.current, 'hidden');
|
|
160
|
-
targetRef.current.style.height = '';
|
|
161
|
-
}
|
|
162
|
-
DomHandler.addClass(targetRef.current, props.enterActiveClassName);
|
|
163
|
-
if (props.enterClassName) {
|
|
164
|
-
DomHandler.removeClass(targetRef.current, props.enterClassName);
|
|
165
|
-
}
|
|
166
|
-
bindTargetEnterListener({
|
|
167
|
-
target: targetRef.current
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
} else {
|
|
171
|
-
if (props.enterClassName) {
|
|
172
|
-
DomHandler.removeClass(targetRef.current, props.enterClassName);
|
|
173
|
-
}
|
|
174
|
-
if (props.enterToClassName) {
|
|
175
|
-
DomHandler.addClass(targetRef.current, props.enterToClassName);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
bindDocumentClickListener({
|
|
179
|
-
target: elementRef.current && elementRef.current.ownerDocument
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
var leave = function leave() {
|
|
183
|
-
if (props.leaveActiveClassName) {
|
|
184
|
-
if (!animating.current) {
|
|
185
|
-
animating.current = true;
|
|
186
|
-
DomHandler.addClass(targetRef.current, props.leaveActiveClassName);
|
|
187
|
-
if (props.leaveClassName) {
|
|
188
|
-
DomHandler.removeClass(targetRef.current, props.leaveClassName);
|
|
189
|
-
}
|
|
190
|
-
bindTargetLeaveListener({
|
|
191
|
-
target: targetRef.current
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
if (props.leaveClassName) {
|
|
196
|
-
DomHandler.removeClass(targetRef.current, props.leaveClassName);
|
|
197
|
-
}
|
|
198
|
-
if (props.leaveToClassName) {
|
|
199
|
-
DomHandler.addClass(targetRef.current, props.leaveToClassName);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (props.hideOnOutsideClick) {
|
|
203
|
-
unbindDocumentClickListener();
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
var resolveTarget = function resolveTarget() {
|
|
207
|
-
if (targetRef.current) {
|
|
208
|
-
return targetRef.current;
|
|
209
|
-
}
|
|
210
|
-
switch (props.selector) {
|
|
211
|
-
case '@next':
|
|
212
|
-
return elementRef.current && elementRef.current.nextElementSibling;
|
|
213
|
-
case '@prev':
|
|
214
|
-
return elementRef.current && elementRef.current.previousElementSibling;
|
|
215
|
-
case '@parent':
|
|
216
|
-
return elementRef.current && elementRef.current.parentElement;
|
|
217
|
-
case '@grandparent':
|
|
218
|
-
return elementRef.current && elementRef.current.parentElement.parentElement;
|
|
219
|
-
default:
|
|
220
|
-
return document.querySelector(props.selector);
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
var init = function init() {
|
|
224
|
-
Promise.resolve().then(function () {
|
|
225
|
-
elementRef.current = ObjectUtils.getRefElement(props.nodeRef);
|
|
226
|
-
bindClickListener({
|
|
227
|
-
target: elementRef.current
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
var destroy = function destroy() {
|
|
232
|
-
unbindClickListener();
|
|
233
|
-
unbindDocumentClickListener();
|
|
234
|
-
targetRef.current = null;
|
|
235
|
-
};
|
|
236
|
-
var isVisible = function isVisible(target) {
|
|
237
|
-
return target && target.offsetParent !== null;
|
|
238
|
-
};
|
|
239
|
-
var isOutsideClick = function isOutsideClick(event) {
|
|
240
|
-
return !elementRef.current.isSameNode(event.target) && !elementRef.current.contains(event.target) && !targetRef.current.contains(event.target);
|
|
241
|
-
};
|
|
242
|
-
React.useImperativeHandle(ref, function () {
|
|
243
|
-
return {
|
|
244
|
-
props: props,
|
|
245
|
-
getElement: function getElement() {
|
|
246
|
-
return elementRef.current;
|
|
247
|
-
},
|
|
248
|
-
getTarget: function getTarget() {
|
|
249
|
-
return targetRef.current;
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
});
|
|
253
|
-
useMountEffect(function () {
|
|
254
|
-
init();
|
|
255
|
-
});
|
|
256
|
-
useUpdateEffect(function () {
|
|
257
|
-
init();
|
|
258
|
-
return function () {
|
|
259
|
-
unbindClickListener();
|
|
260
|
-
};
|
|
261
|
-
});
|
|
262
|
-
useUnmountEffect(function () {
|
|
263
|
-
destroy();
|
|
264
|
-
});
|
|
265
|
-
return props.children;
|
|
266
|
-
});
|
|
267
|
-
StyleClass.displayName = 'StyleClass';
|
|
268
|
-
|
|
269
|
-
export { StyleClass };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{useEventListener as r,useMountEffect as t,useUpdateEffect as n,useUnmountEffect as a}from"primereact/hooks";import{ObjectUtils as l,DomHandler as s}from"primereact/utils";import{PrimeReactContext as u}from"primereact/api";function c(e){if(Array.isArray(e))return e}function o(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,a,l,s,u=[],c=!0,o=!1;try{if(l=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=l.call(t)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(e){o=!0,a=e}finally{try{if(!c&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(o)throw a}}return u}}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function m(e,r){if(e){if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,r):void 0}}function f(){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 C(e,r){return c(e)||o(e,r)||m(e,r)||f()}var d={defaultProps:{__TYPE:"StyleClass",nodeRef:null,selector:null,enterClassName:null,enterActiveClassName:null,enterToClassName:null,leaveClassName:null,leaveActiveClassName:null,leaveToClassName:null,hideOnOutsideClick:!1,toggleClassName:null,children:void 0},getProps:function(e){return l.getMergedProps(e,d.defaultProps)},getOtherProps:function(e){return l.getDiffProps(e,d.defaultProps)}},v=e.forwardRef((function(c,o){var i=e.useContext(u),m=d.getProps(c,i),f=e.useRef(null),v=e.useRef(!1),p=e.useRef(null),g=C(r({type:"animationend",listener:function(){s.removeClass(f.current,m.enterActiveClassName),m.enterToClassName&&s.addClass(f.current,m.enterToClassName),y(),"slidedown"===m.enterActiveClassName&&(f.current.style.maxHeight=""),v.current=!1}}),2),N=g[0],y=g[1],h=C(r({type:"animationend",listener:function(){s.removeClass(f.current,m.leaveActiveClassName),m.leaveToClassName&&s.addClass(f.current,m.leaveToClassName),b(),v.current=!1}}),2),A=h[0],b=h[1],T=C(r({type:"click",listener:function(e){H(f.current)&&"static"!==getComputedStyle(f.current).getPropertyValue("position")?I(e)&&R():S()},when:m.hideOnOutsideClick}),2),P=T[0],S=T[1],O=C(r({type:"click",listener:function(){f.current=k(),m.toggleClassName?s.hasClass(f.current,m.toggleClassName)?s.removeClass(f.current,m.toggleClassName):s.addClass(f.current,m.toggleClassName):s.isVisible(f.current)?R():E()}}),2),w=O[0],x=O[1],E=function(){m.enterActiveClassName?v.current||(v.current=!0,"slidedown"===m.enterActiveClassName&&(f.current.style.height="0px",s.removeClass(f.current,"hidden"),f.current.style.maxHeight=f.current.scrollHeight+"px",s.addClass(f.current,"hidden"),f.current.style.height=""),s.addClass(f.current,m.enterActiveClassName),m.enterClassName&&s.removeClass(f.current,m.enterClassName),N({target:f.current})):(m.enterClassName&&s.removeClass(f.current,m.enterClassName),m.enterToClassName&&s.addClass(f.current,m.enterToClassName)),P({target:p.current&&p.current.ownerDocument})},R=function(){m.leaveActiveClassName?v.current||(v.current=!0,s.addClass(f.current,m.leaveActiveClassName),m.leaveClassName&&s.removeClass(f.current,m.leaveClassName),A({target:f.current})):(m.leaveClassName&&s.removeClass(f.current,m.leaveClassName),m.leaveToClassName&&s.addClass(f.current,m.leaveToClassName)),m.hideOnOutsideClick&&S()},k=function(){if(f.current)return f.current;switch(m.selector){case"@next":return p.current&&p.current.nextElementSibling;case"@prev":return p.current&&p.current.previousElementSibling;case"@parent":return p.current&&p.current.parentElement;case"@grandparent":return p.current&&p.current.parentElement.parentElement;default:return document.querySelector(m.selector)}},j=function(){Promise.resolve().then((function(){p.current=l.getRefElement(m.nodeRef),w({target:p.current})}))},H=function(e){return e&&null!==e.offsetParent},I=function(e){return!p.current.isSameNode(e.target)&&!p.current.contains(e.target)&&!f.current.contains(e.target)};return e.useImperativeHandle(o,(function(){return{props:m,getElement:function(){return p.current},getTarget:function(){return f.current}}})),t((function(){j()})),n((function(){return j(),function(){x()}})),a((function(){x(),S(),f.current=null})),m.children}));v.displayName="StyleClass";export{v as StyleClass};
|