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,269 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import PrimeReact, { PrimeReactContext } from 'primereact/api';
|
|
5
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
6
|
-
import { CSSTransition } from 'primereact/csstransition';
|
|
7
|
-
import { useEventListener, useUnmountEffect } from 'primereact/hooks';
|
|
8
|
-
import { ChevronUpIcon } from 'primereact/icons/chevronup';
|
|
9
|
-
import { Ripple } from 'primereact/ripple';
|
|
10
|
-
import { classNames, DomHandler, ZIndexUtils, mergeProps, IconUtils } from 'primereact/utils';
|
|
11
|
-
|
|
12
|
-
function _extends() {
|
|
13
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
14
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
-
var source = arguments[i];
|
|
16
|
-
for (var key in source) {
|
|
17
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
18
|
-
target[key] = source[key];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return target;
|
|
23
|
-
};
|
|
24
|
-
return _extends.apply(this, arguments);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function _typeof(o) {
|
|
28
|
-
"@babel/helpers - typeof";
|
|
29
|
-
|
|
30
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
31
|
-
return typeof o;
|
|
32
|
-
} : function (o) {
|
|
33
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
34
|
-
}, _typeof(o);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function _toPrimitive(input, hint) {
|
|
38
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
39
|
-
var prim = input[Symbol.toPrimitive];
|
|
40
|
-
if (prim !== undefined) {
|
|
41
|
-
var res = prim.call(input, hint || "default");
|
|
42
|
-
if (_typeof(res) !== "object") return res;
|
|
43
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
44
|
-
}
|
|
45
|
-
return (hint === "string" ? String : Number)(input);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _toPropertyKey(arg) {
|
|
49
|
-
var key = _toPrimitive(arg, "string");
|
|
50
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function _defineProperty(obj, key, value) {
|
|
54
|
-
key = _toPropertyKey(key);
|
|
55
|
-
if (key in obj) {
|
|
56
|
-
Object.defineProperty(obj, key, {
|
|
57
|
-
value: value,
|
|
58
|
-
enumerable: true,
|
|
59
|
-
configurable: true,
|
|
60
|
-
writable: true
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
obj[key] = value;
|
|
64
|
-
}
|
|
65
|
-
return obj;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _arrayWithHoles(arr) {
|
|
69
|
-
if (Array.isArray(arr)) return arr;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _iterableToArrayLimit(r, l) {
|
|
73
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
74
|
-
if (null != t) {
|
|
75
|
-
var e,
|
|
76
|
-
n,
|
|
77
|
-
i,
|
|
78
|
-
u,
|
|
79
|
-
a = [],
|
|
80
|
-
f = !0,
|
|
81
|
-
o = !1;
|
|
82
|
-
try {
|
|
83
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
84
|
-
if (Object(t) !== t) return;
|
|
85
|
-
f = !1;
|
|
86
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
87
|
-
} catch (r) {
|
|
88
|
-
o = !0, n = r;
|
|
89
|
-
} finally {
|
|
90
|
-
try {
|
|
91
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
92
|
-
} finally {
|
|
93
|
-
if (o) throw n;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return a;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function _arrayLikeToArray(arr, len) {
|
|
101
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
102
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
103
|
-
return arr2;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
107
|
-
if (!o) return;
|
|
108
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
109
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
110
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
111
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
112
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function _nonIterableRest() {
|
|
116
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function _slicedToArray(arr, i) {
|
|
120
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
var classes = {
|
|
124
|
-
root: function root(_ref) {
|
|
125
|
-
var props = _ref.props;
|
|
126
|
-
return classNames('p-scrolltop p-link p-component', {
|
|
127
|
-
'p-scrolltop-sticky': props.target !== 'window'
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
icon: 'p-scrolltop-icon',
|
|
131
|
-
transition: 'p-scrolltop'
|
|
132
|
-
};
|
|
133
|
-
var styles = "\n@layer primereact {\n .p-scrolltop {\n position: fixed;\n bottom: 20px;\n right: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .p-scrolltop-sticky {\n position: sticky;\n }\n \n .p-scrolltop-sticky.p-link {\n margin-left: auto;\n }\n \n .p-scrolltop-helper {\n display: none !important;\n }\n \n .p-scrolltop-enter {\n opacity: 0;\n }\n \n .p-scrolltop-enter-active {\n opacity: 1;\n transition: opacity .15s;\n }\n \n .p-scrolltop-exit {\n opacity: 1;\n }\n \n .p-scrolltop-exit-active {\n opacity: 0;\n transition: opacity .15s;\n }\n}\n";
|
|
134
|
-
var ScrollTopBase = ComponentBase.extend({
|
|
135
|
-
defaultProps: {
|
|
136
|
-
__TYPE: 'ScrollTop',
|
|
137
|
-
target: 'window',
|
|
138
|
-
threshold: 400,
|
|
139
|
-
icon: null,
|
|
140
|
-
behavior: 'smooth',
|
|
141
|
-
className: null,
|
|
142
|
-
style: null,
|
|
143
|
-
transitionOptions: null,
|
|
144
|
-
onShow: null,
|
|
145
|
-
onHide: null,
|
|
146
|
-
children: undefined
|
|
147
|
-
},
|
|
148
|
-
css: {
|
|
149
|
-
classes: classes,
|
|
150
|
-
styles: styles
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
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; }
|
|
155
|
-
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; }
|
|
156
|
-
var ScrollTop = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
157
|
-
var _React$useState = React.useState(false),
|
|
158
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
159
|
-
visibleState = _React$useState2[0],
|
|
160
|
-
setVisibleState = _React$useState2[1];
|
|
161
|
-
var context = React.useContext(PrimeReactContext);
|
|
162
|
-
var props = ScrollTopBase.getProps(inProps, context);
|
|
163
|
-
var _ScrollTopBase$setMet = ScrollTopBase.setMetaData({
|
|
164
|
-
props: props,
|
|
165
|
-
state: {
|
|
166
|
-
visible: visibleState
|
|
167
|
-
}
|
|
168
|
-
}),
|
|
169
|
-
ptm = _ScrollTopBase$setMet.ptm,
|
|
170
|
-
cx = _ScrollTopBase$setMet.cx,
|
|
171
|
-
isUnstyled = _ScrollTopBase$setMet.isUnstyled;
|
|
172
|
-
useHandleStyle(ScrollTopBase.css.styles, isUnstyled, {
|
|
173
|
-
name: 'scrolltop'
|
|
174
|
-
});
|
|
175
|
-
var scrollElementRef = React.useRef(null);
|
|
176
|
-
var helperRef = React.useRef(null);
|
|
177
|
-
var isTargetParent = props.target === 'parent';
|
|
178
|
-
var _useEventListener = useEventListener({
|
|
179
|
-
target: function target() {
|
|
180
|
-
return helperRef.current && helperRef.current.parentElement;
|
|
181
|
-
},
|
|
182
|
-
type: 'scroll',
|
|
183
|
-
listener: function listener(event) {
|
|
184
|
-
checkVisibility(event.currentTarget.scrollTop);
|
|
185
|
-
}
|
|
186
|
-
}),
|
|
187
|
-
_useEventListener2 = _slicedToArray(_useEventListener, 1),
|
|
188
|
-
bindParentScrollListener = _useEventListener2[0];
|
|
189
|
-
var _useEventListener3 = useEventListener({
|
|
190
|
-
target: 'window',
|
|
191
|
-
type: 'scroll',
|
|
192
|
-
listener: function listener(event) {
|
|
193
|
-
event && checkVisibility(DomHandler.getWindowScrollTop());
|
|
194
|
-
}
|
|
195
|
-
}),
|
|
196
|
-
_useEventListener4 = _slicedToArray(_useEventListener3, 1),
|
|
197
|
-
bindDocumentScrollListener = _useEventListener4[0];
|
|
198
|
-
var onClick = function onClick() {
|
|
199
|
-
var scrollElement = props.target === 'window' ? window : helperRef.current.parentElement;
|
|
200
|
-
scrollElement.scroll({
|
|
201
|
-
top: 0,
|
|
202
|
-
behavior: props.behavior
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
var checkVisibility = function checkVisibility(scrollY) {
|
|
206
|
-
setVisibleState(scrollY > props.threshold);
|
|
207
|
-
};
|
|
208
|
-
var onEnter = function onEnter() {
|
|
209
|
-
ZIndexUtils.set('overlay', scrollElementRef.current, context && context.autoZIndex || PrimeReact.autoZIndex, context && context.zIndex['overlay'] || PrimeReact.zIndex['overlay']);
|
|
210
|
-
};
|
|
211
|
-
var onEntered = function onEntered() {
|
|
212
|
-
props.onShow && props.onShow();
|
|
213
|
-
};
|
|
214
|
-
var onExited = function onExited() {
|
|
215
|
-
ZIndexUtils.clear(scrollElementRef.current);
|
|
216
|
-
props.onHide && props.onHide();
|
|
217
|
-
};
|
|
218
|
-
React.useImperativeHandle(ref, function () {
|
|
219
|
-
return {
|
|
220
|
-
props: props,
|
|
221
|
-
getElement: function getElement() {
|
|
222
|
-
return elementRef.current;
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
});
|
|
226
|
-
React.useEffect(function () {
|
|
227
|
-
if (props.target === 'window') bindDocumentScrollListener();else if (props.target === 'parent') bindParentScrollListener();
|
|
228
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
229
|
-
|
|
230
|
-
useUnmountEffect(function () {
|
|
231
|
-
ZIndexUtils.clear(scrollElementRef.current);
|
|
232
|
-
});
|
|
233
|
-
var iconProps = mergeProps({
|
|
234
|
-
className: cx('icon')
|
|
235
|
-
}, ptm('icon'));
|
|
236
|
-
var icon = props.icon || /*#__PURE__*/React.createElement(ChevronUpIcon, iconProps);
|
|
237
|
-
var scrollIcon = IconUtils.getJSXIcon(icon, _objectSpread({}, iconProps), {
|
|
238
|
-
props: props
|
|
239
|
-
});
|
|
240
|
-
var rootProps = mergeProps({
|
|
241
|
-
ref: scrollElementRef,
|
|
242
|
-
type: 'button',
|
|
243
|
-
className: classNames(props.className, cx('root')),
|
|
244
|
-
style: props.style,
|
|
245
|
-
onClick: onClick
|
|
246
|
-
}, ScrollTopBase.getOtherProps(props), ptm('root'));
|
|
247
|
-
var transitionProps = mergeProps({
|
|
248
|
-
classNames: cx('transition'),
|
|
249
|
-
"in": visibleState,
|
|
250
|
-
timeout: {
|
|
251
|
-
enter: 150,
|
|
252
|
-
exit: 150
|
|
253
|
-
},
|
|
254
|
-
options: props.transitionOptions,
|
|
255
|
-
unmountOnExit: true,
|
|
256
|
-
onEnter: onEnter,
|
|
257
|
-
onEntered: onEntered,
|
|
258
|
-
onExited: onExited
|
|
259
|
-
}, ptm('transition'));
|
|
260
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CSSTransition, _extends({
|
|
261
|
-
nodeRef: scrollElementRef
|
|
262
|
-
}, transitionProps), /*#__PURE__*/React.createElement("button", rootProps, scrollIcon, /*#__PURE__*/React.createElement(Ripple, null))), isTargetParent && /*#__PURE__*/React.createElement("span", {
|
|
263
|
-
ref: helperRef,
|
|
264
|
-
className: "p-scrolltop-helper"
|
|
265
|
-
}));
|
|
266
|
-
}));
|
|
267
|
-
ScrollTop.displayName = 'ScrollTop';
|
|
268
|
-
|
|
269
|
-
export { ScrollTop };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as t from"react";import e,{PrimeReactContext as n}from"primereact/api";import{ComponentBase as r,useHandleStyle as o}from"primereact/componentbase";import{CSSTransition as i}from"primereact/csstransition";import{useEventListener as l,useUnmountEffect as c}from"primereact/hooks";import{ChevronUpIcon as a}from"primereact/icons/chevronup";import{Ripple as s}from"primereact/ripple";import{classNames as p,DomHandler as u,ZIndexUtils as f,mergeProps as m,IconUtils as y}from"primereact/utils";function b(){return b=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},b.apply(this,arguments)}function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function v(t,e){if("object"!==d(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function g(t){var e=v(t,"string");return"symbol"===d(e)?e:String(e)}function h(t){if(Array.isArray(t))return t}function w(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,l,c=[],a=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;a=!1}else for(;!(a=(r=i.call(n)).done)&&(c.push(r.value),c.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{if(!a&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return c}}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function j(t,e){if(t){if("string"==typeof t)return O(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(t,e):void 0}}function S(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(t,e){return h(t)||w(t,e)||j(t,e)||S()}var x=r.extend({defaultProps:{__TYPE:"ScrollTop",target:"window",threshold:400,icon:null,behavior:"smooth",className:null,style:null,transitionOptions:null,onShow:null,onHide:null,children:void 0},css:{classes:{root:function(t){return p("p-scrolltop p-link p-component",{"p-scrolltop-sticky":"window"!==t.props.target})},icon:"p-scrolltop-icon",transition:"p-scrolltop"},styles:"\n@layer primereact {\n .p-scrolltop {\n position: fixed;\n bottom: 20px;\n right: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .p-scrolltop-sticky {\n position: sticky;\n }\n \n .p-scrolltop-sticky.p-link {\n margin-left: auto;\n }\n \n .p-scrolltop-helper {\n display: none !important;\n }\n \n .p-scrolltop-enter {\n opacity: 0;\n }\n \n .p-scrolltop-enter-active {\n opacity: 1;\n transition: opacity .15s;\n }\n \n .p-scrolltop-exit {\n opacity: 1;\n }\n \n .p-scrolltop-exit-active {\n opacity: 0;\n transition: opacity .15s;\n }\n}\n"}});function P(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function k(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?P(Object(n),!0).forEach((function(e){var r,o,i;r=t,i=n[e],(o=g(o=e))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var I=t.memo(t.forwardRef((function(r,d){var v=E(t.useState(!1),2),g=v[0],h=v[1],w=t.useContext(n),O=x.getProps(r,w),j=x.setMetaData({props:O,state:{visible:g}}),S=j.ptm,P=j.cx;o(x.css.styles,j.isUnstyled,{name:"scrolltop"});var I=t.useRef(null),N=t.useRef(null),T="parent"===O.target,A=E(l({target:function(){return N.current&&N.current.parentElement},type:"scroll",listener:function(t){R(t.currentTarget.scrollTop)}}),1)[0],D=E(l({target:"window",type:"scroll",listener:function(t){t&&R(u.getWindowScrollTop())}}),1)[0],R=function(t){h(t>O.threshold)};t.useImperativeHandle(d,(function(){return{props:O,getElement:function(){return elementRef.current}}})),t.useEffect((function(){"window"===O.target?D():"parent"===O.target&&A()}),[]),c((function(){f.clear(I.current)}));var H=m({className:P("icon")},S("icon")),C=y.getJSXIcon(O.icon||t.createElement(a,H),k({},H),{props:O}),z=m({ref:I,type:"button",className:p(O.className,P("root")),style:O.style,onClick:function(){("window"===O.target?window:N.current.parentElement).scroll({top:0,behavior:O.behavior})}},x.getOtherProps(O),S("root")),M=m({classNames:P("transition"),in:g,timeout:{enter:150,exit:150},options:O.transitionOptions,unmountOnExit:!0,onEnter:function(){f.set("overlay",I.current,w&&w.autoZIndex||e.autoZIndex,w&&w.zIndex.overlay||e.zIndex.overlay)},onEntered:function(){O.onShow&&O.onShow()},onExited:function(){f.clear(I.current),O.onHide&&O.onHide()}},S("transition"));return t.createElement(t.Fragment,null,t.createElement(i,b({nodeRef:I},M),t.createElement("button",z,C,t.createElement(s,null))),T&&t.createElement("span",{ref:N,className:"p-scrolltop-helper"}))})));I.displayName="ScrollTop";export{I as ScrollTop};
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Tooltip } from 'primereact/tooltip';
|
|
5
|
-
import { classNames, mergeProps, ObjectUtils, DomHandler } from 'primereact/utils';
|
|
6
|
-
import { ComponentBase } from 'primereact/componentbase';
|
|
7
|
-
import { Ripple } from 'primereact/ripple';
|
|
8
|
-
import { PrimeReactContext } from 'primereact/api';
|
|
9
|
-
|
|
10
|
-
function _extends() {
|
|
11
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
12
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
13
|
-
var source = arguments[i];
|
|
14
|
-
for (var key in source) {
|
|
15
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
16
|
-
target[key] = source[key];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return target;
|
|
21
|
-
};
|
|
22
|
-
return _extends.apply(this, arguments);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function _arrayLikeToArray(arr, len) {
|
|
26
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
27
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
28
|
-
return arr2;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _arrayWithoutHoles(arr) {
|
|
32
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function _iterableToArray(iter) {
|
|
36
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
40
|
-
if (!o) return;
|
|
41
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
42
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
43
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
44
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
45
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _nonIterableSpread() {
|
|
49
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function _toConsumableArray(arr) {
|
|
53
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var classes = {
|
|
57
|
-
root: function root(_ref) {
|
|
58
|
-
var props = _ref.props;
|
|
59
|
-
return classNames('p-selectbutton p-buttonset p-component', props.className);
|
|
60
|
-
},
|
|
61
|
-
button: function button(_ref2) {
|
|
62
|
-
var props = _ref2.itemProps,
|
|
63
|
-
focusedState = _ref2.focusedState;
|
|
64
|
-
return classNames('p-button p-component', {
|
|
65
|
-
'p-highlight': props.selected,
|
|
66
|
-
'p-disabled': props.disabled,
|
|
67
|
-
'p-focus': focusedState
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
label: 'p-button-label p-c'
|
|
71
|
-
};
|
|
72
|
-
var SelectButtonBase = ComponentBase.extend({
|
|
73
|
-
defaultProps: {
|
|
74
|
-
__TYPE: 'SelectButton',
|
|
75
|
-
id: null,
|
|
76
|
-
value: null,
|
|
77
|
-
options: null,
|
|
78
|
-
optionLabel: null,
|
|
79
|
-
optionValue: null,
|
|
80
|
-
optionDisabled: null,
|
|
81
|
-
tabIndex: null,
|
|
82
|
-
multiple: false,
|
|
83
|
-
unselectable: true,
|
|
84
|
-
disabled: false,
|
|
85
|
-
style: null,
|
|
86
|
-
className: null,
|
|
87
|
-
dataKey: null,
|
|
88
|
-
tooltip: null,
|
|
89
|
-
tooltipOptions: null,
|
|
90
|
-
itemTemplate: null,
|
|
91
|
-
onChange: null,
|
|
92
|
-
children: undefined
|
|
93
|
-
},
|
|
94
|
-
css: {
|
|
95
|
-
classes: classes
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
function _arrayWithHoles(arr) {
|
|
100
|
-
if (Array.isArray(arr)) return arr;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _iterableToArrayLimit(r, l) {
|
|
104
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
105
|
-
if (null != t) {
|
|
106
|
-
var e,
|
|
107
|
-
n,
|
|
108
|
-
i,
|
|
109
|
-
u,
|
|
110
|
-
a = [],
|
|
111
|
-
f = !0,
|
|
112
|
-
o = !1;
|
|
113
|
-
try {
|
|
114
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
115
|
-
if (Object(t) !== t) return;
|
|
116
|
-
f = !1;
|
|
117
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
118
|
-
} catch (r) {
|
|
119
|
-
o = !0, n = r;
|
|
120
|
-
} finally {
|
|
121
|
-
try {
|
|
122
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
123
|
-
} finally {
|
|
124
|
-
if (o) throw n;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return a;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function _nonIterableRest() {
|
|
132
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function _slicedToArray(arr, i) {
|
|
136
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var SelectButtonItem = /*#__PURE__*/React.memo(function (props) {
|
|
140
|
-
var _React$useState = React.useState(false),
|
|
141
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
142
|
-
focusedState = _React$useState2[0],
|
|
143
|
-
setFocusedState = _React$useState2[1];
|
|
144
|
-
var ptm = props.ptm,
|
|
145
|
-
cx = props.cx;
|
|
146
|
-
var getPTOptions = function getPTOptions(key) {
|
|
147
|
-
return ptm(key, {
|
|
148
|
-
hostName: props.hostName,
|
|
149
|
-
context: {
|
|
150
|
-
selected: props.selected,
|
|
151
|
-
disabled: props.disabled,
|
|
152
|
-
option: props.option
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
var onClick = function onClick(event) {
|
|
157
|
-
if (props.onClick) {
|
|
158
|
-
props.onClick({
|
|
159
|
-
originalEvent: event,
|
|
160
|
-
option: props.option
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
var onFocus = function onFocus() {
|
|
165
|
-
setFocusedState(true);
|
|
166
|
-
};
|
|
167
|
-
var onBlur = function onBlur() {
|
|
168
|
-
setFocusedState(false);
|
|
169
|
-
};
|
|
170
|
-
var onKeyDown = function onKeyDown(event) {
|
|
171
|
-
var keyCode = event.which;
|
|
172
|
-
if (keyCode === 32) {
|
|
173
|
-
onClick(event);
|
|
174
|
-
event.preventDefault();
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
var createContent = function createContent() {
|
|
178
|
-
var labelProps = mergeProps({
|
|
179
|
-
className: cx('label')
|
|
180
|
-
}, getPTOptions('label'));
|
|
181
|
-
return props.template ? ObjectUtils.getJSXElement(props.template, props.option) : /*#__PURE__*/React.createElement("span", labelProps, props.label);
|
|
182
|
-
};
|
|
183
|
-
var content = createContent();
|
|
184
|
-
var buttonProps = mergeProps({
|
|
185
|
-
className: classNames(props.className, cx('button', {
|
|
186
|
-
itemProps: props,
|
|
187
|
-
focusedState: focusedState
|
|
188
|
-
})),
|
|
189
|
-
role: 'button',
|
|
190
|
-
'aria-label': props.label,
|
|
191
|
-
'aria-pressed': props.selected,
|
|
192
|
-
onClick: onClick,
|
|
193
|
-
onKeyDown: onKeyDown,
|
|
194
|
-
tabIndex: props.tabIndex,
|
|
195
|
-
onFocus: onFocus,
|
|
196
|
-
onBlur: onBlur
|
|
197
|
-
}, getPTOptions('button'));
|
|
198
|
-
return /*#__PURE__*/React.createElement("div", buttonProps, content, !props.disabled && /*#__PURE__*/React.createElement(Ripple, null));
|
|
199
|
-
});
|
|
200
|
-
SelectButtonItem.displayName = 'SelectButtonItem';
|
|
201
|
-
|
|
202
|
-
var SelectButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
203
|
-
var context = React.useContext(PrimeReactContext);
|
|
204
|
-
var props = SelectButtonBase.getProps(inProps, context);
|
|
205
|
-
var elementRef = React.useRef(null);
|
|
206
|
-
var _SelectButtonBase$set = SelectButtonBase.setMetaData({
|
|
207
|
-
props: props
|
|
208
|
-
}),
|
|
209
|
-
ptm = _SelectButtonBase$set.ptm,
|
|
210
|
-
cx = _SelectButtonBase$set.cx;
|
|
211
|
-
var onOptionClick = function onOptionClick(event) {
|
|
212
|
-
if (props.disabled || isOptionDisabled(event.option)) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
var selected = isSelected(event.option);
|
|
216
|
-
if (selected && !props.unselectable) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
var optionValue = getOptionValue(event.option);
|
|
220
|
-
var newValue;
|
|
221
|
-
if (props.multiple) {
|
|
222
|
-
var currentValue = props.value ? _toConsumableArray(props.value) : [];
|
|
223
|
-
newValue = selected ? currentValue.filter(function (val) {
|
|
224
|
-
return !ObjectUtils.equals(val, optionValue, props.dataKey);
|
|
225
|
-
}) : [].concat(_toConsumableArray(currentValue), [optionValue]);
|
|
226
|
-
} else {
|
|
227
|
-
newValue = selected ? null : optionValue;
|
|
228
|
-
}
|
|
229
|
-
if (props.onChange) {
|
|
230
|
-
props.onChange({
|
|
231
|
-
originalEvent: event.originalEvent,
|
|
232
|
-
value: newValue,
|
|
233
|
-
stopPropagation: function stopPropagation() {
|
|
234
|
-
event.originalEvent.stopPropagation();
|
|
235
|
-
},
|
|
236
|
-
preventDefault: function preventDefault() {
|
|
237
|
-
event.originalEvent.preventDefault();
|
|
238
|
-
},
|
|
239
|
-
target: {
|
|
240
|
-
name: props.name,
|
|
241
|
-
id: props.id,
|
|
242
|
-
value: newValue
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
var getOptionLabel = function getOptionLabel(option) {
|
|
248
|
-
return props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : option && option['label'] !== undefined ? option['label'] : option;
|
|
249
|
-
};
|
|
250
|
-
var getOptionValue = function getOptionValue(option) {
|
|
251
|
-
return props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : option && option['value'] !== undefined ? option['value'] : option;
|
|
252
|
-
};
|
|
253
|
-
var isOptionDisabled = function isOptionDisabled(option) {
|
|
254
|
-
if (props.optionDisabled) {
|
|
255
|
-
return ObjectUtils.isFunction(props.optionDisabled) ? props.optionDisabled(option) : ObjectUtils.resolveFieldData(option, props.optionDisabled);
|
|
256
|
-
}
|
|
257
|
-
return option && option['disabled'] !== undefined ? option['disabled'] : false;
|
|
258
|
-
};
|
|
259
|
-
var isSelected = function isSelected(option) {
|
|
260
|
-
var optionValue = getOptionValue(option);
|
|
261
|
-
if (props.multiple) {
|
|
262
|
-
if (props.value && props.value.length) {
|
|
263
|
-
return props.value.some(function (val) {
|
|
264
|
-
return ObjectUtils.equals(val, optionValue, props.dataKey);
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
return ObjectUtils.equals(props.value, optionValue, props.dataKey);
|
|
269
|
-
}
|
|
270
|
-
return false;
|
|
271
|
-
};
|
|
272
|
-
var createItems = function createItems() {
|
|
273
|
-
if (props.options && props.options.length) {
|
|
274
|
-
return props.options.map(function (option, index) {
|
|
275
|
-
var isDisabled = props.disabled || isOptionDisabled(option);
|
|
276
|
-
var optionLabel = getOptionLabel(option);
|
|
277
|
-
var tabIndex = isDisabled ? null : 0;
|
|
278
|
-
var selected = isSelected(option);
|
|
279
|
-
var key = optionLabel + '_' + index;
|
|
280
|
-
return /*#__PURE__*/React.createElement(SelectButtonItem, {
|
|
281
|
-
hostName: "SelectButton",
|
|
282
|
-
key: key,
|
|
283
|
-
label: optionLabel,
|
|
284
|
-
className: option.className,
|
|
285
|
-
option: option,
|
|
286
|
-
onClick: onOptionClick,
|
|
287
|
-
template: props.itemTemplate,
|
|
288
|
-
selected: selected,
|
|
289
|
-
tabIndex: tabIndex,
|
|
290
|
-
disabled: isDisabled,
|
|
291
|
-
ptm: ptm,
|
|
292
|
-
cx: cx
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
return null;
|
|
297
|
-
};
|
|
298
|
-
React.useImperativeHandle(ref, function () {
|
|
299
|
-
return {
|
|
300
|
-
props: props,
|
|
301
|
-
focus: function focus() {
|
|
302
|
-
return DomHandler.focusFirstElement(elementRef.current);
|
|
303
|
-
},
|
|
304
|
-
getElement: function getElement() {
|
|
305
|
-
return elementRef.current;
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
});
|
|
309
|
-
var hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
|
|
310
|
-
var items = createItems();
|
|
311
|
-
var rootProps = mergeProps({
|
|
312
|
-
ref: elementRef,
|
|
313
|
-
id: props.id,
|
|
314
|
-
className: cx('root'),
|
|
315
|
-
style: props.style,
|
|
316
|
-
role: 'group'
|
|
317
|
-
}, SelectButtonBase.getOtherProps(props), ptm('root'));
|
|
318
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", rootProps, items), hasTooltip && /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
319
|
-
target: elementRef,
|
|
320
|
-
content: props.tooltip
|
|
321
|
-
}, props.tooltipOptions, {
|
|
322
|
-
pt: ptm('tooltip')
|
|
323
|
-
})));
|
|
324
|
-
}));
|
|
325
|
-
SelectButton.displayName = 'SelectButton';
|
|
326
|
-
|
|
327
|
-
export { SelectButton };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{Tooltip as t}from"primereact/tooltip";import{classNames as n,mergeProps as o,ObjectUtils as l,DomHandler as r}from"primereact/utils";import{ComponentBase as a}from"primereact/componentbase";import{Ripple as i}from"primereact/ripple";import{PrimeReactContext as u}from"primereact/api";function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s.apply(this,arguments)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function p(e){if(Array.isArray(e))return c(e)}function m(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function d(e,t){if(e){if("string"==typeof e)return c(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)?c(e,t):void 0}}function f(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(e){return p(e)||m(e)||d(e)||f()}var v=a.extend({defaultProps:{__TYPE:"SelectButton",id:null,value:null,options:null,optionLabel:null,optionValue:null,optionDisabled:null,tabIndex:null,multiple:!1,unselectable:!0,disabled:!1,style:null,className:null,dataKey:null,tooltip:null,tooltipOptions:null,itemTemplate:null,onChange:null,children:void 0},css:{classes:{root:function(e){return n("p-selectbutton p-buttonset p-component",e.props.className)},button:function(e){var t=e.itemProps;return n("p-button p-component",{"p-highlight":t.selected,"p-disabled":t.disabled,"p-focus":e.focusedState})},label:"p-button-label p-c"}}});function y(e){if(Array.isArray(e))return e}function g(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,l,r,a,i=[],u=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(o=r.call(n)).done)&&(i.push(o.value),i.length!==t);u=!0);}catch(e){s=!0,l=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw l}}return i}}function h(){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 E=e.memo((function(t){var r,a,u,s=e.useState(!1),c=(a=2,y(r=s)||g(r,a)||d(r,a)||h()),p=c[0],m=c[1],f=t.ptm,b=t.cx,v=function(e){return f(e,{hostName:t.hostName,context:{selected:t.selected,disabled:t.disabled,option:t.option}})},E=function(e){t.onClick&&t.onClick({originalEvent:e,option:t.option})},S=(u=o({className:b("label")},v("label")),t.template?l.getJSXElement(t.template,t.option):e.createElement("span",u,t.label)),N=o({className:n(t.className,b("button",{itemProps:t,focusedState:p})),role:"button","aria-label":t.label,"aria-pressed":t.selected,onClick:E,onKeyDown:function(e){32===e.which&&(E(e),e.preventDefault())},tabIndex:t.tabIndex,onFocus:function(){m(!0)},onBlur:function(){m(!1)}},v("button"));return e.createElement("div",N,S,!t.disabled&&e.createElement(i,null))}));E.displayName="SelectButtonItem";var S=e.memo(e.forwardRef((function(n,a){var i=e.useContext(u),c=v.getProps(n,i),p=e.useRef(null),m=v.setMetaData({props:c}),d=m.ptm,f=m.cx,y=function(e){if(!c.disabled&&!S(e.option)){var t=N(e.option);if(!t||c.unselectable){var n,o=h(e.option);if(c.multiple){var r=c.value?b(c.value):[];n=t?r.filter((function(e){return!l.equals(e,o,c.dataKey)})):[].concat(b(r),[o])}else n=t?null:o;c.onChange&&c.onChange({originalEvent:e.originalEvent,value:n,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:c.name,id:c.id,value:n}})}}},g=function(e){return c.optionLabel?l.resolveFieldData(e,c.optionLabel):e&&void 0!==e.label?e.label:e},h=function(e){return c.optionValue?l.resolveFieldData(e,c.optionValue):e&&void 0!==e.value?e.value:e},S=function(e){return c.optionDisabled?l.isFunction(c.optionDisabled)?c.optionDisabled(e):l.resolveFieldData(e,c.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},N=function(e){var t=h(e);return c.multiple?!(!c.value||!c.value.length)&&c.value.some((function(e){return l.equals(e,t,c.dataKey)})):l.equals(c.value,t,c.dataKey)};e.useImperativeHandle(a,(function(){return{props:c,focus:function(){return r.focusFirstElement(p.current)},getElement:function(){return p.current}}}));var D=l.isNotEmpty(c.tooltip),x=c.options&&c.options.length?c.options.map((function(t,n){var o=c.disabled||S(t),l=g(t),r=o?null:0,a=N(t);return e.createElement(E,{hostName:"SelectButton",key:l+"_"+n,label:l,className:t.className,option:t,onClick:y,template:c.itemTemplate,selected:a,tabIndex:r,disabled:o,ptm:d,cx:f})})):null,I=o({ref:p,id:c.id,className:f("root"),style:c.style,role:"group"},v.getOtherProps(c),d("root"));return e.createElement(e.Fragment,null,e.createElement("div",I,x),D&&e.createElement(t,s({target:p,content:c.tooltip},c.tooltipOptions,{pt:d("tooltip")})))})));S.displayName="SelectButton";export{S as SelectButton};
|