primereact 10.0.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/componentbase/componentbase.cjs.js +12 -7
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.min.mjs +1 -1
- package/componentbase/componentbase.esm.mjs +12 -7
- package/componentbase/componentbase.js +12 -7
- package/componentbase/componentbase.min.js +1 -1
- package/core/core.js +12 -7
- package/core/core.min.js +1 -1
- package/package.json +1 -1
- package/primereact.all.cjs.js +12 -7
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.min.mjs +1 -1
- package/primereact.all.esm.mjs +12 -7
- package/primereact.all.js +12 -7
- package/primereact.all.min.js +1 -1
- package/web-types.json +1 -1
- package/accordion/accordion.esm.js +0 -421
- package/accordion/accordion.esm.min.js +0 -1
- package/api/api.esm.js +0 -944
- package/api/api.esm.min.js +0 -1
- package/autocomplete/autocomplete.esm.js +0 -1127
- package/autocomplete/autocomplete.esm.min.js +0 -1
- package/avatar/avatar.esm.js +0 -245
- package/avatar/avatar.esm.min.js +0 -1
- package/avatargroup/avatargroup.esm.js +0 -55
- package/avatargroup/avatargroup.esm.min.js +0 -1
- package/badge/badge.esm.js +0 -110
- package/badge/badge.esm.min.js +0 -1
- package/blockui/blockui.esm.js +0 -265
- package/blockui/blockui.esm.min.js +0 -1
- package/breadcrumb/breadcrumb.esm.js +0 -351
- package/breadcrumb/breadcrumb.esm.min.js +0 -1
- package/button/button.esm.js +0 -295
- package/button/button.esm.min.js +0 -1
- package/calendar/calendar.esm.js +0 -3473
- package/calendar/calendar.esm.min.js +0 -1
- package/card/card.esm.js +0 -98
- package/card/card.esm.min.js +0 -1
- package/carousel/carousel.esm.js +0 -801
- package/carousel/carousel.esm.min.js +0 -1
- package/cascadeselect/cascadeselect.esm.js +0 -819
- package/cascadeselect/cascadeselect.esm.min.js +0 -1
- package/chart/chart.esm.js +0 -155
- package/chart/chart.esm.min.js +0 -1
- package/checkbox/checkbox.esm.js +0 -357
- package/checkbox/checkbox.esm.min.js +0 -1
- package/chip/chip.esm.js +0 -248
- package/chip/chip.esm.min.js +0 -1
- package/chips/chips.esm.js +0 -501
- package/chips/chips.esm.min.js +0 -1
- package/colorpicker/colorpicker.esm.js +0 -788
- package/colorpicker/colorpicker.esm.min.js +0 -1
- package/column/column.esm.js +0 -8
- package/column/column.esm.min.js +0 -1
- package/columngroup/columngroup.esm.js +0 -6
- package/columngroup/columngroup.esm.min.js +0 -1
- package/componentbase/componentbase.esm.js +0 -323
- package/componentbase/componentbase.esm.min.js +0 -1
- package/confirmdialog/confirmdialog.esm.js +0 -376
- package/confirmdialog/confirmdialog.esm.min.js +0 -1
- package/confirmpopup/confirmpopup.esm.js +0 -610
- package/confirmpopup/confirmpopup.esm.min.js +0 -1
- package/contextmenu/contextmenu.esm.js +0 -664
- package/contextmenu/contextmenu.esm.min.js +0 -1
- package/csstransition/csstransition.esm.js +0 -138
- package/csstransition/csstransition.esm.min.js +0 -1
- package/datascroller/datascroller.esm.js +0 -320
- package/datascroller/datascroller.esm.min.js +0 -1
- package/datatable/datatable.esm.js +0 -6636
- package/datatable/datatable.esm.min.js +0 -1
- package/dataview/dataview.esm.js +0 -506
- package/dataview/dataview.esm.min.js +0 -1
- package/deferredcontent/deferredcontent.esm.js +0 -133
- package/deferredcontent/deferredcontent.esm.min.js +0 -1
- package/dialog/dialog.esm.js +0 -983
- package/dialog/dialog.esm.min.js +0 -1
- package/divider/divider.esm.js +0 -79
- package/divider/divider.esm.min.js +0 -1
- package/dock/dock.esm.js +0 -348
- package/dock/dock.esm.min.js +0 -1
- package/dropdown/dropdown.esm.js +0 -1380
- package/dropdown/dropdown.esm.min.js +0 -1
- package/editor/editor.esm.js +0 -338
- package/editor/editor.esm.min.js +0 -1
- package/fieldset/fieldset.esm.js +0 -270
- package/fieldset/fieldset.esm.min.js +0 -1
- package/fileupload/fileupload.esm.js +0 -1005
- package/fileupload/fileupload.esm.min.js +0 -1
- package/galleria/galleria.esm.js +0 -1090
- package/galleria/galleria.esm.min.js +0 -1
- package/hooks/hooks.esm.js +0 -1042
- package/hooks/hooks.esm.min.js +0 -1
- package/iconbase/iconbase.esm.js +0 -33
- package/iconbase/iconbase.esm.min.js +0 -1
- package/icons/angledoubledown/index.esm.js +0 -39
- package/icons/angledoubledown/index.esm.min.js +0 -1
- package/icons/angledoubleleft/index.esm.js +0 -39
- package/icons/angledoubleleft/index.esm.min.js +0 -1
- package/icons/angledoubleright/index.esm.js +0 -39
- package/icons/angledoubleright/index.esm.min.js +0 -1
- package/icons/angledoubleup/index.esm.js +0 -39
- package/icons/angledoubleup/index.esm.min.js +0 -1
- package/icons/angledown/index.esm.js +0 -37
- package/icons/angledown/index.esm.min.js +0 -1
- package/icons/angleleft/index.esm.js +0 -37
- package/icons/angleleft/index.esm.min.js +0 -1
- package/icons/angleright/index.esm.js +0 -37
- package/icons/angleright/index.esm.min.js +0 -1
- package/icons/angleup/index.esm.js +0 -37
- package/icons/angleup/index.esm.min.js +0 -1
- package/icons/arrowdown/index.esm.js +0 -661
- package/icons/arrowdown/index.esm.min.js +0 -1
- package/icons/arrowup/index.esm.js +0 -661
- package/icons/arrowup/index.esm.min.js +0 -1
- package/icons/ban/index.esm.js +0 -659
- package/icons/ban/index.esm.min.js +0 -1
- package/icons/bars/index.esm.js +0 -39
- package/icons/bars/index.esm.min.js +0 -1
- package/icons/calendar/index.esm.js +0 -37
- package/icons/calendar/index.esm.min.js +0 -1
- package/icons/check/index.esm.js +0 -37
- package/icons/check/index.esm.min.js +0 -1
- package/icons/chevrondown/index.esm.js +0 -37
- package/icons/chevrondown/index.esm.min.js +0 -1
- package/icons/chevronleft/index.esm.js +0 -37
- package/icons/chevronleft/index.esm.min.js +0 -1
- package/icons/chevronright/index.esm.js +0 -37
- package/icons/chevronright/index.esm.min.js +0 -1
- package/icons/chevronup/index.esm.js +0 -37
- package/icons/chevronup/index.esm.min.js +0 -1
- package/icons/download/index.esm.js +0 -661
- package/icons/download/index.esm.min.js +0 -1
- package/icons/exclamationtriangle/index.esm.js +0 -665
- package/icons/exclamationtriangle/index.esm.min.js +0 -1
- package/icons/eye/index.esm.js +0 -39
- package/icons/eye/index.esm.min.js +0 -1
- package/icons/eyeslash/index.esm.js +0 -661
- package/icons/eyeslash/index.esm.min.js +0 -1
- package/icons/filter/index.esm.js +0 -659
- package/icons/filter/index.esm.min.js +0 -1
- package/icons/filterslash/index.esm.js +0 -661
- package/icons/filterslash/index.esm.min.js +0 -1
- package/icons/infocircle/index.esm.js +0 -661
- package/icons/infocircle/index.esm.min.js +0 -1
- package/icons/minus/index.esm.js +0 -37
- package/icons/minus/index.esm.min.js +0 -1
- package/icons/pencil/index.esm.js +0 -659
- package/icons/pencil/index.esm.min.js +0 -1
- package/icons/plus/index.esm.js +0 -659
- package/icons/plus/index.esm.min.js +0 -1
- package/icons/refresh/index.esm.js +0 -661
- package/icons/refresh/index.esm.min.js +0 -1
- package/icons/search/index.esm.js +0 -661
- package/icons/search/index.esm.min.js +0 -1
- package/icons/searchminus/index.esm.js +0 -661
- package/icons/searchminus/index.esm.min.js +0 -1
- package/icons/searchplus/index.esm.js +0 -661
- package/icons/searchplus/index.esm.min.js +0 -1
- package/icons/sortalt/index.esm.js +0 -668
- package/icons/sortalt/index.esm.min.js +0 -1
- package/icons/sortamountdown/index.esm.js +0 -674
- package/icons/sortamountdown/index.esm.min.js +0 -1
- package/icons/sortamountupalt/index.esm.js +0 -674
- package/icons/sortamountupalt/index.esm.min.js +0 -1
- package/icons/spinner/index.esm.js +0 -659
- package/icons/spinner/index.esm.min.js +0 -1
- package/icons/star/index.esm.js +0 -659
- package/icons/star/index.esm.min.js +0 -1
- package/icons/starfill/index.esm.js +0 -659
- package/icons/starfill/index.esm.min.js +0 -1
- package/icons/thlarge/index.esm.js +0 -661
- package/icons/thlarge/index.esm.min.js +0 -1
- package/icons/times/index.esm.js +0 -37
- package/icons/times/index.esm.min.js +0 -1
- package/icons/timescircle/index.esm.js +0 -661
- package/icons/timescircle/index.esm.min.js +0 -1
- package/icons/trash/index.esm.js +0 -661
- package/icons/trash/index.esm.min.js +0 -1
- package/icons/undo/index.esm.js +0 -661
- package/icons/undo/index.esm.min.js +0 -1
- package/icons/upload/index.esm.js +0 -661
- package/icons/upload/index.esm.min.js +0 -1
- package/icons/windowmaximize/index.esm.js +0 -661
- package/icons/windowmaximize/index.esm.min.js +0 -1
- package/icons/windowminimize/index.esm.js +0 -661
- package/icons/windowminimize/index.esm.min.js +0 -1
- package/image/image.esm.js +0 -1162
- package/image/image.esm.min.js +0 -1
- package/inplace/inplace.esm.js +0 -243
- package/inplace/inplace.esm.min.js +0 -1
- package/inputmask/inputmask.esm.js +0 -560
- package/inputmask/inputmask.esm.min.js +0 -1
- package/inputnumber/inputnumber.esm.js +0 -1209
- package/inputnumber/inputnumber.esm.min.js +0 -1
- package/inputswitch/inputswitch.esm.js +0 -291
- package/inputswitch/inputswitch.esm.min.js +0 -1
- package/inputtext/inputtext.esm.js +0 -171
- package/inputtext/inputtext.esm.min.js +0 -1
- package/inputtextarea/inputtextarea.esm.js +0 -220
- package/inputtextarea/inputtextarea.esm.min.js +0 -1
- package/keyfilter/keyfilter.esm.js +0 -108
- package/keyfilter/keyfilter.esm.min.js +0 -1
- package/knob/knob.esm.js +0 -318
- package/knob/knob.esm.min.js +0 -1
- package/listbox/listbox.esm.js +0 -810
- package/listbox/listbox.esm.min.js +0 -1
- package/megamenu/megamenu.esm.js +0 -716
- package/megamenu/megamenu.esm.min.js +0 -1
- package/mention/mention.esm.js +0 -771
- package/mention/mention.esm.min.js +0 -1
- package/menu/menu.esm.js +0 -485
- package/menu/menu.esm.min.js +0 -1
- package/menubar/menubar.esm.js +0 -584
- package/menubar/menubar.esm.min.js +0 -1
- package/message/message.esm.js +0 -169
- package/message/message.esm.min.js +0 -1
- package/messages/messages.esm.js +0 -439
- package/messages/messages.esm.min.js +0 -1
- package/multiselect/multiselect.esm.js +0 -1724
- package/multiselect/multiselect.esm.min.js +0 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +0 -352
- package/multistatecheckbox/multistatecheckbox.esm.min.js +0 -1
- package/orderlist/orderlist.esm.js +0 -816
- package/orderlist/orderlist.esm.min.js +0 -1
- package/organizationchart/organizationchart.esm.js +0 -480
- package/organizationchart/organizationchart.esm.min.js +0 -1
- package/overlaypanel/overlaypanel.esm.js +0 -516
- package/overlaypanel/overlaypanel.esm.min.js +0 -1
- package/overlayservice/overlayservice.esm.js +0 -7
- package/overlayservice/overlayservice.esm.min.js +0 -1
- package/paginator/paginator.esm.js +0 -933
- package/paginator/paginator.esm.min.js +0 -1
- package/panel/panel.esm.js +0 -316
- package/panel/panel.esm.min.js +0 -1
- package/panelmenu/panelmenu.esm.js +0 -645
- package/panelmenu/panelmenu.esm.min.js +0 -1
- package/passthrough/index.esm.js +0 -71
- package/passthrough/index.esm.min.js +0 -1
- package/passthrough/tailwind/index.esm.js +0 -3509
- package/passthrough/tailwind/index.esm.min.js +0 -1
- package/password/password.esm.js +0 -567
- package/password/password.esm.min.js +0 -1
- package/picklist/picklist.esm.js +0 -1119
- package/picklist/picklist.esm.min.js +0 -1
- package/portal/portal.esm.js +0 -110
- package/portal/portal.esm.min.js +0 -1
- package/primereact.all.esm.js +0 -51646
- package/primereact.all.esm.min.js +0 -1
- package/progressbar/progressbar.esm.js +0 -190
- package/progressbar/progressbar.esm.min.js +0 -1
- package/progressspinner/progressspinner.esm.js +0 -88
- package/progressspinner/progressspinner.esm.min.js +0 -1
- package/radiobutton/radiobutton.esm.js +0 -329
- package/radiobutton/radiobutton.esm.min.js +0 -1
- package/rating/rating.esm.js +0 -273
- package/rating/rating.esm.min.js +0 -1
- package/ripple/ripple.esm.js +0 -100
- package/ripple/ripple.esm.min.js +0 -1
- package/row/row.esm.js +0 -36
- package/row/row.esm.min.js +0 -1
- package/scrollpanel/scrollpanel.esm.js +0 -210
- package/scrollpanel/scrollpanel.esm.min.js +0 -1
- package/scrolltop/scrolltop.esm.js +0 -269
- package/scrolltop/scrolltop.esm.min.js +0 -1
- package/selectbutton/selectbutton.esm.js +0 -327
- package/selectbutton/selectbutton.esm.min.js +0 -1
- package/sidebar/sidebar.esm.js +0 -543
- package/sidebar/sidebar.esm.min.js +0 -1
- package/skeleton/skeleton.esm.js +0 -125
- package/skeleton/skeleton.esm.min.js +0 -1
- package/slidemenu/slidemenu.esm.js +0 -689
- package/slidemenu/slidemenu.esm.min.js +0 -1
- package/slider/slider.esm.js +0 -478
- package/slider/slider.esm.min.js +0 -1
- package/speeddial/speeddial.esm.js +0 -521
- package/speeddial/speeddial.esm.min.js +0 -1
- package/splitbutton/splitbutton.esm.js +0 -545
- package/splitbutton/splitbutton.esm.min.js +0 -1
- package/splitter/splitter.esm.js +0 -466
- package/splitter/splitter.esm.min.js +0 -1
- package/steps/steps.esm.js +0 -294
- package/steps/steps.esm.min.js +0 -1
- package/styleclass/styleclass.esm.js +0 -269
- package/styleclass/styleclass.esm.min.js +0 -1
- package/tabmenu/tabmenu.esm.js +0 -332
- package/tabmenu/tabmenu.esm.min.js +0 -1
- package/tabview/tabview.esm.js +0 -678
- package/tabview/tabview.esm.min.js +0 -1
- package/tag/tag.esm.js +0 -117
- package/tag/tag.esm.min.js +0 -1
- package/terminal/terminal.esm.js +0 -280
- package/terminal/terminal.esm.min.js +0 -1
- package/terminalservice/terminalservice.esm.js +0 -7
- package/terminalservice/terminalservice.esm.min.js +0 -1
- package/tieredmenu/tieredmenu.esm.js +0 -699
- package/tieredmenu/tieredmenu.esm.min.js +0 -1
- package/timeline/timeline.esm.js +0 -164
- package/timeline/timeline.esm.min.js +0 -1
- package/toast/toast.esm.js +0 -739
- package/toast/toast.esm.min.js +0 -1
- package/togglebutton/togglebutton.esm.js +0 -217
- package/togglebutton/togglebutton.esm.min.js +0 -1
- package/toolbar/toolbar.esm.js +0 -79
- package/toolbar/toolbar.esm.min.js +0 -1
- package/tooltip/tooltip.esm.js +0 -696
- package/tooltip/tooltip.esm.min.js +0 -1
- package/tree/tree.esm.js +0 -1403
- package/tree/tree.esm.min.js +0 -1
- package/treeselect/treeselect.esm.js +0 -930
- package/treeselect/treeselect.esm.min.js +0 -1
- package/treetable/treetable.esm.js +0 -3094
- package/treetable/treetable.esm.min.js +0 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +0 -292
- package/tristatecheckbox/tristatecheckbox.esm.min.js +0 -1
- package/utils/utils.esm.js +0 -2383
- package/utils/utils.esm.min.js +0 -1
- package/virtualscroller/virtualscroller.esm.js +0 -972
- package/virtualscroller/virtualscroller.esm.min.js +0 -1
package/tree/tree.esm.js
DELETED
|
@@ -1,1403 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { ariaLabel, PrimeReactContext } from 'primereact/api';
|
|
5
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
6
|
-
import { SearchIcon } from 'primereact/icons/search';
|
|
7
|
-
import { SpinnerIcon } from 'primereact/icons/spinner';
|
|
8
|
-
import { classNames, mergeProps, DomHandler, ObjectUtils, IconUtils } from 'primereact/utils';
|
|
9
|
-
import { CheckIcon } from 'primereact/icons/check';
|
|
10
|
-
import { ChevronDownIcon } from 'primereact/icons/chevrondown';
|
|
11
|
-
import { ChevronRightIcon } from 'primereact/icons/chevronright';
|
|
12
|
-
import { MinusIcon } from 'primereact/icons/minus';
|
|
13
|
-
import { Ripple } from 'primereact/ripple';
|
|
14
|
-
|
|
15
|
-
function _extends() {
|
|
16
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
17
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
18
|
-
var source = arguments[i];
|
|
19
|
-
for (var key in source) {
|
|
20
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
21
|
-
target[key] = source[key];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return target;
|
|
26
|
-
};
|
|
27
|
-
return _extends.apply(this, arguments);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function _arrayLikeToArray$2(arr, len) {
|
|
31
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
32
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
33
|
-
return arr2;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _arrayWithoutHoles(arr) {
|
|
37
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _iterableToArray(iter) {
|
|
41
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _unsupportedIterableToArray$2(o, minLen) {
|
|
45
|
-
if (!o) return;
|
|
46
|
-
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
|
|
47
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
48
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
49
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
50
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function _nonIterableSpread() {
|
|
54
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _toConsumableArray(arr) {
|
|
58
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _typeof(o) {
|
|
62
|
-
"@babel/helpers - typeof";
|
|
63
|
-
|
|
64
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
65
|
-
return typeof o;
|
|
66
|
-
} : function (o) {
|
|
67
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
68
|
-
}, _typeof(o);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function _toPrimitive(input, hint) {
|
|
72
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
73
|
-
var prim = input[Symbol.toPrimitive];
|
|
74
|
-
if (prim !== undefined) {
|
|
75
|
-
var res = prim.call(input, hint || "default");
|
|
76
|
-
if (_typeof(res) !== "object") return res;
|
|
77
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
78
|
-
}
|
|
79
|
-
return (hint === "string" ? String : Number)(input);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _toPropertyKey(arg) {
|
|
83
|
-
var key = _toPrimitive(arg, "string");
|
|
84
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function _defineProperty(obj, key, value) {
|
|
88
|
-
key = _toPropertyKey(key);
|
|
89
|
-
if (key in obj) {
|
|
90
|
-
Object.defineProperty(obj, key, {
|
|
91
|
-
value: value,
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true,
|
|
94
|
-
writable: true
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
obj[key] = value;
|
|
98
|
-
}
|
|
99
|
-
return obj;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function _arrayWithHoles(arr) {
|
|
103
|
-
if (Array.isArray(arr)) return arr;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function _iterableToArrayLimit(r, l) {
|
|
107
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
108
|
-
if (null != t) {
|
|
109
|
-
var e,
|
|
110
|
-
n,
|
|
111
|
-
i,
|
|
112
|
-
u,
|
|
113
|
-
a = [],
|
|
114
|
-
f = !0,
|
|
115
|
-
o = !1;
|
|
116
|
-
try {
|
|
117
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
118
|
-
if (Object(t) !== t) return;
|
|
119
|
-
f = !1;
|
|
120
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
121
|
-
} catch (r) {
|
|
122
|
-
o = !0, n = r;
|
|
123
|
-
} finally {
|
|
124
|
-
try {
|
|
125
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
126
|
-
} finally {
|
|
127
|
-
if (o) throw n;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return a;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function _nonIterableRest() {
|
|
135
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function _slicedToArray(arr, i) {
|
|
139
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
var classes = {
|
|
143
|
-
container: 'p-tree-container',
|
|
144
|
-
loadingIcon: 'p-tree-loading-icon',
|
|
145
|
-
loadingOverlay: 'p-tree-loading-overlay p-component-overlay',
|
|
146
|
-
searchIcon: 'p-tree-filter-icon',
|
|
147
|
-
filterContainer: 'p-tree-filter-container',
|
|
148
|
-
input: 'p-tree-filter p-inputtext p-component',
|
|
149
|
-
header: 'p-tree-header',
|
|
150
|
-
footer: 'p-tree-footer',
|
|
151
|
-
root: function root(_ref) {
|
|
152
|
-
var props = _ref.props;
|
|
153
|
-
return classNames('p-tree p-component', {
|
|
154
|
-
'p-tree-selectable': props.selectionMode,
|
|
155
|
-
'p-tree-loading': props.loading,
|
|
156
|
-
'p-disabled': props.disabled
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
label: 'p-treenode-label',
|
|
160
|
-
checkboxIcon: 'p-checkbox-icon p-c',
|
|
161
|
-
checkboxContainer: 'p-checkbox p-component',
|
|
162
|
-
checkbox: function checkbox(_ref2) {
|
|
163
|
-
var props = _ref2.nodeProps,
|
|
164
|
-
checked = _ref2.checked,
|
|
165
|
-
partialChecked = _ref2.partialChecked;
|
|
166
|
-
return classNames('p-checkbox-box', {
|
|
167
|
-
'p-highlight': checked,
|
|
168
|
-
'p-indeterminate': partialChecked,
|
|
169
|
-
'p-disabled': props.disabled
|
|
170
|
-
});
|
|
171
|
-
},
|
|
172
|
-
nodeIcon: 'p-treenode-icon',
|
|
173
|
-
togglerIcon: 'p-tree-toggler-icon',
|
|
174
|
-
toggler: 'p-tree-toggler p-link',
|
|
175
|
-
droppoint: 'p-treenode-droppoint',
|
|
176
|
-
content: function content(_ref3) {
|
|
177
|
-
var props = _ref3.nodeProps,
|
|
178
|
-
checked = _ref3.checked,
|
|
179
|
-
selected = _ref3.selected,
|
|
180
|
-
isCheckboxSelectionMode = _ref3.isCheckboxSelectionMode;
|
|
181
|
-
return classNames('p-treenode-content', {
|
|
182
|
-
'p-treenode-selectable': props.selectionMode && props.node.selectable !== false,
|
|
183
|
-
'p-highlight': isCheckboxSelectionMode() ? checked : selected,
|
|
184
|
-
'p-highlight-contextmenu': props.contextMenuSelectionKey && props.contextMenuSelectionKey === props.node.key,
|
|
185
|
-
'p-disabled': props.disabled
|
|
186
|
-
});
|
|
187
|
-
},
|
|
188
|
-
subgroup: 'p-treenode-children',
|
|
189
|
-
node: function node(_ref4) {
|
|
190
|
-
var isLeaf = _ref4.isLeaf;
|
|
191
|
-
return classNames('p-treenode', {
|
|
192
|
-
'p-treenode-leaf': isLeaf
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
var styles = "\n@layer primereact {\n .p-tree-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow: auto;\n }\n \n .p-treenode-children {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-treenode-selectable {\n cursor: pointer;\n user-select: none;\n }\n \n .p-tree-toggler {\n cursor: pointer;\n user-select: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n position: relative;\n }\n \n .p-treenode-leaf > .p-treenode-content .p-tree-toggler {\n visibility: hidden;\n }\n \n .p-treenode-content {\n display: flex;\n align-items: center;\n }\n \n .p-tree-filter {\n width: 100%;\n }\n \n .p-tree-filter-container {\n position: relative;\n display: block;\n width: 100%;\n }\n \n .p-tree-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-tree-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-tree .p-tree-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n";
|
|
197
|
-
var TreeBase = ComponentBase.extend({
|
|
198
|
-
defaultProps: {
|
|
199
|
-
__TYPE: 'Tree',
|
|
200
|
-
__parentMetadata: null,
|
|
201
|
-
id: null,
|
|
202
|
-
value: null,
|
|
203
|
-
checkboxIcon: null,
|
|
204
|
-
disabled: false,
|
|
205
|
-
selectionMode: null,
|
|
206
|
-
selectionKeys: null,
|
|
207
|
-
onSelectionChange: null,
|
|
208
|
-
contextMenuSelectionKey: null,
|
|
209
|
-
onContextMenuSelectionChange: null,
|
|
210
|
-
expandedKeys: null,
|
|
211
|
-
style: null,
|
|
212
|
-
className: null,
|
|
213
|
-
contentStyle: null,
|
|
214
|
-
contentClassName: null,
|
|
215
|
-
metaKeySelection: true,
|
|
216
|
-
propagateSelectionUp: true,
|
|
217
|
-
propagateSelectionDown: true,
|
|
218
|
-
loading: false,
|
|
219
|
-
loadingIcon: null,
|
|
220
|
-
expandIcon: null,
|
|
221
|
-
collapseIcon: null,
|
|
222
|
-
dragdropScope: null,
|
|
223
|
-
header: null,
|
|
224
|
-
footer: null,
|
|
225
|
-
showHeader: true,
|
|
226
|
-
filter: false,
|
|
227
|
-
filterIcon: null,
|
|
228
|
-
filterValue: null,
|
|
229
|
-
filterBy: 'label',
|
|
230
|
-
filterMode: 'lenient',
|
|
231
|
-
filterPlaceholder: null,
|
|
232
|
-
filterLocale: undefined,
|
|
233
|
-
filterTemplate: null,
|
|
234
|
-
nodeTemplate: null,
|
|
235
|
-
togglerTemplate: null,
|
|
236
|
-
onSelect: null,
|
|
237
|
-
onUnselect: null,
|
|
238
|
-
onExpand: null,
|
|
239
|
-
onCollapse: null,
|
|
240
|
-
onToggle: null,
|
|
241
|
-
onDragDrop: null,
|
|
242
|
-
onContextMenu: null,
|
|
243
|
-
onFilterValueChange: null,
|
|
244
|
-
onNodeClick: null,
|
|
245
|
-
onNodeDoubleClick: null,
|
|
246
|
-
children: undefined
|
|
247
|
-
},
|
|
248
|
-
css: {
|
|
249
|
-
classes: classes,
|
|
250
|
-
styles: styles
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
255
|
-
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
256
|
-
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
257
|
-
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; }
|
|
258
|
-
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; }
|
|
259
|
-
var UITreeNode = /*#__PURE__*/React.memo(function (props) {
|
|
260
|
-
var contentRef = React.useRef(null);
|
|
261
|
-
var nodeTouched = React.useRef(false);
|
|
262
|
-
var isLeaf = props.isNodeLeaf(props.node);
|
|
263
|
-
var expanded = (props.expandedKeys ? props.expandedKeys[props.node.key] !== undefined : false) || props.node.expanded;
|
|
264
|
-
var ptm = props.ptm,
|
|
265
|
-
cx = props.cx;
|
|
266
|
-
var getPTOptions = function getPTOptions(key) {
|
|
267
|
-
return ptm(key, {
|
|
268
|
-
hostName: props.hostName,
|
|
269
|
-
context: {
|
|
270
|
-
selected: props.selected,
|
|
271
|
-
expanded: expanded,
|
|
272
|
-
checked: props.checked,
|
|
273
|
-
isLeaf: isLeaf
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
var expand = function expand(event) {
|
|
278
|
-
var expandedKeys = props.expandedKeys ? _objectSpread$1({}, props.expandedKeys) : {};
|
|
279
|
-
expandedKeys[props.node.key] = true;
|
|
280
|
-
props.onToggle({
|
|
281
|
-
originalEvent: event,
|
|
282
|
-
value: expandedKeys
|
|
283
|
-
});
|
|
284
|
-
invokeToggleEvents(event, true);
|
|
285
|
-
};
|
|
286
|
-
var collapse = function collapse(event) {
|
|
287
|
-
var expandedKeys = _objectSpread$1({}, props.expandedKeys);
|
|
288
|
-
delete expandedKeys[props.node.key];
|
|
289
|
-
props.onToggle({
|
|
290
|
-
originalEvent: event,
|
|
291
|
-
value: expandedKeys
|
|
292
|
-
});
|
|
293
|
-
invokeToggleEvents(event, false);
|
|
294
|
-
};
|
|
295
|
-
var onTogglerClick = function onTogglerClick(event) {
|
|
296
|
-
if (props.disabled) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
expanded ? collapse(event) : expand(event);
|
|
300
|
-
event.preventDefault();
|
|
301
|
-
event.stopPropagation();
|
|
302
|
-
};
|
|
303
|
-
var invokeToggleEvents = function invokeToggleEvents(event, isExpanded) {
|
|
304
|
-
if (isExpanded) {
|
|
305
|
-
if (props.onExpand) {
|
|
306
|
-
props.onExpand({
|
|
307
|
-
originalEvent: event,
|
|
308
|
-
node: props.node
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
} else {
|
|
312
|
-
if (props.onCollapse) {
|
|
313
|
-
props.onCollapse({
|
|
314
|
-
originalEvent: event,
|
|
315
|
-
node: props.node
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
var onNodeKeyDown = function onNodeKeyDown(event) {
|
|
321
|
-
if (props.disabled) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
var nodeElement = event.target.parentElement;
|
|
325
|
-
if (!DomHandler.hasClass(nodeElement, 'p-treenode')) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
switch (event.which) {
|
|
329
|
-
//down arrow
|
|
330
|
-
case 40:
|
|
331
|
-
var listElement = nodeElement.children[1];
|
|
332
|
-
if (listElement) {
|
|
333
|
-
focusNode(listElement.children[0]);
|
|
334
|
-
} else {
|
|
335
|
-
var nextNodeElement = nodeElement.nextElementSibling;
|
|
336
|
-
while (nextNodeElement) {
|
|
337
|
-
if (!DomHandler.hasClass(nextNodeElement, 'p-treenode-droppoint')) {
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
nextNodeElement = nextNodeElement.nextElementSibling;
|
|
341
|
-
}
|
|
342
|
-
if (nextNodeElement) {
|
|
343
|
-
focusNode(nextNodeElement);
|
|
344
|
-
} else {
|
|
345
|
-
var nextSiblingAncestor = findNextSiblingOfAncestor(nodeElement);
|
|
346
|
-
nextSiblingAncestor && focusNode(nextSiblingAncestor);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
event.preventDefault();
|
|
350
|
-
break;
|
|
351
|
-
|
|
352
|
-
//up arrow
|
|
353
|
-
case 38:
|
|
354
|
-
if (nodeElement.previousElementSibling) {
|
|
355
|
-
focusNode(findLastVisibleDescendant(nodeElement.previousElementSibling));
|
|
356
|
-
} else {
|
|
357
|
-
var parentNodeElement = getParentNodeElement(nodeElement);
|
|
358
|
-
parentNodeElement && focusNode(parentNodeElement);
|
|
359
|
-
}
|
|
360
|
-
event.preventDefault();
|
|
361
|
-
break;
|
|
362
|
-
|
|
363
|
-
//right arrow
|
|
364
|
-
case 39:
|
|
365
|
-
if (!expanded) {
|
|
366
|
-
expand(event);
|
|
367
|
-
}
|
|
368
|
-
event.preventDefault();
|
|
369
|
-
break;
|
|
370
|
-
|
|
371
|
-
//left arrow
|
|
372
|
-
case 37:
|
|
373
|
-
if (expanded) {
|
|
374
|
-
collapse(event);
|
|
375
|
-
}
|
|
376
|
-
event.preventDefault();
|
|
377
|
-
break;
|
|
378
|
-
|
|
379
|
-
//enter
|
|
380
|
-
case 13:
|
|
381
|
-
onClick(event);
|
|
382
|
-
event.preventDefault();
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
var findNextSiblingOfAncestor = function findNextSiblingOfAncestor(nodeElement) {
|
|
387
|
-
var parentNodeElement = getParentNodeElement(nodeElement);
|
|
388
|
-
return parentNodeElement ? parentNodeElement.nextElementSibling || findNextSiblingOfAncestor(parentNodeElement) : null;
|
|
389
|
-
};
|
|
390
|
-
var findLastVisibleDescendant = function findLastVisibleDescendant(nodeElement) {
|
|
391
|
-
var childrenListElement = nodeElement.children[1];
|
|
392
|
-
if (childrenListElement) {
|
|
393
|
-
var lastChildElement = childrenListElement.children[childrenListElement.children.length - 1];
|
|
394
|
-
return findLastVisibleDescendant(lastChildElement);
|
|
395
|
-
} else {
|
|
396
|
-
return nodeElement;
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
var getParentNodeElement = function getParentNodeElement(nodeElement) {
|
|
400
|
-
var parentNodeElement = nodeElement.parentElement.parentElement;
|
|
401
|
-
return DomHandler.hasClass(parentNodeElement, 'p-treenode') ? parentNodeElement : null;
|
|
402
|
-
};
|
|
403
|
-
var focusNode = function focusNode(element) {
|
|
404
|
-
element && element.children[0] && element.children[0].focus();
|
|
405
|
-
};
|
|
406
|
-
var onClick = function onClick(event) {
|
|
407
|
-
if (props.onClick) {
|
|
408
|
-
props.onClick({
|
|
409
|
-
originalEvent: event,
|
|
410
|
-
node: props.node
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
var targetNode = event.target.nodeName;
|
|
414
|
-
if (props.disabled || targetNode === 'INPUT' || targetNode === 'BUTTON' || targetNode === 'A' || DomHandler.hasClass(event.target, 'p-clickable')) {
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
if (props.selectionMode && props.node.selectable !== false) {
|
|
418
|
-
var selectionKeys;
|
|
419
|
-
if (isCheckboxSelectionMode()) {
|
|
420
|
-
var checked = isChecked();
|
|
421
|
-
selectionKeys = props.selectionKeys ? _objectSpread$1({}, props.selectionKeys) : {};
|
|
422
|
-
if (checked) {
|
|
423
|
-
if (props.propagateSelectionDown) propagateDown(props.node, false, selectionKeys);else delete selectionKeys[props.node.key];
|
|
424
|
-
if (props.propagateSelectionUp && props.onPropagateUp) {
|
|
425
|
-
props.onPropagateUp({
|
|
426
|
-
originalEvent: event,
|
|
427
|
-
check: false,
|
|
428
|
-
selectionKeys: selectionKeys
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
if (props.onUnselect) {
|
|
432
|
-
props.onUnselect({
|
|
433
|
-
originalEvent: event,
|
|
434
|
-
node: props.node
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
} else {
|
|
438
|
-
if (props.propagateSelectionDown) propagateDown(props.node, true, selectionKeys);else selectionKeys[props.node.key] = {
|
|
439
|
-
checked: true
|
|
440
|
-
};
|
|
441
|
-
if (props.propagateSelectionUp && props.onPropagateUp) {
|
|
442
|
-
props.onPropagateUp({
|
|
443
|
-
originalEvent: event,
|
|
444
|
-
check: true,
|
|
445
|
-
selectionKeys: selectionKeys
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
if (props.onSelect) {
|
|
449
|
-
props.onSelect({
|
|
450
|
-
originalEvent: event,
|
|
451
|
-
node: props.node
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
} else {
|
|
456
|
-
var selected = isSelected();
|
|
457
|
-
var metaSelection = nodeTouched.current ? false : props.metaKeySelection;
|
|
458
|
-
if (metaSelection) {
|
|
459
|
-
var metaKey = event.metaKey || event.ctrlKey;
|
|
460
|
-
if (selected && metaKey) {
|
|
461
|
-
if (isSingleSelectionMode()) {
|
|
462
|
-
selectionKeys = null;
|
|
463
|
-
} else {
|
|
464
|
-
selectionKeys = _objectSpread$1({}, props.selectionKeys);
|
|
465
|
-
delete selectionKeys[props.node.key];
|
|
466
|
-
}
|
|
467
|
-
if (props.onUnselect) {
|
|
468
|
-
props.onUnselect({
|
|
469
|
-
originalEvent: event,
|
|
470
|
-
node: props.node
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
} else {
|
|
474
|
-
if (isSingleSelectionMode()) {
|
|
475
|
-
selectionKeys = props.node.key;
|
|
476
|
-
} else if (isMultipleSelectionMode()) {
|
|
477
|
-
selectionKeys = !metaKey ? {} : props.selectionKeys ? _objectSpread$1({}, props.selectionKeys) : {};
|
|
478
|
-
selectionKeys[props.node.key] = true;
|
|
479
|
-
}
|
|
480
|
-
if (props.onSelect) {
|
|
481
|
-
props.onSelect({
|
|
482
|
-
originalEvent: event,
|
|
483
|
-
node: props.node
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
} else {
|
|
488
|
-
if (isSingleSelectionMode()) {
|
|
489
|
-
if (selected) {
|
|
490
|
-
selectionKeys = null;
|
|
491
|
-
if (props.onUnselect) {
|
|
492
|
-
props.onUnselect({
|
|
493
|
-
originalEvent: event,
|
|
494
|
-
node: props.node
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
} else {
|
|
498
|
-
selectionKeys = props.node.key;
|
|
499
|
-
if (props.onSelect) {
|
|
500
|
-
props.onSelect({
|
|
501
|
-
originalEvent: event,
|
|
502
|
-
node: props.node
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
} else {
|
|
507
|
-
if (selected) {
|
|
508
|
-
selectionKeys = _objectSpread$1({}, props.selectionKeys);
|
|
509
|
-
delete selectionKeys[props.node.key];
|
|
510
|
-
if (props.onUnselect) {
|
|
511
|
-
props.onUnselect({
|
|
512
|
-
originalEvent: event,
|
|
513
|
-
node: props.node
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
} else {
|
|
517
|
-
selectionKeys = props.selectionKeys ? _objectSpread$1({}, props.selectionKeys) : {};
|
|
518
|
-
selectionKeys[props.node.key] = true;
|
|
519
|
-
if (props.onSelect) {
|
|
520
|
-
props.onSelect({
|
|
521
|
-
originalEvent: event,
|
|
522
|
-
node: props.node
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
if (props.onSelectionChange) {
|
|
530
|
-
props.onSelectionChange({
|
|
531
|
-
originalEvent: event,
|
|
532
|
-
value: selectionKeys
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
nodeTouched.current = false;
|
|
537
|
-
};
|
|
538
|
-
var onDoubleClick = function onDoubleClick(event) {
|
|
539
|
-
if (props.onDoubleClick) {
|
|
540
|
-
props.onDoubleClick({
|
|
541
|
-
originalEvent: event,
|
|
542
|
-
node: props.node
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
var onRightClick = function onRightClick(event) {
|
|
547
|
-
if (props.disabled) {
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
DomHandler.clearSelection();
|
|
551
|
-
if (props.onContextMenuSelectionChange) {
|
|
552
|
-
props.onContextMenuSelectionChange({
|
|
553
|
-
originalEvent: event,
|
|
554
|
-
value: props.node.key
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
if (props.onContextMenu) {
|
|
558
|
-
props.onContextMenu({
|
|
559
|
-
originalEvent: event,
|
|
560
|
-
node: props.node
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
var propagateUp = function propagateUp(event) {
|
|
565
|
-
var check = event.check;
|
|
566
|
-
var selectionKeys = event.selectionKeys;
|
|
567
|
-
var checkedChildCount = 0;
|
|
568
|
-
var _iterator = _createForOfIteratorHelper$1(props.node.children),
|
|
569
|
-
_step;
|
|
570
|
-
try {
|
|
571
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
572
|
-
var child = _step.value;
|
|
573
|
-
if (selectionKeys[child.key] && selectionKeys[child.key].checked) checkedChildCount++;
|
|
574
|
-
}
|
|
575
|
-
} catch (err) {
|
|
576
|
-
_iterator.e(err);
|
|
577
|
-
} finally {
|
|
578
|
-
_iterator.f();
|
|
579
|
-
}
|
|
580
|
-
var parentKey = props.node.key;
|
|
581
|
-
var children = ObjectUtils.findChildrenByKey(props.originalOptions, parentKey);
|
|
582
|
-
var isParentPartiallyChecked = children.some(function (ele) {
|
|
583
|
-
return ele.key in selectionKeys;
|
|
584
|
-
});
|
|
585
|
-
var isCompletelyChecked = children.every(function (ele) {
|
|
586
|
-
return ele.key in selectionKeys && selectionKeys[ele.key].checked;
|
|
587
|
-
});
|
|
588
|
-
if (isParentPartiallyChecked && !isCompletelyChecked) {
|
|
589
|
-
selectionKeys[parentKey] = {
|
|
590
|
-
checked: false,
|
|
591
|
-
partialChecked: true
|
|
592
|
-
};
|
|
593
|
-
} else if (isCompletelyChecked) {
|
|
594
|
-
selectionKeys[parentKey] = {
|
|
595
|
-
checked: true,
|
|
596
|
-
partialChecked: false
|
|
597
|
-
};
|
|
598
|
-
} else if (check) {
|
|
599
|
-
selectionKeys[parentKey] = {
|
|
600
|
-
checked: false,
|
|
601
|
-
partialChecked: false
|
|
602
|
-
};
|
|
603
|
-
} else {
|
|
604
|
-
delete selectionKeys[parentKey];
|
|
605
|
-
}
|
|
606
|
-
if (props.propagateSelectionUp && props.onPropagateUp) {
|
|
607
|
-
props.onPropagateUp(event);
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
|
-
var propagateDown = function propagateDown(node, check, selectionKeys) {
|
|
611
|
-
if (check) selectionKeys[node.key] = {
|
|
612
|
-
checked: true,
|
|
613
|
-
partialChecked: false
|
|
614
|
-
};else delete selectionKeys[node.key];
|
|
615
|
-
if (node.children && node.children.length) {
|
|
616
|
-
for (var i = 0; i < node.children.length; i++) {
|
|
617
|
-
propagateDown(node.children[i], check, selectionKeys);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
var isSelected = function isSelected() {
|
|
622
|
-
if (props.selectionMode && props.selectionKeys) return isSingleSelectionMode() ? props.selectionKeys === props.node.key : props.selectionKeys[props.node.key] !== undefined;else return false;
|
|
623
|
-
};
|
|
624
|
-
var isChecked = function isChecked() {
|
|
625
|
-
return (props.selectionKeys ? props.selectionKeys[props.node.key] && props.selectionKeys[props.node.key].checked : false) || false;
|
|
626
|
-
};
|
|
627
|
-
var isPartialChecked = function isPartialChecked() {
|
|
628
|
-
return props.selectionKeys ? props.selectionKeys[props.node.key] && props.selectionKeys[props.node.key].partialChecked : false;
|
|
629
|
-
};
|
|
630
|
-
var isSingleSelectionMode = function isSingleSelectionMode() {
|
|
631
|
-
return props.selectionMode && props.selectionMode === 'single';
|
|
632
|
-
};
|
|
633
|
-
var isMultipleSelectionMode = function isMultipleSelectionMode() {
|
|
634
|
-
return props.selectionMode && props.selectionMode === 'multiple';
|
|
635
|
-
};
|
|
636
|
-
var isCheckboxSelectionMode = function isCheckboxSelectionMode() {
|
|
637
|
-
return props.selectionMode && props.selectionMode === 'checkbox';
|
|
638
|
-
};
|
|
639
|
-
var onTouchEnd = function onTouchEnd() {
|
|
640
|
-
nodeTouched.current = true;
|
|
641
|
-
};
|
|
642
|
-
var onDropPoint = function onDropPoint(event, position) {
|
|
643
|
-
event.preventDefault();
|
|
644
|
-
if (props.node.droppable !== false) {
|
|
645
|
-
DomHandler.removeClass(event.target, 'p-treenode-droppoint-active');
|
|
646
|
-
if (props.onDropPoint) {
|
|
647
|
-
var dropIndex = position === -1 ? props.index : props.index + 1;
|
|
648
|
-
props.onDropPoint({
|
|
649
|
-
originalEvent: event,
|
|
650
|
-
path: props.path,
|
|
651
|
-
index: dropIndex,
|
|
652
|
-
position: position
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
var onDropPointDragOver = function onDropPointDragOver(event) {
|
|
658
|
-
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
|
|
659
|
-
event.dataTransfer.dropEffect = 'move';
|
|
660
|
-
event.preventDefault();
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
var onDropPointDragEnter = function onDropPointDragEnter(event) {
|
|
664
|
-
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
|
|
665
|
-
DomHandler.addClass(event.target, 'p-treenode-droppoint-active');
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
|
-
var onDropPointDragLeave = function onDropPointDragLeave(event) {
|
|
669
|
-
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase()) {
|
|
670
|
-
DomHandler.removeClass(event.target, 'p-treenode-droppoint-active');
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
var onDrop = function onDrop(event) {
|
|
674
|
-
if (props.dragdropScope && props.node.droppable !== false) {
|
|
675
|
-
DomHandler.removeClass(contentRef.current, 'p-treenode-dragover');
|
|
676
|
-
event.preventDefault();
|
|
677
|
-
event.stopPropagation();
|
|
678
|
-
if (props.onDrop) {
|
|
679
|
-
props.onDrop({
|
|
680
|
-
originalEvent: event,
|
|
681
|
-
path: props.path,
|
|
682
|
-
index: props.index
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
|
-
var onDragOver = function onDragOver(event) {
|
|
688
|
-
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
|
|
689
|
-
event.dataTransfer.dropEffect = 'move';
|
|
690
|
-
event.preventDefault();
|
|
691
|
-
event.stopPropagation();
|
|
692
|
-
}
|
|
693
|
-
};
|
|
694
|
-
var onDragEnter = function onDragEnter(event) {
|
|
695
|
-
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
|
|
696
|
-
DomHandler.addClass(contentRef.current, 'p-treenode-dragover');
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
var onDragLeave = function onDragLeave(event) {
|
|
700
|
-
if (event.dataTransfer.types[1] === props.dragdropScope.toLocaleLowerCase() && props.node.droppable !== false) {
|
|
701
|
-
var rect = event.currentTarget.getBoundingClientRect();
|
|
702
|
-
if (event.nativeEvent.x > rect.left + rect.width || event.nativeEvent.x < rect.left || event.nativeEvent.y >= Math.floor(rect.top + rect.height) || event.nativeEvent.y < rect.top) {
|
|
703
|
-
DomHandler.removeClass(contentRef.current, 'p-treenode-dragover');
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
var onDragStart = function onDragStart(event) {
|
|
708
|
-
event.dataTransfer.setData('text', props.dragdropScope);
|
|
709
|
-
event.dataTransfer.setData(props.dragdropScope, props.dragdropScope);
|
|
710
|
-
if (props.onDragStart) {
|
|
711
|
-
props.onDragStart({
|
|
712
|
-
originalEvent: event,
|
|
713
|
-
path: props.path,
|
|
714
|
-
index: props.index
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
var onDragEnd = function onDragEnd(event) {
|
|
719
|
-
if (props.onDragEnd) {
|
|
720
|
-
props.onDragEnd({
|
|
721
|
-
originalEvent: event
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
var createLabel = function createLabel() {
|
|
726
|
-
var labelProps = mergeProps({
|
|
727
|
-
className: cx('label')
|
|
728
|
-
}, getPTOptions('label'));
|
|
729
|
-
var content = /*#__PURE__*/React.createElement("span", labelProps, props.node.label);
|
|
730
|
-
if (props.nodeTemplate) {
|
|
731
|
-
var defaultContentOptions = {
|
|
732
|
-
onTogglerClick: onTogglerClick,
|
|
733
|
-
className: 'p-treenode-label',
|
|
734
|
-
element: content,
|
|
735
|
-
props: props,
|
|
736
|
-
expanded: expanded
|
|
737
|
-
};
|
|
738
|
-
content = ObjectUtils.getJSXElement(props.nodeTemplate, props.node, defaultContentOptions);
|
|
739
|
-
}
|
|
740
|
-
return content;
|
|
741
|
-
};
|
|
742
|
-
var createCheckbox = function createCheckbox() {
|
|
743
|
-
if (isCheckboxSelectionMode() && props.node.selectable !== false) {
|
|
744
|
-
var checked = isChecked();
|
|
745
|
-
var partialChecked = isPartialChecked();
|
|
746
|
-
var checkboxIconProps = mergeProps({
|
|
747
|
-
className: cx('checkboxIcon')
|
|
748
|
-
}, getPTOptions('checkboxIcon'));
|
|
749
|
-
var icon = checked ? props.checkboxIcon || /*#__PURE__*/React.createElement(CheckIcon, checkboxIconProps) : partialChecked ? props.checkboxIcon || /*#__PURE__*/React.createElement(MinusIcon, checkboxIconProps) : null;
|
|
750
|
-
var checkboxIcon = IconUtils.getJSXIcon(icon, _objectSpread$1({}, checkboxIconProps), props);
|
|
751
|
-
var checkboxContainerProps = mergeProps({
|
|
752
|
-
className: cx('checkboxContainer')
|
|
753
|
-
}, getPTOptions('checkboxContainer'));
|
|
754
|
-
var checkboxProps = mergeProps({
|
|
755
|
-
className: cx('checkbox', {
|
|
756
|
-
checked: checked,
|
|
757
|
-
partialChecked: partialChecked,
|
|
758
|
-
nodeProps: props
|
|
759
|
-
}),
|
|
760
|
-
role: 'checkbox',
|
|
761
|
-
'aria-checked': checked
|
|
762
|
-
}, getPTOptions('checkbox'));
|
|
763
|
-
return /*#__PURE__*/React.createElement("div", checkboxContainerProps, /*#__PURE__*/React.createElement("div", checkboxProps, checkboxIcon));
|
|
764
|
-
}
|
|
765
|
-
return null;
|
|
766
|
-
};
|
|
767
|
-
var createIcon = function createIcon() {
|
|
768
|
-
var icon = props.node.icon || (expanded ? props.node.expandedIcon : props.node.collapsedIcon);
|
|
769
|
-
if (icon) {
|
|
770
|
-
var nodeIconProps = mergeProps({
|
|
771
|
-
className: classNames(icon, cx('nodeIcon'))
|
|
772
|
-
}, getPTOptions('nodeIcon'));
|
|
773
|
-
return /*#__PURE__*/React.createElement("span", nodeIconProps);
|
|
774
|
-
}
|
|
775
|
-
return null;
|
|
776
|
-
};
|
|
777
|
-
var createToggler = function createToggler() {
|
|
778
|
-
var label = expanded ? ariaLabel('collapseLabel') : ariaLabel('expandLabel');
|
|
779
|
-
var togglerIconProps = mergeProps({
|
|
780
|
-
className: cx('togglerIcon'),
|
|
781
|
-
'aria-hidden': true
|
|
782
|
-
}, getPTOptions('togglerIcon'));
|
|
783
|
-
var icon = expanded ? props.collapseIcon || /*#__PURE__*/React.createElement(ChevronDownIcon, togglerIconProps) : props.expandIcon || /*#__PURE__*/React.createElement(ChevronRightIcon, togglerIconProps);
|
|
784
|
-
var togglerIcon = IconUtils.getJSXIcon(icon, _objectSpread$1({}, togglerIconProps), {
|
|
785
|
-
props: props,
|
|
786
|
-
expanded: expanded
|
|
787
|
-
});
|
|
788
|
-
var togglerProps = mergeProps({
|
|
789
|
-
type: 'button',
|
|
790
|
-
className: cx('toggler'),
|
|
791
|
-
tabIndex: -1,
|
|
792
|
-
onClick: onTogglerClick,
|
|
793
|
-
'aria-label': label
|
|
794
|
-
}, getPTOptions('toggler'));
|
|
795
|
-
var content = /*#__PURE__*/React.createElement("button", togglerProps, togglerIcon, /*#__PURE__*/React.createElement(Ripple, null));
|
|
796
|
-
if (props.togglerTemplate) {
|
|
797
|
-
var defaultContentOptions = {
|
|
798
|
-
onClick: onTogglerClick,
|
|
799
|
-
containerClassName: 'p-tree-toggler p-link',
|
|
800
|
-
iconClassName: 'p-tree-toggler-icon',
|
|
801
|
-
element: content,
|
|
802
|
-
props: props,
|
|
803
|
-
expanded: expanded
|
|
804
|
-
};
|
|
805
|
-
content = ObjectUtils.getJSXElement(props.togglerTemplate, props.node, defaultContentOptions);
|
|
806
|
-
}
|
|
807
|
-
return content;
|
|
808
|
-
};
|
|
809
|
-
var createDropPoint = function createDropPoint(position) {
|
|
810
|
-
if (props.dragdropScope) {
|
|
811
|
-
var droppointProps = mergeProps({
|
|
812
|
-
className: cx('droppoint'),
|
|
813
|
-
onDrop: function onDrop(event) {
|
|
814
|
-
return onDropPoint(event, position);
|
|
815
|
-
},
|
|
816
|
-
onDragOver: onDropPointDragOver,
|
|
817
|
-
onDragEnter: onDropPointDragEnter,
|
|
818
|
-
onDragLeave: onDropPointDragLeave
|
|
819
|
-
}, getPTOptions('droppoint'));
|
|
820
|
-
return /*#__PURE__*/React.createElement("li", droppointProps);
|
|
821
|
-
}
|
|
822
|
-
return null;
|
|
823
|
-
};
|
|
824
|
-
var createContent = function createContent() {
|
|
825
|
-
var selected = isSelected();
|
|
826
|
-
var checked = isChecked();
|
|
827
|
-
var toggler = createToggler();
|
|
828
|
-
var checkbox = createCheckbox();
|
|
829
|
-
var icon = createIcon();
|
|
830
|
-
var label = createLabel();
|
|
831
|
-
var contentProps = mergeProps({
|
|
832
|
-
ref: contentRef,
|
|
833
|
-
className: classNames(props.node.className, cx('content', {
|
|
834
|
-
checked: checked,
|
|
835
|
-
selected: selected,
|
|
836
|
-
nodeProps: props,
|
|
837
|
-
isCheckboxSelectionMode: isCheckboxSelectionMode
|
|
838
|
-
})),
|
|
839
|
-
style: props.node.style,
|
|
840
|
-
onClick: onClick,
|
|
841
|
-
onDoubleClick: onDoubleClick,
|
|
842
|
-
onContextMenu: onRightClick,
|
|
843
|
-
onTouchEnd: onTouchEnd,
|
|
844
|
-
draggable: props.dragdropScope && props.node.draggable !== false && !props.disabled,
|
|
845
|
-
onDrop: onDrop,
|
|
846
|
-
onDragOver: onDragOver,
|
|
847
|
-
onDragEnter: onDragEnter,
|
|
848
|
-
onDragLeave: onDragLeave,
|
|
849
|
-
onDragStart: onDragStart,
|
|
850
|
-
onDragEnd: onDragEnd,
|
|
851
|
-
onKeyDown: onNodeKeyDown
|
|
852
|
-
}, getPTOptions('content'));
|
|
853
|
-
return /*#__PURE__*/React.createElement("div", contentProps, toggler, checkbox, icon, label);
|
|
854
|
-
};
|
|
855
|
-
var createChildren = function createChildren() {
|
|
856
|
-
var subgroupProps = mergeProps({
|
|
857
|
-
className: cx('subgroup'),
|
|
858
|
-
role: 'group'
|
|
859
|
-
}, getPTOptions('subgroup'));
|
|
860
|
-
if (ObjectUtils.isNotEmpty(props.node.children) && expanded) {
|
|
861
|
-
return /*#__PURE__*/React.createElement("ul", subgroupProps, props.node.children.map(function (childNode, index) {
|
|
862
|
-
return /*#__PURE__*/React.createElement(UITreeNode, {
|
|
863
|
-
key: childNode.key || childNode.label,
|
|
864
|
-
node: childNode,
|
|
865
|
-
originalOptions: props.originalOptions,
|
|
866
|
-
parent: props.node,
|
|
867
|
-
index: index,
|
|
868
|
-
last: index === props.node.children.length - 1,
|
|
869
|
-
path: props.path + '-' + index,
|
|
870
|
-
disabled: props.disabled,
|
|
871
|
-
selectionMode: props.selectionMode,
|
|
872
|
-
selectionKeys: props.selectionKeys,
|
|
873
|
-
onSelectionChange: props.onSelectionChange,
|
|
874
|
-
metaKeySelection: props.metaKeySelection,
|
|
875
|
-
propagateSelectionDown: props.propagateSelectionDown,
|
|
876
|
-
propagateSelectionUp: props.propagateSelectionUp,
|
|
877
|
-
contextMenuSelectionKey: props.contextMenuSelectionKey,
|
|
878
|
-
onContextMenuSelectionChange: props.onContextMenuSelectionChange,
|
|
879
|
-
onContextMenu: props.onContextMenu,
|
|
880
|
-
onExpand: props.onExpand,
|
|
881
|
-
onCollapse: props.onCollapse,
|
|
882
|
-
onSelect: props.onSelect,
|
|
883
|
-
onUnselect: props.onUnselect,
|
|
884
|
-
onClick: props.onClick,
|
|
885
|
-
onDoubleClick: props.onDoubleClick,
|
|
886
|
-
expandedKeys: props.expandedKeys,
|
|
887
|
-
onToggle: props.onToggle,
|
|
888
|
-
onPropagateUp: propagateUp,
|
|
889
|
-
nodeTemplate: props.nodeTemplate,
|
|
890
|
-
togglerTemplate: props.togglerTemplate,
|
|
891
|
-
isNodeLeaf: props.isNodeLeaf,
|
|
892
|
-
dragdropScope: props.dragdropScope,
|
|
893
|
-
onDragStart: props.onDragStart,
|
|
894
|
-
onDragEnd: props.onDragEnd,
|
|
895
|
-
onDrop: props.onDrop,
|
|
896
|
-
onDropPoint: props.onDropPoint,
|
|
897
|
-
ptm: ptm,
|
|
898
|
-
cx: cx
|
|
899
|
-
});
|
|
900
|
-
}));
|
|
901
|
-
}
|
|
902
|
-
return null;
|
|
903
|
-
};
|
|
904
|
-
var createNode = function createNode() {
|
|
905
|
-
var tabIndex = props.disabled ? undefined : 0;
|
|
906
|
-
var selected = isSelected();
|
|
907
|
-
var checked = isChecked();
|
|
908
|
-
var content = createContent();
|
|
909
|
-
var children = createChildren();
|
|
910
|
-
var nodeProps = mergeProps({
|
|
911
|
-
className: classNames(props.node.className, cx('node', {
|
|
912
|
-
isLeaf: isLeaf
|
|
913
|
-
})),
|
|
914
|
-
style: props.node.style,
|
|
915
|
-
tabIndex: tabIndex,
|
|
916
|
-
role: 'treeitem',
|
|
917
|
-
'aria-posinset': props.index + 1,
|
|
918
|
-
'aria-expanded': expanded,
|
|
919
|
-
'aria-selected': checked || selected
|
|
920
|
-
}, getPTOptions('node'));
|
|
921
|
-
return /*#__PURE__*/React.createElement("li", nodeProps, content, children);
|
|
922
|
-
};
|
|
923
|
-
var node = createNode();
|
|
924
|
-
if (props.dragdropScope && !props.disabled) {
|
|
925
|
-
var beforeDropPoint = createDropPoint(-1);
|
|
926
|
-
var afterDropPoint = props.last ? createDropPoint(1) : null;
|
|
927
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, beforeDropPoint, node, afterDropPoint);
|
|
928
|
-
}
|
|
929
|
-
return node;
|
|
930
|
-
});
|
|
931
|
-
UITreeNode.displayName = 'UITreeNode';
|
|
932
|
-
|
|
933
|
-
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; }
|
|
934
|
-
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; }
|
|
935
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
936
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
937
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
938
|
-
var Tree = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
939
|
-
var context = React.useContext(PrimeReactContext);
|
|
940
|
-
var props = TreeBase.getProps(inProps, context);
|
|
941
|
-
var _React$useState = React.useState(''),
|
|
942
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
943
|
-
filterValueState = _React$useState2[0],
|
|
944
|
-
setFilterValueState = _React$useState2[1];
|
|
945
|
-
var _React$useState3 = React.useState(props.expandedKeys),
|
|
946
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
947
|
-
expandedKeysState = _React$useState4[0],
|
|
948
|
-
setExpandedKeysState = _React$useState4[1];
|
|
949
|
-
var elementRef = React.useRef(null);
|
|
950
|
-
var filteredNodes = React.useRef([]);
|
|
951
|
-
var dragState = React.useRef(null);
|
|
952
|
-
var filterChanged = React.useRef(false);
|
|
953
|
-
var filteredValue = props.onFilterValueChange ? props.filterValue : filterValueState;
|
|
954
|
-
var expandedKeys = props.onToggle ? props.expandedKeys : expandedKeysState;
|
|
955
|
-
var _TreeBase$setMetaData = TreeBase.setMetaData({
|
|
956
|
-
props: props,
|
|
957
|
-
state: {
|
|
958
|
-
filterValue: filteredValue,
|
|
959
|
-
expandedKeys: expandedKeys
|
|
960
|
-
}
|
|
961
|
-
}),
|
|
962
|
-
ptm = _TreeBase$setMetaData.ptm,
|
|
963
|
-
cx = _TreeBase$setMetaData.cx,
|
|
964
|
-
isUnstyled = _TreeBase$setMetaData.isUnstyled;
|
|
965
|
-
useHandleStyle(TreeBase.css.styles, isUnstyled, {
|
|
966
|
-
name: 'tree'
|
|
967
|
-
});
|
|
968
|
-
var filterOptions = {
|
|
969
|
-
filter: function filter(e) {
|
|
970
|
-
return onFilterInputChange(e);
|
|
971
|
-
},
|
|
972
|
-
reset: function reset() {
|
|
973
|
-
return resetFilter();
|
|
974
|
-
}
|
|
975
|
-
};
|
|
976
|
-
var getRootNode = function getRootNode() {
|
|
977
|
-
return props.filter && filteredNodes.current ? filteredNodes.current : props.value;
|
|
978
|
-
};
|
|
979
|
-
var onToggle = function onToggle(event) {
|
|
980
|
-
if (props.onToggle) {
|
|
981
|
-
props.onToggle(event);
|
|
982
|
-
} else {
|
|
983
|
-
setExpandedKeysState(event.value);
|
|
984
|
-
}
|
|
985
|
-
};
|
|
986
|
-
var onDragStart = function onDragStart(event) {
|
|
987
|
-
dragState.current = {
|
|
988
|
-
path: event.path,
|
|
989
|
-
index: event.index
|
|
990
|
-
};
|
|
991
|
-
};
|
|
992
|
-
var onDragEnd = function onDragEnd() {
|
|
993
|
-
dragState.current = null;
|
|
994
|
-
};
|
|
995
|
-
var onDrop = function onDrop(event) {
|
|
996
|
-
if (validateDropNode(dragState.current.path, event.path)) {
|
|
997
|
-
var value = JSON.parse(JSON.stringify(props.value));
|
|
998
|
-
var dragPaths = dragState.current.path.split('-');
|
|
999
|
-
dragPaths.pop();
|
|
1000
|
-
var dragNodeParent = findNode(value, dragPaths);
|
|
1001
|
-
var dragNode = dragNodeParent ? dragNodeParent.children[dragState.current.index] : value[dragState.current.index];
|
|
1002
|
-
var dropNode = findNode(value, event.path.split('-'));
|
|
1003
|
-
if (dropNode.children) dropNode.children.push(dragNode);else dropNode.children = [dragNode];
|
|
1004
|
-
if (dragNodeParent) dragNodeParent.children.splice(dragState.current.index, 1);else value.splice(dragState.current.index, 1);
|
|
1005
|
-
if (props.onDragDrop) {
|
|
1006
|
-
props.onDragDrop({
|
|
1007
|
-
originalEvent: event.originalEvent,
|
|
1008
|
-
value: value,
|
|
1009
|
-
dragNode: dragNode,
|
|
1010
|
-
dropNode: dropNode,
|
|
1011
|
-
dropIndex: event.index
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
};
|
|
1016
|
-
var onDropPoint = function onDropPoint(event) {
|
|
1017
|
-
if (validateDropPoint(event)) {
|
|
1018
|
-
var value = JSON.parse(JSON.stringify(props.value));
|
|
1019
|
-
var dragPaths = dragState.current.path.split('-');
|
|
1020
|
-
dragPaths.pop();
|
|
1021
|
-
var dropPaths = event.path.split('-');
|
|
1022
|
-
dropPaths.pop();
|
|
1023
|
-
var dragNodeParent = findNode(value, dragPaths);
|
|
1024
|
-
var dropNodeParent = findNode(value, dropPaths);
|
|
1025
|
-
var dragNode = dragNodeParent ? dragNodeParent.children[dragState.current.index] : value[dragState.current.index];
|
|
1026
|
-
var siblings = areSiblings(dragState.current.path, event.path);
|
|
1027
|
-
if (dragNodeParent) dragNodeParent.children.splice(dragState.current.index, 1);else value.splice(dragState.current.index, 1);
|
|
1028
|
-
if (event.position < 0) {
|
|
1029
|
-
var dropIndex = siblings ? dragState.current.index > event.index ? event.index : event.index - 1 : event.index;
|
|
1030
|
-
if (dropNodeParent) dropNodeParent.children.splice(dropIndex, 0, dragNode);else value.splice(dropIndex, 0, dragNode);
|
|
1031
|
-
} else {
|
|
1032
|
-
if (dropNodeParent) dropNodeParent.children.push(dragNode);else value.push(dragNode);
|
|
1033
|
-
}
|
|
1034
|
-
if (props.onDragDrop) {
|
|
1035
|
-
props.onDragDrop({
|
|
1036
|
-
originalEvent: event.originalEvent,
|
|
1037
|
-
value: value,
|
|
1038
|
-
dragNode: dragNode,
|
|
1039
|
-
dropNode: dropNodeParent,
|
|
1040
|
-
dropIndex: event.index
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
};
|
|
1045
|
-
var validateDrop = function validateDrop(dragPath, dropPath) {
|
|
1046
|
-
if (!dragPath) {
|
|
1047
|
-
return false;
|
|
1048
|
-
} else {
|
|
1049
|
-
//same node
|
|
1050
|
-
if (dragPath === dropPath) {
|
|
1051
|
-
return false;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
//parent dropped on an descendant
|
|
1055
|
-
if (dropPath.indexOf(dragPath) === 0) {
|
|
1056
|
-
return false;
|
|
1057
|
-
}
|
|
1058
|
-
return true;
|
|
1059
|
-
}
|
|
1060
|
-
};
|
|
1061
|
-
var validateDropNode = function validateDropNode(dragPath, dropPath) {
|
|
1062
|
-
var _validateDrop = validateDrop(dragPath, dropPath);
|
|
1063
|
-
if (_validateDrop) {
|
|
1064
|
-
//child dropped on parent
|
|
1065
|
-
if (dragPath.indexOf('-') > 0 && dragPath.substring(0, dragPath.lastIndexOf('-')) === dropPath) {
|
|
1066
|
-
return false;
|
|
1067
|
-
}
|
|
1068
|
-
return true;
|
|
1069
|
-
} else {
|
|
1070
|
-
return false;
|
|
1071
|
-
}
|
|
1072
|
-
};
|
|
1073
|
-
var validateDropPoint = function validateDropPoint(event) {
|
|
1074
|
-
var _validateDrop = validateDrop(dragState.current.path, event.path);
|
|
1075
|
-
if (_validateDrop) {
|
|
1076
|
-
//child dropped to next sibling's drop point
|
|
1077
|
-
if (event.position === -1 && areSiblings(dragState.current.path, event.path) && dragState.current.index + 1 === event.index) {
|
|
1078
|
-
return false;
|
|
1079
|
-
}
|
|
1080
|
-
return true;
|
|
1081
|
-
} else {
|
|
1082
|
-
return false;
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1085
|
-
var areSiblings = function areSiblings(path1, path2) {
|
|
1086
|
-
if (path1.length === 1 && path2.length === 1) return true;else return path1.substring(0, path1.lastIndexOf('-')) === path2.substring(0, path2.lastIndexOf('-'));
|
|
1087
|
-
};
|
|
1088
|
-
var findNode = function findNode(value, path) {
|
|
1089
|
-
if (path.length === 0) {
|
|
1090
|
-
return null;
|
|
1091
|
-
} else {
|
|
1092
|
-
var index = parseInt(path[0], 10);
|
|
1093
|
-
var nextSearchRoot = value.children ? value.children[index] : value[index];
|
|
1094
|
-
if (path.length === 1) {
|
|
1095
|
-
return nextSearchRoot;
|
|
1096
|
-
} else {
|
|
1097
|
-
path.shift();
|
|
1098
|
-
return findNode(nextSearchRoot, path);
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
};
|
|
1102
|
-
var isNodeLeaf = function isNodeLeaf(node) {
|
|
1103
|
-
return node.leaf === false ? false : !(node.children && node.children.length);
|
|
1104
|
-
};
|
|
1105
|
-
var onFilterInputKeyDown = function onFilterInputKeyDown(event) {
|
|
1106
|
-
//enter
|
|
1107
|
-
if (event.which === 13) {
|
|
1108
|
-
event.preventDefault();
|
|
1109
|
-
}
|
|
1110
|
-
};
|
|
1111
|
-
var onFilterInputChange = function onFilterInputChange(event) {
|
|
1112
|
-
filterChanged.current = true;
|
|
1113
|
-
var value = event.target.value;
|
|
1114
|
-
if (props.onFilterValueChange) {
|
|
1115
|
-
props.onFilterValueChange({
|
|
1116
|
-
originalEvent: event,
|
|
1117
|
-
value: value
|
|
1118
|
-
});
|
|
1119
|
-
} else {
|
|
1120
|
-
setFilterValueState(value);
|
|
1121
|
-
}
|
|
1122
|
-
};
|
|
1123
|
-
var filter = function filter(value) {
|
|
1124
|
-
setFilterValueState(ObjectUtils.isNotEmpty(value) ? value : '');
|
|
1125
|
-
_filter();
|
|
1126
|
-
};
|
|
1127
|
-
var _filter = function _filter() {
|
|
1128
|
-
if (!filterChanged.current) {
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
if (ObjectUtils.isEmpty(filteredValue)) {
|
|
1132
|
-
filteredNodes.current = props.value;
|
|
1133
|
-
} else {
|
|
1134
|
-
filteredNodes.current = [];
|
|
1135
|
-
var searchFields = props.filterBy.split(',');
|
|
1136
|
-
var filterText = filteredValue.toLocaleLowerCase(props.filterLocale);
|
|
1137
|
-
var isStrictMode = props.filterMode === 'strict';
|
|
1138
|
-
var _iterator = _createForOfIteratorHelper(props.value),
|
|
1139
|
-
_step;
|
|
1140
|
-
try {
|
|
1141
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1142
|
-
var node = _step.value;
|
|
1143
|
-
var copyNode = _objectSpread({}, node);
|
|
1144
|
-
var paramsWithoutNode = {
|
|
1145
|
-
searchFields: searchFields,
|
|
1146
|
-
filterText: filterText,
|
|
1147
|
-
isStrictMode: isStrictMode
|
|
1148
|
-
};
|
|
1149
|
-
if (isStrictMode && (findFilteredNodes(copyNode, paramsWithoutNode) || isFilterMatched(copyNode, paramsWithoutNode)) || !isStrictMode && (isFilterMatched(copyNode, paramsWithoutNode) || findFilteredNodes(copyNode, paramsWithoutNode))) {
|
|
1150
|
-
filteredNodes.current.push(copyNode);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
} catch (err) {
|
|
1154
|
-
_iterator.e(err);
|
|
1155
|
-
} finally {
|
|
1156
|
-
_iterator.f();
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
filterChanged.current = false;
|
|
1160
|
-
};
|
|
1161
|
-
var findFilteredNodes = function findFilteredNodes(node, paramsWithoutNode) {
|
|
1162
|
-
if (node) {
|
|
1163
|
-
var matched = false;
|
|
1164
|
-
if (node.children) {
|
|
1165
|
-
var childNodes = _toConsumableArray(node.children);
|
|
1166
|
-
node.children = [];
|
|
1167
|
-
var _iterator2 = _createForOfIteratorHelper(childNodes),
|
|
1168
|
-
_step2;
|
|
1169
|
-
try {
|
|
1170
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1171
|
-
var childNode = _step2.value;
|
|
1172
|
-
var copyChildNode = _objectSpread({}, childNode);
|
|
1173
|
-
if (isFilterMatched(copyChildNode, paramsWithoutNode)) {
|
|
1174
|
-
matched = true;
|
|
1175
|
-
node.children.push(copyChildNode);
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
} catch (err) {
|
|
1179
|
-
_iterator2.e(err);
|
|
1180
|
-
} finally {
|
|
1181
|
-
_iterator2.f();
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
if (matched) {
|
|
1185
|
-
node.expanded = true;
|
|
1186
|
-
return true;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
};
|
|
1190
|
-
var isFilterMatched = function isFilterMatched(node, _ref) {
|
|
1191
|
-
var searchFields = _ref.searchFields,
|
|
1192
|
-
filterText = _ref.filterText,
|
|
1193
|
-
isStrictMode = _ref.isStrictMode;
|
|
1194
|
-
var matched = false;
|
|
1195
|
-
var _iterator3 = _createForOfIteratorHelper(searchFields),
|
|
1196
|
-
_step3;
|
|
1197
|
-
try {
|
|
1198
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1199
|
-
var field = _step3.value;
|
|
1200
|
-
var fieldValue = String(ObjectUtils.resolveFieldData(node, field)).toLocaleLowerCase(props.filterLocale);
|
|
1201
|
-
if (fieldValue.indexOf(filterText) > -1) {
|
|
1202
|
-
matched = true;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
} catch (err) {
|
|
1206
|
-
_iterator3.e(err);
|
|
1207
|
-
} finally {
|
|
1208
|
-
_iterator3.f();
|
|
1209
|
-
}
|
|
1210
|
-
if (!matched || isStrictMode && !isNodeLeaf(node)) {
|
|
1211
|
-
matched = findFilteredNodes(node, {
|
|
1212
|
-
searchFields: searchFields,
|
|
1213
|
-
filterText: filterText,
|
|
1214
|
-
isStrictMode: isStrictMode
|
|
1215
|
-
}) || matched;
|
|
1216
|
-
}
|
|
1217
|
-
return matched;
|
|
1218
|
-
};
|
|
1219
|
-
var resetFilter = function resetFilter() {
|
|
1220
|
-
setFilterValueState('');
|
|
1221
|
-
};
|
|
1222
|
-
React.useImperativeHandle(ref, function () {
|
|
1223
|
-
return {
|
|
1224
|
-
props: props,
|
|
1225
|
-
filter: filter,
|
|
1226
|
-
getElement: function getElement() {
|
|
1227
|
-
return elementRef.current;
|
|
1228
|
-
}
|
|
1229
|
-
};
|
|
1230
|
-
});
|
|
1231
|
-
var createRootChild = function createRootChild(node, index, last) {
|
|
1232
|
-
return /*#__PURE__*/React.createElement(UITreeNode, {
|
|
1233
|
-
hostName: "Tree",
|
|
1234
|
-
key: node.key || node.label,
|
|
1235
|
-
node: node,
|
|
1236
|
-
originalOptions: props.value,
|
|
1237
|
-
index: index,
|
|
1238
|
-
last: last,
|
|
1239
|
-
path: String(index),
|
|
1240
|
-
checkboxIcon: props.checkboxIcon,
|
|
1241
|
-
expandIcon: props.expandIcon,
|
|
1242
|
-
collapseIcon: props.collapseIcon,
|
|
1243
|
-
disabled: props.disabled,
|
|
1244
|
-
selectionMode: props.selectionMode,
|
|
1245
|
-
selectionKeys: props.selectionKeys,
|
|
1246
|
-
onSelectionChange: props.onSelectionChange,
|
|
1247
|
-
metaKeySelection: props.metaKeySelection,
|
|
1248
|
-
contextMenuSelectionKey: props.contextMenuSelectionKey,
|
|
1249
|
-
onContextMenuSelectionChange: props.onContextMenuSelectionChange,
|
|
1250
|
-
onContextMenu: props.onContextMenu,
|
|
1251
|
-
propagateSelectionDown: props.propagateSelectionDown,
|
|
1252
|
-
propagateSelectionUp: props.propagateSelectionUp,
|
|
1253
|
-
onExpand: props.onExpand,
|
|
1254
|
-
onCollapse: props.onCollapse,
|
|
1255
|
-
onSelect: props.onSelect,
|
|
1256
|
-
onUnselect: props.onUnselect,
|
|
1257
|
-
expandedKeys: expandedKeys,
|
|
1258
|
-
onToggle: onToggle,
|
|
1259
|
-
nodeTemplate: props.nodeTemplate,
|
|
1260
|
-
togglerTemplate: props.togglerTemplate,
|
|
1261
|
-
isNodeLeaf: isNodeLeaf,
|
|
1262
|
-
dragdropScope: props.dragdropScope,
|
|
1263
|
-
onDragStart: onDragStart,
|
|
1264
|
-
onDragEnd: onDragEnd,
|
|
1265
|
-
onDrop: onDrop,
|
|
1266
|
-
onDropPoint: onDropPoint,
|
|
1267
|
-
onClick: props.onNodeClick,
|
|
1268
|
-
onDoubleClick: props.onNodeDoubleClick,
|
|
1269
|
-
ptm: ptm,
|
|
1270
|
-
cx: cx
|
|
1271
|
-
});
|
|
1272
|
-
};
|
|
1273
|
-
var createRootChildren = function createRootChildren() {
|
|
1274
|
-
if (props.filter) {
|
|
1275
|
-
filterChanged.current = true;
|
|
1276
|
-
_filter();
|
|
1277
|
-
}
|
|
1278
|
-
var value = getRootNode();
|
|
1279
|
-
return value.map(function (node, index) {
|
|
1280
|
-
return createRootChild(node, index, index === value.length - 1);
|
|
1281
|
-
});
|
|
1282
|
-
};
|
|
1283
|
-
var createModel = function createModel() {
|
|
1284
|
-
if (props.value) {
|
|
1285
|
-
var rootNodes = createRootChildren();
|
|
1286
|
-
var containerProps = mergeProps(_objectSpread({
|
|
1287
|
-
className: classNames(props.contentClassName, cx('container')),
|
|
1288
|
-
role: 'tree',
|
|
1289
|
-
style: props.contentStyle
|
|
1290
|
-
}, ariaProps), ptm('container'));
|
|
1291
|
-
return /*#__PURE__*/React.createElement("ul", containerProps, rootNodes);
|
|
1292
|
-
}
|
|
1293
|
-
return null;
|
|
1294
|
-
};
|
|
1295
|
-
var createLoader = function createLoader() {
|
|
1296
|
-
if (props.loading) {
|
|
1297
|
-
var loadingIconProps = mergeProps({
|
|
1298
|
-
className: cx('loadingIcon')
|
|
1299
|
-
}, ptm('loadingIcon'));
|
|
1300
|
-
var icon = props.loadingIcon || /*#__PURE__*/React.createElement(SpinnerIcon, _extends({}, loadingIconProps, {
|
|
1301
|
-
spin: true
|
|
1302
|
-
}));
|
|
1303
|
-
var loadingIcon = IconUtils.getJSXIcon(icon, _objectSpread({}, loadingIconProps), {
|
|
1304
|
-
props: props
|
|
1305
|
-
});
|
|
1306
|
-
var loadingOverlayProps = mergeProps({
|
|
1307
|
-
className: cx('loadingOverlay')
|
|
1308
|
-
}, ptm('loadingOverlay'));
|
|
1309
|
-
return /*#__PURE__*/React.createElement("div", loadingOverlayProps, loadingIcon);
|
|
1310
|
-
}
|
|
1311
|
-
return null;
|
|
1312
|
-
};
|
|
1313
|
-
var createFilter = function createFilter() {
|
|
1314
|
-
if (props.filter) {
|
|
1315
|
-
var value = ObjectUtils.isNotEmpty(filteredValue) ? filteredValue : '';
|
|
1316
|
-
var searchIconProps = mergeProps({
|
|
1317
|
-
className: cx('searchIcon')
|
|
1318
|
-
}, ptm('searchIcon'));
|
|
1319
|
-
var icon = props.filterIcon || /*#__PURE__*/React.createElement(SearchIcon, searchIconProps);
|
|
1320
|
-
var filterIcon = IconUtils.getJSXIcon(icon, _objectSpread({}, searchIconProps), {
|
|
1321
|
-
props: props
|
|
1322
|
-
});
|
|
1323
|
-
var filterContainerProps = mergeProps({
|
|
1324
|
-
className: cx('filterContainer')
|
|
1325
|
-
}, ptm('filterContainer'));
|
|
1326
|
-
var inputProps = mergeProps({
|
|
1327
|
-
type: 'text',
|
|
1328
|
-
value: value,
|
|
1329
|
-
autoComplete: 'off',
|
|
1330
|
-
className: cx('input'),
|
|
1331
|
-
placeholder: props.filterPlaceholder,
|
|
1332
|
-
'aria-label': props.filterPlaceholder,
|
|
1333
|
-
onKeyDown: onFilterInputKeyDown,
|
|
1334
|
-
onChange: onFilterInputChange,
|
|
1335
|
-
disabled: props.disabled
|
|
1336
|
-
}, ptm('input'));
|
|
1337
|
-
var _content = /*#__PURE__*/React.createElement("div", filterContainerProps, /*#__PURE__*/React.createElement("input", inputProps), filterIcon);
|
|
1338
|
-
if (props.filterTemplate) {
|
|
1339
|
-
var defaultContentOptions = {
|
|
1340
|
-
className: 'p-tree-filter-container',
|
|
1341
|
-
element: _content,
|
|
1342
|
-
filterOptions: filterOptions,
|
|
1343
|
-
filterInputKeyDown: onFilterInputKeyDown,
|
|
1344
|
-
filterInputChange: onFilterInputChange,
|
|
1345
|
-
filterIconClassName: 'p-dropdown-filter-icon',
|
|
1346
|
-
props: props
|
|
1347
|
-
};
|
|
1348
|
-
_content = ObjectUtils.getJSXElement(props.filterTemplate, defaultContentOptions);
|
|
1349
|
-
}
|
|
1350
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, _content);
|
|
1351
|
-
}
|
|
1352
|
-
return null;
|
|
1353
|
-
};
|
|
1354
|
-
var createHeader = function createHeader() {
|
|
1355
|
-
if (props.showHeader) {
|
|
1356
|
-
var filterElement = createFilter();
|
|
1357
|
-
var _content2 = filterElement;
|
|
1358
|
-
if (props.header) {
|
|
1359
|
-
var defaultContentOptions = {
|
|
1360
|
-
filterContainerClassName: 'p-tree-filter-container',
|
|
1361
|
-
filterIconClassName: 'p-tree-filter-icon',
|
|
1362
|
-
filterInput: {
|
|
1363
|
-
className: 'p-tree-filter p-inputtext p-component',
|
|
1364
|
-
onKeyDown: onFilterInputKeyDown,
|
|
1365
|
-
onChange: onFilterInputChange
|
|
1366
|
-
},
|
|
1367
|
-
filterElement: filterElement,
|
|
1368
|
-
element: _content2,
|
|
1369
|
-
props: props
|
|
1370
|
-
};
|
|
1371
|
-
_content2 = ObjectUtils.getJSXElement(props.header, defaultContentOptions);
|
|
1372
|
-
}
|
|
1373
|
-
var headerProps = mergeProps({
|
|
1374
|
-
className: cx('header')
|
|
1375
|
-
}, ptm('header'));
|
|
1376
|
-
return /*#__PURE__*/React.createElement("div", headerProps, _content2);
|
|
1377
|
-
}
|
|
1378
|
-
return null;
|
|
1379
|
-
};
|
|
1380
|
-
var createFooter = function createFooter() {
|
|
1381
|
-
var content = ObjectUtils.getJSXElement(props.footer, props);
|
|
1382
|
-
var footerProps = mergeProps({
|
|
1383
|
-
className: cx('footer')
|
|
1384
|
-
}, ptm('footer'));
|
|
1385
|
-
return /*#__PURE__*/React.createElement("div", footerProps, content);
|
|
1386
|
-
};
|
|
1387
|
-
var otherProps = TreeBase.getOtherProps(props);
|
|
1388
|
-
var ariaProps = ObjectUtils.reduceKeys(otherProps, DomHandler.ARIA_PROPS);
|
|
1389
|
-
var loader = createLoader();
|
|
1390
|
-
var content = createModel();
|
|
1391
|
-
var header = createHeader();
|
|
1392
|
-
var footer = createFooter();
|
|
1393
|
-
var rootProps = mergeProps({
|
|
1394
|
-
ref: elementRef,
|
|
1395
|
-
className: classNames(props.className, cx('root')),
|
|
1396
|
-
style: props.style,
|
|
1397
|
-
id: props.id
|
|
1398
|
-
}, TreeBase.getOtherProps(props), ptm('root'));
|
|
1399
|
-
return /*#__PURE__*/React.createElement("div", rootProps, loader, header, content, footer);
|
|
1400
|
-
}));
|
|
1401
|
-
Tree.displayName = 'Tree';
|
|
1402
|
-
|
|
1403
|
-
export { Tree };
|