@etsoo/materialui 1.1.72 → 1.1.73

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.
@@ -38,11 +38,14 @@ export function ComboBoxPro(props) {
38
38
  setOptions(options);
39
39
  }
40
40
  }, [options]);
41
- return (React.createElement(Autocomplete, { id: name, value: localValue, open: open, freeSolo: true, onOpen: () => {
41
+ return (React.createElement(Autocomplete, { id: name, value: localValue, open: open, freeSolo: true, clearOnBlur: false, onOpen: () => {
42
42
  setOpen(true);
43
43
  }, onClose: () => {
44
44
  setOpen(false);
45
- }, options: localOptions, loading: loading, openOnFocus: openOnFocus, renderInput: (params) => (React.createElement(InputField, { ...inputProps, ...params, label: label, name: name })), getOptionLabel: (item) => typeof item === "object" ? getLabel(item) : item, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, onChange: (event, value, reason, details) => {
45
+ }, options: localOptions, loading: loading, openOnFocus: openOnFocus, renderInput: (params) => (React.createElement(InputField, { ...inputProps, ...params, label: label, name: name, onBlur: (event) => {
46
+ if (onChange)
47
+ onChange(event, event.target.value, "blur", undefined);
48
+ } })), getOptionLabel: (item) => typeof item === "object" ? getLabel(item) : item, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, onChange: (event, value, reason, details) => {
46
49
  setValue(value);
47
50
  if (onChange)
48
51
  onChange(event, value, reason, details);
package/lib/TagList.js CHANGED
@@ -30,6 +30,10 @@ export function TagList(props) {
30
30
  if (len >= maxItems) {
31
31
  result.push(moreLabel);
32
32
  }
33
+ else if (len === 0) {
34
+ // When no result, hide the popup
35
+ setOpen(false);
36
+ }
33
37
  setOptions(result);
34
38
  setLoading(false);
35
39
  };
@@ -40,7 +44,7 @@ export function TagList(props) {
40
44
  }
41
45
  }, onClose: () => {
42
46
  setOpen(false);
43
- }, options: options, loading: loading, disableCloseOnSelect: disableCloseOnSelect, openOnFocus: openOnFocus, renderOption: renderOption, renderTags: renderTags, renderInput: (params) => (React.createElement(InputField, { label: label, changeDelay: 480, onChange: async (event) => {
47
+ }, options: options, loading: loading, disableCloseOnSelect: disableCloseOnSelect, clearOnBlur: true, openOnFocus: openOnFocus, renderOption: renderOption, renderTags: renderTags, renderInput: (params) => (React.createElement(InputField, { label: label, changeDelay: 480, onChange: async (event) => {
44
48
  // Stop bubble
45
49
  event.preventDefault();
46
50
  event.stopPropagation();
package/lib/TagListPro.js CHANGED
@@ -32,6 +32,10 @@ export function TagListPro(props) {
32
32
  if (len >= maxItems) {
33
33
  result.push({ id: -1, name: moreLabel });
34
34
  }
35
+ else if (len === 0) {
36
+ // When no result, hide the popup
37
+ setOpen(false);
38
+ }
35
39
  setOptions(result);
36
40
  setLoading(false);
37
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.1.72",
3
+ "version": "1.1.73",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -100,6 +100,7 @@ export function ComboBoxPro<D extends DataType = DataType>(
100
100
  value={localValue}
101
101
  open={open}
102
102
  freeSolo
103
+ clearOnBlur={false}
103
104
  onOpen={() => {
104
105
  setOpen(true);
105
106
  }}
@@ -110,7 +111,16 @@ export function ComboBoxPro<D extends DataType = DataType>(
110
111
  loading={loading}
111
112
  openOnFocus={openOnFocus}
112
113
  renderInput={(params) => (
113
- <InputField {...inputProps} {...params} label={label} name={name} />
114
+ <InputField
115
+ {...inputProps}
116
+ {...params}
117
+ label={label}
118
+ name={name}
119
+ onBlur={(event) => {
120
+ if (onChange)
121
+ onChange(event, event.target.value, "blur", undefined);
122
+ }}
123
+ />
114
124
  )}
115
125
  getOptionLabel={(item) =>
116
126
  typeof item === "object" ? getLabel(item) : item
package/src/TagList.tsx CHANGED
@@ -94,6 +94,9 @@ export function TagList(props: TagListProps) {
94
94
 
95
95
  if (len >= maxItems) {
96
96
  result.push(moreLabel);
97
+ } else if (len === 0) {
98
+ // When no result, hide the popup
99
+ setOpen(false);
97
100
  }
98
101
  setOptions(result);
99
102
  setLoading(false);
@@ -117,6 +120,7 @@ export function TagList(props: TagListProps) {
117
120
  options={options}
118
121
  loading={loading}
119
122
  disableCloseOnSelect={disableCloseOnSelect}
123
+ clearOnBlur
120
124
  openOnFocus={openOnFocus}
121
125
  renderOption={renderOption}
122
126
  renderTags={renderTags}
@@ -108,7 +108,11 @@ export function TagListPro<D extends DataType = DataType>(
108
108
 
109
109
  if (len >= maxItems) {
110
110
  result.push({ id: -1, name: moreLabel } as D);
111
+ } else if (len === 0) {
112
+ // When no result, hide the popup
113
+ setOpen(false);
111
114
  }
115
+
112
116
  setOptions(result);
113
117
  setLoading(false);
114
118
  };