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.
Files changed (319) hide show
  1. package/README.md +1 -1
  2. package/componentbase/componentbase.cjs.js +12 -7
  3. package/componentbase/componentbase.cjs.min.js +1 -1
  4. package/componentbase/componentbase.esm.min.mjs +1 -1
  5. package/componentbase/componentbase.esm.mjs +12 -7
  6. package/componentbase/componentbase.js +12 -7
  7. package/componentbase/componentbase.min.js +1 -1
  8. package/core/core.js +12 -7
  9. package/core/core.min.js +1 -1
  10. package/package.json +1 -1
  11. package/primereact.all.cjs.js +12 -7
  12. package/primereact.all.cjs.min.js +1 -1
  13. package/primereact.all.esm.min.mjs +1 -1
  14. package/primereact.all.esm.mjs +12 -7
  15. package/primereact.all.js +12 -7
  16. package/primereact.all.min.js +1 -1
  17. package/web-types.json +1 -1
  18. package/accordion/accordion.esm.js +0 -421
  19. package/accordion/accordion.esm.min.js +0 -1
  20. package/api/api.esm.js +0 -944
  21. package/api/api.esm.min.js +0 -1
  22. package/autocomplete/autocomplete.esm.js +0 -1127
  23. package/autocomplete/autocomplete.esm.min.js +0 -1
  24. package/avatar/avatar.esm.js +0 -245
  25. package/avatar/avatar.esm.min.js +0 -1
  26. package/avatargroup/avatargroup.esm.js +0 -55
  27. package/avatargroup/avatargroup.esm.min.js +0 -1
  28. package/badge/badge.esm.js +0 -110
  29. package/badge/badge.esm.min.js +0 -1
  30. package/blockui/blockui.esm.js +0 -265
  31. package/blockui/blockui.esm.min.js +0 -1
  32. package/breadcrumb/breadcrumb.esm.js +0 -351
  33. package/breadcrumb/breadcrumb.esm.min.js +0 -1
  34. package/button/button.esm.js +0 -295
  35. package/button/button.esm.min.js +0 -1
  36. package/calendar/calendar.esm.js +0 -3473
  37. package/calendar/calendar.esm.min.js +0 -1
  38. package/card/card.esm.js +0 -98
  39. package/card/card.esm.min.js +0 -1
  40. package/carousel/carousel.esm.js +0 -801
  41. package/carousel/carousel.esm.min.js +0 -1
  42. package/cascadeselect/cascadeselect.esm.js +0 -819
  43. package/cascadeselect/cascadeselect.esm.min.js +0 -1
  44. package/chart/chart.esm.js +0 -155
  45. package/chart/chart.esm.min.js +0 -1
  46. package/checkbox/checkbox.esm.js +0 -357
  47. package/checkbox/checkbox.esm.min.js +0 -1
  48. package/chip/chip.esm.js +0 -248
  49. package/chip/chip.esm.min.js +0 -1
  50. package/chips/chips.esm.js +0 -501
  51. package/chips/chips.esm.min.js +0 -1
  52. package/colorpicker/colorpicker.esm.js +0 -788
  53. package/colorpicker/colorpicker.esm.min.js +0 -1
  54. package/column/column.esm.js +0 -8
  55. package/column/column.esm.min.js +0 -1
  56. package/columngroup/columngroup.esm.js +0 -6
  57. package/columngroup/columngroup.esm.min.js +0 -1
  58. package/componentbase/componentbase.esm.js +0 -323
  59. package/componentbase/componentbase.esm.min.js +0 -1
  60. package/confirmdialog/confirmdialog.esm.js +0 -376
  61. package/confirmdialog/confirmdialog.esm.min.js +0 -1
  62. package/confirmpopup/confirmpopup.esm.js +0 -610
  63. package/confirmpopup/confirmpopup.esm.min.js +0 -1
  64. package/contextmenu/contextmenu.esm.js +0 -664
  65. package/contextmenu/contextmenu.esm.min.js +0 -1
  66. package/csstransition/csstransition.esm.js +0 -138
  67. package/csstransition/csstransition.esm.min.js +0 -1
  68. package/datascroller/datascroller.esm.js +0 -320
  69. package/datascroller/datascroller.esm.min.js +0 -1
  70. package/datatable/datatable.esm.js +0 -6636
  71. package/datatable/datatable.esm.min.js +0 -1
  72. package/dataview/dataview.esm.js +0 -506
  73. package/dataview/dataview.esm.min.js +0 -1
  74. package/deferredcontent/deferredcontent.esm.js +0 -133
  75. package/deferredcontent/deferredcontent.esm.min.js +0 -1
  76. package/dialog/dialog.esm.js +0 -983
  77. package/dialog/dialog.esm.min.js +0 -1
  78. package/divider/divider.esm.js +0 -79
  79. package/divider/divider.esm.min.js +0 -1
  80. package/dock/dock.esm.js +0 -348
  81. package/dock/dock.esm.min.js +0 -1
  82. package/dropdown/dropdown.esm.js +0 -1380
  83. package/dropdown/dropdown.esm.min.js +0 -1
  84. package/editor/editor.esm.js +0 -338
  85. package/editor/editor.esm.min.js +0 -1
  86. package/fieldset/fieldset.esm.js +0 -270
  87. package/fieldset/fieldset.esm.min.js +0 -1
  88. package/fileupload/fileupload.esm.js +0 -1005
  89. package/fileupload/fileupload.esm.min.js +0 -1
  90. package/galleria/galleria.esm.js +0 -1090
  91. package/galleria/galleria.esm.min.js +0 -1
  92. package/hooks/hooks.esm.js +0 -1042
  93. package/hooks/hooks.esm.min.js +0 -1
  94. package/iconbase/iconbase.esm.js +0 -33
  95. package/iconbase/iconbase.esm.min.js +0 -1
  96. package/icons/angledoubledown/index.esm.js +0 -39
  97. package/icons/angledoubledown/index.esm.min.js +0 -1
  98. package/icons/angledoubleleft/index.esm.js +0 -39
  99. package/icons/angledoubleleft/index.esm.min.js +0 -1
  100. package/icons/angledoubleright/index.esm.js +0 -39
  101. package/icons/angledoubleright/index.esm.min.js +0 -1
  102. package/icons/angledoubleup/index.esm.js +0 -39
  103. package/icons/angledoubleup/index.esm.min.js +0 -1
  104. package/icons/angledown/index.esm.js +0 -37
  105. package/icons/angledown/index.esm.min.js +0 -1
  106. package/icons/angleleft/index.esm.js +0 -37
  107. package/icons/angleleft/index.esm.min.js +0 -1
  108. package/icons/angleright/index.esm.js +0 -37
  109. package/icons/angleright/index.esm.min.js +0 -1
  110. package/icons/angleup/index.esm.js +0 -37
  111. package/icons/angleup/index.esm.min.js +0 -1
  112. package/icons/arrowdown/index.esm.js +0 -661
  113. package/icons/arrowdown/index.esm.min.js +0 -1
  114. package/icons/arrowup/index.esm.js +0 -661
  115. package/icons/arrowup/index.esm.min.js +0 -1
  116. package/icons/ban/index.esm.js +0 -659
  117. package/icons/ban/index.esm.min.js +0 -1
  118. package/icons/bars/index.esm.js +0 -39
  119. package/icons/bars/index.esm.min.js +0 -1
  120. package/icons/calendar/index.esm.js +0 -37
  121. package/icons/calendar/index.esm.min.js +0 -1
  122. package/icons/check/index.esm.js +0 -37
  123. package/icons/check/index.esm.min.js +0 -1
  124. package/icons/chevrondown/index.esm.js +0 -37
  125. package/icons/chevrondown/index.esm.min.js +0 -1
  126. package/icons/chevronleft/index.esm.js +0 -37
  127. package/icons/chevronleft/index.esm.min.js +0 -1
  128. package/icons/chevronright/index.esm.js +0 -37
  129. package/icons/chevronright/index.esm.min.js +0 -1
  130. package/icons/chevronup/index.esm.js +0 -37
  131. package/icons/chevronup/index.esm.min.js +0 -1
  132. package/icons/download/index.esm.js +0 -661
  133. package/icons/download/index.esm.min.js +0 -1
  134. package/icons/exclamationtriangle/index.esm.js +0 -665
  135. package/icons/exclamationtriangle/index.esm.min.js +0 -1
  136. package/icons/eye/index.esm.js +0 -39
  137. package/icons/eye/index.esm.min.js +0 -1
  138. package/icons/eyeslash/index.esm.js +0 -661
  139. package/icons/eyeslash/index.esm.min.js +0 -1
  140. package/icons/filter/index.esm.js +0 -659
  141. package/icons/filter/index.esm.min.js +0 -1
  142. package/icons/filterslash/index.esm.js +0 -661
  143. package/icons/filterslash/index.esm.min.js +0 -1
  144. package/icons/infocircle/index.esm.js +0 -661
  145. package/icons/infocircle/index.esm.min.js +0 -1
  146. package/icons/minus/index.esm.js +0 -37
  147. package/icons/minus/index.esm.min.js +0 -1
  148. package/icons/pencil/index.esm.js +0 -659
  149. package/icons/pencil/index.esm.min.js +0 -1
  150. package/icons/plus/index.esm.js +0 -659
  151. package/icons/plus/index.esm.min.js +0 -1
  152. package/icons/refresh/index.esm.js +0 -661
  153. package/icons/refresh/index.esm.min.js +0 -1
  154. package/icons/search/index.esm.js +0 -661
  155. package/icons/search/index.esm.min.js +0 -1
  156. package/icons/searchminus/index.esm.js +0 -661
  157. package/icons/searchminus/index.esm.min.js +0 -1
  158. package/icons/searchplus/index.esm.js +0 -661
  159. package/icons/searchplus/index.esm.min.js +0 -1
  160. package/icons/sortalt/index.esm.js +0 -668
  161. package/icons/sortalt/index.esm.min.js +0 -1
  162. package/icons/sortamountdown/index.esm.js +0 -674
  163. package/icons/sortamountdown/index.esm.min.js +0 -1
  164. package/icons/sortamountupalt/index.esm.js +0 -674
  165. package/icons/sortamountupalt/index.esm.min.js +0 -1
  166. package/icons/spinner/index.esm.js +0 -659
  167. package/icons/spinner/index.esm.min.js +0 -1
  168. package/icons/star/index.esm.js +0 -659
  169. package/icons/star/index.esm.min.js +0 -1
  170. package/icons/starfill/index.esm.js +0 -659
  171. package/icons/starfill/index.esm.min.js +0 -1
  172. package/icons/thlarge/index.esm.js +0 -661
  173. package/icons/thlarge/index.esm.min.js +0 -1
  174. package/icons/times/index.esm.js +0 -37
  175. package/icons/times/index.esm.min.js +0 -1
  176. package/icons/timescircle/index.esm.js +0 -661
  177. package/icons/timescircle/index.esm.min.js +0 -1
  178. package/icons/trash/index.esm.js +0 -661
  179. package/icons/trash/index.esm.min.js +0 -1
  180. package/icons/undo/index.esm.js +0 -661
  181. package/icons/undo/index.esm.min.js +0 -1
  182. package/icons/upload/index.esm.js +0 -661
  183. package/icons/upload/index.esm.min.js +0 -1
  184. package/icons/windowmaximize/index.esm.js +0 -661
  185. package/icons/windowmaximize/index.esm.min.js +0 -1
  186. package/icons/windowminimize/index.esm.js +0 -661
  187. package/icons/windowminimize/index.esm.min.js +0 -1
  188. package/image/image.esm.js +0 -1162
  189. package/image/image.esm.min.js +0 -1
  190. package/inplace/inplace.esm.js +0 -243
  191. package/inplace/inplace.esm.min.js +0 -1
  192. package/inputmask/inputmask.esm.js +0 -560
  193. package/inputmask/inputmask.esm.min.js +0 -1
  194. package/inputnumber/inputnumber.esm.js +0 -1209
  195. package/inputnumber/inputnumber.esm.min.js +0 -1
  196. package/inputswitch/inputswitch.esm.js +0 -291
  197. package/inputswitch/inputswitch.esm.min.js +0 -1
  198. package/inputtext/inputtext.esm.js +0 -171
  199. package/inputtext/inputtext.esm.min.js +0 -1
  200. package/inputtextarea/inputtextarea.esm.js +0 -220
  201. package/inputtextarea/inputtextarea.esm.min.js +0 -1
  202. package/keyfilter/keyfilter.esm.js +0 -108
  203. package/keyfilter/keyfilter.esm.min.js +0 -1
  204. package/knob/knob.esm.js +0 -318
  205. package/knob/knob.esm.min.js +0 -1
  206. package/listbox/listbox.esm.js +0 -810
  207. package/listbox/listbox.esm.min.js +0 -1
  208. package/megamenu/megamenu.esm.js +0 -716
  209. package/megamenu/megamenu.esm.min.js +0 -1
  210. package/mention/mention.esm.js +0 -771
  211. package/mention/mention.esm.min.js +0 -1
  212. package/menu/menu.esm.js +0 -485
  213. package/menu/menu.esm.min.js +0 -1
  214. package/menubar/menubar.esm.js +0 -584
  215. package/menubar/menubar.esm.min.js +0 -1
  216. package/message/message.esm.js +0 -169
  217. package/message/message.esm.min.js +0 -1
  218. package/messages/messages.esm.js +0 -439
  219. package/messages/messages.esm.min.js +0 -1
  220. package/multiselect/multiselect.esm.js +0 -1724
  221. package/multiselect/multiselect.esm.min.js +0 -1
  222. package/multistatecheckbox/multistatecheckbox.esm.js +0 -352
  223. package/multistatecheckbox/multistatecheckbox.esm.min.js +0 -1
  224. package/orderlist/orderlist.esm.js +0 -816
  225. package/orderlist/orderlist.esm.min.js +0 -1
  226. package/organizationchart/organizationchart.esm.js +0 -480
  227. package/organizationchart/organizationchart.esm.min.js +0 -1
  228. package/overlaypanel/overlaypanel.esm.js +0 -516
  229. package/overlaypanel/overlaypanel.esm.min.js +0 -1
  230. package/overlayservice/overlayservice.esm.js +0 -7
  231. package/overlayservice/overlayservice.esm.min.js +0 -1
  232. package/paginator/paginator.esm.js +0 -933
  233. package/paginator/paginator.esm.min.js +0 -1
  234. package/panel/panel.esm.js +0 -316
  235. package/panel/panel.esm.min.js +0 -1
  236. package/panelmenu/panelmenu.esm.js +0 -645
  237. package/panelmenu/panelmenu.esm.min.js +0 -1
  238. package/passthrough/index.esm.js +0 -71
  239. package/passthrough/index.esm.min.js +0 -1
  240. package/passthrough/tailwind/index.esm.js +0 -3509
  241. package/passthrough/tailwind/index.esm.min.js +0 -1
  242. package/password/password.esm.js +0 -567
  243. package/password/password.esm.min.js +0 -1
  244. package/picklist/picklist.esm.js +0 -1119
  245. package/picklist/picklist.esm.min.js +0 -1
  246. package/portal/portal.esm.js +0 -110
  247. package/portal/portal.esm.min.js +0 -1
  248. package/primereact.all.esm.js +0 -51646
  249. package/primereact.all.esm.min.js +0 -1
  250. package/progressbar/progressbar.esm.js +0 -190
  251. package/progressbar/progressbar.esm.min.js +0 -1
  252. package/progressspinner/progressspinner.esm.js +0 -88
  253. package/progressspinner/progressspinner.esm.min.js +0 -1
  254. package/radiobutton/radiobutton.esm.js +0 -329
  255. package/radiobutton/radiobutton.esm.min.js +0 -1
  256. package/rating/rating.esm.js +0 -273
  257. package/rating/rating.esm.min.js +0 -1
  258. package/ripple/ripple.esm.js +0 -100
  259. package/ripple/ripple.esm.min.js +0 -1
  260. package/row/row.esm.js +0 -36
  261. package/row/row.esm.min.js +0 -1
  262. package/scrollpanel/scrollpanel.esm.js +0 -210
  263. package/scrollpanel/scrollpanel.esm.min.js +0 -1
  264. package/scrolltop/scrolltop.esm.js +0 -269
  265. package/scrolltop/scrolltop.esm.min.js +0 -1
  266. package/selectbutton/selectbutton.esm.js +0 -327
  267. package/selectbutton/selectbutton.esm.min.js +0 -1
  268. package/sidebar/sidebar.esm.js +0 -543
  269. package/sidebar/sidebar.esm.min.js +0 -1
  270. package/skeleton/skeleton.esm.js +0 -125
  271. package/skeleton/skeleton.esm.min.js +0 -1
  272. package/slidemenu/slidemenu.esm.js +0 -689
  273. package/slidemenu/slidemenu.esm.min.js +0 -1
  274. package/slider/slider.esm.js +0 -478
  275. package/slider/slider.esm.min.js +0 -1
  276. package/speeddial/speeddial.esm.js +0 -521
  277. package/speeddial/speeddial.esm.min.js +0 -1
  278. package/splitbutton/splitbutton.esm.js +0 -545
  279. package/splitbutton/splitbutton.esm.min.js +0 -1
  280. package/splitter/splitter.esm.js +0 -466
  281. package/splitter/splitter.esm.min.js +0 -1
  282. package/steps/steps.esm.js +0 -294
  283. package/steps/steps.esm.min.js +0 -1
  284. package/styleclass/styleclass.esm.js +0 -269
  285. package/styleclass/styleclass.esm.min.js +0 -1
  286. package/tabmenu/tabmenu.esm.js +0 -332
  287. package/tabmenu/tabmenu.esm.min.js +0 -1
  288. package/tabview/tabview.esm.js +0 -678
  289. package/tabview/tabview.esm.min.js +0 -1
  290. package/tag/tag.esm.js +0 -117
  291. package/tag/tag.esm.min.js +0 -1
  292. package/terminal/terminal.esm.js +0 -280
  293. package/terminal/terminal.esm.min.js +0 -1
  294. package/terminalservice/terminalservice.esm.js +0 -7
  295. package/terminalservice/terminalservice.esm.min.js +0 -1
  296. package/tieredmenu/tieredmenu.esm.js +0 -699
  297. package/tieredmenu/tieredmenu.esm.min.js +0 -1
  298. package/timeline/timeline.esm.js +0 -164
  299. package/timeline/timeline.esm.min.js +0 -1
  300. package/toast/toast.esm.js +0 -739
  301. package/toast/toast.esm.min.js +0 -1
  302. package/togglebutton/togglebutton.esm.js +0 -217
  303. package/togglebutton/togglebutton.esm.min.js +0 -1
  304. package/toolbar/toolbar.esm.js +0 -79
  305. package/toolbar/toolbar.esm.min.js +0 -1
  306. package/tooltip/tooltip.esm.js +0 -696
  307. package/tooltip/tooltip.esm.min.js +0 -1
  308. package/tree/tree.esm.js +0 -1403
  309. package/tree/tree.esm.min.js +0 -1
  310. package/treeselect/treeselect.esm.js +0 -930
  311. package/treeselect/treeselect.esm.min.js +0 -1
  312. package/treetable/treetable.esm.js +0 -3094
  313. package/treetable/treetable.esm.min.js +0 -1
  314. package/tristatecheckbox/tristatecheckbox.esm.js +0 -292
  315. package/tristatecheckbox/tristatecheckbox.esm.min.js +0 -1
  316. package/utils/utils.esm.js +0 -2383
  317. package/utils/utils.esm.min.js +0 -1
  318. package/virtualscroller/virtualscroller.esm.js +0 -972
  319. package/virtualscroller/virtualscroller.esm.min.js +0 -1
@@ -1,819 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import PrimeReact, { PrimeReactContext } from 'primereact/api';
5
- import { CSSTransition } from 'primereact/csstransition';
6
- import { useMountEffect, useUpdateEffect, useOverlayListener, useUnmountEffect } from 'primereact/hooks';
7
- import { ChevronDownIcon } from 'primereact/icons/chevrondown';
8
- import { OverlayService } from 'primereact/overlayservice';
9
- import { Portal } from 'primereact/portal';
10
- import { classNames, mergeProps, DomHandler, ObjectUtils, IconUtils, UniqueComponentId, ZIndexUtils } from 'primereact/utils';
11
- import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
12
- import { AngleRightIcon } from 'primereact/icons/angleright';
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 _typeof(o) {
31
- "@babel/helpers - typeof";
32
-
33
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
34
- return typeof o;
35
- } : function (o) {
36
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
37
- }, _typeof(o);
38
- }
39
-
40
- function _toPrimitive(input, hint) {
41
- if (_typeof(input) !== "object" || input === null) return input;
42
- var prim = input[Symbol.toPrimitive];
43
- if (prim !== undefined) {
44
- var res = prim.call(input, hint || "default");
45
- if (_typeof(res) !== "object") return res;
46
- throw new TypeError("@@toPrimitive must return a primitive value.");
47
- }
48
- return (hint === "string" ? String : Number)(input);
49
- }
50
-
51
- function _toPropertyKey(arg) {
52
- var key = _toPrimitive(arg, "string");
53
- return _typeof(key) === "symbol" ? key : String(key);
54
- }
55
-
56
- function _defineProperty(obj, key, value) {
57
- key = _toPropertyKey(key);
58
- if (key in obj) {
59
- Object.defineProperty(obj, key, {
60
- value: value,
61
- enumerable: true,
62
- configurable: true,
63
- writable: true
64
- });
65
- } else {
66
- obj[key] = value;
67
- }
68
- return obj;
69
- }
70
-
71
- function _arrayWithHoles(arr) {
72
- if (Array.isArray(arr)) return arr;
73
- }
74
-
75
- function _iterableToArrayLimit(r, l) {
76
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
77
- if (null != t) {
78
- var e,
79
- n,
80
- i,
81
- u,
82
- a = [],
83
- f = !0,
84
- o = !1;
85
- try {
86
- if (i = (t = t.call(r)).next, 0 === l) {
87
- if (Object(t) !== t) return;
88
- f = !1;
89
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
90
- } catch (r) {
91
- o = !0, n = r;
92
- } finally {
93
- try {
94
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
95
- } finally {
96
- if (o) throw n;
97
- }
98
- }
99
- return a;
100
- }
101
- }
102
-
103
- function _arrayLikeToArray$1(arr, len) {
104
- if (len == null || len > arr.length) len = arr.length;
105
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
106
- return arr2;
107
- }
108
-
109
- function _unsupportedIterableToArray$1(o, minLen) {
110
- if (!o) return;
111
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
112
- var n = Object.prototype.toString.call(o).slice(8, -1);
113
- if (n === "Object" && o.constructor) n = o.constructor.name;
114
- if (n === "Map" || n === "Set") return Array.from(o);
115
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
116
- }
117
-
118
- function _nonIterableRest() {
119
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
120
- }
121
-
122
- function _slicedToArray(arr, i) {
123
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
124
- }
125
-
126
- var classes = {
127
- root: function root(_ref) {
128
- var props = _ref.props,
129
- focusedState = _ref.focusedState,
130
- overlayVisibleState = _ref.overlayVisibleState;
131
- return classNames('p-cascadeselect p-component p-inputwrapper', {
132
- 'p-disabled': props.disabled,
133
- 'p-focus': focusedState,
134
- 'p-inputwrapper-filled': props.value,
135
- 'p-inputwrapper-focus': focusedState || overlayVisibleState
136
- }, props.className);
137
- },
138
- label: function label(_ref2) {
139
- var props = _ref2.props,
140
- _label = _ref2.label;
141
- return classNames('p-cascadeselect-label ', {
142
- 'p-placeholder': _label === props.placeholder,
143
- 'p-cascadeselect-label-empty': !props.value && _label === 'p-emptylabel'
144
- });
145
- },
146
- list: function list(_ref3) {
147
- var context = _ref3.context;
148
- return classNames('p-cascadeselect-panel p-cascadeselect-items', {
149
- 'p-input-filled': context && context.inputStyle === 'filled' || PrimeReact.inputStyle === 'filled',
150
- 'p-ripple-disabled': context && context.ripple === false || PrimeReact.ripple === false
151
- });
152
- },
153
- sublist: 'p-cascadeselect-panel p-cascadeselect-items p-cascadeselect-sublist',
154
- item: function item(_ref4) {
155
- var option = _ref4.option,
156
- isOptionGroup = _ref4.isOptionGroup,
157
- activeOptionState = _ref4.activeOptionState;
158
- return classNames('p-cascadeselect-item', {
159
- 'p-cascadeselect-item-group': isOptionGroup(option),
160
- 'p-cascadeselect-item-active p-highlight': activeOptionState === option
161
- });
162
- },
163
- dropdownIcon: 'p-cascadeselect-trigger-icon',
164
- dropdownButton: 'p-cascadeselect-trigger',
165
- wrapper: 'p-cascadeselect-items-wrapper',
166
- panel: 'p-cascadeselect-panel p-component',
167
- content: 'p-cascadeselect-item-content',
168
- optionGroupIcon: 'p-cascadeselect-group-icon',
169
- text: 'p-cascadeselect-item-text',
170
- transition: 'p-connected-overlay'
171
- };
172
- var styles = "\n@layer primereact {\n .p-cascadeselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-cascadeselect-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-cascadeselect-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-cascadeselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n .p-cascadeselect .p-cascadeselect-panel {\n min-width: 100%;\n }\n \n .p-cascadeselect-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-cascadeselect-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n }\n \n .p-cascadeselect-item-content {\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-cascadeselect-group-icon {\n margin-left: auto;\n }\n \n .p-cascadeselect-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n min-width: 100%;\n }\n \n .p-fluid .p-cascadeselect {\n display: flex;\n }\n \n .p-fluid .p-cascadeselect .p-cascadeselect-label {\n width: 1%;\n }\n \n .p-cascadeselect-sublist {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n display: none;\n }\n \n .p-cascadeselect-item-active {\n overflow: visible !important;\n }\n \n .p-cascadeselect-item-active > .p-cascadeselect-sublist {\n display: block;\n left: 100%;\n top: 0;\n }\n}\n";
173
- var CascadeSelectBase = ComponentBase.extend({
174
- defaultProps: {
175
- __TYPE: 'CascadeSelect',
176
- appendTo: null,
177
- ariaLabelledBy: null,
178
- autoFocus: false,
179
- breakpoint: undefined,
180
- className: null,
181
- dataKey: null,
182
- disabled: false,
183
- dropdownIcon: null,
184
- id: null,
185
- inputId: null,
186
- inputRef: null,
187
- itemTemplate: null,
188
- name: null,
189
- onBeforeHide: null,
190
- onBeforeShow: null,
191
- onChange: null,
192
- onGroupChange: null,
193
- onHide: null,
194
- onShow: null,
195
- optionGroupChildren: null,
196
- optionGroupIcon: null,
197
- optionGroupLabel: null,
198
- optionLabel: null,
199
- optionValue: null,
200
- options: null,
201
- placeholder: null,
202
- scrollHeight: '400px',
203
- style: null,
204
- tabIndex: null,
205
- transitionOptions: null,
206
- value: null,
207
- children: undefined
208
- },
209
- css: {
210
- classes: classes,
211
- styles: styles
212
- }
213
- });
214
-
215
- 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; }
216
- 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; }
217
- var CascadeSelectSub = /*#__PURE__*/React.memo(function (props) {
218
- var _React$useState = React.useState(null),
219
- _React$useState2 = _slicedToArray(_React$useState, 2),
220
- activeOptionState = _React$useState2[0],
221
- setActiveOptionState = _React$useState2[1];
222
- var elementRef = React.useRef(null);
223
- var context = React.useContext(PrimeReactContext);
224
- var ptm = props.ptm,
225
- cx = props.cx;
226
- var getPTOptions = function getPTOptions(key) {
227
- return ptm(key, {
228
- hostName: props.hostName
229
- });
230
- };
231
- var position = function position() {
232
- var parentItem = elementRef.current.parentElement;
233
- var containerOffset = DomHandler.getOffset(parentItem);
234
- var viewport = DomHandler.getViewport();
235
- var sublistWidth = elementRef.current.offsetParent ? elementRef.current.offsetWidth : DomHandler.getHiddenElementOuterWidth(element);
236
- var itemOuterWidth = DomHandler.getOuterWidth(parentItem.children[0]);
237
- if (parseInt(containerOffset.left, 10) + itemOuterWidth + sublistWidth > viewport.width - DomHandler.calculateScrollbarWidth()) {
238
- elementRef.current.style.left = '-100%';
239
- }
240
- };
241
- var onOptionSelect = function onOptionSelect(event) {
242
- props.onOptionSelect && props.onOptionSelect(event);
243
- };
244
- var _onKeyDown = function onKeyDown(event, option) {
245
- var listItem = event.currentTarget.parentElement;
246
- switch (event.key) {
247
- case 'Down':
248
- case 'ArrowDown':
249
- var nextItem = findNextItem(listItem);
250
- if (nextItem) {
251
- nextItem.children[0].focus();
252
- }
253
- break;
254
- case 'Up':
255
- case 'ArrowUp':
256
- var prevItem = findPrevItem(listItem);
257
- if (prevItem) {
258
- prevItem.children[0].focus();
259
- }
260
- break;
261
- case 'Right':
262
- case 'ArrowRight':
263
- if (isOptionGroup(option)) {
264
- if (activeOptionState === option) {
265
- listItem.children[1].children[0].children[0].focus();
266
- } else {
267
- setActiveOptionState(option);
268
- }
269
- }
270
- break;
271
- case 'Left':
272
- case 'ArrowLeft':
273
- setActiveOptionState(null);
274
- var parentList = event.currentTarget.parentElement.parentElement.previousElementSibling;
275
- if (parentList) {
276
- parentList.focus();
277
- }
278
- break;
279
- case 'Enter':
280
- onOptionClick(event, option);
281
- break;
282
- case 'Tab':
283
- case 'Escape':
284
- if (props.onPanelHide) {
285
- props.onPanelHide();
286
- event.preventDefault();
287
- }
288
- break;
289
- }
290
- event.preventDefault();
291
- };
292
- var findNextItem = function findNextItem(item) {
293
- var nextItem = item.nextElementSibling;
294
- return nextItem ? DomHandler.hasClass(nextItem, 'p-disabled') || !DomHandler.hasClass(nextItem, 'p-cascadeselect-item') ? findNextItem(nextItem) : nextItem : null;
295
- };
296
- var findPrevItem = function findPrevItem(item) {
297
- var prevItem = item.previousElementSibling;
298
- return prevItem ? DomHandler.hasClass(prevItem, 'p-disabled') || !DomHandler.hasClass(prevItem, 'p-cascadeselect-item') ? findPrevItem(prevItem) : prevItem : null;
299
- };
300
- var onOptionClick = function onOptionClick(event, option) {
301
- if (isOptionGroup(option)) {
302
- setActiveOptionState(function (prevActiveOption) {
303
- return prevActiveOption === option ? null : option;
304
- });
305
- if (props.onOptionGroupSelect) {
306
- props.onOptionGroupSelect({
307
- originalEvent: event,
308
- value: option
309
- });
310
- }
311
- } else {
312
- if (props.onOptionSelect) {
313
- props.onOptionSelect({
314
- originalEvent: event,
315
- value: getOptionValue(option)
316
- });
317
- }
318
- }
319
- };
320
- var onOptionGroupSelect = function onOptionGroupSelect(event) {
321
- props.onOptionGroupSelect && props.onOptionGroupSelect(event);
322
- };
323
- var getOptionLabel = function getOptionLabel(option) {
324
- return props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : option;
325
- };
326
- var getOptionValue = function getOptionValue(option) {
327
- return props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : option;
328
- };
329
- var getOptionGroupLabel = function getOptionGroupLabel(optionGroup) {
330
- return props.optionGroupLabel ? ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel) : null;
331
- };
332
- var getOptionGroupChildren = function getOptionGroupChildren(optionGroup) {
333
- return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupChildren[props.level]);
334
- };
335
- var isOptionGroup = function isOptionGroup(option) {
336
- return Object.prototype.hasOwnProperty.call(option, props.optionGroupChildren[props.level]);
337
- };
338
- var getOptionLabelToRender = function getOptionLabelToRender(option) {
339
- return isOptionGroup(option) ? getOptionGroupLabel(option) : getOptionLabel(option);
340
- };
341
- useMountEffect(function () {
342
- if (props.selectionPath && props.options && !props.dirty) {
343
- var activeOption = props.options.find(function (o) {
344
- return props.selectionPath.includes(o);
345
- });
346
- activeOption && setActiveOptionState(activeOption);
347
- }
348
- if (!props.root) {
349
- position();
350
- }
351
- });
352
- useUpdateEffect(function () {
353
- setActiveOptionState(null);
354
- }, [props.parentActive]);
355
- var createSubmenu = function createSubmenu(option) {
356
- if (isOptionGroup(option) && activeOptionState === option) {
357
- var options = getOptionGroupChildren(option);
358
- var parentActive = activeOptionState === option;
359
- var level = props.level + 1;
360
- return /*#__PURE__*/React.createElement(CascadeSelectSub, {
361
- hostName: props.hostName,
362
- options: options,
363
- className: cx('sublist'),
364
- selectionPath: props.selectionPath,
365
- optionLabel: props.optionLabel,
366
- optionValue: props.optionValue,
367
- level: level,
368
- onOptionSelect: onOptionSelect,
369
- onOptionGroupSelect: onOptionGroupSelect,
370
- parentActive: parentActive,
371
- optionGroupLabel: props.optionGroupLabel,
372
- optionGroupChildren: props.optionGroupChildren,
373
- dirty: props.dirty,
374
- template: props.template,
375
- onPanelHide: props.onPanelHide,
376
- ptm: ptm,
377
- cx: cx
378
- });
379
- }
380
- return null;
381
- };
382
- var createOption = function createOption(option, index) {
383
- var submenu = createSubmenu(option);
384
- var textProps = mergeProps({
385
- className: cx('text')
386
- }, getPTOptions('text'));
387
- var content = props.template ? ObjectUtils.getJSXElement(props.template, getOptionValue(option)) : /*#__PURE__*/React.createElement("span", textProps, getOptionLabelToRender(option));
388
- var optionGroupIconProps = mergeProps({
389
- className: cx('optionGroupIcon')
390
- }, getPTOptions('optionGroupIcon'));
391
- var icon = props.optionGroupIcon || /*#__PURE__*/React.createElement(AngleRightIcon, optionGroupIconProps);
392
- var optionGroup = isOptionGroup(option) && IconUtils.getJSXIcon(icon, _objectSpread$1({}, optionGroupIconProps), {
393
- props: props
394
- });
395
- var key = getOptionLabelToRender(option) + '_' + index;
396
- var contentProps = mergeProps({
397
- className: cx('content'),
398
- onClick: function onClick(event) {
399
- return onOptionClick(event, option);
400
- },
401
- tabIndex: 0,
402
- onKeyDown: function onKeyDown(event) {
403
- return _onKeyDown(event, option);
404
- }
405
- }, getPTOptions('content'));
406
- var itemProps = mergeProps({
407
- className: classNames(option.className, cx('item', {
408
- option: option,
409
- isOptionGroup: isOptionGroup,
410
- activeOptionState: activeOptionState
411
- })),
412
- style: option.style,
413
- role: 'none',
414
- 'data-p-item-group': isOptionGroup(option),
415
- 'data-p-highlight': activeOptionState === option
416
- }, getPTOptions('item'));
417
- return /*#__PURE__*/React.createElement("li", _extends({
418
- key: key
419
- }, itemProps), /*#__PURE__*/React.createElement("div", contentProps, content, optionGroup, /*#__PURE__*/React.createElement(Ripple, null)), submenu);
420
- };
421
- var createMenu = function createMenu() {
422
- return props.options ? props.options.map(createOption) : null;
423
- };
424
- var submenu = createMenu();
425
- var listProps = mergeProps({
426
- ref: elementRef,
427
- className: cx(props.level === 0 ? 'list' : 'sublist', {
428
- context: context
429
- }),
430
- role: 'listbox',
431
- 'aria-orientation': 'horizontal'
432
- }, props.level === 0 ? getPTOptions('list') : getPTOptions('sublist'));
433
- return /*#__PURE__*/React.createElement("ul", listProps, submenu);
434
- });
435
-
436
- 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; }
437
- 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; }
438
- 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; } } }; }
439
- 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); }
440
- 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; }
441
- var CascadeSelect = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
442
- var context = React.useContext(PrimeReactContext);
443
- var props = CascadeSelectBase.getProps(inProps, context);
444
- var _React$useState = React.useState(false),
445
- _React$useState2 = _slicedToArray(_React$useState, 2),
446
- focusedState = _React$useState2[0],
447
- setFocusedState = _React$useState2[1];
448
- var _React$useState3 = React.useState(false),
449
- _React$useState4 = _slicedToArray(_React$useState3, 2),
450
- overlayVisibleState = _React$useState4[0],
451
- setOverlayVisibleState = _React$useState4[1];
452
- var _React$useState5 = React.useState(null),
453
- _React$useState6 = _slicedToArray(_React$useState5, 2),
454
- attributeSelectorState = _React$useState6[0],
455
- setAttributeSelectorState = _React$useState6[1];
456
- var _CascadeSelectBase$se = CascadeSelectBase.setMetaData({
457
- props: props,
458
- state: {
459
- focused: focusedState,
460
- overlayVisible: overlayVisibleState,
461
- attributeSelector: attributeSelectorState
462
- }
463
- }),
464
- ptm = _CascadeSelectBase$se.ptm,
465
- cx = _CascadeSelectBase$se.cx,
466
- isUnstyled = _CascadeSelectBase$se.isUnstyled;
467
- useHandleStyle(CascadeSelectBase.css.styles, isUnstyled, {
468
- name: 'cascadeselect'
469
- });
470
- var elementRef = React.useRef(null);
471
- var overlayRef = React.useRef(null);
472
- var inputRef = React.useRef(null);
473
- var labelRef = React.useRef(null);
474
- var styleElementRef = React.useRef(null);
475
- var dirty = React.useRef(false);
476
- var selectionPath = React.useRef(null);
477
- var _useOverlayListener = useOverlayListener({
478
- target: elementRef,
479
- overlay: overlayRef,
480
- listener: function listener(event, _ref) {
481
- var valid = _ref.valid;
482
- valid && hide();
483
- },
484
- when: overlayVisibleState
485
- }),
486
- _useOverlayListener2 = _slicedToArray(_useOverlayListener, 2),
487
- bindOverlayListener = _useOverlayListener2[0],
488
- unbindOverlayListener = _useOverlayListener2[1];
489
- var onOptionSelect = function onOptionSelect(event) {
490
- if (props.onChange) {
491
- props.onChange({
492
- originalEvent: event,
493
- value: event.value
494
- });
495
- }
496
- updateSelectionPath();
497
- hide();
498
- DomHandler.focus(inputRef.current);
499
- };
500
- var onOptionGroupSelect = function onOptionGroupSelect(event) {
501
- dirty.current = true;
502
- props.onGroupChange && props.onGroupChange(event);
503
- };
504
- var getOptionLabel = function getOptionLabel(option) {
505
- var label = props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : option;
506
- return label || option;
507
- };
508
- var getOptionValue = function getOptionValue(option) {
509
- return props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : option;
510
- };
511
- var getOptionGroupChildren = function getOptionGroupChildren(optionGroup, level) {
512
- return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupChildren[level]);
513
- };
514
- var isOptionGroup = function isOptionGroup(option, level) {
515
- return Object.prototype.hasOwnProperty.call(option, props.optionGroupChildren[level]);
516
- };
517
- var updateSelectionPath = function updateSelectionPath() {
518
- var path;
519
- if (props.value != null && props.options) {
520
- var _iterator = _createForOfIteratorHelper(props.options),
521
- _step;
522
- try {
523
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
524
- var option = _step.value;
525
- path = findModelOptionInGroup(option, 0);
526
- if (path) {
527
- break;
528
- }
529
- }
530
- } catch (err) {
531
- _iterator.e(err);
532
- } finally {
533
- _iterator.f();
534
- }
535
- }
536
- selectionPath.current = path;
537
- };
538
- var findModelOptionInGroup = function findModelOptionInGroup(option, level) {
539
- if (isOptionGroup(option, level)) {
540
- var selectedOption;
541
- var _iterator2 = _createForOfIteratorHelper(getOptionGroupChildren(option, level)),
542
- _step2;
543
- try {
544
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
545
- var childOption = _step2.value;
546
- selectedOption = findModelOptionInGroup(childOption, level + 1);
547
- if (selectedOption) {
548
- selectedOption.unshift(option);
549
- return selectedOption;
550
- }
551
- }
552
- } catch (err) {
553
- _iterator2.e(err);
554
- } finally {
555
- _iterator2.f();
556
- }
557
- } else if (ObjectUtils.equals(props.value, getOptionValue(option), props.dataKey)) {
558
- return [option];
559
- }
560
- return null;
561
- };
562
- var _onClick = function onClick(event) {
563
- if (props.disabled) {
564
- return;
565
- }
566
- if (!overlayRef.current || !overlayRef.current.contains(event.target)) {
567
- DomHandler.focus(inputRef.current);
568
- overlayVisibleState ? hide() : show();
569
- }
570
- };
571
- var onInputFocus = function onInputFocus() {
572
- setFocusedState(true);
573
- };
574
- var onInputBlur = function onInputBlur() {
575
- setFocusedState(false);
576
- };
577
- var onInputKeyDown = function onInputKeyDown(event) {
578
- switch (event.which) {
579
- //down
580
- case 40:
581
- if (overlayVisibleState) {
582
- DomHandler.findSingle(overlayRef.current, '.p-cascadeselect-item').children[0].focus();
583
- } else if (event.altKey && props.options && props.options.length) {
584
- show();
585
- }
586
- event.preventDefault();
587
- break;
588
-
589
- //space
590
- case 32:
591
- overlayVisibleState ? hide() : show();
592
- event.preventDefault();
593
- break;
594
-
595
- //tab
596
- case 9:
597
- hide();
598
- break;
599
- }
600
- };
601
- var onPanelClick = function onPanelClick(event) {
602
- OverlayService.emit('overlay-click', {
603
- originalEvent: event,
604
- target: elementRef.current
605
- });
606
- };
607
- var show = function show() {
608
- props.onBeforeShow && props.onBeforeShow();
609
- setOverlayVisibleState(true);
610
- };
611
- var hide = function hide() {
612
- props.onBeforeHide && props.onBeforeHide();
613
- setOverlayVisibleState(false);
614
- DomHandler.focus(inputRef.current);
615
- };
616
- var onOverlayEnter = function onOverlayEnter() {
617
- ZIndexUtils.set('overlay', overlayRef.current, context && context.autoZIndex || PrimeReact.autoZIndex, context && context.zIndex['overlay'] || PrimeReact.zIndex['overlay']);
618
- DomHandler.addStyles(overlayRef.current, {
619
- position: 'absolute',
620
- top: '0',
621
- left: '0'
622
- });
623
- alignOverlay();
624
- if (attributeSelectorState && props.breakpoint) {
625
- overlayRef.current.setAttribute(attributeSelectorState + '_panel', '');
626
- createStyle();
627
- }
628
- };
629
- var onOverlayEntered = function onOverlayEntered() {
630
- bindOverlayListener();
631
- props.onShow && props.onShow();
632
- };
633
- var onOverlayExit = function onOverlayExit() {
634
- unbindOverlayListener();
635
- dirty.current = false;
636
- };
637
- var onOverlayExited = function onOverlayExited() {
638
- ZIndexUtils.clear(overlayRef.current);
639
- props.onHide && props.onHide();
640
- destroyStyle();
641
- };
642
- var alignOverlay = function alignOverlay() {
643
- DomHandler.alignOverlay(overlayRef.current, labelRef.current.parentElement, props.appendTo || context && context.appendTo || PrimeReact.appendTo);
644
- };
645
- var createStyle = function createStyle() {
646
- if (!styleElementRef.current) {
647
- styleElementRef.current = DomHandler.createInlineStyle(context && context.nonce || PrimeReact.nonce);
648
- var selector = "".concat(attributeSelectorState, "_panel");
649
- var innerHTML = "\n@media screen and (max-width: ".concat(props.breakpoint, ") {\n .p-cascadeselect-panel[").concat(selector, "] .p-cascadeselect-items-wrapper > ul {\n max-height: ").concat(props.scrollHeight, ";\n overflow: ").concat(props.scrollHeight ? 'auto' : '', ";\n }\n\n .p-cascadeselect-panel[").concat(selector, "] .p-cascadeselect-sublist {\n position: relative;\n }\n\n .p-cascadeselect-panel[").concat(selector, "] .p-cascadeselect-item-active > .p-cascadeselect-sublist {\n left: 0 !important;\n box-shadow: none;\n border-radius: 0;\n padding: 0 0 0 calc(var(--inline-spacing) * 2); /* @todo */\n }\n\n .p-cascadeselect-panel[").concat(selector, "] .p-cascadeselect-group-icon:before {\n content: \"\\e930\";\n }\n}\n");
650
- styleElementRef.current.innerHTML = innerHTML;
651
- }
652
- };
653
- var destroyStyle = function destroyStyle() {
654
- styleElementRef.current = DomHandler.removeInlineStyle(styleElementRef.current);
655
- };
656
- React.useImperativeHandle(ref, function () {
657
- return {
658
- props: props,
659
- getElement: function getElement() {
660
- return elementRef.current;
661
- },
662
- getOverlay: function getOverlay() {
663
- return overlayRef.current;
664
- },
665
- getInput: function getInput() {
666
- return inputRef.current;
667
- },
668
- getLabel: function getLabel() {
669
- return labelRef.current;
670
- },
671
- focus: function focus() {
672
- return DomHandler.focus(inputRef.current);
673
- }
674
- };
675
- });
676
- useMountEffect(function () {
677
- if (props.breakpoint) {
678
- !attributeSelectorState && setAttributeSelectorState(UniqueComponentId());
679
- }
680
- if (props.autoFocus) {
681
- DomHandler.focus(inputRef.current, props.autoFocus);
682
- }
683
- });
684
- React.useEffect(function () {
685
- ObjectUtils.combinedRefs(inputRef, props.inputRef);
686
- }, [inputRef, props.inputRef]);
687
- useUpdateEffect(function () {
688
- updateSelectionPath();
689
- }, [props.value]);
690
- useUnmountEffect(function () {
691
- ZIndexUtils.clear(overlayRef.current);
692
- });
693
- var createKeyboardHelper = function createKeyboardHelper() {
694
- var value = props.value ? getOptionLabel(props.value) : undefined;
695
- var hiddenSelectedMessageProps = mergeProps({
696
- className: 'p-hidden-accessible'
697
- }, ptm('hiddenSelectedMessage'));
698
- var inputProps = mergeProps(_objectSpread({
699
- ref: inputRef,
700
- type: 'text',
701
- id: props.inputId,
702
- name: props.name,
703
- defaultValue: value,
704
- readOnly: true,
705
- disabled: props.disabled,
706
- onFocus: onInputFocus,
707
- onBlur: onInputBlur,
708
- onKeyDown: function onKeyDown(e) {
709
- return onInputKeyDown(e);
710
- },
711
- tabIndex: props.tabIndex,
712
- 'aria-haspopup': 'listbox'
713
- }, ariaProps), ptm('input'));
714
- return /*#__PURE__*/React.createElement("div", hiddenSelectedMessageProps, /*#__PURE__*/React.createElement("input", inputProps));
715
- };
716
- var createLabel = function createLabel() {
717
- var label = props.value ? getOptionLabel(props.value) : props.placeholder || 'p-emptylabel';
718
- var labelProps = mergeProps({
719
- ref: labelRef,
720
- className: cx('label', {
721
- label: label
722
- })
723
- }, ptm('label'));
724
- return /*#__PURE__*/React.createElement("span", labelProps, label);
725
- };
726
- var createDropdownIcon = function createDropdownIcon() {
727
- var dropdownIconProps = mergeProps({
728
- className: cx('dropdownIcon')
729
- }, ptm('dropdownIcon'));
730
- var icon = props.dropdownIcon || /*#__PURE__*/React.createElement(ChevronDownIcon, dropdownIconProps);
731
- var dropdownIcon = IconUtils.getJSXIcon(icon, _objectSpread({}, dropdownIconProps), {
732
- props: props
733
- });
734
- var dropdownButtonProps = mergeProps({
735
- className: cx('dropdownButton'),
736
- role: 'button',
737
- 'aria-haspopup': 'listbox',
738
- 'aria-expanded': overlayVisibleState
739
- }, ptm('dropdownButton'));
740
- return /*#__PURE__*/React.createElement("div", dropdownButtonProps, dropdownIcon);
741
- };
742
- var wrapperProps = mergeProps({
743
- className: cx('wrapper')
744
- }, ptm('wrapper'));
745
- var panelProps = mergeProps({
746
- ref: overlayRef,
747
- className: cx('panel'),
748
- onClick: function onClick(e) {
749
- return onPanelClick(e);
750
- }
751
- }, ptm('panel'));
752
- var createOverlay = function createOverlay() {
753
- var transitionProps = mergeProps({
754
- classNames: cx('transition'),
755
- "in": overlayVisibleState,
756
- timeout: {
757
- enter: 120,
758
- exit: 100
759
- },
760
- options: props.transitionOptions,
761
- unmountOnExit: true,
762
- onEnter: onOverlayEnter,
763
- onEntered: onOverlayEntered,
764
- onExit: onOverlayExit,
765
- onExited: onOverlayExited
766
- }, ptm('transition'));
767
- var overlay = /*#__PURE__*/React.createElement(CSSTransition, _extends({
768
- nodeRef: overlayRef
769
- }, transitionProps), /*#__PURE__*/React.createElement("div", panelProps, /*#__PURE__*/React.createElement("div", wrapperProps, /*#__PURE__*/React.createElement(CascadeSelectSub, {
770
- hostName: "CascadeSelect",
771
- options: props.options,
772
- selectionPath: selectionPath.current,
773
- optionGroupIcon: props.optionGroupIcon,
774
- optionLabel: props.optionLabel,
775
- optionValue: props.optionValue,
776
- level: 0,
777
- optionGroupLabel: props.optionGroupLabel,
778
- optionGroupChildren: props.optionGroupChildren,
779
- onOptionSelect: onOptionSelect,
780
- onOptionGroupSelect: onOptionGroupSelect,
781
- root: true,
782
- template: props.itemTemplate,
783
- onPanelHide: hide,
784
- ptm: ptm,
785
- cx: cx
786
- }))));
787
- return /*#__PURE__*/React.createElement(Portal, {
788
- element: overlay,
789
- appendTo: props.appendTo
790
- });
791
- };
792
- var createElement = function createElement() {
793
- var keyboardHelper = createKeyboardHelper();
794
- var labelElement = createLabel();
795
- var dropdownIcon = createDropdownIcon();
796
- var overlay = createOverlay();
797
- var rootProps = mergeProps({
798
- id: props.id,
799
- ref: elementRef,
800
- className: cx('root', {
801
- focusedState: focusedState,
802
- overlayVisibleState: overlayVisibleState
803
- }),
804
- style: props.style,
805
- onClick: function onClick(e) {
806
- return _onClick(e);
807
- }
808
- }, otherProps, ptm('root'));
809
- return /*#__PURE__*/React.createElement("div", rootProps, keyboardHelper, labelElement, dropdownIcon, overlay);
810
- };
811
- var otherProps = CascadeSelectBase.getOtherProps(props);
812
- ObjectUtils.reduceKeys(otherProps, DomHandler.DATA_PROPS);
813
- var ariaProps = ObjectUtils.reduceKeys(otherProps, DomHandler.ARIA_PROPS);
814
- var element = createElement();
815
- return element;
816
- }));
817
- CascadeSelect.displayName = 'CascadeSelect';
818
-
819
- export { CascadeSelect };