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,664 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import PrimeReact, { PrimeReactContext } from 'primereact/api';
5
- import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
6
- import { CSSTransition } from 'primereact/csstransition';
7
- import { useUpdateEffect, useMatchMedia, useEventListener, useResizeListener, useMountEffect, useUnmountEffect } from 'primereact/hooks';
8
- import { Portal } from 'primereact/portal';
9
- import { classNames, mergeProps, DomHandler, IconUtils, ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primereact/utils';
10
- import { AngleRightIcon } from 'primereact/icons/angleright';
11
- import { Ripple } from 'primereact/ripple';
12
-
13
- function _extends() {
14
- _extends = Object.assign ? Object.assign.bind() : function (target) {
15
- for (var i = 1; i < arguments.length; i++) {
16
- var source = arguments[i];
17
- for (var key in source) {
18
- if (Object.prototype.hasOwnProperty.call(source, key)) {
19
- target[key] = source[key];
20
- }
21
- }
22
- }
23
- return target;
24
- };
25
- return _extends.apply(this, arguments);
26
- }
27
-
28
- function _arrayWithHoles(arr) {
29
- if (Array.isArray(arr)) return arr;
30
- }
31
-
32
- function _iterableToArrayLimit(r, l) {
33
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
34
- if (null != t) {
35
- var e,
36
- n,
37
- i,
38
- u,
39
- a = [],
40
- f = !0,
41
- o = !1;
42
- try {
43
- if (i = (t = t.call(r)).next, 0 === l) {
44
- if (Object(t) !== t) return;
45
- f = !1;
46
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
47
- } catch (r) {
48
- o = !0, n = r;
49
- } finally {
50
- try {
51
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
52
- } finally {
53
- if (o) throw n;
54
- }
55
- }
56
- return a;
57
- }
58
- }
59
-
60
- function _arrayLikeToArray(arr, len) {
61
- if (len == null || len > arr.length) len = arr.length;
62
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
63
- return arr2;
64
- }
65
-
66
- function _unsupportedIterableToArray(o, minLen) {
67
- if (!o) return;
68
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
69
- var n = Object.prototype.toString.call(o).slice(8, -1);
70
- if (n === "Object" && o.constructor) n = o.constructor.name;
71
- if (n === "Map" || n === "Set") return Array.from(o);
72
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
73
- }
74
-
75
- function _nonIterableRest() {
76
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
77
- }
78
-
79
- function _slicedToArray(arr, i) {
80
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
81
- }
82
-
83
- var styles = "\n@layer primereact {\n .p-contextmenu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n \n .p-contextmenu .p-submenu-list {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n }\n \n .p-contextmenu .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n \n .p-contextmenu .p-menuitem-text {\n line-height: 1;\n }\n \n .p-contextmenu .p-menuitem {\n position: relative;\n }\n \n .p-contextmenu .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n }\n \n .p-contextmenu-enter {\n opacity: 0;\n }\n \n .p-contextmenu-enter-active {\n opacity: 1;\n transition: opacity 250ms;\n }\n}\n";
84
- var classes = {
85
- root: function root(_ref) {
86
- var context = _ref.context;
87
- return classNames('p-contextmenu p-component', {
88
- 'p-input-filled': context && context.inputStyle === 'filled' || PrimeReact.inputStyle === 'filled',
89
- 'p-ripple-disabled': context && context.ripple === false || PrimeReact.ripple === false
90
- });
91
- },
92
- menu: function menu(_ref2) {
93
- var props = _ref2.menuProps;
94
- return classNames({
95
- 'p-submenu-list': !props.root
96
- });
97
- },
98
- menuitem: function menuitem(_ref3) {
99
- var item = _ref3.item,
100
- active = _ref3.active;
101
- return classNames('p-menuitem', {
102
- 'p-menuitem-active': active
103
- }, item.className);
104
- },
105
- action: function action(_ref4) {
106
- var item = _ref4.item;
107
- return classNames('p-menuitem-link', {
108
- 'p-disabled': item.disabled
109
- });
110
- },
111
- icon: 'p-menuitem-icon',
112
- submenuIcon: 'p-submenu-icon',
113
- label: 'p-menuitem-text',
114
- separator: 'p-menu-separator',
115
- transition: 'p-contextmenu',
116
- submenuTransition: 'p-contextmenusub'
117
- };
118
- var ContextMenuBase = ComponentBase.extend({
119
- defaultProps: {
120
- __TYPE: 'ContextMenu',
121
- id: null,
122
- model: null,
123
- style: null,
124
- className: null,
125
- global: false,
126
- autoZIndex: true,
127
- baseZIndex: 0,
128
- breakpoint: undefined,
129
- scrollHeight: '400px',
130
- appendTo: null,
131
- transitionOptions: null,
132
- onShow: null,
133
- onHide: null,
134
- submenuIcon: null,
135
- children: undefined
136
- },
137
- css: {
138
- classes: classes,
139
- styles: styles
140
- }
141
- });
142
-
143
- function _typeof(o) {
144
- "@babel/helpers - typeof";
145
-
146
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
147
- return typeof o;
148
- } : function (o) {
149
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
150
- }, _typeof(o);
151
- }
152
-
153
- function _toPrimitive(input, hint) {
154
- if (_typeof(input) !== "object" || input === null) return input;
155
- var prim = input[Symbol.toPrimitive];
156
- if (prim !== undefined) {
157
- var res = prim.call(input, hint || "default");
158
- if (_typeof(res) !== "object") return res;
159
- throw new TypeError("@@toPrimitive must return a primitive value.");
160
- }
161
- return (hint === "string" ? String : Number)(input);
162
- }
163
-
164
- function _toPropertyKey(arg) {
165
- var key = _toPrimitive(arg, "string");
166
- return _typeof(key) === "symbol" ? key : String(key);
167
- }
168
-
169
- function _defineProperty(obj, key, value) {
170
- key = _toPropertyKey(key);
171
- if (key in obj) {
172
- Object.defineProperty(obj, key, {
173
- value: value,
174
- enumerable: true,
175
- configurable: true,
176
- writable: true
177
- });
178
- } else {
179
- obj[key] = value;
180
- }
181
- return obj;
182
- }
183
-
184
- 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; }
185
- 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; }
186
- var ContextMenuSub = /*#__PURE__*/React.memo(function (props) {
187
- var _React$useState = React.useState(null),
188
- _React$useState2 = _slicedToArray(_React$useState, 2),
189
- activeItemState = _React$useState2[0],
190
- setActiveItemState = _React$useState2[1];
191
- var submenuRef = React.useRef(null);
192
- var active = props.root || !props.resetMenu;
193
- var ptm = props.ptm,
194
- cx = props.cx;
195
- var getPTOptions = function getPTOptions(item, key) {
196
- return ptm(key, {
197
- hostName: props.hostName,
198
- context: {
199
- active: activeItemState === item
200
- }
201
- });
202
- };
203
- if (props.resetMenu === true && activeItemState !== null) {
204
- setActiveItemState(null);
205
- }
206
- var onItemMouseEnter = function onItemMouseEnter(event, item) {
207
- if (item.disabled || props.isMobileMode) {
208
- event.preventDefault();
209
- return;
210
- }
211
- setActiveItemState(item);
212
- };
213
- var onItemClick = function onItemClick(event, item) {
214
- if (item.disabled) {
215
- event.preventDefault();
216
- return;
217
- }
218
- if (!item.url) {
219
- event.preventDefault();
220
- }
221
- if (item.command) {
222
- item.command({
223
- originalEvent: event,
224
- item: item
225
- });
226
- }
227
- if (props.isMobileMode && item.items) {
228
- if (activeItemState && item === activeItemState) setActiveItemState(null);else setActiveItemState(item);
229
- }
230
- if (!item.items) {
231
- props.onLeafClick(event);
232
- }
233
- };
234
- var position = function position() {
235
- if (!props.isMobileMode) {
236
- var parentItem = submenuRef.current.parentElement;
237
- var containerOffset = DomHandler.getOffset(parentItem);
238
- var viewport = DomHandler.getViewport();
239
- var sublistWidth = submenuRef.current.offsetParent ? submenuRef.current.offsetWidth : DomHandler.getHiddenElementOuterWidth(submenuRef.current);
240
- var itemOuterWidth = DomHandler.getOuterWidth(parentItem.children[0]);
241
- var top = parseInt(containerOffset.top, 10) + submenuRef.current.offsetHeight - DomHandler.getWindowScrollTop();
242
- if (top > viewport.height) {
243
- submenuRef.current.style.top = viewport.height - top + 'px';
244
- } else {
245
- submenuRef.current.style.top = '0px';
246
- }
247
- if (parseInt(containerOffset.left, 10) + itemOuterWidth + sublistWidth > viewport.width - DomHandler.calculateScrollbarWidth()) {
248
- submenuRef.current.style.left = -1 * sublistWidth + 'px';
249
- } else {
250
- submenuRef.current.style.left = itemOuterWidth + 'px';
251
- }
252
- }
253
- };
254
- var onEnter = function onEnter() {
255
- position();
256
- };
257
- useUpdateEffect(function () {
258
- active && position();
259
- });
260
- var createSeparator = function createSeparator(index) {
261
- var key = props.id + '_separator_' + index;
262
- var separatorProps = mergeProps({
263
- id: key,
264
- key: key,
265
- className: cx('separator'),
266
- role: 'separator'
267
- }, ptm('separator', {
268
- hostName: props.hostName
269
- }));
270
- return /*#__PURE__*/React.createElement("li", separatorProps);
271
- };
272
- var createSubmenu = function createSubmenu(item, index) {
273
- if (item.items) {
274
- return /*#__PURE__*/React.createElement(ContextMenuSub, {
275
- id: props.id + '_' + index,
276
- hostName: props.hostName,
277
- menuProps: props.menuProps,
278
- model: item.items,
279
- resetMenu: item !== activeItemState,
280
- onLeafClick: props.onLeafClick,
281
- isMobileMode: props.isMobileMode,
282
- submenuIcon: props.submenuIcon,
283
- ptm: ptm,
284
- cx: cx
285
- });
286
- }
287
- return null;
288
- };
289
- var createMenuItem = function createMenuItem(item, index) {
290
- var _mergeProps;
291
- if (item.visible === false) {
292
- return null;
293
- }
294
- var active = activeItemState === item;
295
- var key = item.id || props.id + '_' + index;
296
- var iconProps = mergeProps({
297
- className: cx('icon')
298
- }, getPTOptions(item, 'icon'));
299
- var icon = IconUtils.getJSXIcon(item.icon, _objectSpread({}, iconProps), {
300
- props: props.menuProps
301
- });
302
- var submenuIconProps = mergeProps({
303
- className: cx('submenuIcon')
304
- }, getPTOptions(item, 'submenuIcon'));
305
- var labelProps = mergeProps({
306
- className: cx('label')
307
- }, getPTOptions(item, 'label'));
308
- var submenuIcon = item.items && IconUtils.getJSXIcon(props.submenuIcon || /*#__PURE__*/React.createElement(AngleRightIcon, submenuIconProps), _objectSpread({}, submenuIconProps), {
309
- props: props.menuProps
310
- });
311
- var label = item.label && /*#__PURE__*/React.createElement("span", labelProps, item.label);
312
- var submenu = createSubmenu(item, index);
313
- var actionProps = mergeProps({
314
- href: item.url || '#',
315
- className: cx('action', {
316
- item: item
317
- }),
318
- target: item.target,
319
- onClick: function onClick(event) {
320
- return onItemClick(event, item);
321
- },
322
- role: 'menuitem',
323
- 'aria-haspopup': item.items != null,
324
- 'aria-disabled': item.disabled
325
- }, getPTOptions(item, 'action'));
326
- var content = /*#__PURE__*/React.createElement("a", actionProps, icon, label, submenuIcon, /*#__PURE__*/React.createElement(Ripple, null));
327
- if (item.template) {
328
- var defaultContentOptions = {
329
- onClick: function onClick(event) {
330
- return onItemClick(event, item);
331
- },
332
- className: 'p-menuitem-link',
333
- labelClassName: 'p-menuitem-text',
334
- iconClassName: 'p-menuitem-icon',
335
- submenuIconClassName: submenuIconClassName,
336
- element: content,
337
- props: props,
338
- active: active
339
- };
340
- content = ObjectUtils.getJSXElement(item.template, item, defaultContentOptions);
341
- }
342
- var menuitemProps = mergeProps((_mergeProps = {
343
- id: key,
344
- key: key,
345
- role: 'none',
346
- className: cx('menuitem', {
347
- item: item,
348
- active: active
349
- }),
350
- style: item.style
351
- }, _defineProperty(_mergeProps, "key", key), _defineProperty(_mergeProps, "onMouseEnter", function onMouseEnter(event) {
352
- return onItemMouseEnter(event, item);
353
- }), _mergeProps), getPTOptions(item, 'menuitem'));
354
- return /*#__PURE__*/React.createElement("li", menuitemProps, content, submenu);
355
- };
356
- var createItem = function createItem(item, index) {
357
- return item.separator ? createSeparator(index) : createMenuItem(item, index);
358
- };
359
- var createMenu = function createMenu() {
360
- return props.model ? props.model.map(createItem) : null;
361
- };
362
- var submenu = createMenu();
363
- var menuProps = mergeProps({
364
- className: cx('menu', {
365
- menuProps: props
366
- })
367
- }, ptm('menu', {
368
- hostName: props.hostName
369
- }));
370
- var transitionProps = mergeProps({
371
- classNames: cx('submenuTransition'),
372
- "in": active,
373
- timeout: {
374
- enter: 0,
375
- exit: 0
376
- },
377
- unmountOnExit: true,
378
- onEnter: onEnter
379
- }, ptm('menu.transition', {
380
- hostName: props.hostName
381
- }));
382
- return /*#__PURE__*/React.createElement(CSSTransition, _extends({
383
- nodeRef: submenuRef
384
- }, transitionProps), /*#__PURE__*/React.createElement("ul", _extends({
385
- ref: submenuRef
386
- }, menuProps), submenu));
387
- });
388
- ContextMenuSub.displayName = 'ContextMenuSub';
389
-
390
- var ContextMenu = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
391
- var context = React.useContext(PrimeReactContext);
392
- var props = ContextMenuBase.getProps(inProps, context);
393
- var _React$useState = React.useState(props.id),
394
- _React$useState2 = _slicedToArray(_React$useState, 2),
395
- idState = _React$useState2[0],
396
- setIdState = _React$useState2[1];
397
- var _React$useState3 = React.useState(false),
398
- _React$useState4 = _slicedToArray(_React$useState3, 2),
399
- visibleState = _React$useState4[0],
400
- setVisibleState = _React$useState4[1];
401
- var _React$useState5 = React.useState(false),
402
- _React$useState6 = _slicedToArray(_React$useState5, 2),
403
- reshowState = _React$useState6[0],
404
- setReshowState = _React$useState6[1];
405
- var _React$useState7 = React.useState(false),
406
- _React$useState8 = _slicedToArray(_React$useState7, 2),
407
- resetMenuState = _React$useState8[0],
408
- setResetMenuState = _React$useState8[1];
409
- var _React$useState9 = React.useState(null),
410
- _React$useState10 = _slicedToArray(_React$useState9, 2),
411
- attributeSelectorState = _React$useState10[0],
412
- setAttributeSelectorState = _React$useState10[1];
413
- var _ContextMenuBase$setM = ContextMenuBase.setMetaData({
414
- props: props,
415
- state: {
416
- id: idState,
417
- visible: visibleState,
418
- reshow: reshowState,
419
- resetMenu: resetMenuState,
420
- attributeSelector: attributeSelectorState
421
- }
422
- }),
423
- ptm = _ContextMenuBase$setM.ptm,
424
- cx = _ContextMenuBase$setM.cx,
425
- isUnstyled = _ContextMenuBase$setM.isUnstyled;
426
- useHandleStyle(ContextMenuBase.css.styles, isUnstyled, {
427
- name: 'contextmenu'
428
- });
429
- var menuRef = React.useRef(null);
430
- var currentEvent = React.useRef(null);
431
- var styleElementRef = React.useRef(null);
432
- var isMobileMode = useMatchMedia("screen and (max-width: ".concat(props.breakpoint, ")"), !!props.breakpoint);
433
- var _useEventListener = useEventListener({
434
- type: 'click',
435
- listener: function listener(event) {
436
- if (isOutsideClicked(event) && event.button !== 2) {
437
- hide(event);
438
- setResetMenuState(true);
439
- }
440
- }
441
- }),
442
- _useEventListener2 = _slicedToArray(_useEventListener, 2),
443
- bindDocumentClickListener = _useEventListener2[0],
444
- unbindDocumentClickListener = _useEventListener2[1];
445
- var _useEventListener3 = useEventListener({
446
- type: 'contextmenu',
447
- when: props.global,
448
- listener: function listener(event) {
449
- show(event);
450
- }
451
- }),
452
- _useEventListener4 = _slicedToArray(_useEventListener3, 1),
453
- bindDocumentContextMenuListener = _useEventListener4[0];
454
- var _useResizeListener = useResizeListener({
455
- listener: function listener(event) {
456
- if (visibleState && !DomHandler.isTouchDevice()) {
457
- hide(event);
458
- }
459
- }
460
- }),
461
- _useResizeListener2 = _slicedToArray(_useResizeListener, 2),
462
- bindDocumentResizeListener = _useResizeListener2[0],
463
- unbindDocumentResizeListener = _useResizeListener2[1];
464
- var createStyle = function createStyle() {
465
- if (!styleElementRef.current) {
466
- styleElementRef.current = DomHandler.createInlineStyle(context && context.nonce || PrimeReact.nonce);
467
- var selector = "".concat(attributeSelectorState);
468
- var innerHTML = "\n@media screen and (max-width: ".concat(props.breakpoint, ") {\n .p-contextmenu[").concat(selector, "] > ul {\n max-height: ").concat(props.scrollHeight, ";\n overflow: ").concat(props.scrollHeight ? 'auto' : '', ";\n }\n\n .p-contextmenu[").concat(selector, "] .p-submenu-list {\n position: relative;\n }\n\n .p-contextmenu[").concat(selector, "] .p-menuitem-active > .p-submenu-list {\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-contextmenu[").concat(selector, "] .p-menuitem-active > .p-menuitem-link > .p-submenu-icon {\n transform: rotate(-180deg);\n }\n\n .p-contextmenu[").concat(selector, "] .p-submenu-icon:before {\n content: \"\\e930\";\n }\n}\n");
469
- styleElementRef.current.innerHTML = innerHTML;
470
- }
471
- };
472
- var destroyStyle = function destroyStyle() {
473
- styleElementRef.current = DomHandler.removeInlineStyle(styleElementRef.current);
474
- };
475
- var onMenuClick = function onMenuClick() {
476
- setResetMenuState(false);
477
- };
478
- var onMenuMouseEnter = function onMenuMouseEnter() {
479
- setResetMenuState(false);
480
- };
481
- var show = function show(event) {
482
- event.stopPropagation();
483
- event.preventDefault();
484
- currentEvent.current = event;
485
- if (visibleState) {
486
- setReshowState(true);
487
- } else {
488
- setVisibleState(true);
489
- props.onShow && props.onShow(currentEvent.current);
490
- }
491
- };
492
- var hide = function hide(event) {
493
- currentEvent.current = event;
494
- setVisibleState(false);
495
- setReshowState(false);
496
- props.onHide && props.onHide(currentEvent.current);
497
- };
498
- var onEnter = function onEnter() {
499
- DomHandler.addStyles(menuRef.current, {
500
- position: 'absolute'
501
- });
502
- if (props.autoZIndex) {
503
- ZIndexUtils.set('menu', menuRef.current, context && context.autoZIndex || PrimeReact.autoZIndex, props.baseZIndex || context && context.zIndex['menu'] || PrimeReact.zIndex['menu']);
504
- }
505
- position(currentEvent.current);
506
- if (attributeSelectorState && props.breakpoint) {
507
- menuRef.current.setAttribute(attributeSelectorState, '');
508
- createStyle();
509
- }
510
- };
511
- var onEntered = function onEntered() {
512
- bindDocumentListeners();
513
- };
514
- var onExit = function onExit() {
515
- unbindDocumentListeners();
516
- ZIndexUtils.clear(menuRef.current);
517
- };
518
- var onExited = function onExited() {
519
- ZIndexUtils.clear(menuRef.current);
520
- destroyStyle();
521
- };
522
- var position = function position(event) {
523
- if (event) {
524
- var left = event.pageX + 1;
525
- var top = event.pageY + 1;
526
- var width = menuRef.current.offsetParent ? menuRef.current.offsetWidth : DomHandler.getHiddenElementOuterWidth(menuRef.current);
527
- var height = menuRef.current.offsetParent ? menuRef.current.offsetHeight : DomHandler.getHiddenElementOuterHeight(menuRef.current);
528
- var viewport = DomHandler.getViewport();
529
-
530
- //flip
531
- if (left + width - document.body.scrollLeft > viewport.width) {
532
- left -= width;
533
- }
534
-
535
- //flip
536
- if (top + height - document.body.scrollTop > viewport.height) {
537
- top -= height;
538
- }
539
-
540
- //fit
541
- if (left < document.body.scrollLeft) {
542
- left = document.body.scrollLeft;
543
- }
544
-
545
- //fit
546
- if (top < document.body.scrollTop) {
547
- top = document.body.scrollTop;
548
- }
549
- menuRef.current.style.left = left + 'px';
550
- menuRef.current.style.top = top + 'px';
551
- }
552
- };
553
- var onLeafClick = function onLeafClick(event) {
554
- setResetMenuState(true);
555
- hide(event);
556
- event.stopPropagation();
557
- };
558
- var isOutsideClicked = function isOutsideClicked(event) {
559
- return menuRef && menuRef.current && !(menuRef.current.isSameNode(event.target) || menuRef.current.contains(event.target));
560
- };
561
- var bindDocumentListeners = function bindDocumentListeners() {
562
- bindDocumentResizeListener();
563
- bindDocumentClickListener();
564
- };
565
- var unbindDocumentListeners = function unbindDocumentListeners() {
566
- unbindDocumentResizeListener();
567
- unbindDocumentClickListener();
568
- };
569
- useMountEffect(function () {
570
- var uniqueId = UniqueComponentId();
571
- !idState && setIdState(uniqueId);
572
- if (props.breakpoint) {
573
- !attributeSelectorState && setAttributeSelectorState(uniqueId);
574
- }
575
- });
576
- useUpdateEffect(function () {
577
- props.global && bindDocumentContextMenuListener();
578
- }, [props.global]);
579
- useUpdateEffect(function () {
580
- if (attributeSelectorState && menuRef.current) {
581
- menuRef.current.setAttribute(attributeSelectorState, '');
582
- createStyle();
583
- }
584
- return function () {
585
- destroyStyle();
586
- };
587
- }, [attributeSelectorState, props.breakpoint]);
588
- useUpdateEffect(function () {
589
- if (visibleState) {
590
- setVisibleState(false);
591
- setReshowState(false);
592
- setResetMenuState(true);
593
- } else if (!reshowState && !visibleState && resetMenuState) {
594
- show(currentEvent.current);
595
- }
596
- }, [reshowState]);
597
- useUnmountEffect(function () {
598
- ZIndexUtils.clear(menuRef.current);
599
- });
600
- React.useImperativeHandle(ref, function () {
601
- return {
602
- props: props,
603
- show: show,
604
- hide: hide,
605
- getElement: function getElement() {
606
- return menuRef.current;
607
- }
608
- };
609
- });
610
- var createContextMenu = function createContextMenu() {
611
- var rootProps = mergeProps({
612
- id: props.id,
613
- className: classNames(props.className, cx('root', {
614
- context: context
615
- })),
616
- style: props.style,
617
- onClick: function onClick(e) {
618
- return onMenuClick();
619
- },
620
- onMouseEnter: function onMouseEnter(e) {
621
- return onMenuMouseEnter();
622
- }
623
- }, ContextMenuBase.getOtherProps(props), ptm('root'));
624
- var transitionProps = mergeProps({
625
- classNames: cx('transition'),
626
- "in": visibleState,
627
- timeout: {
628
- enter: 250,
629
- exit: 0
630
- },
631
- options: props.transitionOptions,
632
- unmountOnExit: true,
633
- onEnter: onEnter,
634
- onEntered: onEntered,
635
- onExit: onExit,
636
- onExited: onExited
637
- }, ptm('transition'));
638
- return /*#__PURE__*/React.createElement(CSSTransition, _extends({
639
- nodeRef: menuRef
640
- }, transitionProps), /*#__PURE__*/React.createElement("div", _extends({
641
- ref: menuRef
642
- }, rootProps), /*#__PURE__*/React.createElement(ContextMenuSub, {
643
- hostName: "ContextMenu",
644
- id: idState,
645
- menuProps: props,
646
- model: props.model,
647
- root: true,
648
- resetMenu: resetMenuState,
649
- onLeafClick: onLeafClick,
650
- isMobileMode: isMobileMode,
651
- submenuIcon: props.submenuIcon,
652
- ptm: ptm,
653
- cx: cx
654
- })));
655
- };
656
- var element = createContextMenu();
657
- return /*#__PURE__*/React.createElement(Portal, {
658
- element: element,
659
- appendTo: props.appendTo
660
- });
661
- }));
662
- ContextMenu.displayName = 'ContextMenu';
663
-
664
- export { ContextMenu };
@@ -1 +0,0 @@
1
- import*as e from"react";import t,{PrimeReactContext as n}from"primereact/api";import{ComponentBase as r,useHandleStyle as o}from"primereact/componentbase";import{CSSTransition as i}from"primereact/csstransition";import{useUpdateEffect as u,useMatchMedia as a,useEventListener as c,useResizeListener as l,useMountEffect as s,useUnmountEffect as m}from"primereact/hooks";import{Portal as p}from"primereact/portal";import{classNames as f,mergeProps as d,DomHandler as b,IconUtils as y,ObjectUtils as h,UniqueComponentId as v,ZIndexUtils as g}from"primereact/utils";import{AngleRightIcon as x}from"primereact/icons/angleright";import{Ripple as S}from"primereact/ripple";function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},O.apply(this,arguments)}function E(e){if(Array.isArray(e))return e}function N(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function I(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function P(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function M(e,t){return E(e)||N(e,t)||I(e,t)||P()}var k=r.extend({defaultProps:{__TYPE:"ContextMenu",id:null,model:null,style:null,className:null,global:!1,autoZIndex:!0,baseZIndex:0,breakpoint:void 0,scrollHeight:"400px",appendTo:null,transitionOptions:null,onShow:null,onHide:null,submenuIcon:null,children:void 0},css:{classes:{root:function(e){var n=e.context;return f("p-contextmenu p-component",{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===t.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===t.ripple})},menu:function(e){return f({"p-submenu-list":!e.menuProps.root})},menuitem:function(e){return f("p-menuitem",{"p-menuitem-active":e.active},e.item.className)},action:function(e){return f("p-menuitem-link",{"p-disabled":e.item.disabled})},icon:"p-menuitem-icon",submenuIcon:"p-submenu-icon",label:"p-menuitem-text",separator:"p-menu-separator",transition:"p-contextmenu",submenuTransition:"p-contextmenusub"},styles:"\n@layer primereact {\n .p-contextmenu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n \n .p-contextmenu .p-submenu-list {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n }\n \n .p-contextmenu .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n \n .p-contextmenu .p-menuitem-text {\n line-height: 1;\n }\n \n .p-contextmenu .p-menuitem {\n position: relative;\n }\n \n .p-contextmenu .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n }\n \n .p-contextmenu-enter {\n opacity: 0;\n }\n \n .p-contextmenu-enter-active {\n opacity: 1;\n transition: opacity 250ms;\n }\n}\n"}});function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function C(e,t){if("object"!==j(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function H(e){var t=C(e,"string");return"symbol"===j(t)?t:String(t)}function T(e,t,n){return(t=H(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){T(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var L=e.memo((function(t){var n=M(e.useState(null),2),r=n[0],o=n[1],a=e.useRef(null),c=t.root||!t.resetMenu,l=t.ptm,s=t.cx,m=function(e,n){return l(n,{hostName:t.hostName,context:{active:r===e}})};!0===t.resetMenu&&null!==r&&o(null);var p=function(e,n){n.disabled||t.isMobileMode?e.preventDefault():o(n)},f=function(e,n){n.disabled?e.preventDefault():(n.url||e.preventDefault(),n.command&&n.command({originalEvent:e,item:n}),t.isMobileMode&&n.items&&o(r&&n===r?null:n),n.items||t.onLeafClick(e))},v=function(){if(!t.isMobileMode){var e=a.current.parentElement,n=b.getOffset(e),r=b.getViewport(),o=a.current.offsetParent?a.current.offsetWidth:b.getHiddenElementOuterWidth(a.current),i=b.getOuterWidth(e.children[0]),u=parseInt(n.top,10)+a.current.offsetHeight-b.getWindowScrollTop();a.current.style.top=u>r.height?r.height-u+"px":"0px",a.current.style.left=parseInt(n.left,10)+i+o>r.width-b.calculateScrollbarWidth()?-1*o+"px":i+"px"}};u((function(){c&&v()}));var g=function(n){var r=t.id+"_separator_"+n,o=d({id:r,key:r,className:s("separator"),role:"separator"},l("separator",{hostName:t.hostName}));return e.createElement("li",o)},E=function(n,o){return n.items?e.createElement(L,{id:t.id+"_"+o,hostName:t.hostName,menuProps:t.menuProps,model:n.items,resetMenu:n!==r,onLeafClick:t.onLeafClick,isMobileMode:t.isMobileMode,submenuIcon:t.submenuIcon,ptm:l,cx:s}):null},N=function(n,o){var i;if(!1===n.visible)return null;var u=r===n,a=n.id||t.id+"_"+o,c=d({className:s("icon")},m(n,"icon")),l=y.getJSXIcon(n.icon,A({},c),{props:t.menuProps}),b=d({className:s("submenuIcon")},m(n,"submenuIcon")),v=d({className:s("label")},m(n,"label")),g=n.items&&y.getJSXIcon(t.submenuIcon||e.createElement(x,b),A({},b),{props:t.menuProps}),O=n.label&&e.createElement("span",v,n.label),N=E(n,o),w=d({href:n.url||"#",className:s("action",{item:n}),target:n.target,onClick:function(e){return f(e,n)},role:"menuitem","aria-haspopup":null!=n.items,"aria-disabled":n.disabled},m(n,"action")),I=e.createElement("a",w,l,O,g,e.createElement(S,null));if(n.template){var P={onClick:function(e){return f(e,n)},className:"p-menuitem-link",labelClassName:"p-menuitem-text",iconClassName:"p-menuitem-icon",submenuIconClassName:submenuIconClassName,element:I,props:t,active:u};I=h.getJSXElement(n.template,n,P)}var M=d((T(i={id:a,key:a,role:"none",className:s("menuitem",{item:n,active:u}),style:n.style},"key",a),T(i,"onMouseEnter",(function(e){return p(e,n)})),i),m(n,"menuitem"));return e.createElement("li",M,I,N)},w=t.model?t.model.map((function(e,t){return e.separator?g(t):N(e,t)})):null,I=d({className:s("menu",{menuProps:t})},l("menu",{hostName:t.hostName})),P=d({classNames:s("submenuTransition"),in:c,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:function(){v()}},l("menu.transition",{hostName:t.hostName}));return e.createElement(i,O({nodeRef:a},P),e.createElement("ul",O({ref:a},I),w))}));L.displayName="ContextMenuSub";var R=e.memo(e.forwardRef((function(r,y){var h=e.useContext(n),x=k.getProps(r,h),S=M(e.useState(x.id),2),E=S[0],N=S[1],w=M(e.useState(!1),2),I=w[0],P=w[1],j=M(e.useState(!1),2),C=j[0],H=j[1],T=M(e.useState(!1),2),D=T[0],A=T[1],R=M(e.useState(null),2),W=R[0],Z=R[1],_=k.setMetaData({props:x,state:{id:E,visible:I,reshow:C,resetMenu:D,attributeSelector:W}}),X=_.ptm,z=_.cx;o(k.css.styles,_.isUnstyled,{name:"contextmenu"});var J=e.useRef(null),U=e.useRef(null),V=e.useRef(null),Y=a("screen and (max-width: ".concat(x.breakpoint,")"),!!x.breakpoint),$=M(c({type:"click",listener:function(e){se(e)&&2!==e.button&&(re(e),A(!0))}}),2),q=$[0],B=$[1],F=M(c({type:"contextmenu",when:x.global,listener:function(e){ne(e)}}),1)[0],G=M(l({listener:function(e){I&&!b.isTouchDevice()&&re(e)}}),2),K=G[0],Q=G[1],ee=function(){if(!V.current){V.current=b.createInlineStyle(h&&h.nonce||t.nonce);var e="".concat(W),n="\n@media screen and (max-width: ".concat(x.breakpoint,") {\n .p-contextmenu[").concat(e,"] > ul {\n max-height: ").concat(x.scrollHeight,";\n overflow: ").concat(x.scrollHeight?"auto":"",";\n }\n\n .p-contextmenu[").concat(e,"] .p-submenu-list {\n position: relative;\n }\n\n .p-contextmenu[").concat(e,"] .p-menuitem-active > .p-submenu-list {\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-contextmenu[").concat(e,"] .p-menuitem-active > .p-menuitem-link > .p-submenu-icon {\n transform: rotate(-180deg);\n }\n\n .p-contextmenu[").concat(e,'] .p-submenu-icon:before {\n content: "\\e930";\n }\n}\n');V.current.innerHTML=n}},te=function(){V.current=b.removeInlineStyle(V.current)},ne=function(e){e.stopPropagation(),e.preventDefault(),U.current=e,I?H(!0):(P(!0),x.onShow&&x.onShow(U.current))},re=function(e){U.current=e,P(!1),H(!1),x.onHide&&x.onHide(U.current)},oe=function(){b.addStyles(J.current,{position:"absolute"}),x.autoZIndex&&g.set("menu",J.current,h&&h.autoZIndex||t.autoZIndex,x.baseZIndex||h&&h.zIndex.menu||t.zIndex.menu),ce(U.current),W&&x.breakpoint&&(J.current.setAttribute(W,""),ee())},ie=function(){me()},ue=function(){pe(),g.clear(J.current)},ae=function(){g.clear(J.current),te()},ce=function(e){if(e){var t=e.pageX+1,n=e.pageY+1,r=J.current.offsetParent?J.current.offsetWidth:b.getHiddenElementOuterWidth(J.current),o=J.current.offsetParent?J.current.offsetHeight:b.getHiddenElementOuterHeight(J.current),i=b.getViewport();t+r-document.body.scrollLeft>i.width&&(t-=r),n+o-document.body.scrollTop>i.height&&(n-=o),t<document.body.scrollLeft&&(t=document.body.scrollLeft),n<document.body.scrollTop&&(n=document.body.scrollTop),J.current.style.left=t+"px",J.current.style.top=n+"px"}},le=function(e){A(!0),re(e),e.stopPropagation()},se=function(e){return J&&J.current&&!(J.current.isSameNode(e.target)||J.current.contains(e.target))},me=function(){K(),q()},pe=function(){Q(),B()};s((function(){var e=v();!E&&N(e),x.breakpoint&&!W&&Z(e)})),u((function(){x.global&&F()}),[x.global]),u((function(){return W&&J.current&&(J.current.setAttribute(W,""),ee()),function(){te()}}),[W,x.breakpoint]),u((function(){I?(P(!1),H(!1),A(!0)):C||I||!D||ne(U.current)}),[C]),m((function(){g.clear(J.current)})),e.useImperativeHandle(y,(function(){return{props:x,show:ne,hide:re,getElement:function(){return J.current}}}));var fe,de,be=(fe=d({id:x.id,className:f(x.className,z("root",{context:h})),style:x.style,onClick:function(e){A(!1)},onMouseEnter:function(e){A(!1)}},k.getOtherProps(x),X("root")),de=d({classNames:z("transition"),in:I,timeout:{enter:250,exit:0},options:x.transitionOptions,unmountOnExit:!0,onEnter:oe,onEntered:ie,onExit:ue,onExited:ae},X("transition")),e.createElement(i,O({nodeRef:J},de),e.createElement("div",O({ref:J},fe),e.createElement(L,{hostName:"ContextMenu",id:E,menuProps:x,model:x.model,root:!0,resetMenu:D,onLeafClick:le,isMobileMode:Y,submenuIcon:x.submenuIcon,ptm:X,cx:z}))));return e.createElement(p,{element:be,appendTo:x.appendTo})})));R.displayName="ContextMenu";export{R as ContextMenu};