react-admin-base-bootstrap 0.9.23 → 0.9.24

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.
@@ -16,6 +16,7 @@ export interface ApiSelectProps<Option = any> {
16
16
  staticOptions?: any[];
17
17
  sortable?: boolean;
18
18
  onAddOrEdit?: (item: any) => void;
19
+ free?: boolean;
19
20
  getNewOptionData?: (name: string, elem: React.ReactNode) => any | null;
20
21
  }
21
22
  export default function ApiSelect<Option = any>(props: ApiSelectProps<Option>): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
11
11
  import React, { Fragment, useCallback, useMemo, useState } from 'react';
12
- import { RefreshScope, useFetch, useRefresh } from 'react-admin-base';
12
+ import { RefreshScope, useFetch, useFreeFetch, useRefresh } from 'react-admin-base';
13
13
  import { FormattedMessage, useIntl } from 'react-intl';
14
14
  import Select, { components } from "react-select";
15
15
  import CreatableSelect from 'react-select/creatable';
@@ -66,13 +66,13 @@ const SortableMultiValueRemove = (props) => {
66
66
  };
67
67
  const SortableComponents = { Option, SingleValue, MultiValue: SortableMultiValue, IndicatorsContainer, MultiValueRemove: SortableMultiValueRemove };
68
68
  export default function ApiSelect(props) {
69
- const { disabled, url, getOptionLabel, sortable, getOptionValue, idKey, nameKey, filter, group, onCreateOption, getNewOptionData, isMulti, onChange, value, placeholder, staticOptions } = props;
69
+ const { disabled, url, getOptionLabel, sortable, free, getOptionValue, idKey, nameKey, filter, group, onCreateOption, getNewOptionData, isMulti, onChange, value, placeholder, staticOptions } = props;
70
70
  const intl = useIntl();
71
71
  const [search, setSearch] = useState('');
72
72
  const params = useMemo(() => ({ query: search }), [search]);
73
73
  const [isMenuOpen, setIsMenuOpen] = useState(false);
74
74
  const [hasMenuOpen, setHasMenuOpen] = useState(false);
75
- const [data, loading, error, update] = useFetch((isMenuOpen && url) || false, params);
75
+ const [data, loading, error, update] = (free ? useFreeFetch : useFetch)((isMenuOpen && url) || false, params);
76
76
  const [creating, setCreating] = useState(false);
77
77
  let options = staticOptions || (data && data.data) || data;
78
78
  if (group) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-admin-base-bootstrap",
3
- "version": "0.9.23",
3
+ "version": "0.9.24",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -1,7 +1,7 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import { css } from "@emotion/react"
3
3
  import React, {Fragment, useCallback, useMemo, useRef, useState} from 'react';
4
- import {RefreshScope, useFetch, useRefresh} from 'react-admin-base';
4
+ import {RefreshScope, useFetch, useFreeFetch, useRefresh} from 'react-admin-base';
5
5
  import { FormattedMessage, useIntl } from 'react-intl';
6
6
  import Select, { components } from "react-select";
7
7
  import CreatableSelect from 'react-select/creatable';
@@ -141,18 +141,19 @@ export interface ApiSelectProps<Option = any> {
141
141
  staticOptions?: any[];
142
142
  sortable?: boolean;
143
143
  onAddOrEdit?: (item: any) => void;
144
+ free?: boolean;
144
145
  getNewOptionData?: (name: string, elem: React.ReactNode) => any|null;
145
146
  }
146
147
 
147
148
 
148
149
  export default function ApiSelect<Option = any>(props: ApiSelectProps<Option>) {
149
- const { disabled, url, getOptionLabel, sortable, getOptionValue, idKey, nameKey, filter, group, onCreateOption, getNewOptionData, isMulti, onChange, value, placeholder, staticOptions } = props;
150
+ const { disabled, url, getOptionLabel, sortable, free, getOptionValue, idKey, nameKey, filter, group, onCreateOption, getNewOptionData, isMulti, onChange, value, placeholder, staticOptions } = props;
150
151
  const intl = useIntl();
151
152
  const [ search, setSearch ] = useState('');
152
153
  const params = useMemo(() => ({ query: search }), [search]);
153
154
  const [ isMenuOpen, setIsMenuOpen ] = useState(false);
154
155
  const [ hasMenuOpen, setHasMenuOpen ] = useState(false);
155
- const [ data, loading, error, update ] = useFetch((isMenuOpen && url) || false, params);
156
+ const [ data, loading, error, update ] = (free ? useFreeFetch : useFetch)((isMenuOpen && url) || false, params);
156
157
  const [ creating, setCreating ] = useState(false);
157
158
 
158
159
  let options = staticOptions || (data && data.data) || data;
package/bun.lockb DELETED
Binary file