awing-library 2.1.2-dev.546 → 2.1.2-dev.547

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/AWING/AsyncAutocomplete/Container.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,2CA+N5E"}
1
+ {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/AWING/AsyncAutocomplete/Container.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,2CAyO5E"}
@@ -45,10 +45,10 @@ function AsyncAutocomplete(props) {
45
45
  setHasMore(true);
46
46
  fetchRef.current?.(search, 1, (results)=>{
47
47
  if (!active) return;
48
- if (results && results.length > 0) setOptions([
49
- ...results
50
- ]);
51
- else if (results && 0 === results.length) setHasMore(false);
48
+ if (results) {
49
+ setOptions(results);
50
+ setHasMore(results.length === pageSize);
51
+ }
52
52
  });
53
53
  return ()=>{
54
54
  active = false;
@@ -127,6 +127,10 @@ function AsyncAutocomplete(props) {
127
127
  value: multiple ? value ?? [] : value ?? null,
128
128
  onChange: (_event, newValue)=>{
129
129
  if (onChange) onChange(newValue);
130
+ if (multiple) {
131
+ setInputValue('');
132
+ setSearchString('');
133
+ }
130
134
  },
131
135
  onInputChange: (_event, newInputValue, reason)=>{
132
136
  if ('reset' === reason) {
@@ -138,6 +142,12 @@ function AsyncAutocomplete(props) {
138
142
  setSearchString(newInputValue);
139
143
  } else setInputValue(newInputValue);
140
144
  },
145
+ onBlur: ()=>{
146
+ if (multiple) {
147
+ setInputValue('');
148
+ setSearchString('');
149
+ } else setInputValue(value ? getOptionLabel(value) : '');
150
+ },
141
151
  clearOnBlur: false,
142
152
  loading: loading,
143
153
  slotProps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.2-dev.546",
3
+ "version": "2.1.2-dev.547",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {