kts-component-invoice-operate 3.2.95 → 3.2.97

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.
package/dist/index.esm.js CHANGED
@@ -10831,41 +10831,49 @@ function ItemNameInput(props) {
10831
10831
  }, []);
10832
10832
  var onSearch = React.useCallback( /*#__PURE__*/function () {
10833
10833
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
10834
+ var list;
10834
10835
  return _regeneratorRuntime().wrap(function _callee$(_context) {
10835
10836
  while (1) {
10836
10837
  switch (_context.prev = _context.next) {
10837
10838
  case 0:
10838
10839
  _context.prev = 0;
10839
10840
 
10840
- if (!autoComplete.onItemNameSearch) {
10841
- _context.next = 7;
10841
+ if (!(autoComplete.onItemNameSearch && searchText)) {
10842
+ _context.next = 11;
10842
10843
  break;
10843
10844
  }
10844
10845
 
10845
- _context.t0 = setOptions;
10846
+ _context.t0 = _toConsumableArray;
10846
10847
  _context.next = 5;
10847
10848
  return autoComplete.onItemNameSearch(searchText);
10848
10849
 
10849
10850
  case 5:
10850
10851
  _context.t1 = _context.sent;
10851
- (0, _context.t0)(_context.t1);
10852
+ list = (0, _context.t0)(_context.t1);
10853
+ console.log('===> list', list);
10854
+ setOptions(list);
10855
+ _context.next = 12;
10856
+ break;
10852
10857
 
10853
- case 7:
10854
- _context.next = 13;
10858
+ case 11:
10859
+ setOptions([]);
10860
+
10861
+ case 12:
10862
+ _context.next = 18;
10855
10863
  break;
10856
10864
 
10857
- case 9:
10858
- _context.prev = 9;
10865
+ case 14:
10866
+ _context.prev = 14;
10859
10867
  _context.t2 = _context["catch"](0);
10860
10868
  setOptions([]);
10861
10869
  throw _context.t2;
10862
10870
 
10863
- case 13:
10871
+ case 18:
10864
10872
  case "end":
10865
10873
  return _context.stop();
10866
10874
  }
10867
10875
  }
10868
- }, _callee, null, [[0, 9]]);
10876
+ }, _callee, null, [[0, 14]]);
10869
10877
  }));
10870
10878
 
10871
10879
  return function (_x) {
@@ -10912,6 +10920,7 @@ function ItemNameInput(props) {
10912
10920
  return _ref2.apply(this, arguments);
10913
10921
  };
10914
10922
  }(), [options, controller]);
10923
+ console.log('===> options', options);
10915
10924
  return React.createElement("div", {
10916
10925
  className: 'kts-invoice-operate-goods-list-itemName-input'
10917
10926
  }, props.shorthand && React.createElement("span", {
package/dist/index.js CHANGED
@@ -10841,41 +10841,49 @@ function ItemNameInput(props) {
10841
10841
  }, []);
10842
10842
  var onSearch = React__default['default'].useCallback( /*#__PURE__*/function () {
10843
10843
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
10844
+ var list;
10844
10845
  return _regeneratorRuntime().wrap(function _callee$(_context) {
10845
10846
  while (1) {
10846
10847
  switch (_context.prev = _context.next) {
10847
10848
  case 0:
10848
10849
  _context.prev = 0;
10849
10850
 
10850
- if (!autoComplete.onItemNameSearch) {
10851
- _context.next = 7;
10851
+ if (!(autoComplete.onItemNameSearch && searchText)) {
10852
+ _context.next = 11;
10852
10853
  break;
10853
10854
  }
10854
10855
 
10855
- _context.t0 = setOptions;
10856
+ _context.t0 = _toConsumableArray;
10856
10857
  _context.next = 5;
10857
10858
  return autoComplete.onItemNameSearch(searchText);
10858
10859
 
10859
10860
  case 5:
10860
10861
  _context.t1 = _context.sent;
10861
- (0, _context.t0)(_context.t1);
10862
+ list = (0, _context.t0)(_context.t1);
10863
+ console.log('===> list', list);
10864
+ setOptions(list);
10865
+ _context.next = 12;
10866
+ break;
10862
10867
 
10863
- case 7:
10864
- _context.next = 13;
10868
+ case 11:
10869
+ setOptions([]);
10870
+
10871
+ case 12:
10872
+ _context.next = 18;
10865
10873
  break;
10866
10874
 
10867
- case 9:
10868
- _context.prev = 9;
10875
+ case 14:
10876
+ _context.prev = 14;
10869
10877
  _context.t2 = _context["catch"](0);
10870
10878
  setOptions([]);
10871
10879
  throw _context.t2;
10872
10880
 
10873
- case 13:
10881
+ case 18:
10874
10882
  case "end":
10875
10883
  return _context.stop();
10876
10884
  }
10877
10885
  }
10878
- }, _callee, null, [[0, 9]]);
10886
+ }, _callee, null, [[0, 14]]);
10879
10887
  }));
10880
10888
 
10881
10889
  return function (_x) {
@@ -10922,6 +10930,7 @@ function ItemNameInput(props) {
10922
10930
  return _ref2.apply(this, arguments);
10923
10931
  };
10924
10932
  }(), [options, controller]);
10933
+ console.log('===> options', options);
10925
10934
  return React__default['default'].createElement("div", {
10926
10935
  className: 'kts-invoice-operate-goods-list-itemName-input'
10927
10936
  }, props.shorthand && React__default['default'].createElement("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.95",
3
+ "version": "3.2.97",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -23,8 +23,12 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
23
23
 
24
24
  const onSearch = React.useCallback(async (searchText: string) => {
25
25
  try {
26
- if (autoComplete.onItemNameSearch) {
27
- setOptions(await autoComplete.onItemNameSearch(searchText));
26
+ if (autoComplete.onItemNameSearch && searchText) {
27
+ const list = [...await autoComplete.onItemNameSearch(searchText)];
28
+ console.log('===> list', list);
29
+ setOptions(list);
30
+ }else{
31
+ setOptions([]);
28
32
  }
29
33
  } catch (error) {
30
34
  setOptions([])
@@ -39,10 +43,12 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
39
43
  await controller.setEditGood({ itemName: record.itemName });
40
44
 
41
45
  controller.importGoodsDrawer(record);
42
-
46
+
43
47
  setOptions([]);
44
48
  }, [options, controller])
45
49
 
50
+ console.log('===> options', options)
51
+
46
52
  return (
47
53
  <div className='kts-invoice-operate-goods-list-itemName-input'>
48
54
  {props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}