@cgarciagarcia/react-query-builder 1.3.0 → 1.3.2
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -3
- package/dist/src/actions/filter.d.ts +8 -0
- package/dist/src/actions/filter.js +30 -0
- package/dist/src/actions/include.d.ts +2 -0
- package/dist/src/actions/include.js +6 -0
- package/dist/src/actions/index.d.ts +3 -0
- package/dist/src/actions/index.js +3 -0
- package/dist/src/actions/sort.d.ts +7 -0
- package/dist/src/actions/sort.js +9 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/useQueryBuilder.d.ts +14 -0
- package/dist/src/useQueryBuilder.js +69 -0
- package/dist/src/utils/alias.d.ts +2 -0
- package/dist/src/utils/alias.js +3 -0
- package/dist/src/utils/build.d.ts +2 -0
- package/dist/src/utils/build.js +20 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/dist/actions/filter.js +0 -44
- package/dist/actions/include.js +0 -23
- package/dist/actions/index.js +0 -3
- package/dist/actions/sort.js +0 -26
- package/dist/dist/actions/filter.js +0 -47
- package/dist/dist/actions/include.js +0 -26
- package/dist/dist/actions/index.js +0 -3
- package/dist/dist/actions/sort.js +0 -29
- package/dist/dist/dist/actions/filter.js +0 -47
- package/dist/dist/dist/actions/include.js +0 -26
- package/dist/dist/dist/actions/index.js +0 -3
- package/dist/dist/dist/actions/sort.js +0 -29
- package/dist/dist/dist/index.js +0 -3
- package/dist/dist/dist/useQueryBuilder.js +0 -86
- package/dist/dist/dist/utils/alias.js +0 -4
- package/dist/dist/dist/utils/build.js +0 -30
- package/dist/dist/dist/utils/index.js +0 -3
- package/dist/dist/dist/utils/state.js +0 -1
- package/dist/dist/index.js +0 -3
- package/dist/dist/useQueryBuilder.js +0 -86
- package/dist/dist/utils/alias.js +0 -4
- package/dist/dist/utils/build.js +0 -30
- package/dist/dist/utils/index.js +0 -3
- package/dist/dist/utils/state.js +0 -1
- package/dist/useQueryBuilder.js +0 -81
- package/dist/utils/alias.js +0 -4
- package/dist/utils/build.js +0 -29
- package/dist/utils/index.js +0 -3
- package/dist/utils/state.js +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Alias, type FilterValue, type GlobalState } from "types";
|
|
2
|
+
export declare const filterAction: <Al extends Alias<object>, Attr extends string>(attribute: Attr, value: FilterValue, state: GlobalState<Al>) => GlobalState<Al>;
|
|
3
|
+
export declare const clearFilterAction: <Al>(state: GlobalState<Al>) => {
|
|
4
|
+
filters: never[];
|
|
5
|
+
aliases: Alias<Al>;
|
|
6
|
+
includes: import("types").Includes;
|
|
7
|
+
sorts: import("types").Sorts;
|
|
8
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { usingAlias } from "../utils";
|
|
2
|
+
export const filterAction = (attribute, value, state) => {
|
|
3
|
+
const alias = usingAlias(state, attribute);
|
|
4
|
+
let prevFilter;
|
|
5
|
+
const allFilters = state.filters.reduce((filters, filter) => {
|
|
6
|
+
if (filter.attribute === alias) {
|
|
7
|
+
prevFilter = filter;
|
|
8
|
+
return filters;
|
|
9
|
+
}
|
|
10
|
+
return [...filters, filter];
|
|
11
|
+
}, []);
|
|
12
|
+
const val = Array.isArray(value) ? value : [value];
|
|
13
|
+
const newState = {
|
|
14
|
+
...state,
|
|
15
|
+
filters: [
|
|
16
|
+
...allFilters,
|
|
17
|
+
{
|
|
18
|
+
attribute: attribute,
|
|
19
|
+
value: [...(prevFilter?.value ?? []), ...val],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
return newState;
|
|
24
|
+
};
|
|
25
|
+
export const clearFilterAction = (state) => {
|
|
26
|
+
return {
|
|
27
|
+
...state,
|
|
28
|
+
filters: [],
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { usingAlias } from "index";
|
|
2
|
+
export const sortAction = (sorts, state) => {
|
|
3
|
+
const [attribute, direction] = sorts;
|
|
4
|
+
const attributeAliased = usingAlias(state, attribute);
|
|
5
|
+
return {
|
|
6
|
+
...state,
|
|
7
|
+
sorts: [...state.sorts, [attributeAliased, direction]],
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FilterValue, type Include } from "types";
|
|
2
|
+
export interface QueryBuilder<AliasType = NonNullable<unknown>> {
|
|
3
|
+
filters: (attribute: keyof AliasType | string, value: FilterValue) => QueryBuilder<AliasType>;
|
|
4
|
+
build: () => string;
|
|
5
|
+
clearFilters: () => QueryBuilder<AliasType>;
|
|
6
|
+
includes: (includes: Include) => QueryBuilder<AliasType>;
|
|
7
|
+
sorts: (attribute: string, direction?: "asc" | "desc") => QueryBuilder<AliasType>;
|
|
8
|
+
}
|
|
9
|
+
type ExtensibleQueryProps<T> = Pick<QueryBuilder<T>, "filters" | "includes" | "sorts">;
|
|
10
|
+
interface QueryBuilderProps<AliasType> extends ExtensibleQueryProps<AliasType> {
|
|
11
|
+
aliases?: AliasType;
|
|
12
|
+
}
|
|
13
|
+
export declare const useQueryBuilder: <Aliases extends Record<string, string>>(config?: QueryBuilderProps<Aliases>) => QueryBuilder<Aliases>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useReducer, useState } from "react";
|
|
2
|
+
import { build, clearFilterAction, filterAction, includeAction, sortAction, } from "index";
|
|
3
|
+
const reducer = (state, action) => {
|
|
4
|
+
switch (action?.type) {
|
|
5
|
+
case "filter": {
|
|
6
|
+
const filter = action.payload;
|
|
7
|
+
return filterAction(filter.attribute, filter.value, state);
|
|
8
|
+
}
|
|
9
|
+
case "clear_filter": {
|
|
10
|
+
return clearFilterAction(state);
|
|
11
|
+
}
|
|
12
|
+
case "include": {
|
|
13
|
+
const includes = action.payload;
|
|
14
|
+
return includeAction(includes, state);
|
|
15
|
+
}
|
|
16
|
+
case "sort": {
|
|
17
|
+
const sorts = action.payload;
|
|
18
|
+
return sortAction(sorts, state);
|
|
19
|
+
}
|
|
20
|
+
default: {
|
|
21
|
+
return { ...state };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const initialState = () => ({
|
|
26
|
+
aliases: {},
|
|
27
|
+
filters: [],
|
|
28
|
+
includes: [],
|
|
29
|
+
sorts: [],
|
|
30
|
+
});
|
|
31
|
+
export const useQueryBuilder = (config = {}) => {
|
|
32
|
+
const [init] = useState(() => initialState());
|
|
33
|
+
const [state, dispatch] = useReducer(reducer, init, (init) => ({
|
|
34
|
+
...init,
|
|
35
|
+
aliases: config?.aliases ?? {},
|
|
36
|
+
}));
|
|
37
|
+
const builder = {
|
|
38
|
+
filters: (attribute, value) => {
|
|
39
|
+
dispatch({
|
|
40
|
+
type: "filter",
|
|
41
|
+
payload: { attribute, value },
|
|
42
|
+
});
|
|
43
|
+
return builder;
|
|
44
|
+
},
|
|
45
|
+
build: () => build(state),
|
|
46
|
+
clearFilters: () => {
|
|
47
|
+
dispatch({
|
|
48
|
+
type: "clear_filter",
|
|
49
|
+
payload: undefined,
|
|
50
|
+
});
|
|
51
|
+
return builder;
|
|
52
|
+
},
|
|
53
|
+
includes: (includes) => {
|
|
54
|
+
dispatch({
|
|
55
|
+
type: "include",
|
|
56
|
+
payload: includes,
|
|
57
|
+
});
|
|
58
|
+
return builder;
|
|
59
|
+
},
|
|
60
|
+
sorts: (attribute, direction) => {
|
|
61
|
+
dispatch({
|
|
62
|
+
type: "sort",
|
|
63
|
+
payload: [attribute, direction ?? "asc"],
|
|
64
|
+
});
|
|
65
|
+
return builder;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
return builder;
|
|
69
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const build = (state) => {
|
|
2
|
+
const filters = state.filters.reduce((acc, filter) => ({
|
|
3
|
+
...acc,
|
|
4
|
+
[`filters[${filter.attribute}]`]: filter.value.join(","),
|
|
5
|
+
}), {});
|
|
6
|
+
const sorts = state.sorts.reduce((acc, sort) => {
|
|
7
|
+
const [attribute, dir] = sort;
|
|
8
|
+
const direction = dir === "desc" ? "-" : "";
|
|
9
|
+
acc.push(`${direction}${attribute}`);
|
|
10
|
+
return acc;
|
|
11
|
+
}, []);
|
|
12
|
+
const urlSearchParams = new URLSearchParams({
|
|
13
|
+
...filters,
|
|
14
|
+
});
|
|
15
|
+
if (sorts.length > 0) {
|
|
16
|
+
urlSearchParams.append("sort", sorts.join(","));
|
|
17
|
+
}
|
|
18
|
+
const searchParamsString = urlSearchParams.toString();
|
|
19
|
+
return searchParamsString ? "?" + urlSearchParams.toString() : "";
|
|
20
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es5.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2016.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2017.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2018.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2019.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2021.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2023.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.esnext.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.core.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2017.date.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2017.object.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2017.string.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2019.array.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2019.object.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2019.string.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.date.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.string.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2020.number.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2021.string.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.array.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.error.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.object.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.string.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2023.array.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.esnext.collection.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.esnext.promise.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.esnext.object.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.decorators.d.ts","../../personal-wallet/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/@types/react/global.d.ts","../node_modules/csstype/index.d.ts","../node_modules/@types/prop-types/index.d.ts","../node_modules/@types/react/index.d.ts","../node_modules/@types/react/jsx-runtime.d.ts","../src/actions/sort.ts","../src/actions/filter.ts","../src/actions/include.ts","../src/actions/index.ts","../src/usequerybuilder.ts","../src/index.ts","../src/utils/state.ts","../src/utils/alias.ts","../src/utils/build.ts","../src/utils/index.ts","./index.js","./usequerybuilder.js","./actions/filter.js","./actions/include.js","./actions/index.js","./actions/sort.js","./dist/index.js","./dist/usequerybuilder.js","./dist/actions/filter.js","./dist/actions/include.js","./dist/actions/index.js","./dist/actions/sort.js","./dist/utils/alias.js","./dist/utils/build.js","./dist/utils/index.js","./dist/utils/state.js","./utils/alias.js","./utils/build.js","./utils/index.js","./utils/state.js","../node_modules/@types/eslint/helpers.d.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/eslint/index.d.ts","../node_modules/@types/json5/index.d.ts","../node_modules/@types/semver/classes/semver.d.ts","../node_modules/@types/semver/functions/parse.d.ts","../node_modules/@types/semver/functions/valid.d.ts","../node_modules/@types/semver/functions/clean.d.ts","../node_modules/@types/semver/functions/inc.d.ts","../node_modules/@types/semver/functions/diff.d.ts","../node_modules/@types/semver/functions/major.d.ts","../node_modules/@types/semver/functions/minor.d.ts","../node_modules/@types/semver/functions/patch.d.ts","../node_modules/@types/semver/functions/prerelease.d.ts","../node_modules/@types/semver/functions/compare.d.ts","../node_modules/@types/semver/functions/rcompare.d.ts","../node_modules/@types/semver/functions/compare-loose.d.ts","../node_modules/@types/semver/functions/compare-build.d.ts","../node_modules/@types/semver/functions/sort.d.ts","../node_modules/@types/semver/functions/rsort.d.ts","../node_modules/@types/semver/functions/gt.d.ts","../node_modules/@types/semver/functions/lt.d.ts","../node_modules/@types/semver/functions/eq.d.ts","../node_modules/@types/semver/functions/neq.d.ts","../node_modules/@types/semver/functions/gte.d.ts","../node_modules/@types/semver/functions/lte.d.ts","../node_modules/@types/semver/functions/cmp.d.ts","../node_modules/@types/semver/functions/coerce.d.ts","../node_modules/@types/semver/classes/comparator.d.ts","../node_modules/@types/semver/classes/range.d.ts","../node_modules/@types/semver/functions/satisfies.d.ts","../node_modules/@types/semver/ranges/max-satisfying.d.ts","../node_modules/@types/semver/ranges/min-satisfying.d.ts","../node_modules/@types/semver/ranges/to-comparators.d.ts","../node_modules/@types/semver/ranges/min-version.d.ts","../node_modules/@types/semver/ranges/valid.d.ts","../node_modules/@types/semver/ranges/outside.d.ts","../node_modules/@types/semver/ranges/gtr.d.ts","../node_modules/@types/semver/ranges/ltr.d.ts","../node_modules/@types/semver/ranges/intersects.d.ts","../node_modules/@types/semver/ranges/simplify.d.ts","../node_modules/@types/semver/ranges/subset.d.ts","../node_modules/@types/semver/internals/identifiers.d.ts","../node_modules/@types/semver/index.d.ts"],"fileInfos":[{"version":"824cb491a40f7e8fdeb56f1df5edf91b23f3e3ee6b4cde84d4a99be32338faee","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","1c0cdb8dc619bc549c3e5020643e7cf7ae7940058e8c7e5aefa5871b6d86f44b","886e50ef125efb7878f744e86908884c0133e7a6d9d80013f421b0cd8fb2af94",{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"b20fe0eca9a4e405f1a5ae24a2b3290b37cf7f21eba6cbe4fc3fab979237d4f3","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"8073890e29d2f46fdbc19b8d6d2eb9ea58db9a2052f8640af20baff9afbc8640","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"08a58483392df5fcc1db57d782e87734f77ae9eab42516028acbfe46f29a3ef7","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true},{"version":"13f6e6380c78e15e140243dc4be2fa546c287c6d61f4729bc2dd7cf449605471","affectsGlobalScope":true},{"version":"15b98a533864d324e5f57cd3cfc0579b231df58c1c0f6063ea0fcb13c3c74ff9","affectsGlobalScope":true},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"36a2e4c9a67439aca5f91bb304611d5ae6e20d420503e96c230cf8fcdc948d94","affectsGlobalScope":true},"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","247a952efd811d780e5630f8cfd76f495196f5fa74f6f0fee39ac8ba4a3c9800",{"version":"8ca4709dbd22a34bcc1ebf93e1877645bdb02ebd3f3d9a211a299a8db2ee4ba1","affectsGlobalScope":true},"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","4001cb03b235a742281b2750827bfb7086ec0472c8681a8b1b4747c45f5b1523","c8ce20c95f4c581e26b929f44802e2fb43493d0fec9f9bc4ce961a66086b35f0","185cef62784cabc03bec476bcf55237197aabac68b330b6e1ca56800d6dc8abb","0e37ae5ef3edcd6115a587951d25014cc5bc3f953fc929b134d92c8cef302098","42c330263fcf91f809202fef1374eea97da206086b1f342d0d2a87bbd77848c5","9b94524fe81d65aa037b251de4e8b9d79ab232192b5d5423be98c2ab33a00dd3","81ecc1ad9d04099aa08500207e223a5a88dc81417557a282670106299e95689e","f3e0da52b93dd65a91c9e3d0cc99bc8b95a0e0af06eb2f250f990b6665e4bd16","a26b4e8139cad65cd09a54aed2158063f54edccdf655d4737e129c98fa01977c","b8cebadea3a810df4a3088661f8b3b167324f6adc4d4d322a147e0bbd776b319","9b94524fe81d65aa037b251de4e8b9d79ab232192b5d5423be98c2ab33a00dd3",{"version":"196b68f796f36652092a6b5dd33d4718fc2e84c34b6d991fcaa453c04d23177b","signature":"82e3a6c9d3e419fe1615394ce1c957b9eebe79372dac0743f6224827fc8515b9"},{"version":"abfc9c6d2fa90fa34aa04514809a22467d33be8a16cd67a14d80c9f4d2803f4c","signature":"87509250ff1e1172fc1779dda405a31c0aba43fd1b47066d3b94604a2a167712"},{"version":"66e718fa1b782acb0e10b785460cadaba0352d2517a48bef345f94f5d34fb07b","signature":"bef9a910eb35d25f156e93a1b55b42b968a4013e32baf2eb882b811aff8c66e5"},"dd0eac172db9df20f09754786bfab7312e8486e8c71d40a2b2da47dcc07024f6",{"version":"3e8273c3a35e4638df54c920afd327f4fe6e1045d4163fd18d6e33ca4080c7b1","signature":"110dde780d788b1e27fe4be26b1917ea72bb182f71bd5a70982d56bc2aa5cbe0"},"9b94524fe81d65aa037b251de4e8b9d79ab232192b5d5423be98c2ab33a00dd3",{"version":"916659b8304613a9c4f10c820413b3c5688944ebe4b84bd6f60ae8d5eebd6272","signature":"82e3a6c9d3e419fe1615394ce1c957b9eebe79372dac0743f6224827fc8515b9"},{"version":"a886a29e0a03dd43fa185b8d6180d5b0fe62cdfedd92fe5609675b4061738c41","signature":"87509250ff1e1172fc1779dda405a31c0aba43fd1b47066d3b94604a2a167712"},{"version":"31ddbd1c39049d3e639c6bfda003a56c746a9d2d79ebf40c94eb7a9bb7dc3b52","signature":"bef9a910eb35d25f156e93a1b55b42b968a4013e32baf2eb882b811aff8c66e5"},"dd0eac172db9df20f09754786bfab7312e8486e8c71d40a2b2da47dcc07024f6",{"version":"4aa16197ad9abb7e54bd182825c415130559b830464381dce23f21b0ff95db10","signature":"110dde780d788b1e27fe4be26b1917ea72bb182f71bd5a70982d56bc2aa5cbe0"},{"version":"edae8f0c93020c613c62d0eb7b8befcf4230aa2b155f15d96216c3b2b8648ff5","signature":"fb6b322fdcea8fb0d10ff3d992a9ac954a4638cdc817b6c121287f5019fa9f6b"},{"version":"fdafd1d40dadcf13826a8088f7ef9089df883cd3e9d98ef9f10accaace831590","signature":"76146d8cb3adcd7d1b6343257426bceb99037e29efac1ac1ec45c309db43eabe"},"b8cebadea3a810df4a3088661f8b3b167324f6adc4d4d322a147e0bbd776b319","8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",{"version":"edae8f0c93020c613c62d0eb7b8befcf4230aa2b155f15d96216c3b2b8648ff5","signature":"fb6b322fdcea8fb0d10ff3d992a9ac954a4638cdc817b6c121287f5019fa9f6b"},{"version":"00e86344bcd239314bcb29b3d255347fab8a7bdd0210cbfa19ee3061ce799524","signature":"76146d8cb3adcd7d1b6343257426bceb99037e29efac1ac1ec45c309db43eabe"},"b8cebadea3a810df4a3088661f8b3b167324f6adc4d4d322a147e0bbd776b319","8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4"],"root":[[73,102]],"options":{"allowJs":true,"esModuleInterop":true,"jsx":4,"module":99,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","skipLibCheck":true,"strict":true},"fileIdsList":[[72,82],[72],[72,73,74,75],[72,78],[72,76,77,82],[71,72,78],[72,79,80,81],[103,104,105],[68,69,70],[71],[108,147],[108,132,147],[147],[108],[108,133,147],[108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146],[133,147],[72,79]],"referencedMap":[[85,1],[86,2],[87,3],[88,4],[91,1],[92,2],[93,3],[94,4],[89,5],[90,6],[95,2],[96,2],[97,7],[98,2],[83,5],[84,6],[99,2],[100,2],[101,7],[102,2],[106,8],[71,9],[72,10],[132,11],[133,12],[108,13],[111,13],[130,11],[131,11],[121,11],[120,14],[118,11],[113,11],[126,11],[124,11],[128,11],[112,11],[125,11],[129,11],[114,11],[115,11],[127,11],[109,11],[116,11],[117,11],[119,11],[123,11],[134,15],[122,11],[110,11],[147,16],[141,15],[143,17],[142,15],[135,15],[136,15],[138,15],[140,15],[144,17],[145,17],[137,17],[139,17],[74,1],[75,4],[76,3],[73,4],[78,5],[77,6],[80,4],[81,18],[82,7],[79,4]],"exportedModulesMap":[[106,8],[71,9],[72,10],[132,11],[133,12],[108,13],[111,13],[130,11],[131,11],[121,11],[120,14],[118,11],[113,11],[126,11],[124,11],[128,11],[112,11],[125,11],[129,11],[114,11],[115,11],[127,11],[109,11],[116,11],[117,11],[119,11],[123,11],[134,15],[122,11],[110,11],[147,16],[141,15],[143,17],[142,15],[135,15],[136,15],[138,15],[140,15],[144,17],[145,17],[137,17],[139,17],[74,1],[75,4],[76,3],[73,4],[78,5],[77,6],[80,4],[81,18],[82,7],[79,4]],"semanticDiagnosticsPerFile":[66,67,13,12,2,14,15,16,17,18,19,20,21,3,22,4,23,27,24,25,26,28,29,30,5,31,32,33,34,6,38,35,36,37,39,7,40,45,46,41,42,43,44,8,50,47,48,49,51,9,52,53,54,57,55,56,58,59,10,1,60,11,64,62,61,65,63,85,86,87,88,83,84,99,100,101,102,103,106,104,105,107,70,68,71,72,132,133,108,111,130,131,121,120,118,113,126,124,128,112,125,129,114,115,127,109,116,117,119,123,134,122,110,147,146,141,143,142,135,136,138,140,144,145,137,139,69,74,75,76,73,78,77,80,[81,[{"file":"../src/utils/build.ts","start":525,"length":15,"messageText":"Cannot find name 'URLSearchParams'. Did you mean 'urlSearchParams'?","category":1,"code":2552,"relatedInformation":[{"file":"../src/utils/build.ts","start":503,"length":15,"messageText":"'urlSearchParams' is declared here.","category":3,"code":2728}]}]],82,79]},"version":"5.4.5"}
|
|
1
|
+
{"program":{"fileNames":["../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es5.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.dom.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/.pnpm/typescript@5.5.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/global.d.ts","../node_modules/.pnpm/csstype@3.1.3/node_modules/csstype/index.d.ts","../node_modules/.pnpm/@types+prop-types@15.7.12/node_modules/@types/prop-types/index.d.ts","../node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts","../node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/jsx-runtime.d.ts","../src/types/index.d.ts","../src/utils/alias.ts","../src/utils/build.ts","../src/utils/index.ts","../src/actions/sort.ts","../src/actions/filter.ts","../src/actions/include.ts","../src/actions/index.ts","../src/usequerybuilder.ts","../src/index.ts","../index.js"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"36a2e4c9a67439aca5f91bb304611d5ae6e20d420503e96c230cf8fcdc948d94","affectsGlobalScope":true},"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","247a952efd811d780e5630f8cfd76f495196f5fa74f6f0fee39ac8ba4a3c9800",{"version":"8ca4709dbd22a34bcc1ebf93e1877645bdb02ebd3f3d9a211a299a8db2ee4ba1","affectsGlobalScope":true},"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","7df2bbc3af842a0e585285afc1e370a5c6d807f8334a2aee977a363a0f7c481e",{"version":"3e5bbd3b9984c1a38073687125db23aad8023c3f2f84cfdad530027fc5e7beaa","signature":"f5f8599fb858d05f82925b40fefa48a5ac8626dcbcdd81ebe878cec336a8fd39"},{"version":"4107dfe18887c6ad25be8b595397f952c2476597796444b7487b6a752d17bd28","signature":"a84e4f65f7a25a0c7771a20fb5f1383716044776c2c660ffb29aeb311dd32862"},"d0091298ea49905c39dbe1aec1f8fa4e042bdc7d2fd479dce3b80bb512f81845",{"version":"77739f4a6ee562d3e950ebef542b5053d4ede90f9ff12b518b126bc08ec69996","signature":"a5b6f24fc100e3cea994d3871ad001e3984ea4e27f92a5fa3a3ede61d51b9afb"},{"version":"d6538747bb4a2aa0790ba0f73ab928bb519899c983f8d961d1674cb8595a2cb6","signature":"01f1a5df14bab6b527acd5d3113bd8b173760e7c7913aa7c794c5526c624609f"},{"version":"ffc374725cfb39812fb1059a8dfeba5afc6e8142b1275ac68a613cdc4951d63f","signature":"3ce1ba5853de8f3554aff462cc163e8667b2f3c312375b0d9789c87efde04c50"},"4caa6f0205a5c341776d7f97ecc587fb435bcdf583929612dd40fba01a3e33d2",{"version":"ab09ac72f9328e3975060a11c2ad24ef3bd3487ae3df433741525cb832cd35cb","signature":"5a849ad1df4a1b56d00b22e43d29b770fe9a31b8817f6204d464af8f92072d68"},"5fb32e3692cd6391161703f4802f5bfe28ca13fb7f093af58fb0092ae66ffe08",{"version":"e9a2505933b5e08b66d5d15d2bafd974dc2df0e9fc9a551600b817197c068505","signature":"6453348bfc587bf67d5854ca3077db6dd6d21d59cb2e4d49e68ffba96b86e1ff"}],"root":[[65,75]],"options":{"allowJs":true,"declaration":true,"esModuleInterop":true,"jsx":4,"module":7,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":9},"fileIdsList":[[64,74],[60,61,62],[63],[64,65,68],[64,65],[64,69,70,71],[64,65,74],[64,68,72,73],[63,64,65,74],[64,66,67]],"referencedMap":[[75,1],[63,2],[64,3],[70,4],[71,5],[72,6],[69,7],[74,8],[73,9],[66,5],[67,5],[68,10]]},"version":"5.5.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgarciagarcia/react-query-builder",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"
|
|
11
|
+
"clean": "rm -rf dist",
|
|
12
|
+
"build": "npm run clean && tsc",
|
|
12
13
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
package/dist/actions/filter.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
import { usingAlias, } from "@/utils";
|
|
22
|
-
export var filterAction = function (attribute, value, state) {
|
|
23
|
-
var _a;
|
|
24
|
-
var alias = usingAlias(state, attribute);
|
|
25
|
-
var prevFilter;
|
|
26
|
-
var allFilters = state.filters.reduce(function (filters, filter) {
|
|
27
|
-
if (filter.attribute === alias) {
|
|
28
|
-
prevFilter = filter;
|
|
29
|
-
return filters;
|
|
30
|
-
}
|
|
31
|
-
return __spreadArray(__spreadArray([], filters, true), [filter], false);
|
|
32
|
-
}, []);
|
|
33
|
-
var val = Array.isArray(value) ? value : [value];
|
|
34
|
-
var newState = __assign(__assign({}, state), { filters: __spreadArray(__spreadArray([], allFilters, true), [
|
|
35
|
-
{
|
|
36
|
-
attribute: attribute,
|
|
37
|
-
value: __spreadArray(__spreadArray([], ((_a = prevFilter === null || prevFilter === void 0 ? void 0 : prevFilter.value) !== null && _a !== void 0 ? _a : []), true), val, true),
|
|
38
|
-
},
|
|
39
|
-
], false) });
|
|
40
|
-
return newState;
|
|
41
|
-
};
|
|
42
|
-
export var clearFilterAction = function (state) {
|
|
43
|
-
return __assign(__assign({}, state), { filters: [] });
|
|
44
|
-
};
|
package/dist/actions/include.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
export var includeAction = function (includes, state) {
|
|
22
|
-
return __assign(__assign({}, state), { includes: __spreadArray(__spreadArray([], state.includes, true), [includes], false) });
|
|
23
|
-
};
|
package/dist/actions/index.js
DELETED
package/dist/actions/sort.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
import { usingAlias } from "@/index";
|
|
22
|
-
export var sortAction = function (sorts, state) {
|
|
23
|
-
var attribute = sorts[0], direction = sorts[1];
|
|
24
|
-
var attributeAliased = usingAlias(state, attribute);
|
|
25
|
-
return __assign(__assign({}, state), { sorts: __spreadArray(__spreadArray([], state.sorts, true), [[attributeAliased, direction]], false) });
|
|
26
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2)
|
|
15
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
16
|
-
if (ar || !(i in from)) {
|
|
17
|
-
if (!ar)
|
|
18
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
19
|
-
ar[i] = from[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
23
|
-
};
|
|
24
|
-
import { usingAlias, } from "@/utils";
|
|
25
|
-
export var filterAction = function (attribute, value, state) {
|
|
26
|
-
var _a;
|
|
27
|
-
var alias = usingAlias(state, attribute);
|
|
28
|
-
var prevFilter;
|
|
29
|
-
var allFilters = state.filters.reduce(function (filters, filter) {
|
|
30
|
-
if (filter.attribute === alias) {
|
|
31
|
-
prevFilter = filter;
|
|
32
|
-
return filters;
|
|
33
|
-
}
|
|
34
|
-
return __spreadArray(__spreadArray([], filters, true), [filter], false);
|
|
35
|
-
}, []);
|
|
36
|
-
var val = Array.isArray(value) ? value : [value];
|
|
37
|
-
var newState = __assign(__assign({}, state), { filters: __spreadArray(__spreadArray([], allFilters, true), [
|
|
38
|
-
{
|
|
39
|
-
attribute: attribute,
|
|
40
|
-
value: __spreadArray(__spreadArray([], ((_a = prevFilter === null || prevFilter === void 0 ? void 0 : prevFilter.value) !== null && _a !== void 0 ? _a : []), true), val, true),
|
|
41
|
-
},
|
|
42
|
-
], false) });
|
|
43
|
-
return newState;
|
|
44
|
-
};
|
|
45
|
-
export var clearFilterAction = function (state) {
|
|
46
|
-
return __assign(__assign({}, state), { filters: [] });
|
|
47
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2)
|
|
15
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
16
|
-
if (ar || !(i in from)) {
|
|
17
|
-
if (!ar)
|
|
18
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
19
|
-
ar[i] = from[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
23
|
-
};
|
|
24
|
-
export var includeAction = function (includes, state) {
|
|
25
|
-
return __assign(__assign({}, state), { includes: __spreadArray(__spreadArray([], state.includes, true), [includes], false) });
|
|
26
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2)
|
|
15
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
16
|
-
if (ar || !(i in from)) {
|
|
17
|
-
if (!ar)
|
|
18
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
19
|
-
ar[i] = from[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
23
|
-
};
|
|
24
|
-
import { usingAlias } from "@/index";
|
|
25
|
-
export var sortAction = function (sorts, state) {
|
|
26
|
-
var attribute = sorts[0], direction = sorts[1];
|
|
27
|
-
var attributeAliased = usingAlias(state, attribute);
|
|
28
|
-
return __assign(__assign({}, state), { sorts: __spreadArray(__spreadArray([], state.sorts, true), [[attributeAliased, direction]], false) });
|
|
29
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2)
|
|
15
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
16
|
-
if (ar || !(i in from)) {
|
|
17
|
-
if (!ar)
|
|
18
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
19
|
-
ar[i] = from[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
23
|
-
};
|
|
24
|
-
import { usingAlias, } from "@/utils";
|
|
25
|
-
export var filterAction = function (attribute, value, state) {
|
|
26
|
-
var _a;
|
|
27
|
-
var alias = usingAlias(state, attribute);
|
|
28
|
-
var prevFilter;
|
|
29
|
-
var allFilters = state.filters.reduce(function (filters, filter) {
|
|
30
|
-
if (filter.attribute === alias) {
|
|
31
|
-
prevFilter = filter;
|
|
32
|
-
return filters;
|
|
33
|
-
}
|
|
34
|
-
return __spreadArray(__spreadArray([], filters, true), [filter], false);
|
|
35
|
-
}, []);
|
|
36
|
-
var val = Array.isArray(value) ? value : [value];
|
|
37
|
-
var newState = __assign(__assign({}, state), { filters: __spreadArray(__spreadArray([], allFilters, true), [
|
|
38
|
-
{
|
|
39
|
-
attribute: attribute,
|
|
40
|
-
value: __spreadArray(__spreadArray([], ((_a = prevFilter === null || prevFilter === void 0 ? void 0 : prevFilter.value) !== null && _a !== void 0 ? _a : []), true), val, true),
|
|
41
|
-
},
|
|
42
|
-
], false) });
|
|
43
|
-
return newState;
|
|
44
|
-
};
|
|
45
|
-
export var clearFilterAction = function (state) {
|
|
46
|
-
return __assign(__assign({}, state), { filters: [] });
|
|
47
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2)
|
|
15
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
16
|
-
if (ar || !(i in from)) {
|
|
17
|
-
if (!ar)
|
|
18
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
19
|
-
ar[i] = from[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
23
|
-
};
|
|
24
|
-
export var includeAction = function (includes, state) {
|
|
25
|
-
return __assign(__assign({}, state), { includes: __spreadArray(__spreadArray([], state.includes, true), [includes], false) });
|
|
26
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2)
|
|
15
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
16
|
-
if (ar || !(i in from)) {
|
|
17
|
-
if (!ar)
|
|
18
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
19
|
-
ar[i] = from[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
23
|
-
};
|
|
24
|
-
import { usingAlias } from "@/index";
|
|
25
|
-
export var sortAction = function (sorts, state) {
|
|
26
|
-
var attribute = sorts[0], direction = sorts[1];
|
|
27
|
-
var attributeAliased = usingAlias(state, attribute);
|
|
28
|
-
return __assign(__assign({}, state), { sorts: __spreadArray(__spreadArray([], state.sorts, true), [[attributeAliased, direction]], false) });
|
|
29
|
-
};
|
package/dist/dist/dist/index.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
import { useReducer, useState } from "react";
|
|
14
|
-
import { build, clearFilterAction, filterAction, includeAction, sortAction, } from "@/index";
|
|
15
|
-
var reducer = function (state, action) {
|
|
16
|
-
switch (action === null || action === void 0 ? void 0 : action.type) {
|
|
17
|
-
case "filter": {
|
|
18
|
-
var filter = action.payload;
|
|
19
|
-
return filterAction(filter.attribute, filter.value, state);
|
|
20
|
-
}
|
|
21
|
-
case "clear_filter": {
|
|
22
|
-
return clearFilterAction(state);
|
|
23
|
-
}
|
|
24
|
-
case "include": {
|
|
25
|
-
var includes = action.payload;
|
|
26
|
-
return includeAction(includes, state);
|
|
27
|
-
}
|
|
28
|
-
case "sort": {
|
|
29
|
-
var sorts = action.payload;
|
|
30
|
-
return sortAction(sorts, state);
|
|
31
|
-
}
|
|
32
|
-
default: {
|
|
33
|
-
return __assign({}, state);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var initialState = function () {
|
|
38
|
-
return ({
|
|
39
|
-
aliases: {},
|
|
40
|
-
filters: [],
|
|
41
|
-
includes: [],
|
|
42
|
-
sorts: [],
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
export var useQueryBuilder = function (config) {
|
|
46
|
-
if (config === void 0) {
|
|
47
|
-
config = {};
|
|
48
|
-
}
|
|
49
|
-
var init = useState(function () { return initialState(); })[0];
|
|
50
|
-
var _a = useReducer(reducer, init, function (init) {
|
|
51
|
-
var _a;
|
|
52
|
-
return (__assign(__assign({}, init), { aliases: (_a = config === null || config === void 0 ? void 0 : config.aliases) !== null && _a !== void 0 ? _a : {} }));
|
|
53
|
-
}), state = _a[0], dispatch = _a[1];
|
|
54
|
-
var builder = {
|
|
55
|
-
filters: function (attribute, value) {
|
|
56
|
-
dispatch({
|
|
57
|
-
type: "filter",
|
|
58
|
-
payload: { attribute: attribute, value: value },
|
|
59
|
-
});
|
|
60
|
-
return builder;
|
|
61
|
-
},
|
|
62
|
-
build: function () { return build(state); },
|
|
63
|
-
clearFilters: function () {
|
|
64
|
-
dispatch({
|
|
65
|
-
type: "clear_filter",
|
|
66
|
-
payload: undefined,
|
|
67
|
-
});
|
|
68
|
-
return builder;
|
|
69
|
-
},
|
|
70
|
-
includes: function (includes) {
|
|
71
|
-
dispatch({
|
|
72
|
-
type: "include",
|
|
73
|
-
payload: includes,
|
|
74
|
-
});
|
|
75
|
-
return builder;
|
|
76
|
-
},
|
|
77
|
-
sorts: function (attribute, direction) {
|
|
78
|
-
dispatch({
|
|
79
|
-
type: "sort",
|
|
80
|
-
payload: [attribute, direction !== null && direction !== void 0 ? direction : "asc"],
|
|
81
|
-
});
|
|
82
|
-
return builder;
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
return builder;
|
|
86
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
export var build = function (state) {
|
|
14
|
-
var filters = state.filters.reduce(function (acc, filter) {
|
|
15
|
-
var _a;
|
|
16
|
-
return (__assign(__assign({}, acc), (_a = {}, _a["filters[".concat(filter.attribute, "]")] = filter.value.join(","), _a)));
|
|
17
|
-
}, {});
|
|
18
|
-
var sorts = state.sorts.reduce(function (acc, sort) {
|
|
19
|
-
var attribute = sort[0], dir = sort[1];
|
|
20
|
-
var direction = dir === "desc" ? "-" : "";
|
|
21
|
-
acc.push("".concat(direction).concat(attribute));
|
|
22
|
-
return acc;
|
|
23
|
-
}, []);
|
|
24
|
-
var urlSearchParams = new URLSearchParams(__assign({}, filters));
|
|
25
|
-
if (sorts.length > 0) {
|
|
26
|
-
urlSearchParams.append("sort", sorts.join(","));
|
|
27
|
-
}
|
|
28
|
-
var searchParamsString = urlSearchParams.toString();
|
|
29
|
-
return searchParamsString ? "?" + urlSearchParams.toString() : "";
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/dist/index.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
import { useReducer, useState } from "react";
|
|
14
|
-
import { build, clearFilterAction, filterAction, includeAction, sortAction, } from "@/index";
|
|
15
|
-
var reducer = function (state, action) {
|
|
16
|
-
switch (action === null || action === void 0 ? void 0 : action.type) {
|
|
17
|
-
case "filter": {
|
|
18
|
-
var filter = action.payload;
|
|
19
|
-
return filterAction(filter.attribute, filter.value, state);
|
|
20
|
-
}
|
|
21
|
-
case "clear_filter": {
|
|
22
|
-
return clearFilterAction(state);
|
|
23
|
-
}
|
|
24
|
-
case "include": {
|
|
25
|
-
var includes = action.payload;
|
|
26
|
-
return includeAction(includes, state);
|
|
27
|
-
}
|
|
28
|
-
case "sort": {
|
|
29
|
-
var sorts = action.payload;
|
|
30
|
-
return sortAction(sorts, state);
|
|
31
|
-
}
|
|
32
|
-
default: {
|
|
33
|
-
return __assign({}, state);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var initialState = function () {
|
|
38
|
-
return ({
|
|
39
|
-
aliases: {},
|
|
40
|
-
filters: [],
|
|
41
|
-
includes: [],
|
|
42
|
-
sorts: [],
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
export var useQueryBuilder = function (config) {
|
|
46
|
-
if (config === void 0) {
|
|
47
|
-
config = {};
|
|
48
|
-
}
|
|
49
|
-
var init = useState(function () { return initialState(); })[0];
|
|
50
|
-
var _a = useReducer(reducer, init, function (init) {
|
|
51
|
-
var _a;
|
|
52
|
-
return (__assign(__assign({}, init), { aliases: (_a = config === null || config === void 0 ? void 0 : config.aliases) !== null && _a !== void 0 ? _a : {} }));
|
|
53
|
-
}), state = _a[0], dispatch = _a[1];
|
|
54
|
-
var builder = {
|
|
55
|
-
filters: function (attribute, value) {
|
|
56
|
-
dispatch({
|
|
57
|
-
type: "filter",
|
|
58
|
-
payload: { attribute: attribute, value: value },
|
|
59
|
-
});
|
|
60
|
-
return builder;
|
|
61
|
-
},
|
|
62
|
-
build: function () { return build(state); },
|
|
63
|
-
clearFilters: function () {
|
|
64
|
-
dispatch({
|
|
65
|
-
type: "clear_filter",
|
|
66
|
-
payload: undefined,
|
|
67
|
-
});
|
|
68
|
-
return builder;
|
|
69
|
-
},
|
|
70
|
-
includes: function (includes) {
|
|
71
|
-
dispatch({
|
|
72
|
-
type: "include",
|
|
73
|
-
payload: includes,
|
|
74
|
-
});
|
|
75
|
-
return builder;
|
|
76
|
-
},
|
|
77
|
-
sorts: function (attribute, direction) {
|
|
78
|
-
dispatch({
|
|
79
|
-
type: "sort",
|
|
80
|
-
payload: [attribute, direction !== null && direction !== void 0 ? direction : "asc"],
|
|
81
|
-
});
|
|
82
|
-
return builder;
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
return builder;
|
|
86
|
-
};
|
package/dist/dist/utils/alias.js
DELETED
package/dist/dist/utils/build.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s)
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
export var build = function (state) {
|
|
14
|
-
var filters = state.filters.reduce(function (acc, filter) {
|
|
15
|
-
var _a;
|
|
16
|
-
return (__assign(__assign({}, acc), (_a = {}, _a["filters[".concat(filter.attribute, "]")] = filter.value.join(","), _a)));
|
|
17
|
-
}, {});
|
|
18
|
-
var sorts = state.sorts.reduce(function (acc, sort) {
|
|
19
|
-
var attribute = sort[0], dir = sort[1];
|
|
20
|
-
var direction = dir === "desc" ? "-" : "";
|
|
21
|
-
acc.push("".concat(direction).concat(attribute));
|
|
22
|
-
return acc;
|
|
23
|
-
}, []);
|
|
24
|
-
var urlSearchParams = new URLSearchParams(__assign({}, filters));
|
|
25
|
-
if (sorts.length > 0) {
|
|
26
|
-
urlSearchParams.append("sort", sorts.join(","));
|
|
27
|
-
}
|
|
28
|
-
var searchParamsString = urlSearchParams.toString();
|
|
29
|
-
return searchParamsString ? "?" + urlSearchParams.toString() : "";
|
|
30
|
-
};
|
package/dist/dist/utils/index.js
DELETED
package/dist/dist/utils/state.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/useQueryBuilder.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { useReducer, useState } from "react";
|
|
13
|
-
import { build, clearFilterAction, filterAction, includeAction, sortAction, } from "@/index";
|
|
14
|
-
var reducer = function (state, action) {
|
|
15
|
-
switch (action === null || action === void 0 ? void 0 : action.type) {
|
|
16
|
-
case "filter": {
|
|
17
|
-
var filter = action.payload;
|
|
18
|
-
return filterAction(filter.attribute, filter.value, state);
|
|
19
|
-
}
|
|
20
|
-
case "clear_filter": {
|
|
21
|
-
return clearFilterAction(state);
|
|
22
|
-
}
|
|
23
|
-
case "include": {
|
|
24
|
-
var includes = action.payload;
|
|
25
|
-
return includeAction(includes, state);
|
|
26
|
-
}
|
|
27
|
-
case "sort": {
|
|
28
|
-
var sorts = action.payload;
|
|
29
|
-
return sortAction(sorts, state);
|
|
30
|
-
}
|
|
31
|
-
default: {
|
|
32
|
-
return __assign({}, state);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var initialState = function () { return ({
|
|
37
|
-
aliases: {},
|
|
38
|
-
filters: [],
|
|
39
|
-
includes: [],
|
|
40
|
-
sorts: [],
|
|
41
|
-
}); };
|
|
42
|
-
export var useQueryBuilder = function (config) {
|
|
43
|
-
if (config === void 0) { config = {}; }
|
|
44
|
-
var init = useState(function () { return initialState(); })[0];
|
|
45
|
-
var _a = useReducer(reducer, init, function (init) {
|
|
46
|
-
var _a;
|
|
47
|
-
return (__assign(__assign({}, init), { aliases: (_a = config === null || config === void 0 ? void 0 : config.aliases) !== null && _a !== void 0 ? _a : {} }));
|
|
48
|
-
}), state = _a[0], dispatch = _a[1];
|
|
49
|
-
var builder = {
|
|
50
|
-
filters: function (attribute, value) {
|
|
51
|
-
dispatch({
|
|
52
|
-
type: "filter",
|
|
53
|
-
payload: { attribute: attribute, value: value },
|
|
54
|
-
});
|
|
55
|
-
return builder;
|
|
56
|
-
},
|
|
57
|
-
build: function () { return build(state); },
|
|
58
|
-
clearFilters: function () {
|
|
59
|
-
dispatch({
|
|
60
|
-
type: "clear_filter",
|
|
61
|
-
payload: undefined,
|
|
62
|
-
});
|
|
63
|
-
return builder;
|
|
64
|
-
},
|
|
65
|
-
includes: function (includes) {
|
|
66
|
-
dispatch({
|
|
67
|
-
type: "include",
|
|
68
|
-
payload: includes,
|
|
69
|
-
});
|
|
70
|
-
return builder;
|
|
71
|
-
},
|
|
72
|
-
sorts: function (attribute, direction) {
|
|
73
|
-
dispatch({
|
|
74
|
-
type: "sort",
|
|
75
|
-
payload: [attribute, direction !== null && direction !== void 0 ? direction : "asc"],
|
|
76
|
-
});
|
|
77
|
-
return builder;
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
return builder;
|
|
81
|
-
};
|
package/dist/utils/alias.js
DELETED
package/dist/utils/build.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
export var build = function (state) {
|
|
13
|
-
var filters = state.filters.reduce(function (acc, filter) {
|
|
14
|
-
var _a;
|
|
15
|
-
return (__assign(__assign({}, acc), (_a = {}, _a["filters[".concat(filter.attribute, "]")] = filter.value.join(","), _a)));
|
|
16
|
-
}, {});
|
|
17
|
-
var sorts = state.sorts.reduce(function (acc, sort) {
|
|
18
|
-
var attribute = sort[0], dir = sort[1];
|
|
19
|
-
var direction = dir === "desc" ? "-" : "";
|
|
20
|
-
acc.push("".concat(direction).concat(attribute));
|
|
21
|
-
return acc;
|
|
22
|
-
}, []);
|
|
23
|
-
var urlSearchParams = new URLSearchParams(__assign({}, filters));
|
|
24
|
-
if (sorts.length > 0) {
|
|
25
|
-
urlSearchParams.append("sort", sorts.join(","));
|
|
26
|
-
}
|
|
27
|
-
var searchParamsString = urlSearchParams.toString();
|
|
28
|
-
return searchParamsString ? "?" + urlSearchParams.toString() : "";
|
|
29
|
-
};
|
package/dist/utils/index.js
DELETED
package/dist/utils/state.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|