react-core-ts 1.3.5 → 1.3.7

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.
@@ -232,7 +232,7 @@ const AutoCompleteWithSelectedList = forwardRef<
232
232
 
233
233
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
234
234
  const { value } = e.target;
235
- setDropOpen(true);
235
+ //setVisibleDrop();
236
236
  setSearchValue(value);
237
237
  handleChangeWithDebounce(value);
238
238
  if (!value) {
@@ -242,7 +242,7 @@ const AutoCompleteWithSelectedList = forwardRef<
242
242
  };
243
243
  const handleSuggestionChange = (e: React.ChangeEvent<HTMLInputElement>) => {
244
244
  const { value } = e.target;
245
- setDropOpen(true);
245
+ //setVisibleDrop();
246
246
  setSearchValue(value);
247
247
  handleChangeWithDebounce(value);
248
248
  };
@@ -303,7 +303,7 @@ const AutoCompleteWithSelectedList = forwardRef<
303
303
  window.addEventListener('scroll', handleClickOutside as any);
304
304
 
305
305
  const scrollableDivs = document.querySelectorAll(
306
- 'div[style*="overflow"], .overflow-auto ,overflow-y-auto overflow-x-auto'
306
+ 'div[style*="overflow"], .overflow-auto, .overflow-y-auto, .overflow-x-auto'
307
307
  );
308
308
  scrollableDivs.forEach((div) =>
309
309
  div.addEventListener('scroll', handleClickOutside as any)
@@ -360,7 +360,7 @@ const AutoCompleteWithSelectedList = forwardRef<
360
360
 
361
361
  const handleOnClick = () => {
362
362
  (!disabled && !readOnly && !expandable && !dropOpen) || viewMode
363
- ? setDropOpen(true)
363
+ ? setVisibleDrop()
364
364
  : '';
365
365
  };
366
366
  const onInputFocus = () => {
@@ -399,12 +399,16 @@ const AutoCompleteWithSelectedList = forwardRef<
399
399
  : '';
400
400
 
401
401
  const handleDropOpen = (e: any) => {
402
+ setVisibleDrop()
403
+ };
404
+
405
+ const setVisibleDrop = () => {
402
406
  setVisible(false);
403
407
  if (!dropOpen) setDropOpen(true);
404
408
  setTimeout(() => {
405
409
  setVisible(true);
406
- }, 100);
407
- };
410
+ }, 200);
411
+ }
408
412
 
409
413
  const handleDropClose = (e: any) => {
410
414
  if (dropOpen) setDropOpen(false);
@@ -620,6 +624,7 @@ const AutoCompleteWithSelectedList = forwardRef<
620
624
  style={{
621
625
  ...dropdownStyle,
622
626
  minHeight: viewMode ? 100 : 192,
627
+ visibility: visible ? 'visible' : 'hidden',
623
628
  }}
624
629
  className={`qbs-autocomplete-suggestions qbs-autocomplete-selected-suggestions ${
625
630
  viewMode ? 'qbs-dropdown-selected-preview' : ''
@@ -675,7 +680,7 @@ const AutoCompleteWithSelectedList = forwardRef<
675
680
  searchValue !== '' &&
676
681
  async) ? (
677
682
  <div className="qbs-flex qbs-align-middle qbs-justify-center qbs-min-emp-h">
678
- <div className="qbs-pt-16">
683
+ <div className="qbs-pt-16 qbs-autocomplete-loader">
679
684
  <Spinner />
680
685
  </div>
681
686
  </div>
@@ -245,7 +245,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
245
245
  window.addEventListener("scroll", handleClickOutside as any);
246
246
 
247
247
  const scrollableDivs = document.querySelectorAll(
248
- 'div[style*="overflow"], .overflow-auto ,overflow-y-auto overflow-x-auto'
248
+ 'div[style*="overflow"], .overflow-auto, .overflow-y-auto, .overflow-x-auto'
249
249
  );
250
250
  scrollableDivs.forEach((div) =>
251
251
  div.addEventListener("scroll", handleClickOutside as any)
@@ -262,7 +262,7 @@ const ExpandableAutoComplete = forwardRef<
262
262
  window.addEventListener("scroll", handleClickOutside as any);
263
263
 
264
264
  const scrollableDivs = document.querySelectorAll(
265
- 'div[style*="overflow"], .overflow-auto ,overflow-y-auto overflow-x-auto'
265
+ 'div[style*="overflow"], .overflow-auto, .overflow-y-auto, .overflow-x-auto'
266
266
  );
267
267
  scrollableDivs.forEach((div) =>
268
268
  div.addEventListener("scroll", handleClickOutside as any)
@@ -340,6 +340,12 @@ const ExpandableAutoComplete = forwardRef<
340
340
  if (dropOpen) setDropOpen(false);
341
341
  };
342
342
 
343
+ const handleClearSelected = () => {
344
+ setSelectedItems([]);
345
+ if (isMultiple) onChange([]);
346
+ else onChange({ [descId]: '', [desc]: '' });
347
+ };
348
+
343
349
  return (
344
350
  <div className={fullWidth ? "fullWidth" : "autoWidth"} ref={dropdownRef}>
345
351
  {label && (
@@ -446,6 +452,15 @@ const ExpandableAutoComplete = forwardRef<
446
452
  />
447
453
  </div>
448
454
 
455
+ {selectedItems?.length > 1 && (
456
+ <div
457
+ className={`qbs-clear-link qbs-text-right qbs-cursor-pointer qbs-text-xs absolute right-2 bottom-1`}
458
+ onClick={handleClearSelected}
459
+ >
460
+ Clear all
461
+ </div>
462
+ )}
463
+
449
464
  {/* Icons for Clearing Input or Toggling Dropdown */}
450
465
 
451
466
  <InputActions
@@ -507,6 +522,7 @@ const ExpandableAutoComplete = forwardRef<
507
522
  {isLoading ? (
508
523
  <div
509
524
  style={{ display: "flex", justifyContent: "center" }}
525
+ className="qbs-autocomplete-loader"
510
526
  >
511
527
  <span>
512
528
  <Spinner />
@@ -16,6 +16,7 @@ type valueProps = {
16
16
  param2?: string | number | null;
17
17
  param3?: string | number | null;
18
18
  param4?: string | number | null;
19
+ from?: number
19
20
  };
20
21
  interface AutoSuggestionInputProps {
21
22
  id?: string;
@@ -148,7 +149,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
148
149
  handleValChange(value);
149
150
  if (!value) {
150
151
  setInputValue('');
151
- onChange({ id: undefined, name: '' });
152
+ onChange({ id: undefined, name: '', from: 2 });
152
153
  }
153
154
  };
154
155
 
@@ -156,7 +157,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
156
157
  debounce(
157
158
  (value: string) => {
158
159
  setDropOpen(true);
159
- onChange({ id: undefined, name: '' });
160
+ onChange({ id: undefined, name: '', from: 1 });
160
161
  if (value.trim() === '' && type === 'auto_complete') {
161
162
  setSuggestions([]);
162
163
  if (autoFilter) {
@@ -327,7 +328,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
327
328
  const mainElement = document.querySelector('main');
328
329
  mainElement?.addEventListener('scroll', handleScroll);
329
330
 
330
- const gridElements = document.querySelectorAll('.k-grid-content, .overflow-auto');
331
+ const gridElements = document.querySelectorAll('.k-grid-content, .overflow-auto, .overflow-y-auto, .overflow-x-auto');
331
332
  gridElements.forEach((gridElement: any) => {
332
333
  gridElement.addEventListener('scroll', handleScroll);
333
334
  });
@@ -349,7 +350,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
349
350
  const handleClear = () => {
350
351
  setDropOpen(false);
351
352
  setInputValue('');
352
- onChange({ id: undefined, name: '' });
353
+ onChange({ id: undefined, name: '', from: 3 });
353
354
  onLabelClick();
354
355
  };
355
356
 
@@ -517,7 +518,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
517
518
  return (
518
519
  (filteredData?.length > 0 || showNoResults) && (
519
520
  <ul
520
- className=" absolute h-auto max-h-40 pl-[10px] overflow-auto w-full bg-white shadow-gray-300 shadow-md border border-grey-light py-1.5 z-50 mt-9"
521
+ className=" absolute h-auto max-h-40 overflow-auto w-full bg-white shadow-gray-300 shadow-md border border-grey-light py-1.5 z-50 mt-9"
521
522
  style={dropPosition}
522
523
  >
523
524
  {filteredData?.length > 0 ? (
@@ -528,7 +529,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
528
529
  value?.id === suggestion?.id
529
530
  ? 'bg-blue-navy text-white'
530
531
  : 'hover:bg-table-hover'
531
- } cursor-pointer p-1 text-xxs ps-3.5`}
532
+ } cursor-pointer p-1 text-xxs ps-3.5 pl-[10px]`}
532
533
  key={suggestion?.id}
533
534
  data-testid={suggestion.name}
534
535
  onClick={() => handleSuggestionClick(suggestion)}
@@ -218,7 +218,8 @@ body * {
218
218
  }
219
219
  }
220
220
 
221
- .qbs-dropdown-selected-container .qbs-clear-link {
221
+ .qbs-dropdown-selected-container .qbs-clear-link,
222
+ .qbs-expandable-container .qbs-clear-link {
222
223
  color: #e76458;
223
224
  }
224
225
 
@@ -235,7 +236,7 @@ body * {
235
236
  overflow: hidden;
236
237
  }
237
238
  .qbs-expandable-container .qbs-textfield-expandable::after {
238
- content: attr(data-value) ' ';
239
+ content: attr(data-value) " ";
239
240
  visibility: hidden;
240
241
  white-space: pre;
241
242
  grid-area: 1 / 2;
@@ -597,7 +598,7 @@ span.dropdown-search-icon {
597
598
 
598
599
  .qbs-table-tooltip .tooltiptext::after,
599
600
  .tooltiptext::after {
600
- content: '';
601
+ content: "";
601
602
  position: absolute;
602
603
  border-width: 5px;
603
604
  border-style: solid;