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,1127 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import PrimeReact, { PrimeReactContext, localeOption } from 'primereact/api';
|
|
5
|
-
import { Button } from 'primereact/button';
|
|
6
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
7
|
-
import { useOverlayListener, useMountEffect, useUpdateEffect, useUnmountEffect } from 'primereact/hooks';
|
|
8
|
-
import { ChevronDownIcon } from 'primereact/icons/chevrondown';
|
|
9
|
-
import { SpinnerIcon } from 'primereact/icons/spinner';
|
|
10
|
-
import { TimesCircleIcon } from 'primereact/icons/timescircle';
|
|
11
|
-
import { InputText } from 'primereact/inputtext';
|
|
12
|
-
import { OverlayService } from 'primereact/overlayservice';
|
|
13
|
-
import { Tooltip } from 'primereact/tooltip';
|
|
14
|
-
import { classNames, mergeProps, ObjectUtils, UniqueComponentId, DomHandler, ZIndexUtils, IconUtils } from 'primereact/utils';
|
|
15
|
-
import { CSSTransition } from 'primereact/csstransition';
|
|
16
|
-
import { Portal } from 'primereact/portal';
|
|
17
|
-
import { Ripple } from 'primereact/ripple';
|
|
18
|
-
import { VirtualScroller } from 'primereact/virtualscroller';
|
|
19
|
-
|
|
20
|
-
function _typeof(o) {
|
|
21
|
-
"@babel/helpers - typeof";
|
|
22
|
-
|
|
23
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
24
|
-
return typeof o;
|
|
25
|
-
} : function (o) {
|
|
26
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
27
|
-
}, _typeof(o);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function _toPrimitive(input, hint) {
|
|
31
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
32
|
-
var prim = input[Symbol.toPrimitive];
|
|
33
|
-
if (prim !== undefined) {
|
|
34
|
-
var res = prim.call(input, hint || "default");
|
|
35
|
-
if (_typeof(res) !== "object") return res;
|
|
36
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
37
|
-
}
|
|
38
|
-
return (hint === "string" ? String : Number)(input);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _toPropertyKey(arg) {
|
|
42
|
-
var key = _toPrimitive(arg, "string");
|
|
43
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _defineProperty(obj, key, value) {
|
|
47
|
-
key = _toPropertyKey(key);
|
|
48
|
-
if (key in obj) {
|
|
49
|
-
Object.defineProperty(obj, key, {
|
|
50
|
-
value: value,
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
obj[key] = value;
|
|
57
|
-
}
|
|
58
|
-
return obj;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _extends() {
|
|
62
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
63
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
64
|
-
var source = arguments[i];
|
|
65
|
-
for (var key in source) {
|
|
66
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
67
|
-
target[key] = source[key];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return target;
|
|
72
|
-
};
|
|
73
|
-
return _extends.apply(this, arguments);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function _arrayLikeToArray(arr, len) {
|
|
77
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
78
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
79
|
-
return arr2;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _arrayWithoutHoles(arr) {
|
|
83
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function _iterableToArray(iter) {
|
|
87
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
91
|
-
if (!o) return;
|
|
92
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
93
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
94
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
95
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
96
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function _nonIterableSpread() {
|
|
100
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _toConsumableArray(arr) {
|
|
104
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function _arrayWithHoles(arr) {
|
|
108
|
-
if (Array.isArray(arr)) return arr;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function _iterableToArrayLimit(r, l) {
|
|
112
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
113
|
-
if (null != t) {
|
|
114
|
-
var e,
|
|
115
|
-
n,
|
|
116
|
-
i,
|
|
117
|
-
u,
|
|
118
|
-
a = [],
|
|
119
|
-
f = !0,
|
|
120
|
-
o = !1;
|
|
121
|
-
try {
|
|
122
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
123
|
-
if (Object(t) !== t) return;
|
|
124
|
-
f = !1;
|
|
125
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
126
|
-
} catch (r) {
|
|
127
|
-
o = !0, n = r;
|
|
128
|
-
} finally {
|
|
129
|
-
try {
|
|
130
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
131
|
-
} finally {
|
|
132
|
-
if (o) throw n;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return a;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function _nonIterableRest() {
|
|
140
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function _slicedToArray(arr, i) {
|
|
144
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
var classes = {
|
|
148
|
-
root: function root(_ref) {
|
|
149
|
-
var props = _ref.props,
|
|
150
|
-
focusedState = _ref.focusedState;
|
|
151
|
-
return classNames('p-autocomplete p-component p-inputwrapper', {
|
|
152
|
-
'p-autocomplete-dd': props.dropdown,
|
|
153
|
-
'p-autocomplete-multiple': props.multiple,
|
|
154
|
-
'p-inputwrapper-filled': props.value,
|
|
155
|
-
'p-inputwrapper-focus': focusedState
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
container: function container(_ref2) {
|
|
159
|
-
var props = _ref2.props;
|
|
160
|
-
return classNames('p-autocomplete-multiple-container p-component p-inputtext', {
|
|
161
|
-
'p-disabled': props.disabled
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
loadingIcon: 'p-autocomplete-loader',
|
|
165
|
-
dropdownButton: 'p-autocomplete-dropdown',
|
|
166
|
-
removeTokenIcon: 'p-autocomplete-token-icon',
|
|
167
|
-
token: 'p-autocomplete-token p-highlight',
|
|
168
|
-
tokenLabel: 'p-autocomplete-token-label',
|
|
169
|
-
inputToken: 'p-autocomplete-input-token',
|
|
170
|
-
input: function input(_ref3) {
|
|
171
|
-
var props = _ref3.props;
|
|
172
|
-
return classNames('p-autocomplete-input', {
|
|
173
|
-
'p-autocomplete-dd-input': props.dropdown
|
|
174
|
-
});
|
|
175
|
-
},
|
|
176
|
-
panel: function panel(_ref4) {
|
|
177
|
-
var context = _ref4.context;
|
|
178
|
-
return classNames('p-autocomplete-panel p-component', {
|
|
179
|
-
'p-input-filled': context && context.inputStyle === 'filled' || PrimeReact.inputStyle === 'filled',
|
|
180
|
-
'p-ripple-disabled': context && context.ripple === false || PrimeReact.ripple === false
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
listWrapper: 'p-autocomplete-items-wrapper',
|
|
184
|
-
list: function list(_ref5) {
|
|
185
|
-
var virtualScrollerOptions = _ref5.virtualScrollerOptions,
|
|
186
|
-
options = _ref5.options;
|
|
187
|
-
return virtualScrollerOptions ? classNames('p-autocomplete-items', options.className) : 'p-autocomplete-items';
|
|
188
|
-
},
|
|
189
|
-
emptyMessage: 'p-autocomplete-item',
|
|
190
|
-
item: function item(_ref6) {
|
|
191
|
-
var suggestion = _ref6.suggestion,
|
|
192
|
-
optionGroupLabel = _ref6.optionGroupLabel;
|
|
193
|
-
return optionGroupLabel ? classNames('p-autocomplete-item', {
|
|
194
|
-
'p-disabled': suggestion.disabled
|
|
195
|
-
}) : classNames('p-autocomplete-item', {
|
|
196
|
-
'p-disabled': suggestion.disabled
|
|
197
|
-
});
|
|
198
|
-
},
|
|
199
|
-
itemGroup: 'p-autocomplete-item-group',
|
|
200
|
-
footer: 'p-autocomplete-footer',
|
|
201
|
-
transition: 'p-connected-overlay'
|
|
202
|
-
};
|
|
203
|
-
var styles = "\n@layer primereact {\n .p-autocomplete {\n display: inline-flex;\n position: relative;\n }\n \n .p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-autocomplete-dd .p-autocomplete-input {\n flex: 1 1 auto;\n width: 1%;\n }\n \n .p-autocomplete-dd .p-autocomplete-input,\n .p-autocomplete-dd .p-autocomplete-multiple-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n \n .p-autocomplete-dd .p-autocomplete-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0px;\n }\n \n .p-autocomplete .p-autocomplete-panel {\n min-width: 100%;\n }\n \n .p-autocomplete-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-autocomplete-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-autocomplete-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-autocomplete-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n \n .p-autocomplete-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n }\n \n .p-autocomplete-token-icon {\n cursor: pointer;\n }\n \n .p-autocomplete-input-token {\n flex: 1 1 auto;\n display: inline-flex;\n }\n \n .p-autocomplete-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n }\n \n .p-fluid .p-autocomplete {\n display: flex;\n }\n \n .p-fluid .p-autocomplete-dd .p-autocomplete-input {\n width: 1%;\n }\n \n .p-autocomplete-items-wrapper {\n overflow: auto;\n } \n}\n";
|
|
204
|
-
var AutoCompleteBase = ComponentBase.extend({
|
|
205
|
-
defaultProps: {
|
|
206
|
-
__TYPE: 'AutoComplete',
|
|
207
|
-
id: null,
|
|
208
|
-
appendTo: null,
|
|
209
|
-
autoFocus: false,
|
|
210
|
-
autoHighlight: false,
|
|
211
|
-
className: null,
|
|
212
|
-
completeMethod: null,
|
|
213
|
-
delay: 300,
|
|
214
|
-
disabled: false,
|
|
215
|
-
dropdown: false,
|
|
216
|
-
dropdownAriaLabel: null,
|
|
217
|
-
dropdownAutoFocus: true,
|
|
218
|
-
dropdownIcon: null,
|
|
219
|
-
dropdownMode: 'blank',
|
|
220
|
-
emptyMessage: null,
|
|
221
|
-
field: null,
|
|
222
|
-
forceSelection: false,
|
|
223
|
-
inputClassName: null,
|
|
224
|
-
inputId: null,
|
|
225
|
-
inputRef: null,
|
|
226
|
-
inputStyle: null,
|
|
227
|
-
itemTemplate: null,
|
|
228
|
-
loadingIcon: null,
|
|
229
|
-
maxLength: null,
|
|
230
|
-
minLength: 1,
|
|
231
|
-
multiple: false,
|
|
232
|
-
name: null,
|
|
233
|
-
onBlur: null,
|
|
234
|
-
onChange: null,
|
|
235
|
-
onClear: null,
|
|
236
|
-
onClick: null,
|
|
237
|
-
onContextMenu: null,
|
|
238
|
-
onDblClick: null,
|
|
239
|
-
onDropdownClick: null,
|
|
240
|
-
onFocus: null,
|
|
241
|
-
onHide: null,
|
|
242
|
-
onKeyPress: null,
|
|
243
|
-
onKeyUp: null,
|
|
244
|
-
onMouseDown: null,
|
|
245
|
-
onSelect: null,
|
|
246
|
-
onShow: null,
|
|
247
|
-
onUnselect: null,
|
|
248
|
-
optionGroupChildren: null,
|
|
249
|
-
optionGroupLabel: null,
|
|
250
|
-
optionGroupTemplate: null,
|
|
251
|
-
panelClassName: null,
|
|
252
|
-
panelFooterTemplate: null,
|
|
253
|
-
panelStyle: null,
|
|
254
|
-
placeholder: null,
|
|
255
|
-
readOnly: false,
|
|
256
|
-
removeTokenIcon: null,
|
|
257
|
-
scrollHeight: '200px',
|
|
258
|
-
selectedItemTemplate: null,
|
|
259
|
-
selectionLimit: null,
|
|
260
|
-
showEmptyMessage: false,
|
|
261
|
-
size: null,
|
|
262
|
-
style: null,
|
|
263
|
-
suggestions: null,
|
|
264
|
-
tabIndex: null,
|
|
265
|
-
tooltip: null,
|
|
266
|
-
tooltipOptions: null,
|
|
267
|
-
transitionOptions: null,
|
|
268
|
-
type: 'text',
|
|
269
|
-
value: null,
|
|
270
|
-
virtualScrollerOptions: null,
|
|
271
|
-
children: undefined
|
|
272
|
-
},
|
|
273
|
-
css: {
|
|
274
|
-
classes: classes,
|
|
275
|
-
styles: styles
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
function ownKeys$1(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; }
|
|
280
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
281
|
-
var AutoCompletePanel = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
282
|
-
var ptm = props.ptm,
|
|
283
|
-
cx = props.cx;
|
|
284
|
-
var context = React.useContext(PrimeReactContext);
|
|
285
|
-
var _ptm = function _ptm(key, options) {
|
|
286
|
-
return ptm(key, _objectSpread$1({
|
|
287
|
-
hostName: props.hostName
|
|
288
|
-
}, options));
|
|
289
|
-
};
|
|
290
|
-
var getPTOptions = function getPTOptions(item, key) {
|
|
291
|
-
return _ptm(key, {
|
|
292
|
-
context: {
|
|
293
|
-
selected: props.selectedItem.current === item
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
};
|
|
297
|
-
var getOptionGroupRenderKey = function getOptionGroupRenderKey(optionGroup) {
|
|
298
|
-
return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel);
|
|
299
|
-
};
|
|
300
|
-
var createFooter = function createFooter() {
|
|
301
|
-
if (props.panelFooterTemplate) {
|
|
302
|
-
var content = ObjectUtils.getJSXElement(props.panelFooterTemplate, props, props.onOverlayHide);
|
|
303
|
-
var footerProps = mergeProps({
|
|
304
|
-
className: cx('footer')
|
|
305
|
-
}, _ptm('footer'));
|
|
306
|
-
return /*#__PURE__*/React.createElement("div", footerProps, content);
|
|
307
|
-
}
|
|
308
|
-
return null;
|
|
309
|
-
};
|
|
310
|
-
var createGroupChildren = function createGroupChildren(optionGroup, i, style) {
|
|
311
|
-
var groupChildren = props.getOptionGroupChildren(optionGroup);
|
|
312
|
-
return groupChildren.map(function (item, j) {
|
|
313
|
-
var key = i + '_' + j;
|
|
314
|
-
var selected = props.selectedItem === item;
|
|
315
|
-
var content = props.itemTemplate ? ObjectUtils.getJSXElement(props.itemTemplate, item, j) : props.field ? ObjectUtils.resolveFieldData(item, props.field) : item;
|
|
316
|
-
var itemProps = mergeProps({
|
|
317
|
-
role: 'option',
|
|
318
|
-
className: cx('item', {
|
|
319
|
-
optionGroupLabel: props.optionGroupLabel,
|
|
320
|
-
suggestion: item
|
|
321
|
-
}),
|
|
322
|
-
style: style,
|
|
323
|
-
onClick: function onClick(e) {
|
|
324
|
-
return props.onItemClick(e, item);
|
|
325
|
-
},
|
|
326
|
-
'aria-selected': selected,
|
|
327
|
-
'data-group': i,
|
|
328
|
-
'data-index': j,
|
|
329
|
-
'data-p-disabled': item.disabled
|
|
330
|
-
}, getPTOptions(item, 'item'));
|
|
331
|
-
return /*#__PURE__*/React.createElement("li", _extends({
|
|
332
|
-
key: key
|
|
333
|
-
}, itemProps), content, /*#__PURE__*/React.createElement(Ripple, null));
|
|
334
|
-
});
|
|
335
|
-
};
|
|
336
|
-
var createItem = function createItem(suggestion, index) {
|
|
337
|
-
var scrollerOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
338
|
-
var style = {
|
|
339
|
-
height: scrollerOptions.props ? scrollerOptions.props.itemSize : undefined
|
|
340
|
-
};
|
|
341
|
-
if (props.optionGroupLabel) {
|
|
342
|
-
var content = props.optionGroupTemplate ? ObjectUtils.getJSXElement(props.optionGroupTemplate, suggestion, index) : props.getOptionGroupLabel(suggestion);
|
|
343
|
-
var childrenContent = createGroupChildren(suggestion, index, style);
|
|
344
|
-
var key = index + '_' + getOptionGroupRenderKey(suggestion);
|
|
345
|
-
var itemGroupProps = mergeProps({
|
|
346
|
-
className: cx('itemGroup'),
|
|
347
|
-
style: style
|
|
348
|
-
}, _ptm('itemGroup'));
|
|
349
|
-
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
350
|
-
key: key
|
|
351
|
-
}, /*#__PURE__*/React.createElement("li", itemGroupProps, content), childrenContent);
|
|
352
|
-
} else {
|
|
353
|
-
var _content = props.itemTemplate ? ObjectUtils.getJSXElement(props.itemTemplate, suggestion, index) : props.field ? ObjectUtils.resolveFieldData(suggestion, props.field) : suggestion;
|
|
354
|
-
var itemProps = mergeProps({
|
|
355
|
-
index: index,
|
|
356
|
-
role: 'option',
|
|
357
|
-
className: cx('item', {
|
|
358
|
-
suggestion: suggestion
|
|
359
|
-
}),
|
|
360
|
-
style: style,
|
|
361
|
-
onClick: function onClick(e) {
|
|
362
|
-
return props.onItemClick(e, suggestion);
|
|
363
|
-
},
|
|
364
|
-
'aria-selected': props.selectedItem === suggestion,
|
|
365
|
-
'data-p-disabled': suggestion.disabled
|
|
366
|
-
}, getPTOptions(suggestion, 'item'));
|
|
367
|
-
return /*#__PURE__*/React.createElement("li", _extends({
|
|
368
|
-
key: index
|
|
369
|
-
}, itemProps), _content, /*#__PURE__*/React.createElement(Ripple, null));
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
var createItems = function createItems() {
|
|
373
|
-
return props.suggestions ? props.suggestions.map(createItem) : null;
|
|
374
|
-
};
|
|
375
|
-
var createContent = function createContent() {
|
|
376
|
-
if (props.showEmptyMessage && ObjectUtils.isEmpty(props.suggestions)) {
|
|
377
|
-
var emptyMessage = props.emptyMessage || localeOption('emptyMessage');
|
|
378
|
-
var emptyMessageProps = mergeProps({
|
|
379
|
-
className: cx('emptyMessage')
|
|
380
|
-
}, _ptm('emptyMesage'));
|
|
381
|
-
var listProps = mergeProps({
|
|
382
|
-
className: cx('list')
|
|
383
|
-
}, _ptm('list'));
|
|
384
|
-
return /*#__PURE__*/React.createElement("ul", listProps, /*#__PURE__*/React.createElement("li", emptyMessageProps, emptyMessage));
|
|
385
|
-
}
|
|
386
|
-
if (props.virtualScrollerOptions) {
|
|
387
|
-
var virtualScrollerProps = _objectSpread$1(_objectSpread$1({}, props.virtualScrollerOptions), {
|
|
388
|
-
style: _objectSpread$1(_objectSpread$1({}, props.virtualScrollerOptions.style), {
|
|
389
|
-
height: props.scrollHeight
|
|
390
|
-
}),
|
|
391
|
-
autoSize: true,
|
|
392
|
-
items: props.suggestions,
|
|
393
|
-
itemTemplate: function itemTemplate(item, options) {
|
|
394
|
-
return item && createItem(item, options.index, options);
|
|
395
|
-
},
|
|
396
|
-
contentTemplate: function contentTemplate(options) {
|
|
397
|
-
var listProps = mergeProps({
|
|
398
|
-
id: props.listId,
|
|
399
|
-
ref: options.contentRef,
|
|
400
|
-
style: options.style,
|
|
401
|
-
className: cx('list', {
|
|
402
|
-
virtualScrollerProps: virtualScrollerProps,
|
|
403
|
-
options: options
|
|
404
|
-
}),
|
|
405
|
-
role: 'listbox'
|
|
406
|
-
}, _ptm('list'));
|
|
407
|
-
return /*#__PURE__*/React.createElement("ul", listProps, options.children);
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
return /*#__PURE__*/React.createElement(VirtualScroller, _extends({
|
|
411
|
-
ref: props.virtualScrollerRef
|
|
412
|
-
}, virtualScrollerProps, {
|
|
413
|
-
pt: _ptm('virtualScroller'),
|
|
414
|
-
__parentMetadata: {
|
|
415
|
-
parent: props.metaData
|
|
416
|
-
}
|
|
417
|
-
}));
|
|
418
|
-
} else {
|
|
419
|
-
var items = createItems();
|
|
420
|
-
var _listProps = mergeProps({
|
|
421
|
-
id: props.listId,
|
|
422
|
-
className: cx('list'),
|
|
423
|
-
role: 'listbox'
|
|
424
|
-
}, _ptm('list'));
|
|
425
|
-
var listWrapperProps = mergeProps({
|
|
426
|
-
className: cx('listWrapper'),
|
|
427
|
-
style: {
|
|
428
|
-
maxHeight: props.scrollHeight || 'auto'
|
|
429
|
-
}
|
|
430
|
-
}, _ptm('listWrapper'));
|
|
431
|
-
return /*#__PURE__*/React.createElement("div", listWrapperProps, /*#__PURE__*/React.createElement("ul", _listProps, items));
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
var createElement = function createElement() {
|
|
435
|
-
var style = _objectSpread$1({}, props.panelStyle || {});
|
|
436
|
-
var content = createContent();
|
|
437
|
-
var footer = createFooter();
|
|
438
|
-
var panelProps = mergeProps({
|
|
439
|
-
className: classNames(props.panelClassName, cx('panel', {
|
|
440
|
-
context: context
|
|
441
|
-
})),
|
|
442
|
-
style: style,
|
|
443
|
-
onClick: function onClick(e) {
|
|
444
|
-
return props.onClick(e);
|
|
445
|
-
}
|
|
446
|
-
}, _ptm('panel'));
|
|
447
|
-
var transitionProps = mergeProps({
|
|
448
|
-
classNames: cx('transition'),
|
|
449
|
-
"in": props["in"],
|
|
450
|
-
timeout: {
|
|
451
|
-
enter: 120,
|
|
452
|
-
exit: 100
|
|
453
|
-
},
|
|
454
|
-
options: props.transitionOptions,
|
|
455
|
-
unmountOnExit: true,
|
|
456
|
-
onEnter: props.onEnter,
|
|
457
|
-
onEntering: props.onEntering,
|
|
458
|
-
onEntered: props.onEntered,
|
|
459
|
-
onExit: props.onExit,
|
|
460
|
-
onExited: props.onExited
|
|
461
|
-
}, _ptm('transition'));
|
|
462
|
-
return /*#__PURE__*/React.createElement(CSSTransition, _extends({
|
|
463
|
-
nodeRef: ref
|
|
464
|
-
}, transitionProps), /*#__PURE__*/React.createElement("div", _extends({
|
|
465
|
-
ref: ref
|
|
466
|
-
}, panelProps), content, footer));
|
|
467
|
-
};
|
|
468
|
-
var element = createElement();
|
|
469
|
-
return /*#__PURE__*/React.createElement(Portal, {
|
|
470
|
-
element: element,
|
|
471
|
-
appendTo: props.appendTo
|
|
472
|
-
});
|
|
473
|
-
}));
|
|
474
|
-
AutoCompletePanel.displayName = 'AutoCompletePanel';
|
|
475
|
-
|
|
476
|
-
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; }
|
|
477
|
-
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; }
|
|
478
|
-
var AutoComplete = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
479
|
-
var context = React.useContext(PrimeReactContext);
|
|
480
|
-
var props = AutoCompleteBase.getProps(inProps, context);
|
|
481
|
-
var _React$useState = React.useState(props.id),
|
|
482
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
483
|
-
idState = _React$useState2[0],
|
|
484
|
-
setIdState = _React$useState2[1];
|
|
485
|
-
var _React$useState3 = React.useState(false),
|
|
486
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
487
|
-
searchingState = _React$useState4[0],
|
|
488
|
-
setSearchingState = _React$useState4[1];
|
|
489
|
-
var _React$useState5 = React.useState(false),
|
|
490
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
491
|
-
focusedState = _React$useState6[0],
|
|
492
|
-
setFocusedState = _React$useState6[1];
|
|
493
|
-
var _React$useState7 = React.useState(false),
|
|
494
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
495
|
-
overlayVisibleState = _React$useState8[0],
|
|
496
|
-
setOverlayVisibleState = _React$useState8[1];
|
|
497
|
-
var metaData = {
|
|
498
|
-
props: props,
|
|
499
|
-
state: {
|
|
500
|
-
id: idState,
|
|
501
|
-
searching: searchingState,
|
|
502
|
-
focused: focusedState,
|
|
503
|
-
overlayVisible: overlayVisibleState
|
|
504
|
-
}
|
|
505
|
-
};
|
|
506
|
-
var _AutoCompleteBase$set = AutoCompleteBase.setMetaData(metaData),
|
|
507
|
-
ptm = _AutoCompleteBase$set.ptm,
|
|
508
|
-
cx = _AutoCompleteBase$set.cx,
|
|
509
|
-
sx = _AutoCompleteBase$set.sx,
|
|
510
|
-
isUnstyled = _AutoCompleteBase$set.isUnstyled;
|
|
511
|
-
useHandleStyle(AutoCompleteBase.css.styles, isUnstyled, {
|
|
512
|
-
name: 'autocomplete'
|
|
513
|
-
});
|
|
514
|
-
var elementRef = React.useRef(null);
|
|
515
|
-
var overlayRef = React.useRef(null);
|
|
516
|
-
var inputRef = React.useRef(props.inputRef);
|
|
517
|
-
var multiContainerRef = React.useRef(null);
|
|
518
|
-
var virtualScrollerRef = React.useRef(null);
|
|
519
|
-
var timeout = React.useRef(null);
|
|
520
|
-
var selectedItem = React.useRef(null);
|
|
521
|
-
var _useOverlayListener = useOverlayListener({
|
|
522
|
-
target: elementRef,
|
|
523
|
-
overlay: overlayRef,
|
|
524
|
-
listener: function listener(event, _ref) {
|
|
525
|
-
var type = _ref.type,
|
|
526
|
-
valid = _ref.valid;
|
|
527
|
-
if (valid) {
|
|
528
|
-
type === 'outside' ? !isInputClicked(event) && hide() : hide();
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
when: overlayVisibleState
|
|
532
|
-
}),
|
|
533
|
-
_useOverlayListener2 = _slicedToArray(_useOverlayListener, 2),
|
|
534
|
-
bindOverlayListener = _useOverlayListener2[0],
|
|
535
|
-
unbindOverlayListener = _useOverlayListener2[1];
|
|
536
|
-
var isInputClicked = function isInputClicked(event) {
|
|
537
|
-
return props.multiple ? event.target === multiContainerRef.current || multiContainerRef.current.contains(event.target) : event.target === inputRef.current;
|
|
538
|
-
};
|
|
539
|
-
var onInputChange = function onInputChange(event) {
|
|
540
|
-
//Cancel the search request if user types within the timeout
|
|
541
|
-
if (timeout.current) {
|
|
542
|
-
clearTimeout(timeout.current);
|
|
543
|
-
}
|
|
544
|
-
var query = event.target.value;
|
|
545
|
-
if (!props.multiple) {
|
|
546
|
-
updateModel(event, query);
|
|
547
|
-
}
|
|
548
|
-
if (ObjectUtils.isEmpty(query)) {
|
|
549
|
-
hide();
|
|
550
|
-
props.onClear && props.onClear(event);
|
|
551
|
-
} else {
|
|
552
|
-
if (query.length >= props.minLength) {
|
|
553
|
-
timeout.current = setTimeout(function () {
|
|
554
|
-
search(event, query, 'input');
|
|
555
|
-
}, props.delay);
|
|
556
|
-
} else {
|
|
557
|
-
hide();
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
var search = function search(event, query, source) {
|
|
562
|
-
//allow empty string but not undefined or null
|
|
563
|
-
if (query === undefined || query === null) {
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
//do not search blank values on input change
|
|
568
|
-
if (source === 'input' && query.trim().length === 0) {
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
if (props.completeMethod) {
|
|
572
|
-
setSearchingState(true);
|
|
573
|
-
props.completeMethod({
|
|
574
|
-
originalEvent: event,
|
|
575
|
-
query: query
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
var selectItem = function selectItem(event, option, preventInputFocus) {
|
|
580
|
-
if (props.multiple) {
|
|
581
|
-
inputRef.current.value = '';
|
|
582
|
-
|
|
583
|
-
// allows empty value/selectionlimit and within sectionlimit
|
|
584
|
-
if (!isSelected(option) && isAllowMoreValues()) {
|
|
585
|
-
var newValue = props.value ? [].concat(_toConsumableArray(props.value), [option]) : [option];
|
|
586
|
-
updateModel(event, newValue);
|
|
587
|
-
}
|
|
588
|
-
} else {
|
|
589
|
-
updateInputField(option);
|
|
590
|
-
updateModel(event, option);
|
|
591
|
-
}
|
|
592
|
-
if (props.onSelect) {
|
|
593
|
-
props.onSelect({
|
|
594
|
-
originalEvent: event,
|
|
595
|
-
value: option
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
if (!preventInputFocus) {
|
|
599
|
-
DomHandler.focus(inputRef.current);
|
|
600
|
-
hide();
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
|
-
var updateModel = function updateModel(event, value) {
|
|
604
|
-
// #2176 only call change if value actually changed
|
|
605
|
-
if (selectedItem && ObjectUtils.deepEquals(selectedItem.current, value)) {
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
if (props.onChange) {
|
|
609
|
-
props.onChange({
|
|
610
|
-
originalEvent: event,
|
|
611
|
-
value: value,
|
|
612
|
-
stopPropagation: function stopPropagation() {
|
|
613
|
-
event.stopPropagation();
|
|
614
|
-
},
|
|
615
|
-
preventDefault: function preventDefault() {
|
|
616
|
-
event.preventDefault();
|
|
617
|
-
},
|
|
618
|
-
target: {
|
|
619
|
-
name: props.name,
|
|
620
|
-
id: idState,
|
|
621
|
-
value: value
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
selectedItem.current = ObjectUtils.isNotEmpty(value) ? value : null;
|
|
626
|
-
};
|
|
627
|
-
var formatValue = function formatValue(value) {
|
|
628
|
-
if (value) {
|
|
629
|
-
if (typeof value === 'string') {
|
|
630
|
-
return value;
|
|
631
|
-
} else if (props.selectedItemTemplate) {
|
|
632
|
-
var resolvedFieldData = ObjectUtils.getJSXElement(props.selectedItemTemplate, value);
|
|
633
|
-
return resolvedFieldData ? resolvedFieldData : value;
|
|
634
|
-
} else if (props.field) {
|
|
635
|
-
var _resolvedFieldData = ObjectUtils.resolveFieldData(value, props.field);
|
|
636
|
-
return _resolvedFieldData !== null && _resolvedFieldData !== undefined ? _resolvedFieldData : value;
|
|
637
|
-
} else {
|
|
638
|
-
return value;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
return '';
|
|
642
|
-
};
|
|
643
|
-
var updateInputField = function updateInputField(value) {
|
|
644
|
-
inputRef.current.value = formatValue(value);
|
|
645
|
-
};
|
|
646
|
-
var show = function show() {
|
|
647
|
-
setOverlayVisibleState(true);
|
|
648
|
-
};
|
|
649
|
-
var hide = function hide() {
|
|
650
|
-
setOverlayVisibleState(false);
|
|
651
|
-
setSearchingState(false);
|
|
652
|
-
};
|
|
653
|
-
var onOverlayEnter = function onOverlayEnter() {
|
|
654
|
-
ZIndexUtils.set('overlay', overlayRef.current, context && context.autoZIndex || PrimeReact.autoZIndex, context && context.zIndex['overlay'] || PrimeReact.zIndex['overlay']);
|
|
655
|
-
DomHandler.addStyles(overlayRef.current, {
|
|
656
|
-
position: 'absolute',
|
|
657
|
-
top: '0',
|
|
658
|
-
left: '0'
|
|
659
|
-
});
|
|
660
|
-
alignOverlay();
|
|
661
|
-
};
|
|
662
|
-
var onOverlayEntering = function onOverlayEntering() {
|
|
663
|
-
if (props.autoHighlight && props.suggestions && props.suggestions.length) {
|
|
664
|
-
var element = getScrollableElement().firstChild.firstChild;
|
|
665
|
-
!isUnstyled() && DomHandler.addClass(element, 'p-highlight');
|
|
666
|
-
element.current.setAttribute('data-p-highlight', true);
|
|
667
|
-
}
|
|
668
|
-
};
|
|
669
|
-
var onOverlayEntered = function onOverlayEntered() {
|
|
670
|
-
bindOverlayListener();
|
|
671
|
-
props.onShow && props.onShow();
|
|
672
|
-
};
|
|
673
|
-
var onOverlayExit = function onOverlayExit() {
|
|
674
|
-
unbindOverlayListener();
|
|
675
|
-
};
|
|
676
|
-
var onOverlayExited = function onOverlayExited() {
|
|
677
|
-
ZIndexUtils.clear(overlayRef.current);
|
|
678
|
-
props.onHide && props.onHide();
|
|
679
|
-
};
|
|
680
|
-
var alignOverlay = function alignOverlay() {
|
|
681
|
-
var target = props.multiple ? multiContainerRef.current : inputRef.current;
|
|
682
|
-
DomHandler.alignOverlay(overlayRef.current, target, props.appendTo || context && context.appendTo || PrimeReact.appendTo);
|
|
683
|
-
};
|
|
684
|
-
var onPanelClick = function onPanelClick(event) {
|
|
685
|
-
OverlayService.emit('overlay-click', {
|
|
686
|
-
originalEvent: event,
|
|
687
|
-
target: elementRef.current
|
|
688
|
-
});
|
|
689
|
-
};
|
|
690
|
-
var onDropdownClick = function onDropdownClick(event) {
|
|
691
|
-
if (props.dropdownAutoFocus) {
|
|
692
|
-
DomHandler.focus(inputRef.current, props.dropdownAutoFocus);
|
|
693
|
-
}
|
|
694
|
-
if (props.dropdownMode === 'blank') search(event, '', 'dropdown');else if (props.dropdownMode === 'current') search(event, inputRef.current.value, 'dropdown');
|
|
695
|
-
if (props.onDropdownClick) {
|
|
696
|
-
props.onDropdownClick({
|
|
697
|
-
originalEvent: event,
|
|
698
|
-
query: inputRef.current.value
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
var removeItem = function removeItem(event, index) {
|
|
703
|
-
var removedValue = props.value[index];
|
|
704
|
-
var newValue = props.value.filter(function (_, i) {
|
|
705
|
-
return index !== i;
|
|
706
|
-
});
|
|
707
|
-
updateModel(event, newValue);
|
|
708
|
-
if (props.onUnselect) {
|
|
709
|
-
props.onUnselect({
|
|
710
|
-
originalEvent: event,
|
|
711
|
-
value: removedValue
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
var onInputKeyDown = function onInputKeyDown(event) {
|
|
716
|
-
if (overlayVisibleState) {
|
|
717
|
-
var highlightItem = DomHandler.findSingle(overlayRef.current, 'li.p-highlight');
|
|
718
|
-
switch (event.which) {
|
|
719
|
-
//down
|
|
720
|
-
case 40:
|
|
721
|
-
if (highlightItem) {
|
|
722
|
-
var nextElement = findNextItem(highlightItem);
|
|
723
|
-
if (nextElement) {
|
|
724
|
-
!isUnstyled() && DomHandler.addClass(nextElement, 'p-highlight');
|
|
725
|
-
nextElement.setAttribute('data-p-highlight', true);
|
|
726
|
-
DomHandler.removeClass(highlightItem, 'p-highlight');
|
|
727
|
-
DomHandler.scrollInView(getScrollableElement(), nextElement);
|
|
728
|
-
}
|
|
729
|
-
} else {
|
|
730
|
-
highlightItem = DomHandler.findSingle(overlayRef.current, 'li');
|
|
731
|
-
if (DomHandler.hasClass(highlightItem, 'p-autocomplete-item-group')) {
|
|
732
|
-
highlightItem = findNextItem(highlightItem);
|
|
733
|
-
}
|
|
734
|
-
if (highlightItem) {
|
|
735
|
-
!isUnstyled() && DomHandler.addClass(highlightItem, 'p-highlight');
|
|
736
|
-
highlightItem.setAttribute('data-p-highlight', true);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
event.preventDefault();
|
|
740
|
-
break;
|
|
741
|
-
|
|
742
|
-
//up
|
|
743
|
-
case 38:
|
|
744
|
-
if (highlightItem) {
|
|
745
|
-
var previousElement = findPrevItem(highlightItem);
|
|
746
|
-
if (previousElement) {
|
|
747
|
-
!isUnstyled() && DomHandler.addClass(previousElement, 'p-highlight');
|
|
748
|
-
previousElement.setAttribute('data-p-highlight', true);
|
|
749
|
-
!isUnstyled() && DomHandler.removeClass(highlightItem, 'p-highlight');
|
|
750
|
-
highlightItem.setAttribute('data-p-highlight', false);
|
|
751
|
-
DomHandler.scrollInView(getScrollableElement(), previousElement);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
event.preventDefault();
|
|
755
|
-
break;
|
|
756
|
-
|
|
757
|
-
//enter
|
|
758
|
-
case 13:
|
|
759
|
-
if (highlightItem) {
|
|
760
|
-
selectHighlightItem(event, highlightItem);
|
|
761
|
-
hide();
|
|
762
|
-
event.preventDefault();
|
|
763
|
-
}
|
|
764
|
-
break;
|
|
765
|
-
|
|
766
|
-
//escape
|
|
767
|
-
case 27:
|
|
768
|
-
hide();
|
|
769
|
-
event.preventDefault();
|
|
770
|
-
break;
|
|
771
|
-
|
|
772
|
-
//tab
|
|
773
|
-
case 9:
|
|
774
|
-
if (highlightItem) {
|
|
775
|
-
selectHighlightItem(event, highlightItem);
|
|
776
|
-
}
|
|
777
|
-
hide();
|
|
778
|
-
break;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
if (props.multiple) {
|
|
782
|
-
switch (event.which) {
|
|
783
|
-
//backspace
|
|
784
|
-
case 8:
|
|
785
|
-
if (props.value && props.value.length && !inputRef.current.value) {
|
|
786
|
-
var removedValue = props.value[props.value.length - 1];
|
|
787
|
-
var newValue = props.value.slice(0, -1);
|
|
788
|
-
updateModel(event, newValue);
|
|
789
|
-
if (props.onUnselect) {
|
|
790
|
-
props.onUnselect({
|
|
791
|
-
originalEvent: event,
|
|
792
|
-
value: removedValue
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
break;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
var selectHighlightItem = function selectHighlightItem(event, item) {
|
|
801
|
-
if (props.optionGroupLabel) {
|
|
802
|
-
var optionGroup = props.suggestions[item.dataset.group];
|
|
803
|
-
selectItem(event, getOptionGroupChildren(optionGroup)[item.dataset.index]);
|
|
804
|
-
} else {
|
|
805
|
-
selectItem(event, props.suggestions[item.getAttribute('index')]);
|
|
806
|
-
}
|
|
807
|
-
};
|
|
808
|
-
var findNextItem = function findNextItem(item) {
|
|
809
|
-
var nextItem = item.nextElementSibling;
|
|
810
|
-
return nextItem ? DomHandler.hasClass(nextItem, 'p-autocomplete-item-group') ? findNextItem(nextItem) : nextItem : null;
|
|
811
|
-
};
|
|
812
|
-
var findPrevItem = function findPrevItem(item) {
|
|
813
|
-
var prevItem = item.previousElementSibling;
|
|
814
|
-
return prevItem ? DomHandler.hasClass(prevItem, 'p-autocomplete-item-group') ? findPrevItem(prevItem) : prevItem : null;
|
|
815
|
-
};
|
|
816
|
-
var onInputFocus = function onInputFocus(event) {
|
|
817
|
-
setFocusedState(true);
|
|
818
|
-
props.onFocus && props.onFocus(event);
|
|
819
|
-
};
|
|
820
|
-
var forceItemSelection = function forceItemSelection(event) {
|
|
821
|
-
if (props.multiple) {
|
|
822
|
-
inputRef.current.value = '';
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
var inputValue = ObjectUtils.trim(event.target.value);
|
|
826
|
-
var item = (props.suggestions || []).find(function (it) {
|
|
827
|
-
var value = props.field ? ObjectUtils.resolveFieldData(it, props.field) : it;
|
|
828
|
-
return value && inputValue === ObjectUtils.trim(value);
|
|
829
|
-
});
|
|
830
|
-
if (item) {
|
|
831
|
-
selectItem(event, item, true);
|
|
832
|
-
} else {
|
|
833
|
-
inputRef.current.value = '';
|
|
834
|
-
updateModel(event, null);
|
|
835
|
-
props.onClear && props.onClear(event);
|
|
836
|
-
}
|
|
837
|
-
};
|
|
838
|
-
var onInputBlur = function onInputBlur(event) {
|
|
839
|
-
setFocusedState(false);
|
|
840
|
-
if (props.forceSelection) {
|
|
841
|
-
forceItemSelection(event);
|
|
842
|
-
}
|
|
843
|
-
props.onBlur && props.onBlur(event);
|
|
844
|
-
};
|
|
845
|
-
var onMultiContainerClick = function onMultiContainerClick(event) {
|
|
846
|
-
DomHandler.focus(inputRef.current);
|
|
847
|
-
props.onClick && props.onClick(event);
|
|
848
|
-
};
|
|
849
|
-
var onMultiInputFocus = function onMultiInputFocus(event) {
|
|
850
|
-
onInputFocus(event);
|
|
851
|
-
!isUnstyled() && DomHandler.addClass(multiContainerRef.current, 'p-focus');
|
|
852
|
-
multiContainerRef.current.setAttribute('data-p-focus', true);
|
|
853
|
-
};
|
|
854
|
-
var onMultiInputBlur = function onMultiInputBlur(event) {
|
|
855
|
-
onInputBlur(event);
|
|
856
|
-
!isUnstyled() && DomHandler.removeClass(multiContainerRef.current, 'p-focus');
|
|
857
|
-
multiContainerRef.current.setAttribute('data-p-focus', false);
|
|
858
|
-
};
|
|
859
|
-
var isSelected = function isSelected(val) {
|
|
860
|
-
return props.value ? props.value.some(function (v) {
|
|
861
|
-
return ObjectUtils.equals(v, val);
|
|
862
|
-
}) : false;
|
|
863
|
-
};
|
|
864
|
-
var getScrollableElement = function getScrollableElement() {
|
|
865
|
-
return overlayRef.current.firstChild;
|
|
866
|
-
};
|
|
867
|
-
var getOptionGroupLabel = function getOptionGroupLabel(optionGroup) {
|
|
868
|
-
return props.optionGroupLabel ? ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel) : optionGroup;
|
|
869
|
-
};
|
|
870
|
-
var getOptionGroupChildren = function getOptionGroupChildren(optionGroup) {
|
|
871
|
-
return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupChildren);
|
|
872
|
-
};
|
|
873
|
-
var isAllowMoreValues = function isAllowMoreValues() {
|
|
874
|
-
return !props.value || !props.selectionLimit || props.value.length < props.selectionLimit;
|
|
875
|
-
};
|
|
876
|
-
React.useEffect(function () {
|
|
877
|
-
ObjectUtils.combinedRefs(inputRef, props.inputRef);
|
|
878
|
-
}, [inputRef, props.inputRef]);
|
|
879
|
-
useMountEffect(function () {
|
|
880
|
-
if (!idState) {
|
|
881
|
-
setIdState(UniqueComponentId());
|
|
882
|
-
}
|
|
883
|
-
if (props.autoFocus) {
|
|
884
|
-
DomHandler.focus(inputRef.current, props.autoFocus);
|
|
885
|
-
}
|
|
886
|
-
});
|
|
887
|
-
useUpdateEffect(function () {
|
|
888
|
-
if (searchingState) {
|
|
889
|
-
ObjectUtils.isNotEmpty(props.suggestions) || props.showEmptyMessage ? show() : hide();
|
|
890
|
-
setSearchingState(false);
|
|
891
|
-
}
|
|
892
|
-
}, [props.suggestions]);
|
|
893
|
-
useUpdateEffect(function () {
|
|
894
|
-
if (inputRef.current && !props.multiple) {
|
|
895
|
-
updateInputField(props.value);
|
|
896
|
-
}
|
|
897
|
-
if (overlayVisibleState) {
|
|
898
|
-
alignOverlay();
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
useUnmountEffect(function () {
|
|
902
|
-
if (timeout.current) {
|
|
903
|
-
clearTimeout(timeout.current);
|
|
904
|
-
}
|
|
905
|
-
ZIndexUtils.clear(overlayRef.current);
|
|
906
|
-
});
|
|
907
|
-
React.useImperativeHandle(ref, function () {
|
|
908
|
-
return {
|
|
909
|
-
props: props,
|
|
910
|
-
search: search,
|
|
911
|
-
show: show,
|
|
912
|
-
hide: hide,
|
|
913
|
-
focus: function focus() {
|
|
914
|
-
return DomHandler.focus(inputRef.current);
|
|
915
|
-
},
|
|
916
|
-
getElement: function getElement() {
|
|
917
|
-
return elementRef.current;
|
|
918
|
-
},
|
|
919
|
-
getOverlay: function getOverlay() {
|
|
920
|
-
return overlayRef.current;
|
|
921
|
-
},
|
|
922
|
-
getInput: function getInput() {
|
|
923
|
-
return inputRef.current;
|
|
924
|
-
},
|
|
925
|
-
getVirtualScroller: function getVirtualScroller() {
|
|
926
|
-
return virtualScrollerRef.current;
|
|
927
|
-
}
|
|
928
|
-
};
|
|
929
|
-
});
|
|
930
|
-
var createSimpleAutoComplete = function createSimpleAutoComplete() {
|
|
931
|
-
var value = formatValue(props.value);
|
|
932
|
-
var ariaControls = overlayVisibleState ? idState + '_list' : null;
|
|
933
|
-
return /*#__PURE__*/React.createElement(InputText, _extends({
|
|
934
|
-
ref: inputRef,
|
|
935
|
-
id: props.inputId,
|
|
936
|
-
type: props.type,
|
|
937
|
-
name: props.name,
|
|
938
|
-
defaultValue: value,
|
|
939
|
-
role: "combobox",
|
|
940
|
-
"aria-autocomplete": "list",
|
|
941
|
-
"aria-controls": ariaControls,
|
|
942
|
-
"aria-haspopup": "listbox",
|
|
943
|
-
"aria-expanded": overlayVisibleState,
|
|
944
|
-
className: classNames(props.inputClassName, cx('input')),
|
|
945
|
-
style: props.inputStyle,
|
|
946
|
-
autoComplete: "off",
|
|
947
|
-
readOnly: props.readOnly,
|
|
948
|
-
required: props.required,
|
|
949
|
-
disabled: props.disabled,
|
|
950
|
-
placeholder: props.placeholder,
|
|
951
|
-
size: props.size,
|
|
952
|
-
maxLength: props.maxLength,
|
|
953
|
-
tabIndex: props.tabIndex,
|
|
954
|
-
onBlur: onInputBlur,
|
|
955
|
-
onFocus: onInputFocus,
|
|
956
|
-
onChange: onInputChange,
|
|
957
|
-
onMouseDown: props.onMouseDown,
|
|
958
|
-
onKeyUp: props.onKeyUp,
|
|
959
|
-
onKeyDown: onInputKeyDown,
|
|
960
|
-
onKeyPress: props.onKeyPress,
|
|
961
|
-
onContextMenu: props.onContextMenu,
|
|
962
|
-
onClick: props.onClick,
|
|
963
|
-
onDoubleClick: props.onDblClick,
|
|
964
|
-
pt: ptm('input')
|
|
965
|
-
}, ariaProps, {
|
|
966
|
-
__parentMetadata: {
|
|
967
|
-
parent: metaData
|
|
968
|
-
}
|
|
969
|
-
}));
|
|
970
|
-
};
|
|
971
|
-
var createChips = function createChips() {
|
|
972
|
-
if (ObjectUtils.isNotEmpty(props.value)) {
|
|
973
|
-
return props.value.map(function (val, index) {
|
|
974
|
-
var key = index + 'multi-item';
|
|
975
|
-
var removeTokenIconProps = mergeProps({
|
|
976
|
-
className: cx('removeTokenIcon'),
|
|
977
|
-
onClick: function onClick(e) {
|
|
978
|
-
return removeItem(e, index);
|
|
979
|
-
}
|
|
980
|
-
}, ptm('removeTokenIcon'));
|
|
981
|
-
var icon = props.removeTokenIcon || /*#__PURE__*/React.createElement(TimesCircleIcon, removeTokenIconProps);
|
|
982
|
-
var removeTokenIcon = !props.disabled && IconUtils.getJSXIcon(icon, _objectSpread({}, removeTokenIconProps), {
|
|
983
|
-
props: props
|
|
984
|
-
});
|
|
985
|
-
var tokenProps = mergeProps({
|
|
986
|
-
className: cx('token')
|
|
987
|
-
}, ptm('token'));
|
|
988
|
-
var tokenLabelProps = mergeProps({
|
|
989
|
-
className: cx('tokenLabel')
|
|
990
|
-
}, ptm('tokenLabel'));
|
|
991
|
-
return /*#__PURE__*/React.createElement("li", _extends({
|
|
992
|
-
key: key
|
|
993
|
-
}, tokenProps), /*#__PURE__*/React.createElement("span", tokenLabelProps, formatValue(val)), removeTokenIcon);
|
|
994
|
-
});
|
|
995
|
-
}
|
|
996
|
-
return null;
|
|
997
|
-
};
|
|
998
|
-
var createMultiInput = function createMultiInput(allowMoreValues) {
|
|
999
|
-
var ariaControls = overlayVisibleState ? idState + '_list' : null;
|
|
1000
|
-
var inputTokenProps = mergeProps({
|
|
1001
|
-
className: cx('inputToken')
|
|
1002
|
-
}, ptm('inputToken'));
|
|
1003
|
-
var inputProps = mergeProps(_objectSpread({
|
|
1004
|
-
id: props.inputId,
|
|
1005
|
-
ref: inputRef,
|
|
1006
|
-
'aria-autocomplete': 'list',
|
|
1007
|
-
'aria-controls': ariaControls,
|
|
1008
|
-
'aria-expanded': overlayVisibleState,
|
|
1009
|
-
'aria-haspopup': 'listbox',
|
|
1010
|
-
autoComplete: 'off',
|
|
1011
|
-
className: props.inputClassName,
|
|
1012
|
-
disabled: props.disabled,
|
|
1013
|
-
maxLength: props.maxLength,
|
|
1014
|
-
name: props.name,
|
|
1015
|
-
onBlur: onMultiInputBlur,
|
|
1016
|
-
onChange: allowMoreValues ? onInputChange : undefined,
|
|
1017
|
-
onFocus: onMultiInputFocus,
|
|
1018
|
-
onKeyDown: allowMoreValues ? onInputKeyDown : undefined,
|
|
1019
|
-
onKeyPress: props.onKeyPress,
|
|
1020
|
-
onKeyUp: props.onKeyUp,
|
|
1021
|
-
placeholder: allowMoreValues ? props.placeholder : undefined,
|
|
1022
|
-
readOnly: props.readOnly || !allowMoreValues,
|
|
1023
|
-
required: props.required,
|
|
1024
|
-
role: 'combobox',
|
|
1025
|
-
style: props.inputStyle,
|
|
1026
|
-
tabIndex: props.tabIndex,
|
|
1027
|
-
type: props.type
|
|
1028
|
-
}, ariaProps), ptm('input'));
|
|
1029
|
-
return /*#__PURE__*/React.createElement("li", inputTokenProps, /*#__PURE__*/React.createElement("input", inputProps));
|
|
1030
|
-
};
|
|
1031
|
-
var createMultipleAutoComplete = function createMultipleAutoComplete() {
|
|
1032
|
-
var allowMoreValues = isAllowMoreValues();
|
|
1033
|
-
var tokens = createChips();
|
|
1034
|
-
var input = createMultiInput(allowMoreValues);
|
|
1035
|
-
var containerProps = mergeProps({
|
|
1036
|
-
ref: multiContainerRef,
|
|
1037
|
-
className: cx('container'),
|
|
1038
|
-
onClick: allowMoreValues ? onMultiContainerClick : undefined,
|
|
1039
|
-
onContextMenu: props.onContextMenu,
|
|
1040
|
-
onMouseDown: props.onMouseDown,
|
|
1041
|
-
onDoubleClick: props.onDblClick,
|
|
1042
|
-
'data-p-focus': focusedState,
|
|
1043
|
-
'data-p-disabled': props.disabled
|
|
1044
|
-
}, ptm('container'));
|
|
1045
|
-
return /*#__PURE__*/React.createElement("ul", containerProps, tokens, input);
|
|
1046
|
-
};
|
|
1047
|
-
var createDropdown = function createDropdown() {
|
|
1048
|
-
if (props.dropdown) {
|
|
1049
|
-
var ariaLabel = props.dropdownAriaLabel || props.placeholder || localeOption('choose');
|
|
1050
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
1051
|
-
type: "button",
|
|
1052
|
-
icon: props.dropdownIcon || /*#__PURE__*/React.createElement(ChevronDownIcon, null),
|
|
1053
|
-
className: cx('dropdownButton'),
|
|
1054
|
-
disabled: props.disabled,
|
|
1055
|
-
onClick: onDropdownClick,
|
|
1056
|
-
"aria-label": ariaLabel,
|
|
1057
|
-
pt: ptm('dropdownButton'),
|
|
1058
|
-
__parentMetadata: {
|
|
1059
|
-
parent: metaData
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
return null;
|
|
1064
|
-
};
|
|
1065
|
-
var createLoader = function createLoader() {
|
|
1066
|
-
if (searchingState) {
|
|
1067
|
-
var loadingIconProps = mergeProps({
|
|
1068
|
-
className: cx('loadingIcon')
|
|
1069
|
-
}, ptm('loadingIcon'));
|
|
1070
|
-
var icon = props.loadingIcon || /*#__PURE__*/React.createElement(SpinnerIcon, _extends({}, loadingIconProps, {
|
|
1071
|
-
spin: true
|
|
1072
|
-
}));
|
|
1073
|
-
var loaderIcon = IconUtils.getJSXIcon(icon, _objectSpread({}, loadingIconProps), {
|
|
1074
|
-
props: props
|
|
1075
|
-
});
|
|
1076
|
-
return loaderIcon;
|
|
1077
|
-
}
|
|
1078
|
-
return null;
|
|
1079
|
-
};
|
|
1080
|
-
var createInput = function createInput() {
|
|
1081
|
-
return props.multiple ? createMultipleAutoComplete() : createSimpleAutoComplete();
|
|
1082
|
-
};
|
|
1083
|
-
var listId = idState + '_list';
|
|
1084
|
-
var hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
|
|
1085
|
-
var otherProps = AutoCompleteBase.getOtherProps(props);
|
|
1086
|
-
var ariaProps = ObjectUtils.reduceKeys(otherProps, DomHandler.ARIA_PROPS);
|
|
1087
|
-
var loader = createLoader();
|
|
1088
|
-
var input = createInput();
|
|
1089
|
-
var dropdown = createDropdown();
|
|
1090
|
-
var rootProps = mergeProps({
|
|
1091
|
-
id: idState,
|
|
1092
|
-
ref: elementRef,
|
|
1093
|
-
style: props.style,
|
|
1094
|
-
className: classNames(props.className, cx('root', {
|
|
1095
|
-
focusedState: focusedState
|
|
1096
|
-
}))
|
|
1097
|
-
}, otherProps, ptm('root'));
|
|
1098
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", rootProps, input, loader, dropdown, /*#__PURE__*/React.createElement(AutoCompletePanel, _extends({
|
|
1099
|
-
hostName: "AutoComplete",
|
|
1100
|
-
ref: overlayRef,
|
|
1101
|
-
virtualScrollerRef: virtualScrollerRef
|
|
1102
|
-
}, props, {
|
|
1103
|
-
listId: listId,
|
|
1104
|
-
onItemClick: selectItem,
|
|
1105
|
-
selectedItem: selectedItem,
|
|
1106
|
-
onClick: onPanelClick,
|
|
1107
|
-
getOptionGroupLabel: getOptionGroupLabel,
|
|
1108
|
-
getOptionGroupChildren: getOptionGroupChildren,
|
|
1109
|
-
"in": overlayVisibleState,
|
|
1110
|
-
onEnter: onOverlayEnter,
|
|
1111
|
-
onEntering: onOverlayEntering,
|
|
1112
|
-
onEntered: onOverlayEntered,
|
|
1113
|
-
onExit: onOverlayExit,
|
|
1114
|
-
onExited: onOverlayExited,
|
|
1115
|
-
ptm: ptm,
|
|
1116
|
-
cx: cx,
|
|
1117
|
-
sx: sx
|
|
1118
|
-
}))), hasTooltip && /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
1119
|
-
target: elementRef,
|
|
1120
|
-
content: props.tooltip
|
|
1121
|
-
}, props.tooltipOptions, {
|
|
1122
|
-
pt: ptm('tooltip')
|
|
1123
|
-
})));
|
|
1124
|
-
}));
|
|
1125
|
-
AutoComplete.displayName = 'AutoComplete';
|
|
1126
|
-
|
|
1127
|
-
export { AutoComplete };
|