primereact 8.7.1 → 8.7.2

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 (94) hide show
  1. package/autocomplete/autocomplete.cjs.js +6 -2
  2. package/autocomplete/autocomplete.cjs.min.js +1 -1
  3. package/autocomplete/autocomplete.d.ts +1 -0
  4. package/autocomplete/autocomplete.esm.js +6 -2
  5. package/autocomplete/autocomplete.esm.min.js +1 -1
  6. package/autocomplete/autocomplete.js +6 -2
  7. package/autocomplete/autocomplete.min.js +1 -1
  8. package/calendar/calendar.cjs.js +21 -5
  9. package/calendar/calendar.cjs.min.js +1 -1
  10. package/calendar/calendar.esm.js +21 -5
  11. package/calendar/calendar.esm.min.js +1 -1
  12. package/calendar/calendar.js +21 -5
  13. package/calendar/calendar.min.js +1 -1
  14. package/column/column.d.ts +1 -0
  15. package/core/core.js +23 -11
  16. package/core/core.min.js +6 -6
  17. package/inputnumber/inputnumber.cjs.js +12 -1
  18. package/inputnumber/inputnumber.cjs.min.js +1 -1
  19. package/inputnumber/inputnumber.d.ts +1 -0
  20. package/inputnumber/inputnumber.esm.js +12 -1
  21. package/inputnumber/inputnumber.esm.min.js +1 -1
  22. package/inputnumber/inputnumber.js +12 -1
  23. package/inputnumber/inputnumber.min.js +1 -1
  24. package/inputtext/inputtext.cjs.js +4 -4
  25. package/inputtext/inputtext.cjs.min.js +1 -1
  26. package/inputtext/inputtext.d.ts +5 -3
  27. package/inputtext/inputtext.esm.js +4 -4
  28. package/inputtext/inputtext.esm.min.js +1 -1
  29. package/inputtext/inputtext.js +4 -4
  30. package/inputtext/inputtext.min.js +1 -1
  31. package/inputtextarea/inputtextarea.cjs.js +28 -2
  32. package/inputtextarea/inputtextarea.cjs.min.js +1 -1
  33. package/inputtextarea/inputtextarea.d.ts +6 -2
  34. package/inputtextarea/inputtextarea.esm.js +28 -2
  35. package/inputtextarea/inputtextarea.esm.min.js +1 -1
  36. package/inputtextarea/inputtextarea.js +29 -4
  37. package/inputtextarea/inputtextarea.min.js +1 -1
  38. package/keyfilter/keyfilter.cjs.js +2 -1
  39. package/keyfilter/keyfilter.cjs.min.js +1 -1
  40. package/keyfilter/keyfilter.esm.js +2 -1
  41. package/keyfilter/keyfilter.esm.min.js +1 -1
  42. package/keyfilter/keyfilter.js +2 -1
  43. package/keyfilter/keyfilter.min.js +1 -1
  44. package/mention/mention.cjs.js +28 -2
  45. package/mention/mention.cjs.min.js +1 -1
  46. package/mention/mention.esm.js +28 -2
  47. package/mention/mention.esm.min.js +1 -1
  48. package/mention/mention.js +29 -4
  49. package/mention/mention.min.js +1 -1
  50. package/package.json +1 -1
  51. package/primereact.all.cjs.js +92 -30
  52. package/primereact.all.cjs.min.js +1 -1
  53. package/primereact.all.esm.js +92 -30
  54. package/primereact.all.esm.min.js +1 -1
  55. package/primereact.all.js +92 -30
  56. package/primereact.all.min.js +1 -1
  57. package/ripple/ripple.cjs.js +0 -1
  58. package/ripple/ripple.cjs.min.js +1 -1
  59. package/ripple/ripple.esm.js +0 -1
  60. package/ripple/ripple.esm.min.js +1 -1
  61. package/ripple/ripple.js +0 -1
  62. package/ripple/ripple.min.js +1 -1
  63. package/splitter/splitter.cjs.js +1 -1
  64. package/splitter/splitter.cjs.min.js +1 -1
  65. package/splitter/splitter.esm.js +1 -1
  66. package/splitter/splitter.esm.min.js +1 -1
  67. package/splitter/splitter.js +1 -1
  68. package/splitter/splitter.min.js +1 -1
  69. package/tieredmenu/tieredmenu.cjs.js +11 -7
  70. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  71. package/tieredmenu/tieredmenu.esm.js +11 -7
  72. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  73. package/tieredmenu/tieredmenu.js +11 -7
  74. package/tieredmenu/tieredmenu.min.js +1 -1
  75. package/tooltip/tooltip.cjs.js +3 -4
  76. package/tooltip/tooltip.cjs.min.js +1 -1
  77. package/tooltip/tooltip.esm.js +3 -4
  78. package/tooltip/tooltip.esm.min.js +1 -1
  79. package/tooltip/tooltip.js +3 -4
  80. package/tooltip/tooltip.min.js +1 -1
  81. package/treetable/treetable.cjs.js +3 -2
  82. package/treetable/treetable.cjs.min.js +1 -1
  83. package/treetable/treetable.esm.js +3 -2
  84. package/treetable/treetable.esm.min.js +1 -1
  85. package/treetable/treetable.js +3 -2
  86. package/treetable/treetable.min.js +1 -1
  87. package/utils/utils.cjs.js +2 -0
  88. package/utils/utils.cjs.min.js +1 -1
  89. package/utils/utils.d.ts +1 -1
  90. package/utils/utils.esm.js +2 -0
  91. package/utils/utils.esm.min.js +1 -1
  92. package/utils/utils.js +2 -0
  93. package/utils/utils.min.js +1 -1
  94. package/web-types.json +15 -3
@@ -1997,6 +1997,8 @@ var ObjectUtils = /*#__PURE__*/function () {
1997
1997
  if (data && Object.keys(data).length && field) {
1998
1998
  if (this.isFunction(field)) {
1999
1999
  return field(data);
2000
+ } else if (ObjectUtils.isNotEmpty(data[field])) {
2001
+ return data[field];
2000
2002
  } else if (field.indexOf('.') === -1) {
2001
2003
  return data[field];
2002
2004
  } else {
@@ -3675,7 +3677,6 @@ var Ripple = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.f
3675
3677
  };
3676
3678
 
3677
3679
  var onTouchStart = function onTouchStart(event) {
3678
- isTouching.current = true;
3679
3680
  var offset = DomHandler.getOffset(targetRef.current);
3680
3681
  var offsetX = event.targetTouches[0].pageX - offset.left + document.body.scrollTop - DomHandler.getWidth(inkRef.current) / 2;
3681
3682
  var offsetY = event.targetTouches[0].pageY - offset.top + document.body.scrollLeft - DomHandler.getHeight(inkRef.current) / 2;
@@ -4220,14 +4221,13 @@ var Tooltip = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.
4220
4221
  }
4221
4222
  };
4222
4223
 
4223
- React__namespace.useEffect(function () {
4224
+ useMountEffect(function () {
4225
+ loadTargetEvents();
4226
+
4224
4227
  if (visibleState && currentTargetRef.current && isDisabled(currentTargetRef.current)) {
4225
4228
  hide();
4226
4229
  }
4227
4230
  });
4228
- useMountEffect(function () {
4229
- loadTargetEvents();
4230
- });
4231
4231
  useUpdateEffect(function () {
4232
4232
  loadTargetEvents();
4233
4233
  return function () {
@@ -4498,8 +4498,9 @@ var KeyFilter = {
4498
4498
  validate: function validate(e, keyfilter) {
4499
4499
  var value = e.target.value,
4500
4500
  validatePattern = true;
4501
+ var regex = this.getRegex(keyfilter);
4501
4502
 
4502
- if (value && !keyfilter.test(value)) {
4503
+ if (value && !regex.test(value)) {
4503
4504
  validatePattern = false;
4504
4505
  }
4505
4506
 
@@ -4510,8 +4511,8 @@ var KeyFilter = {
4510
4511
  var InputText = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.forwardRef(function (props, ref) {
4511
4512
  var elementRef = React__namespace.useRef(ref);
4512
4513
 
4513
- var onKeyPress = function onKeyPress(event) {
4514
- props.onKeyPress && props.onKeyPress(event);
4514
+ var onKeyDown = function onKeyDown(event) {
4515
+ props.onKeyDown && props.onKeyDown(event);
4515
4516
 
4516
4517
  if (props.keyfilter) {
4517
4518
  KeyFilter.onKeyPress(event, props.keyfilter, props.validateOnly);
@@ -4559,7 +4560,7 @@ var InputText = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespac
4559
4560
  }, otherProps, {
4560
4561
  className: className,
4561
4562
  onInput: onInput,
4562
- onKeyPress: onKeyPress,
4563
+ onKeyDown: onKeyDown,
4563
4564
  onPaste: onPaste
4564
4565
  })), hasTooltip && /*#__PURE__*/React__namespace.createElement(Tooltip, _extends({
4565
4566
  target: elementRef,
@@ -4574,7 +4575,7 @@ InputText.defaultProps = {
4574
4575
  tooltip: null,
4575
4576
  tooltipOptions: null,
4576
4577
  onInput: null,
4577
- onKeyPress: null,
4578
+ onKeyDown: null,
4578
4579
  onPaste: null
4579
4580
  };
4580
4581
 
@@ -5683,8 +5684,11 @@ var AutoComplete = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__names
5683
5684
  inputRef.current.value = '';
5684
5685
 
5685
5686
  if (!isSelected(option)) {
5686
- var newValue = props.value ? [].concat(_toConsumableArray(props.value), [option]) : [option];
5687
- updateModel(event, newValue);
5687
+ // allows empty value/selectionlimit and within sectionlimit
5688
+ if (!props.value || !props.selectionLimit || props.value.length < props.selectionLimit) {
5689
+ var newValue = props.value ? [].concat(_toConsumableArray(props.value), [option]) : [option];
5690
+ updateModel(event, newValue);
5691
+ }
5688
5692
  }
5689
5693
  } else {
5690
5694
  updateInputField(option);
@@ -6286,6 +6290,7 @@ AutoComplete.defaultProps = {
6286
6290
  removeIcon: 'pi pi-times-circle',
6287
6291
  scrollHeight: '200px',
6288
6292
  selectedItemTemplate: null,
6293
+ selectionLimit: null,
6289
6294
  showEmptyMessage: false,
6290
6295
  size: null,
6291
6296
  style: null,
@@ -8675,7 +8680,7 @@ var Calendar = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace
8675
8680
  if (value) {
8676
8681
  try {
8677
8682
  if (isSingleSelection()) {
8678
- formattedValue = isValidDate(value) ? formatDateTime(value) : '';
8683
+ formattedValue = isValidDate(value) ? formatDateTime(value) : props.keepInvalid ? value : '';
8679
8684
  } else if (isMultipleSelection()) {
8680
8685
  for (var i = 0; i < value.length; i++) {
8681
8686
  var selectedValue = value[i];
@@ -9236,10 +9241,26 @@ var Calendar = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace
9236
9241
  updateInputfield(newDate); // #3516 view date not updated when value set programatically
9237
9242
 
9238
9243
  if (!visible && newDate) {
9239
- validateDate(newDate);
9240
- setViewDateState(newDate);
9241
- setCurrentMonth(newDate.getMonth());
9242
- setCurrentYear(newDate.getFullYear());
9244
+ var viewDate = newDate;
9245
+
9246
+ if (isMultipleSelection()) {
9247
+ if (newDate.length) {
9248
+ viewDate = newDate[newDate.length - 1];
9249
+ }
9250
+ } else if (isRangeSelection()) {
9251
+ if (newDate.length) {
9252
+ var startDate = newDate[0];
9253
+ var endDate = newDate[1];
9254
+ viewDate = endDate || startDate;
9255
+ }
9256
+ }
9257
+
9258
+ if (viewDate instanceof Date) {
9259
+ validateDate(viewDate);
9260
+ setViewDateState(viewDate);
9261
+ setCurrentMonth(viewDate.getMonth());
9262
+ setCurrentYear(viewDate.getFullYear());
9263
+ }
9243
9264
  }
9244
9265
  }
9245
9266
  }, [props.value, visible]);
@@ -15048,7 +15069,12 @@ var InputNumber = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namesp
15048
15069
  if (inputRef.current) {
15049
15070
  var step = props.step * dir;
15050
15071
  var currentValue = parseValue(inputRef.current.value) || 0;
15051
- var newValue = validateValue(currentValue + step); // touch devices trigger the keyboard to display because of setSelectionRange
15072
+ var newValue = validateValue(currentValue + step);
15073
+
15074
+ if (props.maxLength && props.maxLength < formatValue(newValue).length) {
15075
+ return;
15076
+ } // touch devices trigger the keyboard to display because of setSelectionRange
15077
+
15052
15078
 
15053
15079
  !DomHandler.isTouchDevice() && updateInput(newValue, null, 'spin');
15054
15080
  updateModel(event, newValue);
@@ -15653,6 +15679,11 @@ var InputNumber = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namesp
15653
15679
  } else {
15654
15680
  var selectionStart = inputEl.selectionStart;
15655
15681
  var _selectionEnd = inputEl.selectionEnd;
15682
+
15683
+ if (props.maxLength && props.maxLength < newValue.length) {
15684
+ return;
15685
+ }
15686
+
15656
15687
  inputEl.value = newValue;
15657
15688
  var newLength = newValue.length;
15658
15689
 
@@ -15970,6 +16001,7 @@ InputNumber.defaultProps = {
15970
16001
  localeMatcher: undefined,
15971
16002
  max: null,
15972
16003
  maxFractionDigits: undefined,
16004
+ maxLength: null,
15973
16005
  min: null,
15974
16006
  minFractionDigits: undefined,
15975
16007
  mode: 'decimal',
@@ -27776,6 +27808,22 @@ var InputTextarea = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__name
27776
27808
  props.onKeyUp && props.onKeyUp(event);
27777
27809
  };
27778
27810
 
27811
+ var onKeyDown = function onKeyDown(event) {
27812
+ props.onKeyDown && props.onKeyDown(event);
27813
+
27814
+ if (props.keyfilter) {
27815
+ KeyFilter.onKeyPress(event, props.keyfilter, props.validateOnly);
27816
+ }
27817
+ };
27818
+
27819
+ var onPaste = function onPaste(event) {
27820
+ props.onPaste && props.onPaste(event);
27821
+
27822
+ if (props.keyfilter) {
27823
+ KeyFilter.onPaste(event, props.keyfilter, props.validateOnly);
27824
+ }
27825
+ };
27826
+
27779
27827
  var onInput = function onInput(event) {
27780
27828
  if (props.autoResize) {
27781
27829
  resize();
@@ -27837,7 +27885,9 @@ var InputTextarea = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__name
27837
27885
  onFocus: onFocus,
27838
27886
  onBlur: onBlur,
27839
27887
  onKeyUp: onKeyUp,
27840
- onInput: onInput
27888
+ onKeyDown: onKeyDown,
27889
+ onInput: onInput,
27890
+ onPaste: onPaste
27841
27891
  })), hasTooltip && /*#__PURE__*/React__namespace.createElement(Tooltip, _extends({
27842
27892
  target: elementRef,
27843
27893
  content: props.tooltip
@@ -27847,9 +27897,16 @@ InputTextarea.displayName = 'InputTextarea';
27847
27897
  InputTextarea.defaultProps = {
27848
27898
  __TYPE: 'InputTextarea',
27849
27899
  autoResize: false,
27900
+ keyfilter: null,
27901
+ onBlur: null,
27902
+ onFocus: null,
27903
+ onInput: null,
27904
+ onKeyDown: null,
27905
+ onKeyUp: null,
27906
+ onPaste: null,
27850
27907
  tooltip: null,
27851
27908
  tooltipOptions: null,
27852
- onInput: null
27909
+ validateOnly: false
27853
27910
  };
27854
27911
 
27855
27912
  var radius = 40;
@@ -37123,7 +37180,7 @@ var Splitter = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace
37123
37180
  var childrenLength = props.children && props.children.length;
37124
37181
 
37125
37182
  var panelSize = function panelSize(sizes, index) {
37126
- return index in sizes ? sizes[index] : props.children[index].props.size || 100 / childrenLength;
37183
+ return index in sizes ? sizes[index] : (props.children[index] && props.children[index].props.size || 100) / childrenLength;
37127
37184
  };
37128
37185
 
37129
37186
  var _useEventListener = useEventListener({
@@ -38639,7 +38696,7 @@ var TieredMenuSub = /*#__PURE__*/React__namespace.memo(function (props) {
38639
38696
  }
38640
38697
 
38641
38698
  if (!item.items) {
38642
- onLeafClick();
38699
+ onLeafClick(event);
38643
38700
  }
38644
38701
  };
38645
38702
 
@@ -38695,9 +38752,10 @@ var TieredMenuSub = /*#__PURE__*/React__namespace.memo(function (props) {
38695
38752
  return prevItem ? DomHandler.hasClass(prevItem, 'p-disabled') || !DomHandler.hasClass(prevItem, 'p-menuitem') ? findPrevItem(prevItem) : prevItem : null;
38696
38753
  };
38697
38754
 
38698
- var onLeafClick = function onLeafClick() {
38755
+ var onLeafClick = function onLeafClick(event) {
38699
38756
  setActiveItemState(null);
38700
- props.onLeafClick && props.onLeafClick();
38757
+ props.onLeafClick && props.onLeafClick(event);
38758
+ props.onHide && props.onHide(event);
38701
38759
  };
38702
38760
 
38703
38761
  useMountEffect(function () {
@@ -38888,9 +38946,11 @@ var TieredMenu = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespa
38888
38946
  };
38889
38947
 
38890
38948
  var hide = function hide(event) {
38891
- targetRef.current = event.currentTarget;
38892
- setVisibleState(false);
38893
- props.onHide && props.onHide(event);
38949
+ if (props.popup) {
38950
+ targetRef.current = event.currentTarget;
38951
+ setVisibleState(false);
38952
+ props.onHide && props.onHide(event);
38953
+ }
38894
38954
  };
38895
38955
 
38896
38956
  var onEnter = function onEnter() {
@@ -38959,7 +39019,8 @@ var TieredMenu = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespa
38959
39019
  menuProps: props,
38960
39020
  model: props.model,
38961
39021
  root: true,
38962
- popup: props.popup
39022
+ popup: props.popup,
39023
+ onHide: hide
38963
39024
  })));
38964
39025
  };
38965
39026
 
@@ -42569,9 +42630,10 @@ var TreeTableHeader = /*#__PURE__*/React__namespace.memo(function (props) {
42569
42630
  var headerTooltip = column.props.headerTooltip;
42570
42631
  var hasTooltip = ObjectUtils.isNotEmpty(headerTooltip);
42571
42632
  var resizer = createResizer(column);
42572
- return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("th", {
42633
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, {
42634
+ key: column.columnKey || column.field || options.index
42635
+ }, /*#__PURE__*/React__namespace.createElement("th", {
42573
42636
  ref: headerCellRef,
42574
- key: column.columnKey || column.field || options.index,
42575
42637
  className: className,
42576
42638
  style: column.props.headerStyle || column.props.style,
42577
42639
  tabIndex: column.props.sortable ? props.tabIndex : null,