diginet-core-ui 1.3.49 → 1.3.50

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.
@@ -455,13 +455,15 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
455
455
  items.push(jsx("div", {
456
456
  key: index,
457
457
  css: !itemDisabled ? _DropdownItemCSS : [DisabledCSS, _DropdownItemCSS],
458
- onClick: e => {
459
- if (itemDisabled) return;
460
- onChangeValueWithCheckbox(e) & onChangeValue(displayText, value, icon, data, index);
458
+ onClick: () => {
459
+ if (itemDisabled) return; // onChangeValueWithCheckbox(e) & onChangeValue(displayText, value, icon, data, index);
460
+
461
+ onChangeValue(displayText, value, icon, data, index);
461
462
  },
462
463
  onKeyPress: e => {
463
- if (itemDisabled) return;
464
- if (e.key === 'Enter') e.currentTarget.firstChild.click();
464
+ if (itemDisabled) return; // if (e.key === 'Enter') e.currentTarget.firstChild.click();
465
+
466
+ if (e.key === 'Enter') onChangeValue(displayText, value, icon, data, index);
465
467
  },
466
468
  tabIndex: -1
467
469
  }, jsx(Checkbox, {
@@ -472,7 +474,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
472
474
  padding: '0 16px'
473
475
  },
474
476
  value: value,
475
- disabled: itemDisabled
477
+ disabled: itemDisabled,
478
+ onChange: () => onChangeValue(displayText, value, icon, data, index)
476
479
  }, icon && jsx("div", {
477
480
  css: DropdownIconCSS
478
481
  }, icon), jsx("div", {
@@ -759,9 +762,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
759
762
  if (searchRef.current) lastSearchRef.current = searchRef.current.value;
760
763
 
761
764
  if (onInput) {
762
- isSearch[unique] = true;
763
- const valueInput = e.target.value;
764
- const text = (valueInput || e.target.textContent).normalize();
765
+ isSearch[unique] = true; // const valueInput = e.target.value;
766
+ // const text = (valueInput || e.target.textContent).normalize();
765
767
 
766
768
  if (timeout.current) {
767
769
  if (timing[unique]) {
@@ -769,14 +771,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
769
771
  }
770
772
 
771
773
  timing[unique] = setTimeout(() => {
772
- e.target.value = text;
773
- onInput(e);
774
- e.target.value = valueInput;
775
- }, timeout.current);
774
+ // e.target.value = text;
775
+ onInput(e); // e.target.value = valueInput;
776
+ }, timeout.current || searchDelayTime);
776
777
  } else {
777
- e.target.value = text;
778
- onInput(e);
779
- e.target.value = valueInput;
778
+ // e.target.value = text;
779
+ onInput(e); // e.target.value = valueInput;
780
780
  }
781
781
 
782
782
  return;
@@ -798,7 +798,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
798
798
  }
799
799
 
800
800
  renderDropdown(new RegExp(value.normalize(), 'gim'));
801
- }, timeout.current || 700);
801
+ }, timeout.current || searchDelayTime);
802
802
  };
803
803
 
804
804
  const onChangeValue = (displayText, value, icon, data, index) => {
@@ -894,15 +894,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
894
894
  if (closeAfterSelect === true || closeAfterSelect === undefined && !multiple) {
895
895
  closeDropdown();
896
896
  }
897
- };
898
-
899
- const onChangeValueWithCheckbox = e => {
900
- const firstChild = e.currentTarget.firstChild;
897
+ }; // const onChangeValueWithCheckbox = e => {
898
+ // const firstChild = e.currentTarget.firstChild;
899
+ // if (!firstChild.contains(e.target)) {
900
+ // firstChild.click();
901
+ // }
902
+ // };
901
903
 
902
- if (!firstChild.contains(e.target)) {
903
- firstChild.click();
904
- }
905
- };
906
904
 
907
905
  const onRemove = (e, value) => {
908
906
  const index = currentValue[unique].findIndex(v => JSON.stringify(v) === JSON.stringify(value));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.49",
3
+ "version": "1.3.50",
4
4
  "description": "The DigiNet core ui",
5
5
  "homepage": "https://diginet.com.vn",
6
6
  "main": "index.js",
package/readme.md CHANGED
@@ -38,6 +38,9 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.3.50
42
+ - \[Fixed\]: Dropdown – Fix dropdown onInput search
43
+
41
44
  ## 1.3.49
42
45
  - \[Added\]: MenuIcon – WA3F0100, WA3F1025, WA3F2000, WA3F2020, WA3F2030, WA3F2040, WA3F2100
43
46
  - \[Changed\]: Grid – Phát triển component Grid