@headless-adminapp/app 0.0.17-alpha.8 → 1.0.0
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.d.ts +1 -1
- package/metadata/hooks/useExperienceViewCommands.js +5 -14
- package/metadata/hooks/useExperienceViewLookup.js +2 -11
- package/metadata/hooks/useExperienceViewSubgridCommands.d.ts +1 -1
- 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
|
@@ -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.useExperienceViewSubgridCommands = useExperienceViewSubgridCommands;
|
|
13
4
|
const app_1 = require("@headless-adminapp/app/app");
|
|
@@ -16,16 +7,16 @@ const useExperienceStore_1 = require("./useExperienceStore");
|
|
|
16
7
|
/** @todo move in different dir */
|
|
17
8
|
function useExperienceViewSubgridCommands(logicalName) {
|
|
18
9
|
const experienceStore = (0, useExperienceStore_1.useExperienceStore)();
|
|
19
|
-
const {
|
|
10
|
+
const { appExperience: { subgridCommands }, } = (0, app_1.useAppContext)();
|
|
20
11
|
const { data: commands } = (0, react_query_1.useQuery)({
|
|
21
12
|
queryKey: ['experience-schema-view-subgrid-commands', logicalName],
|
|
22
|
-
queryFn: () =>
|
|
23
|
-
let commands =
|
|
13
|
+
queryFn: async () => {
|
|
14
|
+
let commands = await experienceStore.getSubgridCommands(logicalName);
|
|
24
15
|
if (!commands) {
|
|
25
16
|
commands = subgridCommands;
|
|
26
17
|
}
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
18
|
+
return commands ?? [];
|
|
19
|
+
},
|
|
29
20
|
initialData: [],
|
|
30
21
|
});
|
|
31
22
|
return {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { AppExperience } from '@headless-adminapp/core/experience/app';
|
|
2
|
+
import type { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
|
+
import type { ISchemaExperienceStore, ISchemaStore } from '@headless-adminapp/core/store';
|
|
4
|
+
interface UseMetadataResult {
|
|
5
|
+
schemas: Record<string, Schema<SchemaAttributes>>;
|
|
6
|
+
schemaStore: ISchemaStore<SchemaAttributes>;
|
|
7
|
+
appExperience: AppExperience;
|
|
8
|
+
experienceStore: ISchemaExperienceStore;
|
|
9
|
+
}
|
|
10
|
+
export declare function useMetadata(): UseMetadataResult;
|
|
11
|
+
export {};
|
|
@@ -6,25 +6,13 @@ const context_1 = require("../../mutable/context");
|
|
|
6
6
|
const context_2 = require("../context");
|
|
7
7
|
function useMetadata() {
|
|
8
8
|
const schemaStore = (0, context_1.useContextSelector)(context_2.MetadataContext, (state) => state.schemaStore);
|
|
9
|
-
const
|
|
9
|
+
const appExperience = (0, context_1.useContextSelector)(context_2.MetadataContext, (state) => state.appExperience);
|
|
10
10
|
const experienceStore = (0, context_1.useContextSelector)(context_2.MetadataContext, (state) => state.experienceStore);
|
|
11
|
-
// const schemaLoading = useContextSelector(
|
|
12
|
-
// MetadataContext,
|
|
13
|
-
// (state) => state.schemaLoading
|
|
14
|
-
// );
|
|
15
|
-
const schemaLoading = false;
|
|
16
11
|
const schemas = schemaStore.getAllSchema();
|
|
17
|
-
|
|
18
|
-
const getSchema = (0, react_1.useCallback)((logicalName) => {
|
|
19
|
-
return schemaStore.getSchema(logicalName);
|
|
20
|
-
}, [schemaStore]);
|
|
21
|
-
return {
|
|
12
|
+
return (0, react_1.useMemo)(() => ({
|
|
22
13
|
schemas,
|
|
23
|
-
schemaLoading,
|
|
24
|
-
/*** @deprecated */
|
|
25
|
-
getSchema,
|
|
26
14
|
schemaStore,
|
|
27
|
-
|
|
15
|
+
appExperience,
|
|
28
16
|
experienceStore,
|
|
29
|
-
};
|
|
17
|
+
}), [schemas, schemaStore, appExperience, experienceStore]);
|
|
30
18
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
-
export declare function useSchema<S extends SchemaAttributes = SchemaAttributes>(logicalName: string): import("@headless-adminapp/core/schema").Schema<S
|
|
2
|
+
export declare function useSchema<S extends SchemaAttributes = SchemaAttributes>(logicalName: string): import("@headless-adminapp/core/schema").Schema<S> | null;
|
|
@@ -4,5 +4,8 @@ exports.useSchema = useSchema;
|
|
|
4
4
|
const useMetadata_1 = require("./useMetadata");
|
|
5
5
|
function useSchema(logicalName) {
|
|
6
6
|
const { schemaStore } = (0, useMetadata_1.useMetadata)();
|
|
7
|
+
if (!schemaStore.hasSchema(logicalName)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
7
10
|
return schemaStore.getSchema(logicalName);
|
|
8
11
|
}
|
package/mutable/context.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export type ContextValue<T> = MutableValue<T>;
|
|
|
4
4
|
export declare const useContextSelectorInternal: typeof useMutableValueSelector;
|
|
5
5
|
export declare function createContext<T>(): import("react").Context<ContextValue<T>>;
|
|
6
6
|
export declare function useCreateContextStore<T>(initialValue: T): MutableValue<T>;
|
|
7
|
+
export declare function useContextValue<T>(context: React.Context<ContextValue<T>>): {
|
|
8
|
+
current: T;
|
|
9
|
+
};
|
|
7
10
|
export declare function useContextSelector<T, R>(context: React.Context<ContextValue<T>>, selector: (state: T) => R): R;
|
|
8
11
|
export declare function useContextSetValue<T>(context: React.Context<ContextValue<T>>): (value: Partial<T> | ((state: T) => Partial<T>)) => void;
|
|
9
12
|
type Setter<T, U extends unknown[]> = (setValue: ContextValue<T>['setValue']) => (...args: U) => void;
|
package/mutable/context.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useContextSelectorInternal = void 0;
|
|
4
4
|
exports.createContext = createContext;
|
|
5
5
|
exports.useCreateContextStore = useCreateContextStore;
|
|
6
|
+
exports.useContextValue = useContextValue;
|
|
6
7
|
exports.useContextSelector = useContextSelector;
|
|
7
8
|
exports.useContextSetValue = useContextSetValue;
|
|
8
9
|
exports.useContextValueSetter = useContextValueSetter;
|
|
@@ -18,6 +19,13 @@ function useCreateContextStore(initialValue) {
|
|
|
18
19
|
const [state] = (0, react_1.useState)(() => createContextValue(initialValue));
|
|
19
20
|
return state;
|
|
20
21
|
}
|
|
22
|
+
function useContextValue(context) {
|
|
23
|
+
const contextValue = (0, react_1.useContext)(context);
|
|
24
|
+
if (!contextValue) {
|
|
25
|
+
throw new Error('useContextValue must be used within a Provider');
|
|
26
|
+
}
|
|
27
|
+
return contextValue.value;
|
|
28
|
+
}
|
|
21
29
|
function useContextSelector(context, selector) {
|
|
22
30
|
const contextValue = (0, react_1.useContext)(context);
|
|
23
31
|
if (!contextValue) {
|
package/mutable/utils.js
CHANGED
|
@@ -12,20 +12,13 @@ function createMutableValue(initialValue, isArray) {
|
|
|
12
12
|
value: storeValue,
|
|
13
13
|
setValue: (value) => {
|
|
14
14
|
if (typeof value === 'function') {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
storeValue.current = Object.assign(Object.assign({}, storeValue.current), value(storeValue.current));
|
|
20
|
-
}
|
|
15
|
+
value = value(storeValue.current);
|
|
16
|
+
}
|
|
17
|
+
if (isArray) {
|
|
18
|
+
storeValue.current = value;
|
|
21
19
|
}
|
|
22
20
|
else {
|
|
23
|
-
|
|
24
|
-
storeValue.current = value;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
storeValue.current = Object.assign(Object.assign({}, storeValue.current), value);
|
|
28
|
-
}
|
|
21
|
+
storeValue.current = { ...storeValue.current, ...value };
|
|
29
22
|
}
|
|
30
23
|
listeners.forEach((listener) => listener(storeValue.current));
|
|
31
24
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOpenForm = useOpenForm;
|
|
4
|
+
const defaultParameters_1 = require("@headless-adminapp/app/dataform/utils/defaultParameters");
|
|
4
5
|
const app_1 = require("@headless-adminapp/core/experience/app");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const hooks_1 = require("../../route/hooks/");
|
|
@@ -14,6 +15,9 @@ function useOpenForm() {
|
|
|
14
15
|
type: app_1.PageType.EntityForm,
|
|
15
16
|
id: options.id,
|
|
16
17
|
});
|
|
18
|
+
if (options.parameters) {
|
|
19
|
+
(0, defaultParameters_1.setFormDefaultParameters)(options.logicalName, options.parameters);
|
|
20
|
+
}
|
|
17
21
|
if (options.replace) {
|
|
18
22
|
router.replace(path);
|
|
19
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/app",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -16,13 +16,7 @@
|
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/headless-adminapp/adminapp/issues"
|
|
18
18
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
-
"ts-check": "tsc --noEmit",
|
|
22
|
-
"copy-files": "cp package.json dist && cp src/index.css dist",
|
|
23
|
-
"prepublishOnly": "pnpm run build && pnpm run copy-files",
|
|
24
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
25
|
-
},
|
|
19
|
+
"scripts": {},
|
|
26
20
|
"keywords": [],
|
|
27
21
|
"author": "",
|
|
28
22
|
"license": "ISC",
|
|
@@ -33,10 +27,12 @@
|
|
|
33
27
|
"dayjs": "^1.11.13",
|
|
34
28
|
"exceljs": "^4.4.0",
|
|
35
29
|
"json-to-csv-export": "^2.1.1",
|
|
30
|
+
"libphonenumber-js": "1.11.20",
|
|
36
31
|
"lodash": "^4.17.21",
|
|
37
32
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
38
33
|
"react-hook-form": "7.52.2",
|
|
34
|
+
"uuid": "11.0.3",
|
|
39
35
|
"yup": "^1.4.0"
|
|
40
36
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
-
}
|
|
37
|
+
"gitHead": "2b03aadc605acf3bc18270afce4cbd9072b0b6ae"
|
|
38
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { EntityMainFormCommandItemExperience, Form } from '@headless-adminapp/core/experience/form';
|
|
2
2
|
import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
3
|
import { PropsWithChildren } from 'react';
|
|
4
|
+
import { RetriveRecordFn } from '../../dataform/DataFormProvider/types';
|
|
5
|
+
import { SaveRecordFn } from '../../dataform/utils/saveRecord';
|
|
4
6
|
interface PageEntityFormProviderProps<S extends SchemaAttributes> {
|
|
5
7
|
schema: Schema<S>;
|
|
6
8
|
form: Form<S>;
|
|
7
9
|
recordId?: string;
|
|
8
10
|
commands: EntityMainFormCommandItemExperience[][];
|
|
11
|
+
retriveRecordFn?: RetriveRecordFn<S>;
|
|
12
|
+
saveRecordFn?: SaveRecordFn;
|
|
9
13
|
}
|
|
10
|
-
export declare function PageEntityFormProvider<S extends SchemaAttributes>({ schema, form, recordId, children, commands, }: PropsWithChildren<PageEntityFormProviderProps<S>>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function PageEntityFormProvider<S extends SchemaAttributes>({ schema, form, recordId, children, commands, retriveRecordFn, saveRecordFn, }: PropsWithChildren<PageEntityFormProviderProps<S>>): import("react/jsx-runtime").JSX.Element;
|
|
11
15
|
export {};
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PageEntityFormProvider = PageEntityFormProvider;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const DataFormProvider_1 = require("../../dataform/DataFormProvider");
|
|
6
|
-
function PageEntityFormProvider({ schema, form, recordId, children, commands, }) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(DataFormProvider_1.DataFormProvider, { schema: schema, form: form, recordId: recordId, commands: commands, children: children }));
|
|
6
|
+
function PageEntityFormProvider({ schema, form, recordId, children, commands, retriveRecordFn, saveRecordFn, }) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(DataFormProvider_1.DataFormProvider, { schema: schema, form: form, recordId: recordId, commands: commands, retriveRecordFn: retriveRecordFn, saveRecordFn: saveRecordFn, children: children }));
|
|
8
8
|
}
|
|
@@ -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.useRecordSetResult = useRecordSetResult;
|
|
13
4
|
const react_query_1 = require("@tanstack/react-query");
|
|
@@ -29,26 +20,25 @@ function useRecordSetResult() {
|
|
|
29
20
|
}, [context.logicalName, schemaStore]);
|
|
30
21
|
const cardView = context.cardView;
|
|
31
22
|
const columns = (0, react_1.useMemo)(() => {
|
|
32
|
-
var _a;
|
|
33
23
|
if (!cardView) {
|
|
34
24
|
return [];
|
|
35
25
|
}
|
|
36
26
|
return Array.from(new Set([
|
|
37
27
|
cardView.primaryColumn,
|
|
38
28
|
cardView.avatarColumn,
|
|
39
|
-
...(
|
|
29
|
+
...(cardView.secondaryColumns ?? [])
|
|
40
30
|
.filter((x) => !x.expandedKey)
|
|
41
31
|
.map((x) => x.name),
|
|
42
32
|
])).filter(Boolean);
|
|
43
33
|
}, [cardView]);
|
|
44
34
|
const { isPending, data, error } = (0, react_query_1.useQuery)({
|
|
45
35
|
queryKey: ['data', 'recordset', context.logicalName, context.ids, columns],
|
|
46
|
-
queryFn: () =>
|
|
36
|
+
queryFn: async () => {
|
|
47
37
|
if (!context.logicalName || !context.ids.length || !cardView) {
|
|
48
38
|
return [];
|
|
49
39
|
}
|
|
50
40
|
const schema = schemaStore.getSchema(context.logicalName);
|
|
51
|
-
const result =
|
|
41
|
+
const result = await dataService.retriveRecords({
|
|
52
42
|
logicalName: context.logicalName,
|
|
53
43
|
filter: {
|
|
54
44
|
type: 'and',
|
|
@@ -66,7 +56,7 @@ function useRecordSetResult() {
|
|
|
66
56
|
});
|
|
67
57
|
const sortedData = (0, lodash_1.sortBy)(result.records, (x) => context.ids.indexOf(x[schema.idAttribute]));
|
|
68
58
|
return sortedData;
|
|
69
|
-
}
|
|
59
|
+
},
|
|
70
60
|
});
|
|
71
61
|
if (error) {
|
|
72
62
|
console.error(error);
|
package/route/RouteProvider.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface RouteProviderProps {
|
|
|
7
7
|
pathname: string;
|
|
8
8
|
searchParams: ReadonlyURLSearchParams;
|
|
9
9
|
basePath?: string;
|
|
10
|
-
routeResolver
|
|
11
|
-
isRouteActive
|
|
10
|
+
routeResolver?: RouteResolver;
|
|
11
|
+
isRouteActive?: IsRouteActive;
|
|
12
12
|
}
|
|
13
13
|
export declare const RouteProvider: FC<PropsWithChildren<RouteProviderProps>>;
|
package/route/RouteProvider.js
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RouteProvider = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const route_1 = require("@headless-adminapp/core/experience/route");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const context_1 = require("./context");
|
|
7
|
-
const
|
|
8
|
+
const defaultRouteResolver = (0, route_1.createRouteResolver)(route_1.defaultRouteInfo);
|
|
9
|
+
const defaultIsRouteActive = (0, route_1.createIsRouteActive)(route_1.defaultRouteInfo);
|
|
10
|
+
const RouteProvider = ({ children, pathname, router, searchParams, basePath, routeResolver = defaultRouteResolver, isRouteActive = defaultIsRouteActive, }) => {
|
|
8
11
|
const basePathRef = (0, react_1.useRef)(basePath);
|
|
9
12
|
basePathRef.current = basePath;
|
|
10
13
|
const routeResolverRef = (0, react_1.useRef)(routeResolver);
|
package/store/ClientAppStore.js
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
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.ClientAppStore = void 0;
|
|
13
4
|
class ClientAppStore {
|
|
14
|
-
|
|
15
|
-
this.apps = {};
|
|
16
|
-
}
|
|
5
|
+
apps = {};
|
|
17
6
|
register(app) {
|
|
18
7
|
this.apps[app.id] = app;
|
|
19
8
|
}
|
|
20
|
-
getApp(id) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return app;
|
|
27
|
-
});
|
|
9
|
+
async getApp(id) {
|
|
10
|
+
const app = this.apps[id];
|
|
11
|
+
if (!app) {
|
|
12
|
+
throw new Error(`App Experience for ${id} not found`);
|
|
13
|
+
}
|
|
14
|
+
return app;
|
|
28
15
|
}
|
|
29
16
|
}
|
|
30
17
|
exports.ClientAppStore = ClientAppStore;
|
|
@@ -2,5 +2,5 @@ import { IComponentStore } from '@headless-adminapp/core/store';
|
|
|
2
2
|
export declare class ComponentStore implements IComponentStore {
|
|
3
3
|
private components;
|
|
4
4
|
registerComponent<T>(name: string, component: T): void;
|
|
5
|
-
|
|
5
|
+
getComponent<T>(name: string): T | null;
|
|
6
6
|
}
|
package/store/ComponentStore.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComponentStore = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
4
|
class ComponentStore {
|
|
6
|
-
|
|
7
|
-
this.components = {};
|
|
8
|
-
}
|
|
5
|
+
components = {};
|
|
9
6
|
registerComponent(name, component) {
|
|
10
7
|
this.components[name] = component;
|
|
11
8
|
}
|
|
12
|
-
|
|
9
|
+
getComponent(name) {
|
|
13
10
|
const self = this;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const Component = self.components[name];
|
|
19
|
-
return (0, jsx_runtime_1.jsx)(Component, Object.assign({}, props));
|
|
20
|
-
};
|
|
11
|
+
if (!self.components[name]) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return self.components[name];
|
|
21
15
|
}
|
|
22
16
|
}
|
|
23
17
|
exports.ComponentStore = ComponentStore;
|
package/store/EventManager.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IEventManager } from '@headless-adminapp/core/store';
|
|
2
2
|
export declare class EventManager implements IEventManager {
|
|
3
3
|
private handlers;
|
|
4
|
-
on<T>(key: string, handler: T):
|
|
5
|
-
off<T>(key: string, handler: T):
|
|
4
|
+
on<T>(key: string, handler: T): void;
|
|
5
|
+
off<T>(key: string, handler: T): void;
|
|
6
6
|
emit(key: string, ...args: any[]): any[];
|
|
7
7
|
}
|
package/store/EventManager.js
CHANGED
|
@@ -1,41 +1,25 @@
|
|
|
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.EventManager = void 0;
|
|
13
4
|
class EventManager {
|
|
14
|
-
|
|
15
|
-
this.handlers = {};
|
|
16
|
-
}
|
|
5
|
+
handlers = {};
|
|
17
6
|
on(key, handler) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.handlers[key].push(handler);
|
|
23
|
-
});
|
|
7
|
+
if (!this.handlers[key]) {
|
|
8
|
+
this.handlers[key] = [];
|
|
9
|
+
}
|
|
10
|
+
this.handlers[key].push(handler);
|
|
24
11
|
}
|
|
25
12
|
off(key, handler) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
});
|
|
13
|
+
if (!this.handlers[key]) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
this.handlers[key] = this.handlers[key].filter((h) => h !== handler);
|
|
17
|
+
if (this.handlers[key].length === 0) {
|
|
18
|
+
delete this.handlers[key];
|
|
19
|
+
}
|
|
35
20
|
}
|
|
36
21
|
emit(key, ...args) {
|
|
37
|
-
|
|
38
|
-
const handlers = ((_a = this.handlers[key]) !== null && _a !== void 0 ? _a : []);
|
|
22
|
+
const handlers = (this.handlers[key] ?? []);
|
|
39
23
|
return handlers.map((handler) => handler(...args));
|
|
40
24
|
}
|
|
41
25
|
}
|