@availity/mui-autocomplete 1.2.2 → 1.2.4
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.2.4](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.2.3...@availity/mui-autocomplete@1.2.4) (2025-06-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **mui-autocomplete:** serialize organization params ([23d9dce](https://github.com/Availity/element/commit/23d9dce0bd63e9417a8a79a95ab2c7e5c8946301))
|
|
11
|
+
|
|
12
|
+
## [1.2.3](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.2.2...@availity/mui-autocomplete@1.2.3) (2025-05-30)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **mui-autocomplete:** getNextPageParam should return undefined if no more pages ([b1ff081](https://github.com/Availity/element/commit/b1ff0817b3f97ce5e6f755cd5fb463a1881578a5))
|
|
18
|
+
|
|
5
19
|
## [1.2.2](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.2.1...@availity/mui-autocomplete@1.2.2) (2025-05-29)
|
|
6
20
|
|
|
7
21
|
### Dependency Updates
|
package/dist/index.js
CHANGED
|
@@ -199,7 +199,7 @@ var AsyncAutocomplete = (_a) => {
|
|
|
199
199
|
return loadOptions(pageParam, limit, debouncedInput);
|
|
200
200
|
}),
|
|
201
201
|
staleTime: 1e4,
|
|
202
|
-
getNextPageParam: (lastPage) => lastPage.hasMore ? lastPage.offset + limit :
|
|
202
|
+
getNextPageParam: (lastPage) => lastPage.hasMore ? lastPage.offset + limit : void 0
|
|
203
203
|
}, queryOptions));
|
|
204
204
|
const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
|
|
205
205
|
const handleOnInputChange = (event, value, reason) => {
|
|
@@ -281,9 +281,15 @@ var CodesAutocomplete = (_a) => {
|
|
|
281
281
|
|
|
282
282
|
// src/lib/OrganizationAutocomplete.tsx
|
|
283
283
|
var import_api_axios2 = require("@availity/api-axios");
|
|
284
|
+
var import_qs = __toESM(require("qs"));
|
|
284
285
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
285
286
|
var fetchOrgs = (config) => __async(void 0, null, function* () {
|
|
286
|
-
const
|
|
287
|
+
const configWithParamsSerializer = __spreadProps(__spreadValues({}, config), {
|
|
288
|
+
paramsSerializer: {
|
|
289
|
+
serialize: (params) => import_qs.default.stringify(params, { arrayFormat: "repeat" })
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
const resp = yield import_api_axios2.avOrganizationsApi.getOrganizations(configWithParamsSerializer);
|
|
287
293
|
return {
|
|
288
294
|
options: resp.data.organizations,
|
|
289
295
|
hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
|
package/dist/index.mjs
CHANGED
|
@@ -157,7 +157,7 @@ var AsyncAutocomplete = (_a) => {
|
|
|
157
157
|
return loadOptions(pageParam, limit, debouncedInput);
|
|
158
158
|
}),
|
|
159
159
|
staleTime: 1e4,
|
|
160
|
-
getNextPageParam: (lastPage) => lastPage.hasMore ? lastPage.offset + limit :
|
|
160
|
+
getNextPageParam: (lastPage) => lastPage.hasMore ? lastPage.offset + limit : void 0
|
|
161
161
|
}, queryOptions));
|
|
162
162
|
const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
|
|
163
163
|
const handleOnInputChange = (event, value, reason) => {
|
|
@@ -239,9 +239,15 @@ var CodesAutocomplete = (_a) => {
|
|
|
239
239
|
|
|
240
240
|
// src/lib/OrganizationAutocomplete.tsx
|
|
241
241
|
import { avOrganizationsApi } from "@availity/api-axios";
|
|
242
|
+
import qs from "qs";
|
|
242
243
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
243
244
|
var fetchOrgs = (config) => __async(void 0, null, function* () {
|
|
244
|
-
const
|
|
245
|
+
const configWithParamsSerializer = __spreadProps(__spreadValues({}, config), {
|
|
246
|
+
paramsSerializer: {
|
|
247
|
+
serialize: (params) => qs.stringify(params, { arrayFormat: "repeat" })
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
const resp = yield avOrganizationsApi.getOrganizations(configWithParamsSerializer);
|
|
245
251
|
return {
|
|
246
252
|
options: resp.data.organizations,
|
|
247
253
|
hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-autocomplete",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Availity MUI Autocomplete Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@mui/types": "^7.2.21"
|
|
44
|
+
"@mui/types": "^7.2.21",
|
|
45
|
+
"qs": "^6.14.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@availity/api-axios": "^11.0.0",
|
|
@@ -114,7 +114,8 @@ describe('AsyncAutocomplete', () => {
|
|
|
114
114
|
fireEvent.keyDown(input, { key: 'ArrowDown' });
|
|
115
115
|
|
|
116
116
|
await waitFor(() => {
|
|
117
|
-
expect(screen.getByText('Option
|
|
117
|
+
expect(screen.getByText('Option 0')).toBeDefined();
|
|
118
|
+
expect(() => screen.getByText('Option 10')).toThrow();
|
|
118
119
|
});
|
|
119
120
|
|
|
120
121
|
await act(async () => {
|
|
@@ -124,7 +125,7 @@ describe('AsyncAutocomplete', () => {
|
|
|
124
125
|
|
|
125
126
|
await waitFor(() => {
|
|
126
127
|
expect(screen.getByText('Option 10')).toBeDefined();
|
|
127
|
-
expect(() => screen.getByText('Option 20')).
|
|
128
|
+
expect(() => screen.getByText('Option 20')).toThrow();
|
|
128
129
|
});
|
|
129
130
|
});
|
|
130
131
|
|
|
@@ -67,7 +67,7 @@ export const AsyncAutocomplete = <
|
|
|
67
67
|
queryKey: [queryKey, limit, debouncedInput, watchParams],
|
|
68
68
|
queryFn: async ({ pageParam = 0 }) => loadOptions(pageParam, limit, debouncedInput),
|
|
69
69
|
staleTime: 10000,
|
|
70
|
-
getNextPageParam: (lastPage) => (lastPage.hasMore ? lastPage.offset + limit :
|
|
70
|
+
getNextPageParam: (lastPage) => (lastPage.hasMore ? lastPage.offset + limit : undefined),
|
|
71
71
|
...queryOptions,
|
|
72
72
|
});
|
|
73
73
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { avOrganizationsApi, ApiConfig } from '@availity/api-axios';
|
|
2
2
|
import type { ChipTypeMap } from '@mui/material/Chip';
|
|
3
|
+
import qs from 'qs';
|
|
3
4
|
|
|
4
5
|
import { AsyncAutocomplete, AsyncAutocompleteProps } from './AsyncAutocomplete';
|
|
5
6
|
import type { Optional } from './util';
|
|
@@ -15,7 +16,15 @@ export type Organization = {
|
|
|
15
16
|
export const fetchOrgs = async (
|
|
16
17
|
config: ApiConfig
|
|
17
18
|
): Promise<{ options: Organization[]; hasMore: boolean; offset: number }> => {
|
|
18
|
-
|
|
19
|
+
// Configure axios to use 'repeat' format for arrays (no brackets)
|
|
20
|
+
const configWithParamsSerializer = {
|
|
21
|
+
...config,
|
|
22
|
+
paramsSerializer: {
|
|
23
|
+
serialize: (params: Record<string, any>) => qs.stringify(params, { arrayFormat: 'repeat' }),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const resp = await avOrganizationsApi.getOrganizations(configWithParamsSerializer);
|
|
19
28
|
|
|
20
29
|
return {
|
|
21
30
|
options: resp.data.organizations as Organization[],
|