@etsoo/materialui 1.1.51 → 1.1.52
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/lib/TagList.js +3 -1
- package/package.json +1 -1
- package/src/TagList.tsx +3 -1
package/lib/TagList.js
CHANGED
|
@@ -15,14 +15,16 @@ export function TagList(props) {
|
|
|
15
15
|
option)), renderTags = (value, getTagProps) => value.map((option, index) => (React.createElement(Chip, { variant: "outlined", label: option, ...getTagProps({ index }) }))), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, ...rest } = props;
|
|
16
16
|
const [open, setOpen] = React.useState(false);
|
|
17
17
|
const [options, setOptions] = React.useState([]);
|
|
18
|
-
const loading =
|
|
18
|
+
const [loading, setLoading] = React.useState(false);
|
|
19
19
|
const loadDataLocal = async (keyword) => {
|
|
20
20
|
var _a;
|
|
21
|
+
setLoading(true);
|
|
21
22
|
const result = (_a = (await loadData(keyword, maxItems))) !== null && _a !== void 0 ? _a : [];
|
|
22
23
|
if (result.length >= maxItems) {
|
|
23
24
|
result.push(moreLabel);
|
|
24
25
|
}
|
|
25
26
|
setOptions(result);
|
|
27
|
+
setLoading(false);
|
|
26
28
|
};
|
|
27
29
|
return (React.createElement(Autocomplete, { multiple: true, freeSolo: true, filterOptions: (options, _state) => options, open: open, onOpen: () => {
|
|
28
30
|
setOpen(true);
|
package/package.json
CHANGED
package/src/TagList.tsx
CHANGED
|
@@ -75,14 +75,16 @@ export function TagList(props: TagListProps) {
|
|
|
75
75
|
|
|
76
76
|
const [open, setOpen] = React.useState(false);
|
|
77
77
|
const [options, setOptions] = React.useState<readonly string[]>([]);
|
|
78
|
-
const loading =
|
|
78
|
+
const [loading, setLoading] = React.useState(false);
|
|
79
79
|
|
|
80
80
|
const loadDataLocal = async (keyword?: string) => {
|
|
81
|
+
setLoading(true);
|
|
81
82
|
const result = (await loadData(keyword, maxItems)) ?? [];
|
|
82
83
|
if (result.length >= maxItems) {
|
|
83
84
|
result.push(moreLabel);
|
|
84
85
|
}
|
|
85
86
|
setOptions(result);
|
|
87
|
+
setLoading(false);
|
|
86
88
|
};
|
|
87
89
|
|
|
88
90
|
return (
|