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,521 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { PrimeReactContext } from 'primereact/api';
|
|
5
|
-
import { Button } from 'primereact/button';
|
|
6
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
7
|
-
import { useEventListener, useMountEffect, useUpdateEffect } from 'primereact/hooks';
|
|
8
|
-
import { MinusIcon } from 'primereact/icons/minus';
|
|
9
|
-
import { PlusIcon } from 'primereact/icons/plus';
|
|
10
|
-
import { Ripple } from 'primereact/ripple';
|
|
11
|
-
import { classNames, DomHandler, mergeProps, IconUtils, ObjectUtils } 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 _typeof(o) {
|
|
29
|
-
"@babel/helpers - typeof";
|
|
30
|
-
|
|
31
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
32
|
-
return typeof o;
|
|
33
|
-
} : function (o) {
|
|
34
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
35
|
-
}, _typeof(o);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _toPrimitive(input, hint) {
|
|
39
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
40
|
-
var prim = input[Symbol.toPrimitive];
|
|
41
|
-
if (prim !== undefined) {
|
|
42
|
-
var res = prim.call(input, hint || "default");
|
|
43
|
-
if (_typeof(res) !== "object") return res;
|
|
44
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
45
|
-
}
|
|
46
|
-
return (hint === "string" ? String : Number)(input);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _toPropertyKey(arg) {
|
|
50
|
-
var key = _toPrimitive(arg, "string");
|
|
51
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _defineProperty(obj, key, value) {
|
|
55
|
-
key = _toPropertyKey(key);
|
|
56
|
-
if (key in obj) {
|
|
57
|
-
Object.defineProperty(obj, key, {
|
|
58
|
-
value: value,
|
|
59
|
-
enumerable: true,
|
|
60
|
-
configurable: true,
|
|
61
|
-
writable: true
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
obj[key] = value;
|
|
65
|
-
}
|
|
66
|
-
return obj;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function _arrayWithHoles(arr) {
|
|
70
|
-
if (Array.isArray(arr)) return arr;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function _iterableToArrayLimit(r, l) {
|
|
74
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
75
|
-
if (null != t) {
|
|
76
|
-
var e,
|
|
77
|
-
n,
|
|
78
|
-
i,
|
|
79
|
-
u,
|
|
80
|
-
a = [],
|
|
81
|
-
f = !0,
|
|
82
|
-
o = !1;
|
|
83
|
-
try {
|
|
84
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
85
|
-
if (Object(t) !== t) return;
|
|
86
|
-
f = !1;
|
|
87
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
88
|
-
} catch (r) {
|
|
89
|
-
o = !0, n = r;
|
|
90
|
-
} finally {
|
|
91
|
-
try {
|
|
92
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
93
|
-
} finally {
|
|
94
|
-
if (o) throw n;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return a;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function _arrayLikeToArray(arr, len) {
|
|
102
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
103
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
104
|
-
return arr2;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
108
|
-
if (!o) return;
|
|
109
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
110
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
111
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
112
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
113
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function _nonIterableRest() {
|
|
117
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function _slicedToArray(arr, i) {
|
|
121
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
var styles = "\n@layer primereact {\n .p-speeddial {\n position: absolute;\n display: flex;\n z-index: 1;\n }\n \n .p-speeddial-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: top 0s linear 0.2s;\n pointer-events: none;\n }\n \n .p-speeddial-item {\n transform: scale(0);\n opacity: 0;\n transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 0.8s;\n will-change: transform;\n }\n \n .p-speeddial-action {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n position: relative;\n overflow: hidden;\n text-decoration: none;\n }\n \n .p-speeddial-circle .p-speeddial-item,\n .p-speeddial-semi-circle .p-speeddial-item,\n .p-speeddial-quarter-circle .p-speeddial-item {\n position: absolute;\n }\n \n .p-speeddial-rotate {\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n will-change: transform;\n }\n \n .p-speeddial-mask {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: opacity 250ms cubic-bezier(0.25, 0.8, 0.25, 1);\n }\n \n .p-speeddial-mask-visible {\n pointer-events: none;\n opacity: 1;\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n }\n \n .p-speeddial-opened .p-speeddial-list {\n pointer-events: auto;\n }\n \n .p-speeddial-opened .p-speeddial-item {\n transform: scale(1);\n opacity: 1;\n }\n \n .p-speeddial-opened .p-speeddial-rotate {\n transform: rotate(45deg);\n }\n}\n";
|
|
125
|
-
var classes = {
|
|
126
|
-
root: function root(_ref) {
|
|
127
|
-
var _classNames;
|
|
128
|
-
var props = _ref.props,
|
|
129
|
-
visible = _ref.visible;
|
|
130
|
-
return classNames("p-speeddial p-component p-speeddial-".concat(props.type), (_classNames = {}, _defineProperty(_classNames, "p-speeddial-direction-".concat(props.direction), props.type !== 'circle'), _defineProperty(_classNames, 'p-speeddial-opened', visible), _defineProperty(_classNames, 'p-disabled', props.disabled), _classNames));
|
|
131
|
-
},
|
|
132
|
-
button: function button(_ref2) {
|
|
133
|
-
var props = _ref2.props;
|
|
134
|
-
return classNames('p-speeddial-button p-button-rounded', {
|
|
135
|
-
'p-speeddial-rotate': props.rotateAnimation && !props.hideIcon
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
mask: function mask(_ref3) {
|
|
139
|
-
var visible = _ref3.visible;
|
|
140
|
-
return classNames('p-speeddial-mask', {
|
|
141
|
-
'p-speeddial-mask-visible': visible
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
action: function action(_ref4) {
|
|
145
|
-
var disabled = _ref4.disabled;
|
|
146
|
-
return classNames('p-speeddial-action', {
|
|
147
|
-
'p-disabled': disabled
|
|
148
|
-
});
|
|
149
|
-
},
|
|
150
|
-
actionIcon: function actionIcon(_ref5) {
|
|
151
|
-
var _icon = _ref5._icon;
|
|
152
|
-
return classNames('p-speeddial-action-icon', _icon);
|
|
153
|
-
},
|
|
154
|
-
menu: 'p-speeddial-list',
|
|
155
|
-
menuitem: 'p-speeddial-item'
|
|
156
|
-
};
|
|
157
|
-
var inlineStyles = {
|
|
158
|
-
root: function root(_ref6) {
|
|
159
|
-
var props = _ref6.props;
|
|
160
|
-
return {
|
|
161
|
-
alignItems: props.direction === 'up' || props.direction === 'down' ? 'center' : '',
|
|
162
|
-
justifyContent: props.direction === 'left' || props.direction === 'right' ? 'center' : '',
|
|
163
|
-
flexDirection: props.direction === 'up' ? 'column-reverse' : props.direction === 'down' ? 'column' : props.direction === 'left' ? 'row-reverse' : props.direction === 'right' ? 'row' : null
|
|
164
|
-
};
|
|
165
|
-
},
|
|
166
|
-
menu: function menu(_ref7) {
|
|
167
|
-
var props = _ref7.props;
|
|
168
|
-
return {
|
|
169
|
-
flexDirection: props.direction === 'up' ? 'column-reverse' : props.direction === 'down' ? 'column' : props.direction === 'left' ? 'row-reverse' : props.direction === 'right' ? 'row' : null
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
var SpeedDialBase = ComponentBase.extend({
|
|
174
|
-
defaultProps: {
|
|
175
|
-
__TYPE: 'SpeedDial',
|
|
176
|
-
id: null,
|
|
177
|
-
model: null,
|
|
178
|
-
visible: false,
|
|
179
|
-
style: null,
|
|
180
|
-
className: null,
|
|
181
|
-
direction: 'up',
|
|
182
|
-
transitionDelay: 30,
|
|
183
|
-
type: 'linear',
|
|
184
|
-
radius: 0,
|
|
185
|
-
mask: false,
|
|
186
|
-
disabled: false,
|
|
187
|
-
hideOnClickOutside: true,
|
|
188
|
-
buttonStyle: null,
|
|
189
|
-
buttonClassName: null,
|
|
190
|
-
buttonTemplate: null,
|
|
191
|
-
'aria-label': null,
|
|
192
|
-
maskStyle: null,
|
|
193
|
-
maskClassName: null,
|
|
194
|
-
showIcon: null,
|
|
195
|
-
hideIcon: null,
|
|
196
|
-
rotateAnimation: true,
|
|
197
|
-
onVisibleChange: null,
|
|
198
|
-
onClick: null,
|
|
199
|
-
onShow: null,
|
|
200
|
-
onHide: null,
|
|
201
|
-
children: undefined
|
|
202
|
-
},
|
|
203
|
-
css: {
|
|
204
|
-
classes: classes,
|
|
205
|
-
styles: styles,
|
|
206
|
-
inlineStyles: inlineStyles
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
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; }
|
|
211
|
-
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; }
|
|
212
|
-
var SpeedDial = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
213
|
-
var _React$useState = React.useState(false),
|
|
214
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
215
|
-
visibleState = _React$useState2[0],
|
|
216
|
-
setVisibleState = _React$useState2[1];
|
|
217
|
-
var context = React.useContext(PrimeReactContext);
|
|
218
|
-
var props = SpeedDialBase.getProps(inProps, context);
|
|
219
|
-
var visible = props.onVisibleChange ? props.visible : visibleState;
|
|
220
|
-
var metaData = {
|
|
221
|
-
props: props,
|
|
222
|
-
state: {
|
|
223
|
-
visible: visible
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
var _SpeedDialBase$setMet = SpeedDialBase.setMetaData(metaData),
|
|
227
|
-
ptm = _SpeedDialBase$setMet.ptm,
|
|
228
|
-
cx = _SpeedDialBase$setMet.cx,
|
|
229
|
-
sx = _SpeedDialBase$setMet.sx,
|
|
230
|
-
isUnstyled = _SpeedDialBase$setMet.isUnstyled;
|
|
231
|
-
useHandleStyle(SpeedDialBase.css.styles, isUnstyled, {
|
|
232
|
-
name: 'speeddial'
|
|
233
|
-
});
|
|
234
|
-
var isItemClicked = React.useRef(false);
|
|
235
|
-
var elementRef = React.useRef(null);
|
|
236
|
-
var listRef = React.useRef(null);
|
|
237
|
-
var _useEventListener = useEventListener({
|
|
238
|
-
type: 'click',
|
|
239
|
-
listener: function listener(event) {
|
|
240
|
-
if (!isItemClicked.current && isOutsideClicked(event)) {
|
|
241
|
-
hide();
|
|
242
|
-
}
|
|
243
|
-
isItemClicked.current = false;
|
|
244
|
-
},
|
|
245
|
-
when: visibleState
|
|
246
|
-
}),
|
|
247
|
-
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
248
|
-
bindDocumentClickListener = _useEventListener2[0],
|
|
249
|
-
unbindDocumentClickListener = _useEventListener2[1];
|
|
250
|
-
var show = function show() {
|
|
251
|
-
props.onVisibleChange ? props.onVisibleChange(true) : setVisibleState(true);
|
|
252
|
-
props.onShow && props.onShow();
|
|
253
|
-
};
|
|
254
|
-
var hide = function hide() {
|
|
255
|
-
props.onVisibleChange ? props.onVisibleChange(false) : setVisibleState(false);
|
|
256
|
-
props.onHide && props.onHide();
|
|
257
|
-
};
|
|
258
|
-
var _onClick = function onClick(e) {
|
|
259
|
-
visible ? hide() : show();
|
|
260
|
-
props.onClick && props.onClick(e);
|
|
261
|
-
isItemClicked.current = true;
|
|
262
|
-
};
|
|
263
|
-
var onItemClick = function onItemClick(e, item) {
|
|
264
|
-
item.command && item.command({
|
|
265
|
-
originalEvent: e,
|
|
266
|
-
item: item
|
|
267
|
-
});
|
|
268
|
-
hide();
|
|
269
|
-
isItemClicked.current = true;
|
|
270
|
-
e.preventDefault();
|
|
271
|
-
};
|
|
272
|
-
var isOutsideClicked = function isOutsideClicked(event) {
|
|
273
|
-
return elementRef.current && !(elementRef.current.isSameNode(event.target) || elementRef.current.contains(event.target));
|
|
274
|
-
};
|
|
275
|
-
var calculateTransitionDelay = function calculateTransitionDelay(index) {
|
|
276
|
-
var length = props.model.length;
|
|
277
|
-
return (visible ? index : length - index - 1) * props.transitionDelay;
|
|
278
|
-
};
|
|
279
|
-
var calculatePointStyle = function calculatePointStyle(index) {
|
|
280
|
-
var type = props.type;
|
|
281
|
-
if (type !== 'linear') {
|
|
282
|
-
var length = props.model.length;
|
|
283
|
-
var radius = props.radius || length * 20;
|
|
284
|
-
if (type === 'circle') {
|
|
285
|
-
var step = 2 * Math.PI / length;
|
|
286
|
-
return {
|
|
287
|
-
left: "calc(".concat(radius * Math.cos(step * index), "px + var(--item-diff-x, 0px))"),
|
|
288
|
-
top: "calc(".concat(radius * Math.sin(step * index), "px + var(--item-diff-y, 0px))")
|
|
289
|
-
};
|
|
290
|
-
} else if (type === 'semi-circle') {
|
|
291
|
-
var direction = props.direction;
|
|
292
|
-
var _step = Math.PI / (length - 1);
|
|
293
|
-
var x = "calc(".concat(radius * Math.cos(_step * index), "px + var(--item-diff-x, 0px))");
|
|
294
|
-
var y = "calc(".concat(radius * Math.sin(_step * index), "px + var(--item-diff-y, 0px))");
|
|
295
|
-
if (direction === 'up') {
|
|
296
|
-
return {
|
|
297
|
-
left: x,
|
|
298
|
-
bottom: y
|
|
299
|
-
};
|
|
300
|
-
} else if (direction === 'down') {
|
|
301
|
-
return {
|
|
302
|
-
left: x,
|
|
303
|
-
top: y
|
|
304
|
-
};
|
|
305
|
-
} else if (direction === 'left') {
|
|
306
|
-
return {
|
|
307
|
-
right: y,
|
|
308
|
-
top: x
|
|
309
|
-
};
|
|
310
|
-
} else if (direction === 'right') {
|
|
311
|
-
return {
|
|
312
|
-
left: y,
|
|
313
|
-
top: x
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
} else if (type === 'quarter-circle') {
|
|
317
|
-
var _direction = props.direction;
|
|
318
|
-
var _step2 = Math.PI / (2 * (length - 1));
|
|
319
|
-
var _x = "calc(".concat(radius * Math.cos(_step2 * index), "px + var(--item-diff-x, 0px))");
|
|
320
|
-
var _y = "calc(".concat(radius * Math.sin(_step2 * index), "px + var(--item-diff-y, 0px))");
|
|
321
|
-
if (_direction === 'up-left') {
|
|
322
|
-
return {
|
|
323
|
-
right: _x,
|
|
324
|
-
bottom: _y
|
|
325
|
-
};
|
|
326
|
-
} else if (_direction === 'up-right') {
|
|
327
|
-
return {
|
|
328
|
-
left: _x,
|
|
329
|
-
bottom: _y
|
|
330
|
-
};
|
|
331
|
-
} else if (_direction === 'down-left') {
|
|
332
|
-
return {
|
|
333
|
-
right: _y,
|
|
334
|
-
top: _x
|
|
335
|
-
};
|
|
336
|
-
} else if (_direction === 'down-right') {
|
|
337
|
-
return {
|
|
338
|
-
left: _y,
|
|
339
|
-
top: _x
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return {};
|
|
345
|
-
};
|
|
346
|
-
var getItemStyle = function getItemStyle(index) {
|
|
347
|
-
var transitionDelay = calculateTransitionDelay(index);
|
|
348
|
-
var pointStyle = calculatePointStyle(index);
|
|
349
|
-
return _objectSpread({
|
|
350
|
-
transitionDelay: "".concat(transitionDelay, "ms")
|
|
351
|
-
}, pointStyle);
|
|
352
|
-
};
|
|
353
|
-
useMountEffect(function () {
|
|
354
|
-
if (props.type !== 'linear') {
|
|
355
|
-
var _button = DomHandler.findSingle(elementRef.current, '.p-speeddial-button');
|
|
356
|
-
var firstItem = DomHandler.findSingle(listRef.current, '.p-speeddial-item');
|
|
357
|
-
if (_button && firstItem) {
|
|
358
|
-
var wDiff = Math.abs(_button.offsetWidth - firstItem.offsetWidth);
|
|
359
|
-
var hDiff = Math.abs(_button.offsetHeight - firstItem.offsetHeight);
|
|
360
|
-
listRef.current.style.setProperty('--item-diff-x', "".concat(wDiff / 2, "px"));
|
|
361
|
-
listRef.current.style.setProperty('--item-diff-y', "".concat(hDiff / 2, "px"));
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
useUpdateEffect(function () {
|
|
366
|
-
if (visibleState) {
|
|
367
|
-
props.hideOnClickOutside && bindDocumentClickListener();
|
|
368
|
-
}
|
|
369
|
-
return function () {
|
|
370
|
-
props.hideOnClickOutside && unbindDocumentClickListener();
|
|
371
|
-
};
|
|
372
|
-
}, [visibleState]);
|
|
373
|
-
React.useImperativeHandle(ref, function () {
|
|
374
|
-
return {
|
|
375
|
-
props: props,
|
|
376
|
-
show: show,
|
|
377
|
-
hide: hide,
|
|
378
|
-
getElement: function getElement() {
|
|
379
|
-
return elementRef.current;
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
});
|
|
383
|
-
var createItem = function createItem(item, index) {
|
|
384
|
-
if (item.visible === false) {
|
|
385
|
-
return null;
|
|
386
|
-
}
|
|
387
|
-
var disabled = item.disabled,
|
|
388
|
-
_icon = item.icon,
|
|
389
|
-
label = item.label,
|
|
390
|
-
template = item.template,
|
|
391
|
-
url = item.url,
|
|
392
|
-
target = item.target;
|
|
393
|
-
var contentClassName = classNames('p-speeddial-action', {
|
|
394
|
-
'p-disabled': disabled
|
|
395
|
-
});
|
|
396
|
-
var iconClassName = classNames('p-speeddial-action-icon', _icon);
|
|
397
|
-
var actionIconProps = mergeProps({
|
|
398
|
-
className: cx('actionIcon')
|
|
399
|
-
}, ptm('actionIcon'));
|
|
400
|
-
var actionProps = mergeProps({
|
|
401
|
-
href: url || '#',
|
|
402
|
-
role: 'menuitem',
|
|
403
|
-
className: cx('action', {
|
|
404
|
-
disabled: disabled
|
|
405
|
-
}),
|
|
406
|
-
target: target,
|
|
407
|
-
'data-pr-tooltip': label,
|
|
408
|
-
onClick: function onClick(e) {
|
|
409
|
-
return onItemClick(e, item);
|
|
410
|
-
}
|
|
411
|
-
}, ptm('action'));
|
|
412
|
-
var icon = IconUtils.getJSXIcon(_icon, _objectSpread({}, actionIconProps), {
|
|
413
|
-
props: props
|
|
414
|
-
});
|
|
415
|
-
var content = /*#__PURE__*/React.createElement("a", actionProps, icon, /*#__PURE__*/React.createElement(Ripple, null));
|
|
416
|
-
if (template) {
|
|
417
|
-
var defaultContentOptions = {
|
|
418
|
-
onClick: function onClick(e) {
|
|
419
|
-
return onItemClick(e, item);
|
|
420
|
-
},
|
|
421
|
-
className: contentClassName,
|
|
422
|
-
iconClassName: iconClassName,
|
|
423
|
-
element: content,
|
|
424
|
-
props: props,
|
|
425
|
-
visible: visible
|
|
426
|
-
};
|
|
427
|
-
content = ObjectUtils.getJSXElement(template, item, defaultContentOptions);
|
|
428
|
-
}
|
|
429
|
-
var menuItemProps = mergeProps({
|
|
430
|
-
key: index,
|
|
431
|
-
className: cx('menuitem'),
|
|
432
|
-
style: getItemStyle(index),
|
|
433
|
-
role: 'none'
|
|
434
|
-
}, ptm('menuitem'));
|
|
435
|
-
return /*#__PURE__*/React.createElement("li", menuItemProps, content);
|
|
436
|
-
};
|
|
437
|
-
var createItems = function createItems() {
|
|
438
|
-
return props.model ? props.model.map(createItem) : null;
|
|
439
|
-
};
|
|
440
|
-
var createList = function createList() {
|
|
441
|
-
var items = createItems();
|
|
442
|
-
var menuProps = mergeProps({
|
|
443
|
-
ref: listRef,
|
|
444
|
-
className: cx('menu'),
|
|
445
|
-
style: sx('menu'),
|
|
446
|
-
role: 'menu'
|
|
447
|
-
}, ptm('menu'));
|
|
448
|
-
return /*#__PURE__*/React.createElement("ul", menuProps, items);
|
|
449
|
-
};
|
|
450
|
-
var createButton = function createButton() {
|
|
451
|
-
var _classNames;
|
|
452
|
-
var showIconVisible = !visible && !!props.showIcon || !props.hideIcon;
|
|
453
|
-
var hideIconVisible = visible && !!props.hideIcon;
|
|
454
|
-
var className = classNames('p-speeddial-button p-button-rounded', {
|
|
455
|
-
'p-speeddial-rotate': props.rotateAnimation && !props.hideIcon
|
|
456
|
-
}, props.buttonClassName);
|
|
457
|
-
var iconClassName = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(props.showIcon), !visible && !!props.showIcon || !props.hideIcon), _defineProperty(_classNames, "".concat(props.hideIcon), visible && !!props.hideIcon), _classNames));
|
|
458
|
-
var icon = showIconVisible ? props.showIcon || /*#__PURE__*/React.createElement(PlusIcon, null) : hideIconVisible ? props.hideIcon || /*#__PURE__*/React.createElement(MinusIcon, null) : null;
|
|
459
|
-
var toggleIcon = IconUtils.getJSXIcon(icon, undefined, {
|
|
460
|
-
props: props,
|
|
461
|
-
visible: visible
|
|
462
|
-
});
|
|
463
|
-
var buttonProps = mergeProps({
|
|
464
|
-
type: 'button',
|
|
465
|
-
style: props.buttonStyle,
|
|
466
|
-
className: classNames(props.buttonClassName, cx('button')),
|
|
467
|
-
icon: toggleIcon,
|
|
468
|
-
onClick: function onClick(e) {
|
|
469
|
-
return _onClick(e);
|
|
470
|
-
},
|
|
471
|
-
disabled: props.disabled,
|
|
472
|
-
'aria-label': props['aria-label'],
|
|
473
|
-
pt: ptm('button'),
|
|
474
|
-
unstyled: props.unstyled,
|
|
475
|
-
__parentMetadata: {
|
|
476
|
-
parent: metaData
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
var content = /*#__PURE__*/React.createElement(Button, buttonProps);
|
|
480
|
-
if (props.buttonTemplate) {
|
|
481
|
-
var defaultContentOptions = {
|
|
482
|
-
onClick: _onClick,
|
|
483
|
-
className: className,
|
|
484
|
-
iconClassName: iconClassName,
|
|
485
|
-
element: content,
|
|
486
|
-
props: props,
|
|
487
|
-
visible: visible
|
|
488
|
-
};
|
|
489
|
-
return ObjectUtils.getJSXElement(props.buttonTemplate, defaultContentOptions);
|
|
490
|
-
}
|
|
491
|
-
return content;
|
|
492
|
-
};
|
|
493
|
-
var createMask = function createMask() {
|
|
494
|
-
if (props.mask) {
|
|
495
|
-
var maskProps = mergeProps({
|
|
496
|
-
className: classNames(props.maskClassName, cx('mask', {
|
|
497
|
-
visible: visible
|
|
498
|
-
})),
|
|
499
|
-
style: props.maskStyle
|
|
500
|
-
}, ptm('mask'));
|
|
501
|
-
return /*#__PURE__*/React.createElement("div", maskProps);
|
|
502
|
-
}
|
|
503
|
-
return null;
|
|
504
|
-
};
|
|
505
|
-
var button = createButton();
|
|
506
|
-
var list = createList();
|
|
507
|
-
var mask = createMask();
|
|
508
|
-
var rootProps = mergeProps({
|
|
509
|
-
className: classNames(props.className, cx('root', {
|
|
510
|
-
visible: visible
|
|
511
|
-
})),
|
|
512
|
-
style: _objectSpread(_objectSpread({}, props.style), sx('root'))
|
|
513
|
-
}, SpeedDialBase.getOtherProps(props), ptm('root'));
|
|
514
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({
|
|
515
|
-
id: props.id,
|
|
516
|
-
ref: elementRef
|
|
517
|
-
}, rootProps), button, list), mask);
|
|
518
|
-
}));
|
|
519
|
-
SpeedDial.displayName = 'SpeedDial';
|
|
520
|
-
|
|
521
|
-
export { SpeedDial };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{PrimeReactContext as t}from"primereact/api";import{Button as n}from"primereact/button";import{ComponentBase as i,useHandleStyle as r}from"primereact/componentbase";import{useEventListener as o,useMountEffect as a,useUpdateEffect as l}from"primereact/hooks";import{MinusIcon as c}from"primereact/icons/minus";import{PlusIcon as s}from"primereact/icons/plus";import{Ripple as p}from"primereact/ripple";import{classNames as u,DomHandler as d,mergeProps as m,IconUtils as f,ObjectUtils as b}from"primereact/utils";function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y.apply(this,arguments)}function h(e){return h="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},h(e)}function v(e,t){if("object"!==h(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==h(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function g(e){var t=v(e,"string");return"symbol"===h(t)?t:String(t)}function w(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){if(Array.isArray(e))return e}function S(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(l.push(i.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function k(e,t){if(e){if("string"==typeof e)return x(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)?x(e,t):void 0}}function I(){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,t){return O(e)||S(e,t)||k(e,t)||I()}var j=i.extend({defaultProps:{__TYPE:"SpeedDial",id:null,model:null,visible:!1,style:null,className:null,direction:"up",transitionDelay:30,type:"linear",radius:0,mask:!1,disabled:!1,hideOnClickOutside:!0,buttonStyle:null,buttonClassName:null,buttonTemplate:null,"aria-label":null,maskStyle:null,maskClassName:null,showIcon:null,hideIcon:null,rotateAnimation:!0,onVisibleChange:null,onClick:null,onShow:null,onHide:null,children:void 0},css:{classes:{root:function(e){var t,n=e.props,i=e.visible;return u("p-speeddial p-component p-speeddial-".concat(n.type),(w(t={},"p-speeddial-direction-".concat(n.direction),"circle"!==n.type),w(t,"p-speeddial-opened",i),w(t,"p-disabled",n.disabled),t))},button:function(e){var t=e.props;return u("p-speeddial-button p-button-rounded",{"p-speeddial-rotate":t.rotateAnimation&&!t.hideIcon})},mask:function(e){return u("p-speeddial-mask",{"p-speeddial-mask-visible":e.visible})},action:function(e){return u("p-speeddial-action",{"p-disabled":e.disabled})},actionIcon:function(e){return u("p-speeddial-action-icon",e._icon)},menu:"p-speeddial-list",menuitem:"p-speeddial-item"},styles:"\n@layer primereact {\n .p-speeddial {\n position: absolute;\n display: flex;\n z-index: 1;\n }\n \n .p-speeddial-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: top 0s linear 0.2s;\n pointer-events: none;\n }\n \n .p-speeddial-item {\n transform: scale(0);\n opacity: 0;\n transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 0.8s;\n will-change: transform;\n }\n \n .p-speeddial-action {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n position: relative;\n overflow: hidden;\n text-decoration: none;\n }\n \n .p-speeddial-circle .p-speeddial-item,\n .p-speeddial-semi-circle .p-speeddial-item,\n .p-speeddial-quarter-circle .p-speeddial-item {\n position: absolute;\n }\n \n .p-speeddial-rotate {\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n will-change: transform;\n }\n \n .p-speeddial-mask {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: opacity 250ms cubic-bezier(0.25, 0.8, 0.25, 1);\n }\n \n .p-speeddial-mask-visible {\n pointer-events: none;\n opacity: 1;\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n }\n \n .p-speeddial-opened .p-speeddial-list {\n pointer-events: auto;\n }\n \n .p-speeddial-opened .p-speeddial-item {\n transform: scale(1);\n opacity: 1;\n }\n \n .p-speeddial-opened .p-speeddial-rotate {\n transform: rotate(45deg);\n }\n}\n",inlineStyles:{root:function(e){var t=e.props;return{alignItems:"up"===t.direction||"down"===t.direction?"center":"",justifyContent:"left"===t.direction||"right"===t.direction?"center":"",flexDirection:"up"===t.direction?"column-reverse":"down"===t.direction?"column":"left"===t.direction?"row-reverse":"right"===t.direction?"row":null}},menu:function(e){var t=e.props;return{flexDirection:"up"===t.direction?"column-reverse":"down"===t.direction?"column":"left"===t.direction?"row-reverse":"right"===t.direction?"row":null}}}}});function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var E=e.memo(e.forwardRef((function(i,h){var v=C(e.useState(!1),2),g=v[0],O=v[1],S=e.useContext(t),x=j.getProps(i,S),k=x.onVisibleChange?x.visible:g,I={props:x,state:{visible:k}},N=j.setMetaData(I),E=N.ptm,M=N.cx,D=N.sx;r(j.css.styles,N.isUnstyled,{name:"speeddial"});var A=e.useRef(!1),H=e.useRef(null),T=e.useRef(null),V=C(o({type:"click",listener:function(e){!A.current&&U(e)&&R(),A.current=!1},when:g}),2),z=V[0],_=V[1],J=function(){x.onVisibleChange?x.onVisibleChange(!0):O(!0),x.onShow&&x.onShow()},R=function(){x.onVisibleChange?x.onVisibleChange(!1):O(!1),x.onHide&&x.onHide()},X=function(e){k?R():J(),x.onClick&&x.onClick(e),A.current=!0},q=function(e,t){t.command&&t.command({originalEvent:e,item:t}),R(),A.current=!0,e.preventDefault()},U=function(e){return H.current&&!(H.current.isSameNode(e.target)||H.current.contains(e.target))},W=function(e){return(k?e:x.model.length-e-1)*x.transitionDelay},F=function(e){var t=x.type;if("linear"!==t){var n=x.model.length,i=x.radius||20*n;if("circle"===t){var r=2*Math.PI/n;return{left:"calc(".concat(i*Math.cos(r*e),"px + var(--item-diff-x, 0px))"),top:"calc(".concat(i*Math.sin(r*e),"px + var(--item-diff-y, 0px))")}}if("semi-circle"===t){var o=x.direction,a=Math.PI/(n-1),l="calc(".concat(i*Math.cos(a*e),"px + var(--item-diff-x, 0px))"),c="calc(".concat(i*Math.sin(a*e),"px + var(--item-diff-y, 0px))");if("up"===o)return{left:l,bottom:c};if("down"===o)return{left:l,top:c};if("left"===o)return{right:c,top:l};if("right"===o)return{left:c,top:l}}else if("quarter-circle"===t){var s=x.direction,p=Math.PI/(2*(n-1)),u="calc(".concat(i*Math.cos(p*e),"px + var(--item-diff-x, 0px))"),d="calc(".concat(i*Math.sin(p*e),"px + var(--item-diff-y, 0px))");if("up-left"===s)return{right:u,bottom:d};if("up-right"===s)return{left:u,bottom:d};if("down-left"===s)return{right:d,top:u};if("down-right"===s)return{left:d,top:u}}}return{}},Y=function(e){var t=W(e),n=F(e);return P({transitionDelay:"".concat(t,"ms")},n)};a((function(){if("linear"!==x.type){var e=d.findSingle(H.current,".p-speeddial-button"),t=d.findSingle(T.current,".p-speeddial-item");if(e&&t){var n=Math.abs(e.offsetWidth-t.offsetWidth),i=Math.abs(e.offsetHeight-t.offsetHeight);T.current.style.setProperty("--item-diff-x","".concat(n/2,"px")),T.current.style.setProperty("--item-diff-y","".concat(i/2,"px"))}}})),l((function(){return g&&x.hideOnClickOutside&&z(),function(){x.hideOnClickOutside&&_()}}),[g]),e.useImperativeHandle(h,(function(){return{props:x,show:J,hide:R,getElement:function(){return H.current}}}));var $,B,G,K,L,Q,Z,ee,te,ne,ie=function(t,n){if(!1===t.visible)return null;var i=t.disabled,r=t.icon,o=t.label,a=t.template,l=t.url,c=t.target,s=u("p-speeddial-action",{"p-disabled":i}),d=u("p-speeddial-action-icon",r),y=m({className:M("actionIcon")},E("actionIcon")),h=m({href:l||"#",role:"menuitem",className:M("action",{disabled:i}),target:c,"data-pr-tooltip":o,onClick:function(e){return q(e,t)}},E("action")),v=f.getJSXIcon(r,P({},y),{props:x}),g=e.createElement("a",h,v,e.createElement(p,null));a&&(g=b.getJSXElement(a,t,{onClick:function(e){return q(e,t)},className:s,iconClassName:d,element:g,props:x,visible:k}));var w=m({key:n,className:M("menuitem"),style:Y(n),role:"none"},E("menuitem"));return e.createElement("li",w,g)},re=(B=!k&&!!x.showIcon||!x.hideIcon,G=k&&!!x.hideIcon,K=u("p-speeddial-button p-button-rounded",{"p-speeddial-rotate":x.rotateAnimation&&!x.hideIcon},x.buttonClassName),L=u((w($={},"".concat(x.showIcon),!k&&!!x.showIcon||!x.hideIcon),w($,"".concat(x.hideIcon),k&&!!x.hideIcon),$)),Q=f.getJSXIcon(B?x.showIcon||e.createElement(s,null):G?x.hideIcon||e.createElement(c,null):null,void 0,{props:x,visible:k}),Z=m({type:"button",style:x.buttonStyle,className:u(x.buttonClassName,M("button")),icon:Q,onClick:function(e){return X(e)},disabled:x.disabled,"aria-label":x["aria-label"],pt:E("button"),unstyled:x.unstyled,__parentMetadata:{parent:I}}),ee=e.createElement(n,Z),x.buttonTemplate?b.getJSXElement(x.buttonTemplate,{onClick:X,className:K,iconClassName:L,element:ee,props:x,visible:k}):ee),oe=(te=x.model?x.model.map(ie):null,ne=m({ref:T,className:M("menu"),style:D("menu"),role:"menu"},E("menu")),e.createElement("ul",ne,te)),ae=function(){if(x.mask){var t=m({className:u(x.maskClassName,M("mask",{visible:k})),style:x.maskStyle},E("mask"));return e.createElement("div",t)}return null}(),le=m({className:u(x.className,M("root",{visible:k})),style:P(P({},x.style),D("root"))},j.getOtherProps(x),E("root"));return e.createElement(e.Fragment,null,e.createElement("div",y({id:x.id,ref:H},le),re,oe),ae)})));E.displayName="SpeedDial";export{E as SpeedDial};
|