@headless-adminapp/app 0.0.17-alpha.9 → 1.0.1
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/AppProvider.d.ts +0 -3
- package/app/AppProvider.js +10 -33
- package/app/AuthWrapper.d.ts +1 -1
- package/app/AuthWrapper.js +4 -1
- package/app/LayoutProvider.d.ts +8 -7
- package/app/LayoutProvider.js +28 -2
- package/app/context.d.ts +1 -1
- package/auth/AuthProvider.d.ts +1 -1
- package/auth/AuthProvider.js +30 -23
- package/auth/context.d.ts +2 -0
- package/auth/hooks/useIsSkipAuthCheck.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.js +8 -0
- package/auth/hooks/useLogout.js +1 -1
- package/board/BoardColumnDataResolver.d.ts +1 -0
- package/board/BoardColumnDataResolver.js +64 -0
- package/board/BoardColumnProvider.d.ts +7 -0
- package/board/BoardColumnProvider.js +36 -0
- package/board/context.d.ts +19 -0
- package/board/context.js +6 -0
- package/board/hooks/index.d.ts +6 -0
- package/board/hooks/index.js +15 -0
- package/board/hooks/useBoardColumnConfig.d.ts +2 -0
- package/board/hooks/useBoardColumnConfig.js +8 -0
- package/board/hooks/useBoardColumnData.d.ts +3 -0
- package/board/hooks/useBoardColumnData.js +9 -0
- package/board/hooks/useBoardColumnDataState.d.ts +5 -0
- package/board/hooks/useBoardColumnDataState.js +9 -0
- package/board/hooks/useBoardConfig.d.ts +3 -0
- package/board/hooks/useBoardConfig.js +8 -0
- package/board/hooks/useBoardSchema.d.ts +2 -0
- package/board/hooks/useBoardSchema.js +7 -0
- package/board/hooks/useSearchText.d.ts +1 -0
- package/board/hooks/useSearchText.js +14 -0
- package/board/types.d.ts +47 -0
- package/board/utils.d.ts +3 -0
- package/board/utils.js +6 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +15 -6
- package/builders/CommandBuilder/DefaultCommandBuilder.js +42 -20
- package/builders/CommandBuilder/FormCommandBuilder.d.ts +14 -13
- package/builders/CommandBuilder/FormCommandBuilder.js +66 -52
- package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +8 -27
- package/builders/CommandBuilder/SubgridCommandBuilder.js +115 -57
- package/builders/CommandBuilder/ViewCommandBuilder.js +32 -52
- package/builders/CommandBuilder/utils.js +1 -1
- package/builders/DefineFormExperience.d.ts +27 -0
- package/builders/DefineFormExperience.js +99 -0
- package/builders/DefineViewExperience.d.ts +13 -0
- package/builders/DefineViewExperience.js +33 -0
- package/builders/SchemaExperienceBuilder.d.ts +9 -7
- package/builders/SchemaExperienceBuilder.js +62 -40
- package/builders/utils.js +30 -44
- package/calendar/baseEventAttributes.d.ts +35 -0
- package/calendar/baseEventAttributes.js +38 -0
- package/calendar/context.d.ts +6 -0
- package/calendar/context.js +5 -0
- package/calendar/hooks/index.d.ts +1 -0
- package/{appearance → calendar}/hooks/index.js +1 -1
- package/calendar/hooks/useConfig.d.ts +3 -0
- package/calendar/hooks/useConfig.js +8 -0
- package/calendar/types.d.ts +41 -0
- package/calendar/types.js +2 -0
- package/calendar/utils.d.ts +3 -0
- package/calendar/utils.js +6 -0
- package/command/hooks/useBaseCommandHandlerContext.js +15 -6
- package/command/hooks/useCommands.js +1 -1
- package/command/utils/index.js +34 -9
- package/components/ScrollView/index.d.ts +1 -1
- package/components/ScrollView/index.js +2 -2
- package/components/ScrollbarWithMoreDataRequest/index.d.ts +9 -0
- package/components/ScrollbarWithMoreDataRequest/index.js +32 -0
- package/dataform/DataFormProvider/CustomHookExecuter.d.ts +5 -0
- package/dataform/DataFormProvider/CustomHookExecuter.js +14 -0
- package/dataform/DataFormProvider/DataResolver.d.ts +6 -4
- package/dataform/DataFormProvider/DataResolver.js +11 -94
- package/dataform/DataFormProvider/InitialValueResolver.js +3 -2
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +2 -3
- package/dataform/DataFormProvider/getRecord.d.ts +3 -0
- package/dataform/DataFormProvider/getRecord.js +56 -0
- package/dataform/DataFormProvider/index.d.ts +4 -0
- package/dataform/DataFormProvider/index.js +34 -12
- package/dataform/DataFormProvider/types.d.ts +13 -0
- package/dataform/DataFormProvider/types.js +2 -0
- package/dataform/DataFormProvider/utils.d.ts +23 -0
- package/dataform/DataFormProvider/utils.js +105 -0
- package/dataform/FormManager.d.ts +57 -0
- package/dataform/FormManager.js +247 -0
- package/dataform/constants.d.ts +1 -0
- package/dataform/constants.js +4 -0
- package/dataform/context.d.ts +26 -1
- package/dataform/hooks/index.d.ts +11 -0
- package/dataform/hooks/index.js +11 -0
- package/dataform/hooks/useContextKey.d.ts +1 -0
- package/dataform/hooks/useContextKey.js +8 -0
- package/dataform/hooks/useDisabledControlsManager.d.ts +6 -0
- package/dataform/hooks/useDisabledControlsManager.js +46 -0
- package/dataform/hooks/useEventManager.d.ts +1 -0
- package/dataform/hooks/useEventManager.js +8 -0
- package/dataform/hooks/useFormManager.d.ts +2 -0
- package/dataform/hooks/useFormManager.js +13 -0
- package/dataform/hooks/useFormNotifications.js +2 -2
- package/dataform/hooks/useFormSave.js +28 -31
- package/dataform/hooks/useHiddenControlsManager.d.ts +7 -0
- package/dataform/hooks/useHiddenControlsManager.js +50 -0
- package/dataform/hooks/useIsControlDisabled.d.ts +1 -0
- package/dataform/hooks/useIsControlDisabled.js +27 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.js +17 -0
- package/dataform/hooks/useIsControlHiddenByKey.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByKey.js +17 -0
- package/dataform/hooks/useIsFieldRequired.d.ts +1 -0
- package/dataform/hooks/useIsFieldRequired.js +25 -0
- package/dataform/hooks/useLoadFormGridPage.js +8 -17
- package/dataform/hooks/useMainFormCommands.d.ts +1 -12
- package/dataform/hooks/useMainFormCommands.js +13 -3
- package/dataform/hooks/useOnFieldValueChangeListener.d.ts +1 -0
- package/dataform/hooks/useOnFieldValueChangeListener.js +30 -0
- package/dataform/hooks/useProcessFlowSteps.d.ts +1 -0
- package/dataform/hooks/useProcessFlowSteps.js +45 -0
- package/dataform/hooks/useRecordTitle.d.ts +3 -1
- package/dataform/hooks/useRecordTitle.js +12 -5
- package/dataform/hooks/useRequiredFieldManager.d.ts +6 -0
- package/dataform/hooks/useRequiredFieldManager.js +49 -0
- package/dataform/test.d.ts +57 -0
- package/dataform/test.js +247 -0
- package/dataform/utils/defaultParameters.d.ts +6 -0
- package/dataform/utils/defaultParameters.js +54 -0
- package/dataform/utils/index.d.ts +6 -24
- package/dataform/utils/index.js +164 -190
- package/dataform/utils/saveRecord.d.ts +27 -0
- package/dataform/utils/saveRecord.js +163 -0
- package/datagrid/DataGridProvider/DataResolver.js +38 -109
- package/datagrid/DataGridProvider/index.d.ts +6 -0
- package/datagrid/DataGridProvider/index.js +18 -8
- package/datagrid/DataGridProvider/transformViewColumns.js +10 -2
- package/datagrid/DataGridProvider/utils.js +8 -8
- package/datagrid/column-filter/constants.js +38 -3
- package/datagrid/column-filter/utils.js +7 -1
- package/datagrid/context.d.ts +6 -0
- package/datagrid/hooks/useChangeView.js +1 -1
- package/datagrid/hooks/useGridColumnFilter.js +4 -1
- package/datagrid/hooks/useGridDisabled.d.ts +1 -0
- package/datagrid/hooks/useGridDisabled.js +8 -0
- package/datagrid/hooks/useLoadMainGridPage.js +1 -1
- package/datagrid/hooks/useMainGridCommands.js +23 -9
- package/datagrid/hooks/useOpenRecord.js +2 -2
- package/datagrid/hooks/useSubGridCommands.js +23 -45
- package/defaults.d.ts +2 -0
- package/defaults.js +5 -0
- package/dialog/hooks/useCloseDialog.js +17 -15
- package/dialog/hooks/useOpenAlertDialog.js +8 -3
- package/dialog/hooks/useOpenConfirmDialog.js +10 -4
- package/dialog/hooks/useOpenDialog.js +7 -5
- package/dialog/hooks/useOpenErrorDialog.js +8 -3
- package/dialog/hooks/useOpenPromptDialog.js +10 -4
- package/form/FormValidationStringContext.d.ts +1 -0
- package/form/FormValidationStringContext.js +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +3 -0
- package/hooks/useDebouncedValue.js +0 -1
- package/hooks/useElementLayout.js +1 -1
- package/hooks/useIsMobile.js +0 -1
- package/hooks/useItemsWithKey.d.ts +7 -0
- package/hooks/useItemsWithKey.js +13 -0
- package/hooks/useStorageState.js +1 -2
- package/hooks/useSystemColorScheme.d.ts +1 -1
- package/hooks/useSystemColorScheme.js +0 -1
- package/insights/InsightsProvider.d.ts +8 -0
- package/insights/InsightsProvider.js +27 -0
- package/locale/LocaleProvider.d.ts +2 -1
- package/locale/LocaleProvider.js +3 -3
- package/locale/index.d.ts +1 -0
- package/locale/index.js +1 -0
- package/locale/useCurrencySymbol.d.ts +1 -0
- package/locale/useCurrencySymbol.js +12 -0
- package/locale/utils.js +4 -2
- package/metadata/MetadataProvider.d.ts +8 -4
- package/metadata/MetadataProvider.js +23 -17
- package/metadata/context.d.ts +3 -2
- package/metadata/hooks/index.d.ts +1 -1
- package/metadata/hooks/index.js +1 -1
- package/metadata/hooks/useAppExperience.d.ts +1 -0
- package/metadata/hooks/useAppExperience.js +8 -0
- package/metadata/hooks/useAppStore.d.ts +1 -1
- package/metadata/hooks/useAppStore.js +3 -3
- package/metadata/hooks/useExperienceView.js +2 -11
- package/metadata/hooks/useExperienceViewCommands.js +5 -14
- package/metadata/hooks/useExperienceViewLookup.js +2 -11
- package/metadata/hooks/useExperienceViewSubgridCommands.js +5 -14
- package/metadata/hooks/useMetadata.d.ts +11 -10
- package/metadata/hooks/useMetadata.js +4 -16
- package/metadata/hooks/useSchema.d.ts +1 -1
- package/metadata/hooks/useSchema.js +3 -0
- package/mutable/context.d.ts +3 -0
- package/mutable/context.js +8 -0
- package/mutable/utils.js +5 -12
- package/navigation/hooks/useOpenForm.js +4 -0
- package/package.json +6 -10
- package/providers/PageEntityFormProvider/index.d.ts +5 -1
- package/providers/PageEntityFormProvider/index.js +2 -2
- package/recordset/hooks/useRecordSetResult.js +4 -14
- package/route/RouteProvider.d.ts +2 -2
- package/route/RouteProvider.js +4 -1
- package/store/ClientAppStore.js +7 -20
- package/store/ComponentStore.d.ts +1 -1
- package/store/ComponentStore.js +6 -12
- package/store/EventManager.d.ts +2 -2
- package/store/EventManager.js +13 -29
- package/store/SchemaExperienceStore.js +179 -215
- package/store/index.d.ts +0 -1
- package/store/index.js +0 -1
- package/toast-notification/hooks/useCloseToastNotification.js +17 -15
- package/toast-notification/hooks/useOpenToastNotification.js +7 -5
- package/transport/InMemoryDataService/index.js +54 -77
- package/transport/RestDataService/index.d.ts +3 -3
- package/transport/RestDataService/index.js +68 -91
- package/transport/context.d.ts +2 -1
- package/transport/context.js +7 -1
- package/transport/hooks/index.d.ts +1 -0
- package/transport/hooks/index.js +1 -0
- package/transport/hooks/useFileService.d.ts +1 -0
- package/transport/hooks/useFileService.js +9 -0
- package/transport/hooks/useRetriveRecords.d.ts +33 -0
- package/transport/hooks/useRetriveRecords.js +110 -0
- package/utils/calculateColumnWidths.js +1 -1
- package/utils/color.d.ts +1 -0
- package/utils/color.js +14 -0
- package/utils/getAttributeFormattedValue.d.ts +4 -1
- package/utils/getAttributeFormattedValue.js +109 -54
- package/utils/phone.d.ts +13 -0
- package/utils/phone.js +33 -0
- package/appearance/context.d.ts +0 -7
- package/appearance/context.js +0 -5
- package/appearance/hooks/index.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.js +0 -12
- package/appearance/index.d.ts +0 -2
- package/appearance/index.js +0 -20
- package/builders/CommandBuilder.d.ts +0 -176
- package/builders/CommandBuilder.js +0 -567
- package/locale/types.d.ts +0 -2
- /package/{locale → board}/types.js +0 -0
package/app/AppProvider.d.ts
CHANGED
package/app/AppProvider.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AppProvider = void 0;
|
|
13
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -15,35 +6,21 @@ const react_query_1 = require("@tanstack/react-query");
|
|
|
15
6
|
const react_1 = require("react");
|
|
16
7
|
const hooks_1 = require("../metadata/hooks");
|
|
17
8
|
const context_1 = require("./context");
|
|
18
|
-
const AppProvider = ({ children,
|
|
9
|
+
const AppProvider = ({ children, }) => {
|
|
19
10
|
const experienceStore = (0, hooks_1.useExperienceStore)();
|
|
20
|
-
const
|
|
11
|
+
const appExperience = (0, hooks_1.useAppExperience)();
|
|
21
12
|
const { data: schemaMetadataList } = (0, react_query_1.useQuery)({
|
|
22
13
|
queryKey: ['experience-schema-metadata-list'],
|
|
23
|
-
queryFn: () =>
|
|
14
|
+
queryFn: async () => {
|
|
24
15
|
return experienceStore.getExperienceSchemaMetadatList();
|
|
25
|
-
}
|
|
16
|
+
},
|
|
26
17
|
initialData: [],
|
|
27
18
|
});
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
const schemaMetadataDic = (0, react_1.useMemo)(() => {
|
|
35
|
-
var _a;
|
|
36
|
-
return (_a = schemaMetadataList === null || schemaMetadataList === void 0 ? void 0 : schemaMetadataList.reduce((acc, item) => {
|
|
37
|
-
acc[item.logicalName] = item;
|
|
38
|
-
return acc;
|
|
39
|
-
}, {})) !== null && _a !== void 0 ? _a : {};
|
|
40
|
-
}, [schemaMetadataList]);
|
|
41
|
-
if (isLoading) {
|
|
42
|
-
return loadingComponent;
|
|
43
|
-
}
|
|
44
|
-
if (!app) {
|
|
45
|
-
return notFoundComponent;
|
|
46
|
-
}
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)(context_1.AppContext.Provider, { value: { app, schemaMetadataDic, schemaMetadataList }, children: children }));
|
|
19
|
+
const schemaMetadataDic = (0, react_1.useMemo)(() => schemaMetadataList?.reduce((acc, item) => {
|
|
20
|
+
acc[item.logicalName] = item;
|
|
21
|
+
return acc;
|
|
22
|
+
}, {}) ?? {}, [schemaMetadataList]);
|
|
23
|
+
const contextValue = (0, react_1.useMemo)(() => ({ appExperience, schemaMetadataDic, schemaMetadataList }), [appExperience, schemaMetadataDic, schemaMetadataList]);
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(context_1.AppContext.Provider, { value: contextValue, children: children }));
|
|
48
25
|
};
|
|
49
26
|
exports.AppProvider = AppProvider;
|
package/app/AuthWrapper.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
import { AuthProviderPlaceholderProps } from '../auth';
|
|
3
3
|
interface AuthWrapperProps {
|
|
4
|
-
Placeholder
|
|
4
|
+
Placeholder?: FC<AuthProviderPlaceholderProps>;
|
|
5
5
|
}
|
|
6
6
|
export declare const AuthWrapper: FC<PropsWithChildren<AuthWrapperProps>>;
|
|
7
7
|
export {};
|
package/app/AuthWrapper.js
CHANGED
|
@@ -4,7 +4,10 @@ exports.AuthWrapper = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const auth_1 = require("../auth");
|
|
6
6
|
const mutable_1 = require("../mutable");
|
|
7
|
-
const
|
|
7
|
+
const DefaultPlaceHolder = () => {
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
const AuthWrapper = ({ children, Placeholder = DefaultPlaceHolder, }) => {
|
|
8
11
|
const state = (0, mutable_1.useContextSelector)(auth_1.AuthContext, (state) => state);
|
|
9
12
|
if (state.loadError) {
|
|
10
13
|
return (0, jsx_runtime_1.jsx)(Placeholder, { loadingError: true, retry: state.loadSession });
|
package/app/LayoutProvider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDataService } from '@headless-adminapp/core/transport';
|
|
1
|
+
import { IDataService, IFileService } from '@headless-adminapp/core/transport';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { FC, PropsWithChildren } from 'react';
|
|
4
4
|
import { AuthProviderPlaceholderProps, AuthProviderProps } from '../auth';
|
|
@@ -7,12 +7,13 @@ import { MetadataProviderProps } from '../metadata/MetadataProvider';
|
|
|
7
7
|
import { RouteProviderProps } from '../route/RouteProvider';
|
|
8
8
|
export interface LayoutProviderProps {
|
|
9
9
|
routeProps: RouteProviderProps;
|
|
10
|
-
queryClient
|
|
11
|
-
localeProps
|
|
12
|
-
dataService
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
queryClient?: QueryClient;
|
|
11
|
+
localeProps?: LocaleProviderProps;
|
|
12
|
+
dataService?: IDataService;
|
|
13
|
+
fileService?: IFileService;
|
|
14
|
+
authProps?: AuthProviderProps;
|
|
15
|
+
authPlaceholder?: FC<AuthProviderPlaceholderProps>;
|
|
16
|
+
metadataProps?: MetadataProviderProps;
|
|
16
17
|
containers: {
|
|
17
18
|
DialogContainer: FC;
|
|
18
19
|
ProgressIndicatorContainer: FC;
|
package/app/LayoutProvider.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.LayoutProvider = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_query_1 = require("@tanstack/react-query");
|
|
6
6
|
const auth_1 = require("../auth");
|
|
7
|
+
const defaults_1 = require("../defaults");
|
|
7
8
|
const dialog_1 = require("../dialog");
|
|
8
9
|
const locale_1 = require("../locale");
|
|
9
10
|
const metadata_1 = require("../metadata");
|
|
@@ -12,8 +13,33 @@ const recordset_1 = require("../recordset");
|
|
|
12
13
|
const route_1 = require("../route");
|
|
13
14
|
const toast_notification_1 = require("../toast-notification");
|
|
14
15
|
const transport_1 = require("../transport");
|
|
16
|
+
const context_1 = require("../transport/context");
|
|
15
17
|
const AuthWrapper_1 = require("./AuthWrapper");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
+
const dataServiceNotProvidedError = new Error('No data service provided');
|
|
19
|
+
const defaultDataService = {
|
|
20
|
+
createRecord: async () => {
|
|
21
|
+
throw dataServiceNotProvidedError;
|
|
22
|
+
},
|
|
23
|
+
deleteRecord: async () => {
|
|
24
|
+
throw dataServiceNotProvidedError;
|
|
25
|
+
},
|
|
26
|
+
customAction: async () => {
|
|
27
|
+
throw dataServiceNotProvidedError;
|
|
28
|
+
},
|
|
29
|
+
retriveAggregate: async () => {
|
|
30
|
+
throw dataServiceNotProvidedError;
|
|
31
|
+
},
|
|
32
|
+
retriveRecord: async () => {
|
|
33
|
+
throw dataServiceNotProvidedError;
|
|
34
|
+
},
|
|
35
|
+
retriveRecords: async () => {
|
|
36
|
+
throw dataServiceNotProvidedError;
|
|
37
|
+
},
|
|
38
|
+
updateRecord: async () => {
|
|
39
|
+
throw dataServiceNotProvidedError;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const LayoutProvider = ({ authPlaceholder, authProps, dataService = defaultDataService, fileService, localeProps, metadataProps, queryClient = defaults_1.queryClient, routeProps, children, containers: { DialogContainer, ProgressIndicatorContainer, ToastNotificationContainer, }, }) => {
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(route_1.RouteProvider, { ...routeProps, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { ...localeProps, children: (0, jsx_runtime_1.jsx)(metadata_1.MetadataProvider, { ...metadataProps, children: (0, jsx_runtime_1.jsx)(transport_1.DataServiceContext.Provider, { value: dataService, children: (0, jsx_runtime_1.jsx)(context_1.FileServiceContext.Provider, { value: fileService ?? null, children: (0, jsx_runtime_1.jsx)(dialog_1.DialogProvider, { children: (0, jsx_runtime_1.jsx)(progress_indicator_1.ProgressIndicatorProvider, { children: (0, jsx_runtime_1.jsxs)(toast_notification_1.ToastNotificationProvider, { children: [(0, jsx_runtime_1.jsx)(DialogContainer, {}), (0, jsx_runtime_1.jsx)(ProgressIndicatorContainer, {}), (0, jsx_runtime_1.jsx)(ToastNotificationContainer, {}), (0, jsx_runtime_1.jsx)(auth_1.AuthProvider, { ...authProps, children: (0, jsx_runtime_1.jsx)(AuthWrapper_1.AuthWrapper, { Placeholder: authPlaceholder, children: (0, jsx_runtime_1.jsx)(recordset_1.RecordSetProvider, { children: children }) }) })] }) }) }) }) }) }) }) }) }));
|
|
18
44
|
};
|
|
19
45
|
exports.LayoutProvider = LayoutProvider;
|
package/app/context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppExperience } from '@headless-adminapp/core/experience/app';
|
|
2
2
|
import { SchemaExperienceMetadata } from '@headless-adminapp/core/experience/schema';
|
|
3
3
|
export interface AppContextState {
|
|
4
|
-
|
|
4
|
+
appExperience: AppExperience;
|
|
5
5
|
schemaMetadataList: SchemaExperienceMetadata[];
|
|
6
6
|
schemaMetadataDic: Record<string, SchemaExperienceMetadata>;
|
|
7
7
|
}
|
package/auth/AuthProvider.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { FC, PropsWithChildren } from 'react';
|
|
|
2
2
|
import { SessionResolver, UnauthorizeReason } from './types';
|
|
3
3
|
export interface AuthProviderProps {
|
|
4
4
|
onUnauthenticated?: (reason: UnauthorizeReason) => void;
|
|
5
|
-
sessionResolver
|
|
5
|
+
sessionResolver?: SessionResolver;
|
|
6
6
|
}
|
|
7
7
|
export declare const AuthProvider: FC<PropsWithChildren<AuthProviderProps>>;
|
package/auth/AuthProvider.js
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AuthProvider = void 0;
|
|
13
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
14
6
|
const react_1 = require("react");
|
|
15
7
|
const context_1 = require("../mutable/context");
|
|
16
8
|
const context_2 = require("./context");
|
|
17
9
|
const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
|
|
18
10
|
const onUnauthenticatedRef = (0, react_1.useRef)(onUnauthenticated);
|
|
19
11
|
onUnauthenticatedRef.current = onUnauthenticated;
|
|
12
|
+
const queryClient = (0, react_query_1.useQueryClient)();
|
|
20
13
|
const onUnauthenticatedInternal = (0, react_1.useCallback)((reason) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
onUnauthenticatedRef.current?.(reason);
|
|
15
|
+
queryClient.clear();
|
|
16
|
+
queryClient.removeQueries({
|
|
17
|
+
queryKey: ['data'],
|
|
18
|
+
});
|
|
19
|
+
queryClient
|
|
20
|
+
.invalidateQueries({
|
|
21
|
+
queryKey: ['data'],
|
|
22
|
+
})
|
|
23
|
+
.catch(console.error);
|
|
24
|
+
}, [queryClient]);
|
|
24
25
|
const contextValue = (0, context_1.useCreateContextStore)({
|
|
25
|
-
loading:
|
|
26
|
+
loading: !!sessionResolver,
|
|
26
27
|
loadError: false,
|
|
27
|
-
|
|
28
|
+
authenticated: !sessionResolver,
|
|
29
|
+
initialized: !sessionResolver,
|
|
30
|
+
skipAuthCheck: !sessionResolver,
|
|
28
31
|
loadSession: () => Promise.resolve(),
|
|
29
32
|
onUnauthenticated: onUnauthenticatedInternal,
|
|
30
33
|
});
|
|
@@ -32,11 +35,13 @@ const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
|
|
|
32
35
|
const session = state.initialized && state.authenticated && state.session;
|
|
33
36
|
const sessionResolverRef = (0, react_1.useRef)(sessionResolver);
|
|
34
37
|
sessionResolverRef.current = sessionResolver;
|
|
35
|
-
const loadSession = (0, react_1.useCallback)(() =>
|
|
36
|
-
var _a;
|
|
38
|
+
const loadSession = (0, react_1.useCallback)(async () => {
|
|
37
39
|
contextValue.setValue({ loading: true, loadError: false });
|
|
38
40
|
try {
|
|
39
|
-
|
|
41
|
+
if (!sessionResolverRef.current) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const data = await sessionResolverRef.current();
|
|
40
45
|
if (!data) {
|
|
41
46
|
contextValue.setValue({
|
|
42
47
|
initialized: true,
|
|
@@ -44,7 +49,7 @@ const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
|
|
|
44
49
|
sessionExpired: false,
|
|
45
50
|
session: null,
|
|
46
51
|
});
|
|
47
|
-
|
|
52
|
+
onUnauthenticatedRef.current?.('load');
|
|
48
53
|
}
|
|
49
54
|
else {
|
|
50
55
|
contextValue.setValue({
|
|
@@ -61,7 +66,7 @@ const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
|
|
|
61
66
|
finally {
|
|
62
67
|
contextValue.setValue({ loading: false });
|
|
63
68
|
}
|
|
64
|
-
}
|
|
69
|
+
}, [contextValue]);
|
|
65
70
|
(0, react_1.useEffect)(() => {
|
|
66
71
|
contextValue.setValue({ loadSession });
|
|
67
72
|
}, [contextValue, loadSession]);
|
|
@@ -69,7 +74,6 @@ const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
|
|
|
69
74
|
loadSession().catch(console.error);
|
|
70
75
|
}, [loadSession]);
|
|
71
76
|
(0, react_1.useEffect)(() => {
|
|
72
|
-
var _a;
|
|
73
77
|
if (!session) {
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
@@ -82,18 +86,21 @@ const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
|
|
|
82
86
|
sessionExpired: true,
|
|
83
87
|
session: null,
|
|
84
88
|
});
|
|
85
|
-
|
|
89
|
+
onUnauthenticatedRef.current?.('sessionExpired');
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const MAX_TIMEOUT = 2147483647;
|
|
93
|
+
if (timeout > MAX_TIMEOUT) {
|
|
86
94
|
return;
|
|
87
95
|
}
|
|
88
96
|
const timer = setTimeout(() => {
|
|
89
|
-
var _a;
|
|
90
97
|
contextValue.setValue({
|
|
91
98
|
initialized: true,
|
|
92
99
|
authenticated: false,
|
|
93
100
|
sessionExpired: true,
|
|
94
101
|
session: null,
|
|
95
102
|
});
|
|
96
|
-
|
|
103
|
+
onUnauthenticatedRef.current?.('sessionExpired');
|
|
97
104
|
}, timeout);
|
|
98
105
|
return () => {
|
|
99
106
|
clearTimeout(timer);
|
package/auth/context.d.ts
CHANGED
|
@@ -16,10 +16,12 @@ interface AuthStoreAuthorizedState<T extends AuthSession = AuthSession> {
|
|
|
16
16
|
export type AuthState = (AuthStoreLoadingState | AuthStoreUnauthorizedState | AuthStoreAuthorizedState) & {
|
|
17
17
|
loading: boolean;
|
|
18
18
|
loadError: boolean;
|
|
19
|
+
skipAuthCheck?: boolean;
|
|
19
20
|
loadSession: () => Promise<void>;
|
|
20
21
|
onUnauthenticated?: (reason: UnauthorizeReason) => void;
|
|
21
22
|
};
|
|
22
23
|
export interface AuthSession {
|
|
24
|
+
id: string;
|
|
23
25
|
exp: number;
|
|
24
26
|
fullName: string;
|
|
25
27
|
email: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsSkipAuthCheck(): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsSkipAuthCheck = useIsSkipAuthCheck;
|
|
4
|
+
const mutable_1 = require("../../mutable");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useIsSkipAuthCheck() {
|
|
7
|
+
return (0, mutable_1.useContextSelector)(context_1.AuthContext, (state) => state.skipAuthCheck ?? false);
|
|
8
|
+
}
|
package/auth/hooks/useLogout.js
CHANGED
|
@@ -13,7 +13,7 @@ function useLogout() {
|
|
|
13
13
|
authenticated: false,
|
|
14
14
|
session: null,
|
|
15
15
|
});
|
|
16
|
-
onUnauthenticated
|
|
16
|
+
onUnauthenticated?.('logout');
|
|
17
17
|
}, [setValue, onUnauthenticated]);
|
|
18
18
|
return logout;
|
|
19
19
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DataResolver(): null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataResolver = DataResolver;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const hooks_1 = require("../hooks");
|
|
6
|
+
const mutable_1 = require("../mutable");
|
|
7
|
+
const useRetriveRecords_1 = require("../transport/hooks/useRetriveRecords");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
const useBoardColumnConfig_1 = require("./hooks/useBoardColumnConfig");
|
|
10
|
+
const useBoardConfig_1 = require("./hooks/useBoardConfig");
|
|
11
|
+
const useSearchText_1 = require("./hooks/useSearchText");
|
|
12
|
+
const MAX_RECORDS = 10000;
|
|
13
|
+
function DataResolver() {
|
|
14
|
+
const { schema, sorting, projection: { columns, expand }, } = (0, useBoardConfig_1.useBoardConfig)();
|
|
15
|
+
const [searchText] = (0, useSearchText_1.useSearchText)();
|
|
16
|
+
const { filter, maxRecords = MAX_RECORDS } = (0, useBoardColumnConfig_1.useBoardColumnConfig)();
|
|
17
|
+
const setState = (0, mutable_1.useContextSetValue)(context_1.BoardColumnContext);
|
|
18
|
+
const [search] = (0, hooks_1.useDebouncedValue)(searchText, 500);
|
|
19
|
+
const queryKey = (0, useRetriveRecords_1.useRetrieveRecordsKey)({
|
|
20
|
+
columns,
|
|
21
|
+
expand,
|
|
22
|
+
filter,
|
|
23
|
+
maxRecords,
|
|
24
|
+
schema,
|
|
25
|
+
search,
|
|
26
|
+
sorting,
|
|
27
|
+
});
|
|
28
|
+
(0, useRetriveRecords_1.useClearDataExceptFirstPage)(queryKey);
|
|
29
|
+
const { fetchNextPage, data, hasNextPage, isFetching, isFetchingNextPage } = (0, useRetriveRecords_1.useRetriveRecords)(queryKey, {
|
|
30
|
+
columns,
|
|
31
|
+
expand,
|
|
32
|
+
filter,
|
|
33
|
+
maxRecords,
|
|
34
|
+
schema,
|
|
35
|
+
search,
|
|
36
|
+
sorting,
|
|
37
|
+
});
|
|
38
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
setState({
|
|
40
|
+
fetchNextPage: fetchNextPage,
|
|
41
|
+
});
|
|
42
|
+
}, [fetchNextPage, setState]);
|
|
43
|
+
(0, react_1.useEffect)(() => {
|
|
44
|
+
if (!data) {
|
|
45
|
+
setState({
|
|
46
|
+
data: null,
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
setState({
|
|
51
|
+
data,
|
|
52
|
+
});
|
|
53
|
+
}, [data, setState, schema.idAttribute]);
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
setState({
|
|
56
|
+
dataState: {
|
|
57
|
+
isFetching,
|
|
58
|
+
hasNextPage,
|
|
59
|
+
isFetchingNextPage,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}, [hasNextPage, isFetching, isFetchingNextPage, setState]);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { BoardColumnConfig } from './types';
|
|
3
|
+
export declare function invertValueMapping(value: Record<string, string[]>): Record<string, string[]>;
|
|
4
|
+
export interface BoardColumnProviderProps {
|
|
5
|
+
config: BoardColumnConfig;
|
|
6
|
+
}
|
|
7
|
+
export declare function BoardColumnProvider(props: PropsWithChildren<BoardColumnProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invertValueMapping = invertValueMapping;
|
|
4
|
+
exports.BoardColumnProvider = BoardColumnProvider;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const mutable_1 = require("../mutable");
|
|
7
|
+
const BoardColumnDataResolver_1 = require("./BoardColumnDataResolver");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
const useBoardConfig_1 = require("./hooks/useBoardConfig");
|
|
10
|
+
function invertValueMapping(value) {
|
|
11
|
+
return Object.keys(value).reduce((acc, key) => {
|
|
12
|
+
const toKeys = value[key];
|
|
13
|
+
toKeys.forEach((toKey) => {
|
|
14
|
+
acc[toKey] = [...(acc[toKey] || []), key];
|
|
15
|
+
});
|
|
16
|
+
return acc;
|
|
17
|
+
}, {});
|
|
18
|
+
}
|
|
19
|
+
function BoardColumnProvider(props) {
|
|
20
|
+
const { schema } = (0, useBoardConfig_1.useBoardConfig)();
|
|
21
|
+
const contextValue = (0, mutable_1.useCreateContextStore)({
|
|
22
|
+
config: props.config,
|
|
23
|
+
data: {
|
|
24
|
+
logicalName: schema.logicalName,
|
|
25
|
+
records: [],
|
|
26
|
+
count: 0,
|
|
27
|
+
},
|
|
28
|
+
dataState: {
|
|
29
|
+
hasNextPage: false,
|
|
30
|
+
isFetching: false,
|
|
31
|
+
isFetchingNextPage: false,
|
|
32
|
+
},
|
|
33
|
+
fetchNextPage: () => { },
|
|
34
|
+
});
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(context_1.BoardColumnContext.Provider, { value: contextValue, children: [(0, jsx_runtime_1.jsx)(BoardColumnDataResolver_1.DataResolver, {}), props.children] }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import type { RetriveRecordsResult } from '@headless-adminapp/core/transport';
|
|
3
|
+
import { BoardColumnConfig, BoardConfig } from './types';
|
|
4
|
+
export interface BoardContextState<S extends SchemaAttributes = SchemaAttributes> {
|
|
5
|
+
config: BoardConfig<S>;
|
|
6
|
+
searchText: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BoardColumnContextState<S extends SchemaAttributes = SchemaAttributes> {
|
|
9
|
+
config: BoardColumnConfig;
|
|
10
|
+
data: RetriveRecordsResult<InferredSchemaType<S>> | null;
|
|
11
|
+
dataState: {
|
|
12
|
+
isFetching: boolean;
|
|
13
|
+
hasNextPage: boolean;
|
|
14
|
+
isFetchingNextPage: boolean;
|
|
15
|
+
};
|
|
16
|
+
fetchNextPage: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const BoardContext: import("react").Context<import("../mutable").ContextValue<BoardContextState<SchemaAttributes>>>;
|
|
19
|
+
export declare const BoardColumnContext: import("react").Context<import("../mutable").ContextValue<BoardColumnContextState<SchemaAttributes>>>;
|
package/board/context.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardColumnContext = exports.BoardContext = void 0;
|
|
4
|
+
const mutable_1 = require("../mutable");
|
|
5
|
+
exports.BoardContext = (0, mutable_1.createContext)();
|
|
6
|
+
exports.BoardColumnContext = (0, mutable_1.createContext)();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useBoardColumnConfig } from './useBoardColumnConfig';
|
|
2
|
+
export { useBoardColumnData } from './useBoardColumnData';
|
|
3
|
+
export { useBoardColumnDataState } from './useBoardColumnDataState';
|
|
4
|
+
export { useBoardConfig } from './useBoardConfig';
|
|
5
|
+
export { useBoardSchema } from './useBoardSchema';
|
|
6
|
+
export { useSearchText } from './useSearchText';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchText = exports.useBoardSchema = exports.useBoardConfig = exports.useBoardColumnDataState = exports.useBoardColumnData = exports.useBoardColumnConfig = void 0;
|
|
4
|
+
var useBoardColumnConfig_1 = require("./useBoardColumnConfig");
|
|
5
|
+
Object.defineProperty(exports, "useBoardColumnConfig", { enumerable: true, get: function () { return useBoardColumnConfig_1.useBoardColumnConfig; } });
|
|
6
|
+
var useBoardColumnData_1 = require("./useBoardColumnData");
|
|
7
|
+
Object.defineProperty(exports, "useBoardColumnData", { enumerable: true, get: function () { return useBoardColumnData_1.useBoardColumnData; } });
|
|
8
|
+
var useBoardColumnDataState_1 = require("./useBoardColumnDataState");
|
|
9
|
+
Object.defineProperty(exports, "useBoardColumnDataState", { enumerable: true, get: function () { return useBoardColumnDataState_1.useBoardColumnDataState; } });
|
|
10
|
+
var useBoardConfig_1 = require("./useBoardConfig");
|
|
11
|
+
Object.defineProperty(exports, "useBoardConfig", { enumerable: true, get: function () { return useBoardConfig_1.useBoardConfig; } });
|
|
12
|
+
var useBoardSchema_1 = require("./useBoardSchema");
|
|
13
|
+
Object.defineProperty(exports, "useBoardSchema", { enumerable: true, get: function () { return useBoardSchema_1.useBoardSchema; } });
|
|
14
|
+
var useSearchText_1 = require("./useSearchText");
|
|
15
|
+
Object.defineProperty(exports, "useSearchText", { enumerable: true, get: function () { return useSearchText_1.useSearchText; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardColumnConfig = useBoardColumnConfig;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardColumnConfig() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.BoardColumnContext, (context) => context.config);
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardColumnData = useBoardColumnData;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardColumnData() {
|
|
7
|
+
const data = (0, context_1.useContextSelector)(context_2.BoardColumnContext, (state) => state.data);
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardColumnDataState = useBoardColumnDataState;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardColumnDataState() {
|
|
7
|
+
const data = (0, context_1.useContextSelector)(context_2.BoardColumnContext, (state) => state.dataState);
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardConfig = useBoardConfig;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardConfig() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.BoardContext, (context) => context.config);
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useSearchText(): readonly [string, (value: string) => void];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchText = useSearchText;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useSearchText() {
|
|
8
|
+
const searchText = (0, context_1.useContextSelector)(context_2.BoardContext, (context) => context.searchText);
|
|
9
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.BoardContext);
|
|
10
|
+
const setSearchText = (0, react_1.useCallback)((value) => {
|
|
11
|
+
setValue({ searchText: value });
|
|
12
|
+
}, [setValue]);
|
|
13
|
+
return [searchText, setSearchText];
|
|
14
|
+
}
|