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,810 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { PrimeReactContext, FilterService, localeOption } from 'primereact/api';
5
- import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
6
- import { useMountEffect } from 'primereact/hooks';
7
- import { Tooltip } from 'primereact/tooltip';
8
- import { classNames, mergeProps, IconUtils, ObjectUtils, DomHandler } from 'primereact/utils';
9
- import { VirtualScroller } from 'primereact/virtualscroller';
10
- import { SearchIcon } from 'primereact/icons/search';
11
- import { InputText } from 'primereact/inputtext';
12
- import { Ripple } from 'primereact/ripple';
13
-
14
- function _extends() {
15
- _extends = Object.assign ? Object.assign.bind() : function (target) {
16
- for (var i = 1; i < arguments.length; i++) {
17
- var source = arguments[i];
18
- for (var key in source) {
19
- if (Object.prototype.hasOwnProperty.call(source, key)) {
20
- target[key] = source[key];
21
- }
22
- }
23
- }
24
- return target;
25
- };
26
- return _extends.apply(this, arguments);
27
- }
28
-
29
- function _typeof(o) {
30
- "@babel/helpers - typeof";
31
-
32
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
33
- return typeof o;
34
- } : function (o) {
35
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
36
- }, _typeof(o);
37
- }
38
-
39
- function _toPrimitive(input, hint) {
40
- if (_typeof(input) !== "object" || input === null) return input;
41
- var prim = input[Symbol.toPrimitive];
42
- if (prim !== undefined) {
43
- var res = prim.call(input, hint || "default");
44
- if (_typeof(res) !== "object") return res;
45
- throw new TypeError("@@toPrimitive must return a primitive value.");
46
- }
47
- return (hint === "string" ? String : Number)(input);
48
- }
49
-
50
- function _toPropertyKey(arg) {
51
- var key = _toPrimitive(arg, "string");
52
- return _typeof(key) === "symbol" ? key : String(key);
53
- }
54
-
55
- function _defineProperty(obj, key, value) {
56
- key = _toPropertyKey(key);
57
- if (key in obj) {
58
- Object.defineProperty(obj, key, {
59
- value: value,
60
- enumerable: true,
61
- configurable: true,
62
- writable: true
63
- });
64
- } else {
65
- obj[key] = value;
66
- }
67
- return obj;
68
- }
69
-
70
- function _arrayLikeToArray$1(arr, len) {
71
- if (len == null || len > arr.length) len = arr.length;
72
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
73
- return arr2;
74
- }
75
-
76
- function _arrayWithoutHoles(arr) {
77
- if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
78
- }
79
-
80
- function _iterableToArray(iter) {
81
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
82
- }
83
-
84
- function _unsupportedIterableToArray$1(o, minLen) {
85
- if (!o) return;
86
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
87
- var n = Object.prototype.toString.call(o).slice(8, -1);
88
- if (n === "Object" && o.constructor) n = o.constructor.name;
89
- if (n === "Map" || n === "Set") return Array.from(o);
90
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
91
- }
92
-
93
- function _nonIterableSpread() {
94
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
95
- }
96
-
97
- function _toConsumableArray(arr) {
98
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
99
- }
100
-
101
- function _arrayWithHoles(arr) {
102
- if (Array.isArray(arr)) return arr;
103
- }
104
-
105
- function _iterableToArrayLimit(r, l) {
106
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
107
- if (null != t) {
108
- var e,
109
- n,
110
- i,
111
- u,
112
- a = [],
113
- f = !0,
114
- o = !1;
115
- try {
116
- if (i = (t = t.call(r)).next, 0 === l) {
117
- if (Object(t) !== t) return;
118
- f = !1;
119
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
120
- } catch (r) {
121
- o = !0, n = r;
122
- } finally {
123
- try {
124
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
125
- } finally {
126
- if (o) throw n;
127
- }
128
- }
129
- return a;
130
- }
131
- }
132
-
133
- function _nonIterableRest() {
134
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
135
- }
136
-
137
- function _slicedToArray(arr, i) {
138
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
139
- }
140
-
141
- var classes = {
142
- itemGroup: 'p-listbox-item-group',
143
- emptyMessage: 'p-listbox-empty-message',
144
- list: function list(_ref) {
145
- var props = _ref.props,
146
- options = _ref.options;
147
- return props.virtualScrollerOptions ? classNames('p-listbox-list', options.className) : 'p-listbox-list';
148
- },
149
- wrapper: function wrapper(_ref2) {
150
- var props = _ref2.props;
151
- return classNames('p-listbox-list-wrapper', props.listClassName);
152
- },
153
- root: function root(_ref3) {
154
- var props = _ref3.props;
155
- return classNames('p-listbox p-component', {
156
- 'p-disabled': props.disabled
157
- }, props.className);
158
- },
159
- item: function item(_ref4) {
160
- var props = _ref4.props;
161
- return classNames('p-listbox-item', {
162
- 'p-highlight': props.selected,
163
- 'p-disabled': props.disabled
164
- }, props.option.className);
165
- },
166
- filterContainer: 'p-listbox-filter-container',
167
- filterIcon: 'p-listbox-filter-icon',
168
- filterInput: 'p-listbox-filter',
169
- header: 'p-listbox-header'
170
- };
171
- var styles = "\n@layer primereact {\n .p-listbox-list-wrapper {\n overflow: auto;\n }\n \n .p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n }\n \n .p-listbox-item {\n cursor: pointer;\n position: relative;\n overflow: hidden;\n }\n \n .p-listbox-filter-container {\n position: relative;\n }\n \n .p-listbox-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-listbox-filter {\n width: 100%;\n }\n}\n";
172
- var inlineStyles = {
173
- itemGroup: function itemGroup(_ref5) {
174
- var scrollerOptions = _ref5.scrollerOptions;
175
- return {
176
- height: scrollerOptions.props ? scrollerOptions.props.itemSize : undefined
177
- };
178
- },
179
- list: function list(_ref6) {
180
- var options = _ref6.options,
181
- props = _ref6.props;
182
- return props.virtualScrollerOptions ? options.style : undefined;
183
- }
184
- };
185
- var ListBoxBase = ComponentBase.extend({
186
- defaultProps: {
187
- __TYPE: 'ListBox',
188
- className: null,
189
- dataKey: null,
190
- disabled: null,
191
- emptyFilterMessage: null,
192
- emptyMessage: null,
193
- filter: false,
194
- filterIcon: null,
195
- filterBy: null,
196
- filterInputProps: null,
197
- filterLocale: undefined,
198
- filterMatchMode: 'contains',
199
- filterPlaceholder: null,
200
- filterTemplate: null,
201
- filterValue: null,
202
- id: null,
203
- itemTemplate: null,
204
- listClassName: null,
205
- listStyle: null,
206
- metaKeySelection: false,
207
- multiple: false,
208
- onChange: null,
209
- onFilterValueChange: null,
210
- optionDisabled: null,
211
- optionGroupChildren: null,
212
- optionGroupLabel: null,
213
- optionGroupTemplate: null,
214
- optionLabel: null,
215
- optionValue: null,
216
- options: null,
217
- style: null,
218
- tabIndex: 0,
219
- tooltip: null,
220
- tooltipOptions: null,
221
- value: null,
222
- virtualScrollerOptions: null,
223
- children: undefined
224
- },
225
- css: {
226
- classes: classes,
227
- styles: styles,
228
- inlineStyles: inlineStyles
229
- }
230
- });
231
-
232
- 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; }
233
- 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; }
234
- var ListBoxHeader = /*#__PURE__*/React.memo(function (props) {
235
- var _props$ptCallbacks = props.ptCallbacks,
236
- ptm = _props$ptCallbacks.ptm,
237
- cx = _props$ptCallbacks.cx;
238
- var getPTOptions = function getPTOptions(key, options) {
239
- return ptm(key, _objectSpread$1({
240
- hostName: props.hostName
241
- }, options));
242
- };
243
- var filterOptions = {
244
- filter: function filter(e) {
245
- return onFilter(e);
246
- },
247
- reset: function reset() {
248
- return props.resetFilter();
249
- }
250
- };
251
- var onFilter = function onFilter(event) {
252
- if (props.onFilter) {
253
- props.onFilter({
254
- originalEvent: event,
255
- value: event.target.value
256
- });
257
- }
258
- };
259
- var createHeader = function createHeader() {
260
- var filterIconProps = mergeProps({
261
- className: cx('filterIcon')
262
- }, getPTOptions('filterIcon'));
263
- var icon = props.filterIcon || /*#__PURE__*/React.createElement(SearchIcon, filterIconProps);
264
- var filterIcon = IconUtils.getJSXIcon(icon, _objectSpread$1({}, filterIconProps), {
265
- props: props
266
- });
267
- var headerProps = mergeProps({
268
- className: cx('header')
269
- }, getPTOptions('header'));
270
- var filterContainerProps = mergeProps({
271
- className: cx('filterContainer')
272
- }, getPTOptions('filterContainer'));
273
- var content = /*#__PURE__*/React.createElement("div", filterContainerProps, /*#__PURE__*/React.createElement(InputText, _extends({
274
- type: "text",
275
- value: props.filter,
276
- onChange: onFilter,
277
- className: cx('filterInput'),
278
- disabled: props.disabled,
279
- placeholder: props.filterPlaceholder
280
- }, props.filterInputProps, {
281
- pt: ptm('filterInput'),
282
- unstyled: props.unstyled,
283
- __parentMetadata: {
284
- parent: props.metaData
285
- }
286
- })), filterIcon);
287
- if (props.filterTemplate) {
288
- var defaultContentOptions = {
289
- className: 'p-listbox-filter-container',
290
- element: content,
291
- filterOptions: filterOptions,
292
- filterInputChange: onFilter,
293
- filterIconClassName: 'p-dropdown-filter-icon',
294
- props: props
295
- };
296
- content = ObjectUtils.getJSXElement(props.filterTemplate, defaultContentOptions);
297
- }
298
- return /*#__PURE__*/React.createElement("div", headerProps, content);
299
- };
300
- var content = createHeader();
301
- return /*#__PURE__*/React.createElement(React.Fragment, null, content);
302
- });
303
- ListBoxHeader.displayName = 'ListBoxHeader';
304
-
305
- var ListBoxItem = /*#__PURE__*/React.memo(function (props) {
306
- var _props$ptCallbacks = props.ptCallbacks,
307
- ptm = _props$ptCallbacks.ptm,
308
- cx = _props$ptCallbacks.cx;
309
- var getPTOptions = function getPTOptions(key) {
310
- return ptm(key, {
311
- hostName: props.hostName,
312
- context: {
313
- selected: props.selected,
314
- disabled: props.disabled
315
- }
316
- });
317
- };
318
- var onClick = function onClick(event) {
319
- if (props.onClick) {
320
- props.onClick({
321
- originalEvent: event,
322
- option: props.option
323
- });
324
- }
325
- event.preventDefault();
326
- };
327
- var onTouchEnd = function onTouchEnd(event) {
328
- if (props.onTouchEnd) {
329
- props.onTouchEnd({
330
- originalEvent: event,
331
- option: props.option
332
- });
333
- }
334
- };
335
- var onKeyDown = function onKeyDown(event) {
336
- var item = event.currentTarget;
337
- switch (event.which) {
338
- //down
339
- case 40:
340
- var nextItem = findNextItem(item);
341
- nextItem && nextItem.focus();
342
- event.preventDefault();
343
- break;
344
-
345
- //up
346
- case 38:
347
- var prevItem = findPrevItem(item);
348
- prevItem && prevItem.focus();
349
- event.preventDefault();
350
- break;
351
-
352
- //enter
353
- case 13:
354
- onClick(event);
355
- event.preventDefault();
356
- break;
357
- }
358
- };
359
- var findNextItem = function findNextItem(item) {
360
- var nextItem = item.nextElementSibling;
361
- return nextItem ? DomHandler.hasClass(nextItem, 'p-disabled') || DomHandler.hasClass(nextItem, 'p-listbox-item-group') ? findNextItem(nextItem) : nextItem : null;
362
- };
363
- var findPrevItem = function findPrevItem(item) {
364
- var prevItem = item.previousElementSibling;
365
- return prevItem ? DomHandler.hasClass(prevItem, 'p-disabled') || DomHandler.hasClass(prevItem, 'p-listbox-item-group') ? findPrevItem(prevItem) : prevItem : null;
366
- };
367
- var content = props.template ? ObjectUtils.getJSXElement(props.template, props.option) : props.label;
368
- var itemProps = mergeProps({
369
- className: cx('item', {
370
- props: props
371
- }),
372
- style: props.style,
373
- onClick: onClick,
374
- onTouchEnd: onTouchEnd,
375
- onKeyDown: onKeyDown,
376
- tabIndex: '-1',
377
- 'aria-label': props.label,
378
- key: props.label,
379
- role: 'option',
380
- 'aria-selected': props.selected,
381
- 'aria-disabled': props.disabled
382
- }, getPTOptions('item'));
383
- return /*#__PURE__*/React.createElement("li", itemProps, content, /*#__PURE__*/React.createElement(Ripple, null));
384
- });
385
- ListBoxItem.displayName = 'ListBoxItem';
386
-
387
- 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; }
388
- 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; }
389
- 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; } } }; }
390
- 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); }
391
- 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; }
392
- var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
393
- var context = React.useContext(PrimeReactContext);
394
- var props = ListBoxBase.getProps(inProps, context);
395
- var _React$useState = React.useState(''),
396
- _React$useState2 = _slicedToArray(_React$useState, 2),
397
- filterValueState = _React$useState2[0],
398
- setFilterValueState = _React$useState2[1];
399
- var elementRef = React.useRef(null);
400
- var virtualScrollerRef = React.useRef(null);
401
- var optionTouched = React.useRef(false);
402
- var filteredValue = (props.onFilterValueChange ? props.filterValue : filterValueState) || '';
403
- var hasFilter = filteredValue && filteredValue.trim().length > 0;
404
- var metaData = {
405
- props: props,
406
- state: {
407
- filterValue: filteredValue
408
- }
409
- };
410
- var ptCallbacks = ListBoxBase.setMetaData(metaData);
411
- useHandleStyle(ListBoxBase.css.styles, ptCallbacks.isUnstyled, {
412
- name: 'listbox'
413
- });
414
- var onOptionSelect = function onOptionSelect(event) {
415
- var option = event.option;
416
- if (props.disabled || isOptionDisabled(option)) {
417
- return;
418
- }
419
- props.multiple ? onOptionSelectMultiple(event.originalEvent, option) : onOptionSelectSingle(event.originalEvent, option);
420
- optionTouched.current = false;
421
- };
422
- var onOptionTouchEnd = function onOptionTouchEnd() {
423
- if (props.disabled) {
424
- return;
425
- }
426
- optionTouched.current = true;
427
- };
428
- var onOptionSelectSingle = function onOptionSelectSingle(event, option) {
429
- var selected = isSelected(option);
430
- var valueChanged = false;
431
- var value = null;
432
- var metaSelection = optionTouched.current ? false : props.metaKeySelection;
433
- if (metaSelection) {
434
- var metaKey = event.metaKey || event.ctrlKey;
435
- if (selected) {
436
- if (metaKey) {
437
- value = null;
438
- valueChanged = true;
439
- }
440
- } else {
441
- value = getOptionValue(option);
442
- valueChanged = true;
443
- }
444
- } else {
445
- value = selected ? null : getOptionValue(option);
446
- valueChanged = true;
447
- }
448
- if (valueChanged) {
449
- updateModel(event, value);
450
- }
451
- };
452
- var onOptionSelectMultiple = function onOptionSelectMultiple(event, option) {
453
- var selected = isSelected(option);
454
- var valueChanged = false;
455
- var value = null;
456
- var metaSelection = optionTouched ? false : props.metaKeySelection;
457
- if (metaSelection) {
458
- var metaKey = event.metaKey || event.ctrlKey;
459
- if (selected) {
460
- if (metaKey) value = removeOption(option);else value = [getOptionValue(option)];
461
- valueChanged = true;
462
- } else {
463
- value = metaKey ? props.value || [] : [];
464
- value = [].concat(_toConsumableArray(value), [getOptionValue(option)]);
465
- valueChanged = true;
466
- }
467
- } else {
468
- if (selected) value = removeOption(option);else value = [].concat(_toConsumableArray(props.value || []), [getOptionValue(option)]);
469
- valueChanged = true;
470
- }
471
- if (valueChanged) {
472
- props.onChange({
473
- originalEvent: event,
474
- value: value,
475
- stopPropagation: function stopPropagation() {
476
- event.stopPropagation();
477
- },
478
- preventDefault: function preventDefault() {
479
- event.preventDefault();
480
- },
481
- target: {
482
- name: props.name,
483
- id: props.id,
484
- value: value
485
- }
486
- });
487
- }
488
- };
489
- var onFilter = function onFilter(event) {
490
- virtualScrollerRef.current && virtualScrollerRef.current.scrollToIndex(0);
491
- var originalEvent = event.originalEvent,
492
- value = event.value;
493
- if (props.onFilterValueChange) {
494
- props.onFilterValueChange({
495
- originalEvent: originalEvent,
496
- value: value
497
- });
498
- } else {
499
- setFilterValueState(value);
500
- }
501
- };
502
- var resetFilter = function resetFilter() {
503
- setFilterValueState('');
504
- props.onFilter && props.onFilter({
505
- filter: ''
506
- });
507
- };
508
- var updateModel = function updateModel(event, value) {
509
- if (props.onChange) {
510
- props.onChange({
511
- originalEvent: event,
512
- value: value,
513
- stopPropagation: function stopPropagation() {
514
- event.stopPropagation();
515
- },
516
- preventDefault: function preventDefault() {
517
- event.preventDefault();
518
- },
519
- target: {
520
- name: props.name,
521
- id: props.id,
522
- value: value
523
- }
524
- });
525
- }
526
- };
527
- var removeOption = function removeOption(option) {
528
- return props.value.filter(function (val) {
529
- return !ObjectUtils.equals(val, getOptionValue(option), props.dataKey);
530
- });
531
- };
532
- var getSelectedOptionIndex = function getSelectedOptionIndex() {
533
- if (props.value != null && visibleOptions) {
534
- if (props.optionGroupLabel) {
535
- for (var i = 0; i < visibleOptions.length; i++) {
536
- var selectedOptionIndex = findOptionIndexInList(props.value, getOptionGroupChildren(visibleOptions[i]));
537
- if (selectedOptionIndex !== -1) {
538
- return {
539
- group: i,
540
- option: selectedOptionIndex
541
- };
542
- }
543
- }
544
- } else {
545
- return findOptionIndexInList(props.value, visibleOptions);
546
- }
547
- }
548
- return -1;
549
- };
550
- var equalityKey = function equalityKey() {
551
- return props.optionValue ? null : props.dataKey;
552
- };
553
- var findOptionIndexInList = function findOptionIndexInList(value, list) {
554
- var key = equalityKey();
555
- return list.findIndex(function (item) {
556
- return ObjectUtils.equals(value, getOptionValue(item), key);
557
- });
558
- };
559
- var isSelected = function isSelected(option) {
560
- var optionValue = getOptionValue(option);
561
- var key = equalityKey();
562
- return props.multiple && props.value ? props.value.some(function (val) {
563
- return ObjectUtils.equals(val, optionValue, key);
564
- }) : ObjectUtils.equals(props.value, optionValue, key);
565
- };
566
- var getOptionLabel = function getOptionLabel(option) {
567
- return props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : option && option['label'] !== undefined ? option['label'] : option;
568
- };
569
- var getOptionValue = function getOptionValue(option) {
570
- return props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : option && option['value'] !== undefined ? option['value'] : option;
571
- };
572
- var getOptionRenderKey = function getOptionRenderKey(option) {
573
- return props.dataKey ? ObjectUtils.resolveFieldData(option, props.dataKey) : getOptionLabel(option);
574
- };
575
- var isOptionDisabled = function isOptionDisabled(option) {
576
- if (props.optionDisabled) {
577
- return ObjectUtils.isFunction(props.optionDisabled) ? props.optionDisabled(option) : ObjectUtils.resolveFieldData(option, props.optionDisabled);
578
- }
579
- return option && option['disabled'] !== undefined ? option['disabled'] : false;
580
- };
581
- var getOptionGroupRenderKey = function getOptionGroupRenderKey(optionGroup) {
582
- return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel);
583
- };
584
- var getOptionGroupLabel = function getOptionGroupLabel(optionGroup) {
585
- return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel);
586
- };
587
- var getOptionGroupChildren = function getOptionGroupChildren(optionGroup) {
588
- return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupChildren);
589
- };
590
- var getVisibleOptions = function getVisibleOptions() {
591
- if (hasFilter) {
592
- var filterValue = filteredValue.trim().toLocaleLowerCase(props.filterLocale);
593
- var searchFields = props.filterBy ? props.filterBy.split(',') : [props.optionLabel || 'label'];
594
- if (props.optionGroupLabel) {
595
- var filteredGroups = [];
596
- var _iterator = _createForOfIteratorHelper(props.options),
597
- _step;
598
- try {
599
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
600
- var optgroup = _step.value;
601
- var filteredSubOptions = FilterService.filter(getOptionGroupChildren(optgroup), searchFields, filterValue, props.filterMatchMode, props.filterLocale);
602
- if (filteredSubOptions && filteredSubOptions.length) {
603
- filteredGroups.push(_objectSpread(_objectSpread({}, optgroup), {
604
- items: filteredSubOptions
605
- }));
606
- }
607
- }
608
- } catch (err) {
609
- _iterator.e(err);
610
- } finally {
611
- _iterator.f();
612
- }
613
- return filteredGroups;
614
- } else {
615
- return FilterService.filter(props.options, searchFields, filterValue, props.filterMatchMode, props.filterLocale);
616
- }
617
- } else {
618
- return props.options;
619
- }
620
- };
621
- var scrollToSelectedIndex = function scrollToSelectedIndex() {
622
- if (virtualScrollerRef.current) {
623
- var selectedIndex = getSelectedOptionIndex();
624
- if (selectedIndex !== -1) {
625
- setTimeout(function () {
626
- return virtualScrollerRef.current.scrollToIndex(selectedIndex);
627
- }, 0);
628
- }
629
- }
630
- };
631
- React.useImperativeHandle(ref, function () {
632
- return {
633
- props: props,
634
- focus: function focus() {
635
- return DomHandler.focusFirstElement(elementRef.current);
636
- },
637
- getElement: function getElement() {
638
- return elementRef.current;
639
- },
640
- getVirtualScroller: function getVirtualScroller() {
641
- return virtualScrollerRef.current;
642
- }
643
- };
644
- });
645
- useMountEffect(function () {
646
- scrollToSelectedIndex();
647
- });
648
- var createHeader = function createHeader() {
649
- return props.filter ? /*#__PURE__*/React.createElement(ListBoxHeader, {
650
- hostName: "ListBox",
651
- filter: filteredValue,
652
- filterIcon: props.filterIcon,
653
- onFilter: onFilter,
654
- resetFilter: resetFilter,
655
- filterTemplate: props.filterTemplate,
656
- disabled: props.disabled,
657
- filterPlaceholder: props.filterPlaceholder,
658
- filterInputProps: props.filterInputProps,
659
- ptCallbacks: ptCallbacks,
660
- metaData: metaData
661
- }) : null;
662
- };
663
- var createGroupChildren = function createGroupChildren(optionGroup, style) {
664
- var groupChildren = getOptionGroupChildren(optionGroup);
665
- return groupChildren.map(function (option, j) {
666
- var optionLabel = getOptionLabel(option);
667
- var optionKey = j + '_' + getOptionRenderKey(option);
668
- var disabled = isOptionDisabled(option);
669
- var tabIndex = disabled ? null : props.tabIndex || 0;
670
- return /*#__PURE__*/React.createElement(ListBoxItem, {
671
- hostName: "ListBox",
672
- key: optionKey,
673
- label: optionLabel,
674
- option: option,
675
- style: style,
676
- template: props.itemTemplate,
677
- selected: isSelected(option),
678
- onClick: onOptionSelect,
679
- onTouchEnd: onOptionTouchEnd,
680
- tabIndex: tabIndex,
681
- disabled: disabled,
682
- ptCallbacks: ptCallbacks,
683
- metaData: metaData
684
- });
685
- });
686
- };
687
- var createItem = function createItem(option, index) {
688
- var scrollerOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
689
- var style = {
690
- height: scrollerOptions.props ? scrollerOptions.props.itemSize : undefined
691
- };
692
- if (props.optionGroupLabel) {
693
- var groupContent = props.optionGroupTemplate ? ObjectUtils.getJSXElement(props.optionGroupTemplate, option, index) : getOptionGroupLabel(option);
694
- var groupChildrenContent = createGroupChildren(option, style);
695
- var key = index + '_' + getOptionGroupRenderKey(option);
696
- var itemGroupProps = mergeProps({
697
- className: ptCallbacks.cx('itemGroup'),
698
- style: ptCallbacks.sx('itemGroup', {
699
- scrollerOptions: scrollerOptions
700
- }),
701
- role: 'group'
702
- }, ptCallbacks.ptm('itemGroup'));
703
- return /*#__PURE__*/React.createElement(React.Fragment, {
704
- key: key
705
- }, /*#__PURE__*/React.createElement("li", itemGroupProps, groupContent), groupChildrenContent);
706
- } else {
707
- var optionLabel = getOptionLabel(option);
708
- var optionKey = index + '_' + getOptionRenderKey(option);
709
- var disabled = isOptionDisabled(option);
710
- var tabIndex = disabled ? null : props.tabIndex || 0;
711
- return /*#__PURE__*/React.createElement(ListBoxItem, {
712
- hostName: "ListBox",
713
- key: optionKey,
714
- label: optionLabel,
715
- option: option,
716
- style: style,
717
- template: props.itemTemplate,
718
- selected: isSelected(option),
719
- onClick: onOptionSelect,
720
- onTouchEnd: onOptionTouchEnd,
721
- tabIndex: tabIndex,
722
- disabled: disabled,
723
- ptCallbacks: ptCallbacks,
724
- metaData: metaData
725
- });
726
- }
727
- };
728
- var createItems = function createItems() {
729
- if (ObjectUtils.isNotEmpty(visibleOptions)) {
730
- return visibleOptions.map(createItem);
731
- } else if (hasFilter) {
732
- return createEmptyMessage(props.emptyFilterMessage, true);
733
- }
734
- return createEmptyMessage(props.emptyMessage);
735
- };
736
- var createEmptyMessage = function createEmptyMessage(emptyMessage, isFilter) {
737
- var emptyMessageProps = mergeProps({
738
- className: ptCallbacks.cx('emptyMessage')
739
- }, ptCallbacks.ptm('emptyMessage'));
740
- var message = ObjectUtils.getJSXElement(emptyMessage, props) || localeOption(isFilter ? 'emptyFilterMessage' : 'emptyMessage');
741
- return /*#__PURE__*/React.createElement("li", emptyMessageProps, message);
742
- };
743
- var createList = function createList() {
744
- if (props.virtualScrollerOptions) {
745
- var virtualScrollerProps = _objectSpread(_objectSpread({}, props.virtualScrollerOptions), {
746
- items: visibleOptions,
747
- onLazyLoad: function onLazyLoad(event) {
748
- return props.virtualScrollerOptions.onLazyLoad(_objectSpread(_objectSpread({}, event), {
749
- filter: visibleOptions
750
- }));
751
- },
752
- itemTemplate: function itemTemplate(item, options) {
753
- return item && createItem(item, options.index, options);
754
- },
755
- contentTemplate: function contentTemplate(options) {
756
- var listProps = mergeProps(_objectSpread({
757
- ref: options.contentRef,
758
- style: ptCallbacks.sx('list', {
759
- options: options
760
- }),
761
- className: ptCallbacks.cx('list', {
762
- options: options
763
- }),
764
- role: 'listbox',
765
- 'aria-multiselectable': props.multiple
766
- }, ariaProps), ptCallbacks.ptm('list'));
767
- return /*#__PURE__*/React.createElement("ul", listProps, options.children);
768
- }
769
- });
770
- return /*#__PURE__*/React.createElement(VirtualScroller, _extends({
771
- ref: virtualScrollerRef
772
- }, virtualScrollerProps, {
773
- pt: ptCallbacks.ptm('virtualScroller')
774
- }));
775
- } else {
776
- var items = createItems();
777
- var listProps = mergeProps(_objectSpread({
778
- className: ptCallbacks.cx('list'),
779
- role: 'listbox',
780
- 'aria-multiselectable': props.multiple
781
- }, ariaProps), ptCallbacks.ptm('list'));
782
- return /*#__PURE__*/React.createElement("ul", listProps, items);
783
- }
784
- };
785
- var visibleOptions = getVisibleOptions();
786
- var hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
787
- var otherProps = ListBoxBase.getOtherProps(props);
788
- var ariaProps = ObjectUtils.reduceKeys(otherProps, DomHandler.ARIA_PROPS);
789
- var list = createList();
790
- var header = createHeader();
791
- var wrapperProps = mergeProps({
792
- className: ptCallbacks.cx('wrapper'),
793
- style: props.listStyle
794
- }, ptCallbacks.ptm('wrapper'));
795
- var rootProps = mergeProps({
796
- ref: elementRef,
797
- id: props.id,
798
- className: ptCallbacks.cx('root'),
799
- style: props.style
800
- }, ListBoxBase.getOtherProps(props), ptCallbacks.ptm('root'));
801
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", rootProps, header, /*#__PURE__*/React.createElement("div", wrapperProps, list)), hasTooltip && /*#__PURE__*/React.createElement(Tooltip, _extends({
802
- target: elementRef,
803
- content: props.tooltip
804
- }, props.tooltipOptions, {
805
- pt: ptCallbacks.ptm('tooltip')
806
- })));
807
- }));
808
- ListBox.displayName = 'ListBox';
809
-
810
- export { ListBox };