@webiny/app 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9
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/App.d.ts +25 -0
- package/App.js +82 -0
- package/App.js.map +1 -0
- package/AppContainer.d.ts +23 -0
- package/AppContainer.js +6 -0
- package/AppContainer.js.map +1 -0
- package/README.md +7 -15
- package/apollo-client/InMemoryCache.d.ts +3 -2
- package/apollo-client/InMemoryCache.js +16 -77
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
- package/apollo-client/IntrospectionFragmentMatcher.js +33 -0
- package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
- package/components/Image.d.ts +2 -3
- package/components/Image.js +15 -41
- package/components/Image.js.map +1 -1
- package/components/index.d.ts +1 -2
- package/components/index.js +1 -21
- package/config/RouterConfig/Route.d.ts +29 -0
- package/config/RouterConfig/Route.js +28 -0
- package/config/RouterConfig/Route.js.map +1 -0
- package/config/RouterConfig.d.ts +31 -0
- package/config/RouterConfig.js +19 -0
- package/config/RouterConfig.js.map +1 -0
- package/config.d.ts +1 -1
- package/config.js +20 -29
- package/config.js.map +1 -1
- package/contexts/Ui/index.d.ts +4 -8
- package/contexts/Ui/index.js +27 -89
- package/contexts/Ui/index.js.map +1 -1
- package/core/Plugin.d.ts +8 -0
- package/core/Plugin.js +12 -0
- package/core/Plugin.js.map +1 -0
- package/core/Plugins.d.ts +15 -0
- package/core/Plugins.js +21 -0
- package/core/Plugins.js.map +1 -0
- package/core/Provider.d.ts +8 -0
- package/core/Provider.js +10 -0
- package/core/Provider.js.map +1 -0
- package/core/createProvider.d.ts +10 -0
- package/core/createProvider.js +6 -0
- package/core/createProvider.js.map +1 -0
- package/core/createProviderPlugin.d.ts +8 -0
- package/core/createProviderPlugin.js +12 -0
- package/core/createProviderPlugin.js.map +1 -0
- package/errors/AuthenticationErrorEvent.d.ts +9 -0
- package/errors/AuthenticationErrorEvent.js +13 -0
- package/errors/AuthenticationErrorEvent.js.map +1 -0
- package/errors/NetworkErrorEvent.d.ts +15 -0
- package/errors/NetworkErrorEvent.js +13 -0
- package/errors/NetworkErrorEvent.js.map +1 -0
- package/errors/abstractions.d.ts +12 -0
- package/errors/abstractions.js +6 -0
- package/errors/abstractions.js.map +1 -0
- package/errors/index.d.ts +6 -0
- package/errors/index.js +3 -0
- package/exports/admin/env-config.d.ts +2 -0
- package/exports/admin/env-config.js +2 -0
- package/exports/admin/graphql-client.d.ts +1 -0
- package/exports/admin/graphql-client.js +1 -0
- package/exports/admin/local-storage.d.ts +2 -0
- package/exports/admin/local-storage.js +2 -0
- package/exports/admin/router.d.ts +5 -0
- package/exports/admin/router.js +5 -0
- package/exports/admin/security.d.ts +1 -0
- package/exports/admin/security.js +1 -0
- package/exports/admin.d.ts +7 -0
- package/exports/admin.js +7 -0
- package/features/envConfig/EnvConfig.d.ts +7 -0
- package/features/envConfig/EnvConfig.js +16 -0
- package/features/envConfig/EnvConfig.js.map +1 -0
- package/features/envConfig/abstractions.d.ts +28 -0
- package/features/envConfig/abstractions.js +5 -0
- package/features/envConfig/abstractions.js.map +1 -0
- package/features/envConfig/feature.d.ts +17 -0
- package/features/envConfig/feature.js +15 -0
- package/features/envConfig/feature.js.map +1 -0
- package/features/envConfig/index.d.ts +1 -0
- package/features/envConfig/index.js +1 -0
- package/features/eventPublisher/EventPublisher.d.ts +8 -0
- package/features/eventPublisher/EventPublisher.js +19 -0
- package/features/eventPublisher/EventPublisher.js.map +1 -0
- package/features/eventPublisher/abstractions.d.ts +18 -0
- package/features/eventPublisher/abstractions.js +12 -0
- package/features/eventPublisher/abstractions.js.map +1 -0
- package/features/eventPublisher/feature.d.ts +3 -0
- package/features/eventPublisher/feature.js +17 -0
- package/features/eventPublisher/feature.js.map +1 -0
- package/features/eventPublisher/index.d.ts +3 -0
- package/features/eventPublisher/index.js +2 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
- package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
- package/features/graphqlClient/BatchingGraphQLClient.js +118 -0
- package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
- package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
- package/features/graphqlClient/FetchGraphQLClient.js +51 -0
- package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
- package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
- package/features/graphqlClient/NetworkErrorPublishing.js +48 -0
- package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
- package/features/graphqlClient/RequestValue.d.ts +21 -0
- package/features/graphqlClient/RequestValue.js +46 -0
- package/features/graphqlClient/RequestValue.js.map +1 -0
- package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
- package/features/graphqlClient/RetryGraphQLClient.js +45 -0
- package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js +397 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
- package/features/graphqlClient/abstractions.d.ts +18 -0
- package/features/graphqlClient/abstractions.js +5 -0
- package/features/graphqlClient/abstractions.js.map +1 -0
- package/features/graphqlClient/feature.d.ts +6 -0
- package/features/graphqlClient/feature.js +25 -0
- package/features/graphqlClient/feature.js.map +1 -0
- package/features/graphqlClient/index.d.ts +1 -0
- package/features/graphqlClient/index.js +1 -0
- package/features/graphqlClient/types.d.ts +5 -0
- package/features/graphqlClient/types.js +0 -0
- package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
- package/features/localStorage/BrowserLocalStorageGateway.js +61 -0
- package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
- package/features/localStorage/LocalStorage.d.ts +12 -0
- package/features/localStorage/LocalStorage.js +34 -0
- package/features/localStorage/LocalStorage.js.map +1 -0
- package/features/localStorage/LocalStorageRepository.d.ts +20 -0
- package/features/localStorage/LocalStorageRepository.js +82 -0
- package/features/localStorage/LocalStorageRepository.js.map +1 -0
- package/features/localStorage/abstractions.d.ts +48 -0
- package/features/localStorage/abstractions.js +8 -0
- package/features/localStorage/abstractions.js.map +1 -0
- package/features/localStorage/feature.d.ts +12 -0
- package/features/localStorage/feature.js +23 -0
- package/features/localStorage/feature.js.map +1 -0
- package/features/localStorage/index.d.ts +1 -0
- package/features/localStorage/index.js +1 -0
- package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
- package/features/mainGraphQLClient/MainGraphQLClient.js +27 -0
- package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
- package/features/mainGraphQLClient/abstractions.d.ts +17 -0
- package/features/mainGraphQLClient/abstractions.js +5 -0
- package/features/mainGraphQLClient/abstractions.js.map +1 -0
- package/features/mainGraphQLClient/feature.d.ts +3 -0
- package/features/mainGraphQLClient/feature.js +17 -0
- package/features/mainGraphQLClient/feature.js.map +1 -0
- package/features/mainGraphQLClient/index.d.ts +1 -0
- package/features/mainGraphQLClient/index.js +1 -0
- package/features/router/HistoryRouterGateway.d.ts +22 -0
- package/features/router/HistoryRouterGateway.js +88 -0
- package/features/router/HistoryRouterGateway.js.map +1 -0
- package/features/router/HistoryRouterGateway.test.d.ts +1 -0
- package/features/router/HistoryRouterGateway.test.js +195 -0
- package/features/router/HistoryRouterGateway.test.js.map +1 -0
- package/features/router/Route.d.ts +19 -0
- package/features/router/Route.js +43 -0
- package/features/router/Route.js.map +1 -0
- package/features/router/RouteUrl.d.ts +85 -0
- package/features/router/RouteUrl.js +99 -0
- package/features/router/RouteUrl.js.map +1 -0
- package/features/router/Router.d.ts +45 -0
- package/features/router/Router.js +72 -0
- package/features/router/Router.js.map +1 -0
- package/features/router/RouterPresenter.d.ts +21 -0
- package/features/router/RouterPresenter.js +52 -0
- package/features/router/RouterPresenter.js.map +1 -0
- package/features/router/RouterRepository.d.ts +30 -0
- package/features/router/RouterRepository.js +117 -0
- package/features/router/RouterRepository.js.map +1 -0
- package/features/router/RouterRepository.test.d.ts +1 -0
- package/features/router/RouterRepository.test.js +138 -0
- package/features/router/RouterRepository.test.js.map +1 -0
- package/features/router/abstractions.d.ts +81 -0
- package/features/router/abstractions.js +7 -0
- package/features/router/abstractions.js.map +1 -0
- package/features/router/feature.d.ts +4 -0
- package/features/router/feature.js +19 -0
- package/features/router/feature.js.map +1 -0
- package/features/router/index.d.ts +2 -0
- package/features/router/index.js +1 -0
- package/helpers/InterfaceGenerator/date.d.ts +15 -0
- package/helpers/InterfaceGenerator/date.js +0 -0
- package/helpers/InterfaceGenerator/id.d.ts +23 -0
- package/helpers/InterfaceGenerator/id.js +0 -0
- package/helpers/InterfaceGenerator/identity.d.ts +10 -0
- package/helpers/InterfaceGenerator/identity.js +0 -0
- package/helpers/InterfaceGenerator/index.d.ts +5 -0
- package/helpers/InterfaceGenerator/index.js +0 -0
- package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
- package/helpers/InterfaceGenerator/numeric.js +0 -0
- package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
- package/helpers/InterfaceGenerator/truthful.js +0 -0
- package/hooks/useAutocomplete/index.d.ts +1 -1
- package/hooks/useAutocomplete/index.js +1 -13
- package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
- package/hooks/useAutocomplete/useAutocomplete.js +15 -36
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +4 -15
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +4 -15
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +4 -15
- package/hooks/useDataList/functions/getMeta.js.map +1 -1
- package/hooks/useDataList/functions/index.d.ts +3 -3
- package/hooks/useDataList/functions/index.js +3 -31
- package/hooks/useDataList/functions/searchDataByKey.js +10 -26
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
- package/hooks/useDataList/index.d.ts +1 -1
- package/hooks/useDataList/index.js +1 -13
- package/hooks/useDataList/useDataList.d.ts +2 -3
- package/hooks/useDataList/useDataList.js +139 -205
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.d.ts +1 -2
- package/hooks/useDataList/utils/index.js +1 -23
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
- package/hooks/useDataList/utils/prepareLoadListParams.js +26 -45
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useHandler.js +14 -19
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.d.ts +3 -3
- package/hooks/useHandlers.js +19 -28
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
- package/hooks/useRegisterLegacyPlugin.js +12 -0
- package/hooks/useRegisterLegacyPlugin.js.map +1 -0
- package/hooks/useUi.d.ts +1 -1
- package/hooks/useUi.js +5 -15
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +11 -21
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +1 -15
- package/index.d.ts +25 -4
- package/index.js +23 -37
- package/package.json +38 -38
- package/plugins/AddQuerySelectionPlugin.d.ts +10 -3
- package/plugins/AddQuerySelectionPlugin.js +43 -128
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloCacheObjectIdPlugin.js +15 -51
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.d.ts +3 -2
- package/plugins/ApolloDynamicLink.js +24 -78
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ApolloLinkPlugin.d.ts +1 -1
- package/plugins/ApolloLinkPlugin.js +21 -61
- package/plugins/ApolloLinkPlugin.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.d.ts +1 -1
- package/plugins/ConsoleLinkPlugin.js +20 -59
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +47 -95
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +27 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +23 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +8 -5
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -20
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js +13 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js +19 -0
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +13 -36
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
- package/plugins/NetworkErrorLinkPlugin.js +51 -63
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +12 -51
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +3 -8
- package/plugins/TenantHeaderLinkPlugin.js +25 -82
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/components/Image.d.ts +6 -0
- package/plugins/components/Image.js +12 -0
- package/plugins/components/Image.js.map +1 -0
- package/plugins/image.d.ts +1 -1
- package/plugins/image.js +97 -175
- package/plugins/image.js.map +1 -1
- package/plugins/index.d.ts +5 -5
- package/plugins/index.js +38 -106
- package/plugins/index.js.map +1 -1
- package/presentation/envConfig/useEnvConfig.d.ts +6 -0
- package/presentation/envConfig/useEnvConfig.js +9 -0
- package/presentation/envConfig/useEnvConfig.js.map +1 -0
- package/presentation/localStorage/index.d.ts +3 -0
- package/presentation/localStorage/index.js +3 -0
- package/presentation/localStorage/useLocalStorage.d.ts +6 -0
- package/presentation/localStorage/useLocalStorage.js +15 -0
- package/presentation/localStorage/useLocalStorage.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
- package/presentation/localStorage/useLocalStorageValue.js +22 -0
- package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
- package/presentation/localStorage/useLocalStorageValues.js +32 -0
- package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
- package/presentation/router/RouteElementRegistry.d.ts +14 -0
- package/presentation/router/RouteElementRegistry.js +29 -0
- package/presentation/router/RouteElementRegistry.js.map +1 -0
- package/presentation/router/abstractions.d.ts +13 -0
- package/presentation/router/abstractions.js +5 -0
- package/presentation/router/abstractions.js.map +1 -0
- package/presentation/router/components/Redirect.d.ts +14 -0
- package/presentation/router/components/Redirect.js +13 -0
- package/presentation/router/components/Redirect.js.map +1 -0
- package/presentation/router/components/RouteContent.d.ts +2 -0
- package/presentation/router/components/RouteContent.js +20 -0
- package/presentation/router/components/RouteContent.js.map +1 -0
- package/presentation/router/components/RouteLink.d.ts +50 -0
- package/presentation/router/components/RouteLink.js +17 -0
- package/presentation/router/components/RouteLink.js.map +1 -0
- package/presentation/router/components/SimpleLink.d.ts +44 -0
- package/presentation/router/components/SimpleLink.js +24 -0
- package/presentation/router/components/SimpleLink.js.map +1 -0
- package/presentation/router/hooks/useRoute.d.ts +6 -0
- package/presentation/router/hooks/useRoute.js +22 -0
- package/presentation/router/hooks/useRoute.js.map +1 -0
- package/presentation/router/hooks/useRouter.d.ts +11 -0
- package/presentation/router/hooks/useRouter.js +29 -0
- package/presentation/router/hooks/useRouter.js.map +1 -0
- package/presentation/router/index.d.ts +4 -0
- package/presentation/router/index.js +3 -0
- package/presentation/router/types.d.ts +5 -0
- package/presentation/router/types.js +0 -0
- package/renderApp.d.ts +2 -0
- package/renderApp.js +10 -0
- package/renderApp.js.map +1 -0
- package/router.d.ts +5 -0
- package/router.js +5 -0
- package/rslib-runtime.js +14 -0
- package/rslib-runtime.js.map +1 -0
- package/shared/di/DiContainerProvider.d.ts +8 -0
- package/shared/di/DiContainerProvider.js +13 -0
- package/shared/di/DiContainerProvider.js.map +1 -0
- package/shared/di/createFeature.d.ts +11 -0
- package/shared/di/createFeature.js +10 -0
- package/shared/di/createFeature.js.map +1 -0
- package/shared/di/useFeature.d.ts +2 -0
- package/shared/di/useFeature.js +12 -0
- package/shared/di/useFeature.js.map +1 -0
- package/static/svg/close_24px.33adaadc.svg +1 -0
- package/types.d.ts +30 -30
- package/types.js +0 -13
- package/utils/createGenericContext.d.ts +13 -0
- package/utils/createGenericContext.js +21 -0
- package/utils/createGenericContext.js.map +1 -0
- package/utils/createHashing.d.ts +2 -0
- package/utils/createHashing.js +15 -0
- package/utils/createHashing.js.map +1 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/legacyPluginToReactComponent.d.ts +7 -0
- package/utils/legacyPluginToReactComponent.js +15 -0
- package/utils/legacyPluginToReactComponent.js.map +1 -0
- package/components/Routes.d.ts +0 -2
- package/components/Routes.js +0 -49
- package/components/Routes.js.map +0 -1
- package/components/View.d.ts +0 -8
- package/components/View.js +0 -41
- package/components/View.js.map +0 -1
- package/components/index.js.map +0 -1
- package/hooks/useAutocomplete/index.js.map +0 -1
- package/hooks/useDataList/functions/index.js.map +0 -1
- package/hooks/useDataList/index.js.map +0 -1
- package/hooks/useDataList/utils/index.js.map +0 -1
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -31
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
- package/hooks/useDataList/utils/types.d.ts +0 -34
- package/hooks/useDataList/utils/types.js +0 -5
- package/hooks/useDataList/utils/types.js.map +0 -1
- package/i18n/index.js.map +0 -1
- package/index.js.map +0 -1
- package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -15
- package/plugins/LocaleHeaderLinkPlugin.js +0 -77
- package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
- package/plugins/RoutePlugin.d.ts +0 -12
- package/plugins/RoutePlugin.js +0 -53
- package/plugins/RoutePlugin.js.map +0 -1
- package/plugins/ViewPlugin.d.ts +0 -14
- package/plugins/ViewPlugin.js +0 -58
- package/plugins/ViewPlugin.js.map +0 -1
- package/types.js.map +0 -1
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useAutocomplete } from "./useAutocomplete";
|
|
1
|
+
export { useAutocomplete } from "./useAutocomplete.js";
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "useAutocomplete", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _useAutocomplete.useAutocomplete;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _useAutocomplete = require("./useAutocomplete");
|
|
1
|
+
export { useAutocomplete } from "./useAutocomplete.js";
|
|
@@ -1,38 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _useDataList = require("../useDataList");
|
|
15
|
-
|
|
16
|
-
var useAutocomplete = function useAutocomplete(props) {
|
|
17
|
-
var dataList = (0, _useDataList.useDataList)((0, _objectSpread2.default)({
|
|
18
|
-
useRouter: false
|
|
19
|
-
}, props));
|
|
20
|
-
return {
|
|
21
|
-
options: dataList.data || [],
|
|
22
|
-
onInput: (0, _debounce2.default)(function (query) {
|
|
23
|
-
if (!query) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var search = props.search || query;
|
|
28
|
-
|
|
29
|
-
if (typeof search === "function") {
|
|
30
|
-
search = search(query);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
dataList.setSearch(search);
|
|
34
|
-
}, 250)
|
|
35
|
-
};
|
|
1
|
+
import { useDataList } from "../useDataList/index.js";
|
|
2
|
+
import debounce from "lodash/debounce.js";
|
|
3
|
+
const useAutocomplete = (props)=>{
|
|
4
|
+
const dataList = useDataList(props);
|
|
5
|
+
return {
|
|
6
|
+
options: dataList.data || [],
|
|
7
|
+
onInput: debounce((query)=>{
|
|
8
|
+
if (!query) return;
|
|
9
|
+
let search = props.search || query;
|
|
10
|
+
if ("function" == typeof search) search = search(query);
|
|
11
|
+
dataList.setSearch(search);
|
|
12
|
+
}, 250)
|
|
13
|
+
};
|
|
36
14
|
};
|
|
15
|
+
export { useAutocomplete };
|
|
37
16
|
|
|
38
|
-
|
|
17
|
+
//# sourceMappingURL=useAutocomplete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"hooks/useAutocomplete/useAutocomplete.js","sources":["../../../src/hooks/useAutocomplete/useAutocomplete.ts"],"sourcesContent":["import { useDataList } from \"../useDataList/index.js\";\nimport debounce from \"lodash/debounce.js\";\nimport type { DocumentNode } from \"graphql\";\n\ninterface UseAutocompleteHook {\n options: any[];\n onInput(value: string): void;\n}\n\ninterface Props {\n query: DocumentNode;\n search?: string | ((value: string) => string);\n}\n\nexport const useAutocomplete = (props: Props): UseAutocompleteHook => {\n const dataList = useDataList(props);\n\n return {\n options: dataList.data || [],\n onInput: debounce(query => {\n if (!query) {\n return;\n }\n\n let search = props.search || query;\n if (typeof search === \"function\") {\n search = search(query);\n }\n\n dataList.setSearch(search);\n }, 250)\n };\n};\n"],"names":["useAutocomplete","props","dataList","useDataList","debounce","query","search"],"mappings":";;AAcO,MAAMA,kBAAkB,CAACC;IAC5B,MAAMC,WAAWC,YAAYF;IAE7B,OAAO;QACH,SAASC,SAAS,IAAI,IAAI,EAAE;QAC5B,SAASE,SAASC,CAAAA;YACd,IAAI,CAACA,OACD;YAGJ,IAAIC,SAASL,MAAM,MAAM,IAAII;YAC7B,IAAI,AAAkB,cAAlB,OAAOC,QACPA,SAASA,OAAOD;YAGpBH,SAAS,SAAS,CAACI;QACvB,GAAG;IACP;AACJ"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import searchDataByKey from "./searchDataByKey.js";
|
|
2
|
+
const getData = (response)=>searchDataByKey("data", response);
|
|
3
|
+
export default getData;
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
|
|
11
|
-
|
|
12
|
-
var _default = function _default(response) {
|
|
13
|
-
return (0, _searchDataByKey.default)("data", response);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.default = _default;
|
|
5
|
+
//# sourceMappingURL=getData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"hooks/useDataList/functions/getData.js","sources":["../../../../src/hooks/useDataList/functions/getData.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey.js\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"data\", response);\n"],"names":["response","searchDataByKey"],"mappings":";AAEA,gBAAgB,CAAAA,WAAqCC,gBAAgB,QAAQD"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import searchDataByKey from "./searchDataByKey.js";
|
|
2
|
+
const getError = (response)=>searchDataByKey("error", response);
|
|
3
|
+
export default getError;
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
|
|
11
|
-
|
|
12
|
-
var _default = function _default(response) {
|
|
13
|
-
return (0, _searchDataByKey.default)("error", response);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.default = _default;
|
|
5
|
+
//# sourceMappingURL=getError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"hooks/useDataList/functions/getError.js","sources":["../../../../src/hooks/useDataList/functions/getError.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey.js\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"error\", response);\n"],"names":["response","searchDataByKey"],"mappings":";AAEA,iBAAgB,CAAAA,WAAqCC,gBAAgB,SAASD"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import searchDataByKey from "./searchDataByKey.js";
|
|
2
|
+
const getMeta = (response)=>searchDataByKey("meta", response);
|
|
3
|
+
export default getMeta;
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
|
|
11
|
-
|
|
12
|
-
var _default = function _default(response) {
|
|
13
|
-
return (0, _searchDataByKey.default)("meta", response);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.default = _default;
|
|
5
|
+
//# sourceMappingURL=getMeta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"hooks/useDataList/functions/getMeta.js","sources":["../../../../src/hooks/useDataList/functions/getMeta.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey.js\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"meta\", response);\n"],"names":["response","searchDataByKey"],"mappings":";AAEA,gBAAgB,CAAAA,WAAqCC,gBAAgB,QAAQD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as getData } from "./getData";
|
|
2
|
-
export { default as getError } from "./getError";
|
|
3
|
-
export { default as getMeta } from "./getMeta";
|
|
1
|
+
export { default as getData } from "./getData.js";
|
|
2
|
+
export { default as getError } from "./getError.js";
|
|
3
|
+
export { default as getMeta } from "./getMeta.js";
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports, "getData", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _getData.default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "getError", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function get() {
|
|
17
|
-
return _getError.default;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "getMeta", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function get() {
|
|
23
|
-
return _getMeta.default;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
var _getData = _interopRequireDefault(require("./getData"));
|
|
28
|
-
|
|
29
|
-
var _getError = _interopRequireDefault(require("./getError"));
|
|
30
|
-
|
|
31
|
-
var _getMeta = _interopRequireDefault(require("./getMeta"));
|
|
1
|
+
export { default as getData } from "./getData.js";
|
|
2
|
+
export { default as getError } from "./getError.js";
|
|
3
|
+
export { default as getMeta } from "./getMeta.js";
|
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var searchDataByKey = function searchDataByKey(searchKey, object) {
|
|
9
|
-
if (!object || typeof object !== "object") {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (object[searchKey]) {
|
|
14
|
-
return object[searchKey];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
for (var key in object) {
|
|
18
|
-
var value = searchDataByKey(searchKey, object[key]);
|
|
19
|
-
|
|
20
|
-
if (value) {
|
|
21
|
-
return value;
|
|
1
|
+
const searchDataByKey = (searchKey, object)=>{
|
|
2
|
+
if (!object || "object" != typeof object) return null;
|
|
3
|
+
if (object[searchKey]) return object[searchKey];
|
|
4
|
+
for(const key in object){
|
|
5
|
+
const value = searchDataByKey(searchKey, object[key]);
|
|
6
|
+
if (value) return value;
|
|
22
7
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return null;
|
|
8
|
+
return null;
|
|
26
9
|
};
|
|
10
|
+
const functions_searchDataByKey = searchDataByKey;
|
|
11
|
+
export default functions_searchDataByKey;
|
|
27
12
|
|
|
28
|
-
|
|
29
|
-
exports.default = _default;
|
|
13
|
+
//# sourceMappingURL=searchDataByKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"hooks/useDataList/functions/searchDataByKey.js","sources":["../../../../src/hooks/useDataList/functions/searchDataByKey.ts"],"sourcesContent":["const searchDataByKey = (searchKey: string, object: Record<string, any>): string | null => {\n if (!object || typeof object !== \"object\") {\n return null;\n }\n\n if (object[searchKey]) {\n return object[searchKey];\n }\n\n for (const key in object) {\n const value = searchDataByKey(searchKey, object[key]);\n if (value) {\n return value;\n }\n }\n\n return null;\n};\n\nexport default searchDataByKey;\n"],"names":["searchDataByKey","searchKey","object","key","value"],"mappings":"AAAA,MAAMA,kBAAkB,CAACC,WAAmBC;IACxC,IAAI,CAACA,UAAU,AAAkB,YAAlB,OAAOA,QAClB,OAAO;IAGX,IAAIA,MAAM,CAACD,UAAU,EACjB,OAAOC,MAAM,CAACD,UAAU;IAG5B,IAAK,MAAME,OAAOD,OAAQ;QACtB,MAAME,QAAQJ,gBAAgBC,WAAWC,MAAM,CAACC,IAAI;QACpD,IAAIC,OACA,OAAOA;IAEf;IAEA,OAAO;AACX;AAEA,kCAAeJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useDataList } from "./useDataList";
|
|
1
|
+
export { useDataList } from "./useDataList.js";
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "useDataList", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _useDataList.useDataList;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _useDataList = require("./useDataList");
|
|
1
|
+
export { useDataList } from "./useDataList.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { DocumentNode } from "graphql";
|
|
2
|
-
import { ApolloClient } from "apollo-client";
|
|
1
|
+
import type { DocumentNode } from "graphql";
|
|
2
|
+
import type { ApolloClient } from "apollo-client";
|
|
3
3
|
export interface UseDataListParams {
|
|
4
|
-
useRouter?: boolean;
|
|
5
4
|
variables?: ((params: UseDataListParams) => any) | object;
|
|
6
5
|
client?: ApolloClient<any>;
|
|
7
6
|
query: DocumentNode;
|
|
@@ -1,208 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useQuery } from "@apollo/react-hooks";
|
|
3
|
+
import get from "lodash/get.js";
|
|
4
|
+
import isEqual from "lodash/isEqual.js";
|
|
5
|
+
import { prepareLoadListParams } from "./utils/index.js";
|
|
6
|
+
import { getData, getError, getMeta } from "./functions/index.js";
|
|
7
|
+
const useDataList = (params)=>{
|
|
8
|
+
const [multiSelectedItems, multiSelect] = useState([]);
|
|
9
|
+
const getQueryOptions = useCallback(()=>{
|
|
10
|
+
let variables = params.variables;
|
|
11
|
+
if ("function" == typeof variables) variables = variables(params);
|
|
12
|
+
return {
|
|
13
|
+
client: params.client,
|
|
14
|
+
variables: {
|
|
15
|
+
...variables,
|
|
16
|
+
...prepareLoadListParams()
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
const queryData = useQuery(params.query, getQueryOptions());
|
|
21
|
+
const prevLoadParamsRef = useRef({});
|
|
22
|
+
const dataListProps = {
|
|
23
|
+
data: get(params, "getData", getData)(queryData.data),
|
|
24
|
+
meta: get(params, "getMeta", getMeta)(queryData.data),
|
|
25
|
+
error: get(params, "getError", getError)(queryData.data),
|
|
26
|
+
loading: queryData.loading,
|
|
27
|
+
init () {
|
|
28
|
+
this.refresh();
|
|
29
|
+
},
|
|
30
|
+
refresh (params = null) {
|
|
31
|
+
multiSelect([]);
|
|
32
|
+
if (!params) return void queryData.refetch(dataListProps.__loadParams);
|
|
33
|
+
queryData.refetch(params);
|
|
34
|
+
},
|
|
35
|
+
setPerPage (perPage) {
|
|
36
|
+
const preparedParams = {
|
|
37
|
+
...dataListProps.__loadParams,
|
|
38
|
+
limit: parseInt("" + perPage),
|
|
39
|
+
after: void 0,
|
|
40
|
+
before: void 0
|
|
41
|
+
};
|
|
42
|
+
this.refresh(preparedParams);
|
|
43
|
+
},
|
|
44
|
+
setNextPage (cursor) {
|
|
45
|
+
const preparedParams = {
|
|
46
|
+
...dataListProps.__loadParams,
|
|
47
|
+
after: cursor,
|
|
48
|
+
before: void 0
|
|
49
|
+
};
|
|
50
|
+
this.refresh(preparedParams);
|
|
51
|
+
},
|
|
52
|
+
setPreviousPage (cursor) {
|
|
53
|
+
const preparedParams = {
|
|
54
|
+
...dataListProps.__loadParams,
|
|
55
|
+
after: void 0,
|
|
56
|
+
before: cursor
|
|
57
|
+
};
|
|
58
|
+
this.refresh(preparedParams);
|
|
59
|
+
},
|
|
60
|
+
setSearch (search) {
|
|
61
|
+
const preparedParams = {
|
|
62
|
+
...dataListProps.__loadParams,
|
|
63
|
+
search,
|
|
64
|
+
after: void 0,
|
|
65
|
+
before: void 0
|
|
66
|
+
};
|
|
67
|
+
this.refresh(preparedParams);
|
|
68
|
+
},
|
|
69
|
+
setWhere (where) {
|
|
70
|
+
const preparedParams = {
|
|
71
|
+
...dataListProps.__loadParams,
|
|
72
|
+
where,
|
|
73
|
+
after: void 0,
|
|
74
|
+
before: void 0
|
|
75
|
+
};
|
|
76
|
+
this.refresh(preparedParams);
|
|
77
|
+
},
|
|
78
|
+
setSorters (sort) {
|
|
79
|
+
const preparedParams = {
|
|
80
|
+
...dataListProps.__loadParams,
|
|
81
|
+
sort,
|
|
82
|
+
after: void 0,
|
|
83
|
+
before: void 0
|
|
84
|
+
};
|
|
85
|
+
this.refresh(preparedParams);
|
|
86
|
+
},
|
|
87
|
+
multiSelect (items, value) {
|
|
88
|
+
if (!Array.isArray(items)) items = [
|
|
89
|
+
items
|
|
90
|
+
];
|
|
91
|
+
const returnItems = [
|
|
92
|
+
...multiSelectedItems
|
|
93
|
+
];
|
|
94
|
+
items.forEach((item)=>{
|
|
95
|
+
if (void 0 === value) returnItems.includes(item) ? returnItems.splice(returnItems.indexOf(item), 1) : returnItems.push(item);
|
|
96
|
+
else if (true === value) returnItems.includes(item) || returnItems.push(item);
|
|
97
|
+
else returnItems.includes(item) && returnItems.splice(returnItems.indexOf(item), 1);
|
|
98
|
+
});
|
|
99
|
+
multiSelect(returnItems);
|
|
100
|
+
},
|
|
101
|
+
isSelected (item) {
|
|
102
|
+
const query = new URLSearchParams(location.search);
|
|
103
|
+
return query.get("id") === item.id;
|
|
104
|
+
},
|
|
105
|
+
select (item) {
|
|
106
|
+
const query = new URLSearchParams(location.search);
|
|
107
|
+
query.set("id", item.id);
|
|
108
|
+
},
|
|
109
|
+
isMultiSelected (item) {
|
|
110
|
+
if (!Array.isArray(multiSelectedItems)) return false;
|
|
111
|
+
return multiSelectedItems.includes(item);
|
|
112
|
+
},
|
|
113
|
+
isNoneMultiSelected () {
|
|
114
|
+
return 0 === multiSelectedItems.length;
|
|
115
|
+
},
|
|
116
|
+
getMultiSelected () {
|
|
117
|
+
return multiSelectedItems;
|
|
118
|
+
},
|
|
119
|
+
multiSelectAll (value) {
|
|
120
|
+
const { data } = dataListProps;
|
|
121
|
+
if (Array.isArray(data)) dataListProps.multiSelect(data, value);
|
|
122
|
+
else dataListProps.multiSelect([], value);
|
|
123
|
+
},
|
|
124
|
+
isAllMultiSelected () {
|
|
125
|
+
const { data } = dataListProps;
|
|
126
|
+
return Array.isArray(data) && multiSelectedItems.length === data.length;
|
|
127
|
+
},
|
|
128
|
+
__loadParams: prepareLoadListParams(location)
|
|
59
129
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.refresh();
|
|
70
|
-
},
|
|
71
|
-
refresh: function refresh() {
|
|
72
|
-
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
73
|
-
|
|
74
|
-
// Refresh multi select first.
|
|
75
|
-
_multiSelect([]);
|
|
76
|
-
|
|
77
|
-
if (!params) {
|
|
78
|
-
queryData.refetch(dataListProps.__loadParams);
|
|
79
|
-
return;
|
|
80
|
-
} // if (history) {
|
|
81
|
-
// redirectToRouteWithQueryParams(params, { history, location });
|
|
82
|
-
// return;
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
queryData.refetch(params);
|
|
87
|
-
},
|
|
88
|
-
setPerPage: function setPerPage(perPage) {
|
|
89
|
-
var preparedParams = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataListProps.__loadParams), {}, {
|
|
90
|
-
limit: parseInt("" + perPage),
|
|
91
|
-
after: undefined,
|
|
92
|
-
before: undefined
|
|
93
|
-
});
|
|
94
|
-
this.refresh(preparedParams);
|
|
95
|
-
},
|
|
96
|
-
setNextPage: function setNextPage(cursor) {
|
|
97
|
-
var preparedParams = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataListProps.__loadParams), {}, {
|
|
98
|
-
after: cursor,
|
|
99
|
-
before: undefined
|
|
100
|
-
});
|
|
101
|
-
this.refresh(preparedParams);
|
|
102
|
-
},
|
|
103
|
-
setPreviousPage: function setPreviousPage(cursor) {
|
|
104
|
-
var preparedParams = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataListProps.__loadParams), {}, {
|
|
105
|
-
after: undefined,
|
|
106
|
-
before: cursor
|
|
107
|
-
});
|
|
108
|
-
this.refresh(preparedParams);
|
|
109
|
-
},
|
|
110
|
-
setSearch: function setSearch(search) {
|
|
111
|
-
var preparedParams = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataListProps.__loadParams), {}, {
|
|
112
|
-
search: search,
|
|
113
|
-
after: undefined,
|
|
114
|
-
before: undefined
|
|
115
|
-
});
|
|
116
|
-
this.refresh(preparedParams);
|
|
117
|
-
},
|
|
118
|
-
setWhere: function setWhere(where) {
|
|
119
|
-
var preparedParams = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataListProps.__loadParams), {}, {
|
|
120
|
-
where: where,
|
|
121
|
-
after: undefined,
|
|
122
|
-
before: undefined
|
|
123
|
-
});
|
|
124
|
-
this.refresh(preparedParams);
|
|
125
|
-
},
|
|
126
|
-
setSorters: function setSorters(sort) {
|
|
127
|
-
var preparedParams = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataListProps.__loadParams), {}, {
|
|
128
|
-
sort: sort,
|
|
129
|
-
after: undefined,
|
|
130
|
-
before: undefined
|
|
131
|
-
});
|
|
132
|
-
this.refresh(preparedParams);
|
|
133
|
-
},
|
|
134
|
-
multiSelect: function multiSelect(items, value) {
|
|
135
|
-
if (!Array.isArray(items)) {
|
|
136
|
-
items = [items];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var returnItems = (0, _toConsumableArray2.default)(multiSelectedItems);
|
|
140
|
-
items.forEach(function (item) {
|
|
141
|
-
if (value === undefined) {
|
|
142
|
-
returnItems.includes(item) ? returnItems.splice(returnItems.indexOf(item), 1) : returnItems.push(item);
|
|
143
|
-
} else {
|
|
144
|
-
if (value === true) {
|
|
145
|
-
!returnItems.includes(item) && returnItems.push(item);
|
|
146
|
-
} else {
|
|
147
|
-
returnItems.includes(item) && returnItems.splice(returnItems.indexOf(item), 1);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
_multiSelect(returnItems);
|
|
153
|
-
},
|
|
154
|
-
isSelected: function isSelected(item) {
|
|
155
|
-
var query = new URLSearchParams(location.search);
|
|
156
|
-
return query.get("id") === item.id;
|
|
157
|
-
},
|
|
158
|
-
select: function select(item) {
|
|
159
|
-
var query = new URLSearchParams(location.search);
|
|
160
|
-
query.set("id", item.id);
|
|
161
|
-
history.push({
|
|
162
|
-
search: query.toString()
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
isMultiSelected: function isMultiSelected(item) {
|
|
166
|
-
if (!Array.isArray(multiSelectedItems)) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return multiSelectedItems.includes(item);
|
|
171
|
-
},
|
|
172
|
-
isNoneMultiSelected: function isNoneMultiSelected() {
|
|
173
|
-
return multiSelectedItems.length === 0;
|
|
174
|
-
},
|
|
175
|
-
getMultiSelected: function getMultiSelected() {
|
|
176
|
-
return multiSelectedItems;
|
|
177
|
-
},
|
|
178
|
-
multiSelectAll: function multiSelectAll(value) {
|
|
179
|
-
var data = dataListProps.data;
|
|
180
|
-
|
|
181
|
-
if (Array.isArray(data)) {
|
|
182
|
-
dataListProps.multiSelect(data, value);
|
|
183
|
-
} else {
|
|
184
|
-
dataListProps.multiSelect([], value);
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
isAllMultiSelected: function isAllMultiSelected() {
|
|
188
|
-
var data = dataListProps.data;
|
|
189
|
-
return Array.isArray(data) && multiSelectedItems.length === data.length;
|
|
190
|
-
},
|
|
191
|
-
__loadParams: (0, _utils.prepareLoadListParams)(location)
|
|
192
|
-
};
|
|
193
|
-
(0, _react.useEffect)(function () {
|
|
194
|
-
var params = {
|
|
195
|
-
prev: prevLoadParamsRef.current,
|
|
196
|
-
current: dataListProps.__loadParams
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
if (!(0, _isEqual2.default)(params.prev, params.current)) {
|
|
200
|
-
dataListProps.init();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
prevLoadParamsRef.current = params.current;
|
|
204
|
-
});
|
|
205
|
-
return dataListProps;
|
|
130
|
+
useEffect(()=>{
|
|
131
|
+
const params = {
|
|
132
|
+
prev: prevLoadParamsRef.current,
|
|
133
|
+
current: dataListProps.__loadParams
|
|
134
|
+
};
|
|
135
|
+
if (!isEqual(params.prev, params.current)) dataListProps.init();
|
|
136
|
+
prevLoadParamsRef.current = params.current;
|
|
137
|
+
});
|
|
138
|
+
return dataListProps;
|
|
206
139
|
};
|
|
140
|
+
export { useDataList };
|
|
207
141
|
|
|
208
|
-
|
|
142
|
+
//# sourceMappingURL=useDataList.js.map
|