@headless-adminapp/app 0.0.17-alpha.50 → 0.0.17-alpha.53
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.js +13 -17
- package/app/AuthWrapper.js +9 -13
- package/app/LayoutProvider.js +16 -20
- package/app/context.js +2 -5
- package/app/hooks/index.js +1 -17
- package/app/hooks/useAppContext.js +4 -7
- package/app/index.js +4 -11
- package/auth/AuthProvider.js +17 -21
- package/auth/context.d.ts +1 -1
- package/auth/context.js +2 -5
- package/auth/hooks/index.js +2 -18
- package/auth/hooks/useAuthSession.js +4 -7
- package/auth/hooks/useIsSkipAuthCheck.js +4 -7
- package/auth/hooks/useLogout.js +7 -10
- package/auth/index.js +4 -23
- package/auth/types.js +1 -2
- package/board/BoardColumnDataResolver.js +20 -23
- package/board/BoardColumnProvider.js +10 -14
- package/board/context.js +3 -6
- package/board/hooks/index.js +6 -15
- package/board/hooks/useBoardColumnConfig.js +4 -7
- package/board/hooks/useBoardColumnData.js +4 -7
- package/board/hooks/useBoardColumnDataState.js +4 -7
- package/board/hooks/useBoardConfig.js +4 -7
- package/board/hooks/useBoardSchema.js +3 -6
- package/board/hooks/useSearchText.js +7 -10
- package/board/types.js +1 -2
- package/board/utils.js +1 -4
- package/builders/CommandBuilder/CommandBuilder.js +10 -13
- package/builders/CommandBuilder/DefaultCommandBuilder.js +22 -25
- package/builders/CommandBuilder/FormCommandBuilder.js +9 -12
- package/builders/CommandBuilder/SubgridCommandBuilder.js +11 -14
- package/builders/CommandBuilder/ViewCommandBuilder.js +14 -17
- package/builders/CommandBuilder/index.js +1 -5
- package/builders/CommandBuilder/utils.js +2 -6
- package/builders/SchemaExperienceBuilder.js +1 -5
- package/builders/index.js +2 -7
- package/builders/utils.js +12 -41
- package/command/hooks/index.js +2 -18
- package/command/hooks/useBaseCommandHandlerContext.js +25 -29
- package/command/hooks/useCommands.js +6 -9
- package/command/index.js +2 -18
- package/command/types.js +1 -2
- package/command/utils/index.js +4 -7
- package/components/ScrollView/index.js +4 -11
- package/components/ScrollbarWithMoreDataRequest/index.js +9 -13
- package/dataform/DataFormProvider/DataResolver.d.ts +2 -2
- package/dataform/DataFormProvider/DataResolver.js +31 -32
- package/dataform/DataFormProvider/InitialValueResolver.js +19 -22
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +9 -12
- package/dataform/DataFormProvider/index.js +22 -25
- package/dataform/context.js +2 -5
- package/dataform/hooks/index.js +13 -29
- package/dataform/hooks/useFormInstance.js +3 -6
- package/dataform/hooks/useFormIsDirty.js +3 -6
- package/dataform/hooks/useFormIsReadonly.js +4 -7
- package/dataform/hooks/useFormNotifications.js +7 -10
- package/dataform/hooks/useFormRecord.js +4 -7
- package/dataform/hooks/useFormSave.js +30 -33
- package/dataform/hooks/useFormSchema.js +4 -7
- package/dataform/hooks/useLoadFormGridPage.js +10 -13
- package/dataform/hooks/useMainFormCommands.js +27 -32
- package/dataform/hooks/useProcessFlowSteps.js +18 -21
- package/dataform/hooks/useRecordId.js +4 -7
- package/dataform/hooks/useRecordTitle.d.ts +3 -1
- package/dataform/hooks/useRecordTitle.js +11 -14
- package/dataform/hooks/useSelectedForm.js +4 -7
- package/dataform/index.js +4 -23
- package/dataform/utils/defaultParameters.js +2 -6
- package/dataform/utils/index.d.ts +1 -1
- package/dataform/utils/index.js +17 -45
- package/dataform/utils/saveRecord.js +5 -9
- package/datagrid/DataGridProvider/DataResolver.js +42 -39
- package/datagrid/DataGridProvider/index.js +22 -25
- package/datagrid/DataGridProvider/transformViewColumns.js +4 -7
- package/datagrid/DataGridProvider/utils.js +5 -13
- package/datagrid/column-filter/constants.js +2 -5
- package/datagrid/column-filter/index.js +2 -7
- package/datagrid/column-filter/types.js +1 -2
- package/datagrid/column-filter/utils.js +3 -7
- package/datagrid/context.d.ts +1 -1
- package/datagrid/context.js +2 -5
- package/datagrid/hooks/index.js +20 -36
- package/datagrid/hooks/useChangeView.js +6 -9
- package/datagrid/hooks/useGridColumnFilter.js +7 -10
- package/datagrid/hooks/useGridColumns.js +4 -7
- package/datagrid/hooks/useGridCommands.js +4 -7
- package/datagrid/hooks/useGridData.js +4 -7
- package/datagrid/hooks/useGridDataState.js +4 -7
- package/datagrid/hooks/useGridExtraFilter.js +4 -7
- package/datagrid/hooks/useGridOptions.js +1 -4
- package/datagrid/hooks/useGridPagination.js +1 -4
- package/datagrid/hooks/useGridRefresh.js +7 -10
- package/datagrid/hooks/useGridSchema.js +4 -7
- package/datagrid/hooks/useGridSelection.js +7 -10
- package/datagrid/hooks/useGridSorting.js +7 -10
- package/datagrid/hooks/useGridViewLookupData.js +4 -7
- package/datagrid/hooks/useLoadMainGridPage.js +9 -12
- package/datagrid/hooks/useMainGridCommands.js +50 -57
- package/datagrid/hooks/useMaxRecords.js +4 -7
- package/datagrid/hooks/useOpenRecord.js +15 -18
- package/datagrid/hooks/useSearchText.js +7 -10
- package/datagrid/hooks/useSelectedView.js +4 -7
- package/datagrid/hooks/useSubGridCommands.js +19 -24
- package/datagrid/index.js +5 -27
- package/defaults.js +2 -5
- package/dialog/DialogProvider.js +6 -10
- package/dialog/context.d.ts +1 -1
- package/dialog/context.js +2 -5
- package/dialog/hooks/index.js +8 -24
- package/dialog/hooks/useCloseDialog.js +6 -9
- package/dialog/hooks/useDialogItem.d.ts +1 -1
- package/dialog/hooks/useDialogItem.js +4 -7
- package/dialog/hooks/useDialogItems.d.ts +1 -1
- package/dialog/hooks/useDialogItems.js +4 -7
- package/dialog/hooks/useOpenAlertDialog.js +5 -8
- package/dialog/hooks/useOpenConfirmDialog.js +5 -8
- package/dialog/hooks/useOpenDialog.js +10 -15
- package/dialog/hooks/useOpenErrorDialog.js +5 -8
- package/dialog/hooks/useOpenPromptDialog.js +5 -8
- package/dialog/index.js +3 -22
- package/form/FormValidationStringContext.js +5 -9
- package/form/index.js +1 -7
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +6 -21
- package/hooks/useDebouncedValue.js +8 -11
- package/hooks/useElementLayout.js +4 -7
- package/hooks/useIsMobile.js +6 -12
- package/hooks/useItemsWithKey.d.ts +7 -0
- package/hooks/useItemsWithKey.js +10 -0
- package/hooks/useStorageState.js +4 -7
- package/hooks/useSystemColorScheme.js +4 -7
- package/insights/InsightsProvider.js +10 -13
- package/insights/context.d.ts +1 -1
- package/insights/context.js +2 -5
- package/insights/hooks/index.js +4 -7
- package/insights/index.js +2 -20
- package/locale/LocaleProvider.js +8 -12
- package/locale/context.js +2 -5
- package/locale/index.js +4 -23
- package/locale/useCurrencySymbol.js +7 -10
- package/locale/useLocale.js +4 -7
- package/locale/utils.js +1 -4
- package/metadata/MetadataProvider.js +17 -21
- package/metadata/context.d.ts +1 -1
- package/metadata/context.js +2 -5
- package/metadata/hooks/index.js +8 -24
- package/metadata/hooks/useAppStore.js +4 -7
- package/metadata/hooks/useExperienceStore.js +4 -7
- package/metadata/hooks/useExperienceView.js +6 -9
- package/metadata/hooks/useExperienceViewCommands.js +7 -10
- package/metadata/hooks/useExperienceViewLookup.js +5 -8
- package/metadata/hooks/useExperienceViewSubgridCommands.js +7 -10
- package/metadata/hooks/useMetadata.js +8 -11
- package/metadata/hooks/useSchema.js +3 -6
- package/metadata/index.js +3 -22
- package/mutable/context.js +17 -25
- package/mutable/index.js +3 -27
- package/mutable/state.js +6 -10
- package/mutable/type.js +1 -2
- package/mutable/utils.js +12 -23
- package/navigation/hooks/index.js +1 -17
- package/navigation/hooks/useOpenForm.js +11 -14
- package/navigation/index.js +1 -17
- package/package.json +4 -2
- package/progress-indicator/ProgressIndicatorProvider.js +12 -16
- package/progress-indicator/context.js +2 -5
- package/progress-indicator/hooks/index.js +1 -17
- package/progress-indicator/hooks/useProgressIndicator.d.ts +1 -1
- package/progress-indicator/hooks/useProgressIndicator.js +4 -7
- package/progress-indicator/index.js +3 -22
- package/providers/PageEntityFormProvider/index.js +4 -7
- package/providers/PageEntityViewProvider/index.js +4 -7
- package/recordset/RecordSetProvider.js +12 -16
- package/recordset/context.d.ts +1 -1
- package/recordset/context.js +2 -5
- package/recordset/hooks/index.js +3 -19
- package/recordset/hooks/useRecordSetResult.js +15 -18
- package/recordset/hooks/useRecordSetSetter.js +6 -9
- package/recordset/hooks/useRecordSetVisibility.js +7 -10
- package/recordset/index.js +3 -22
- package/route/RouteProvider.js +14 -18
- package/route/context.js +6 -9
- package/route/hooks/index.js +6 -22
- package/route/hooks/useBasePath.js +4 -7
- package/route/hooks/useIsRouteActive.js +4 -7
- package/route/hooks/usePathname.js +4 -7
- package/route/hooks/useRouteResolver.js +4 -7
- package/route/hooks/useRouter.js +4 -7
- package/route/hooks/useSearchParams.js +4 -7
- package/route/index.js +2 -20
- package/route/types.js +1 -2
- package/store/ClientAppStore.js +1 -5
- package/store/ComponentStore.js +1 -5
- package/store/EventManager.js +1 -5
- package/store/SchemaExperienceStore.js +2 -7
- package/store/index.js +4 -20
- package/toast-notification/ToastNotificationProvider.js +6 -10
- package/toast-notification/context.d.ts +1 -1
- package/toast-notification/context.js +2 -5
- package/toast-notification/hooks/index.js +3 -19
- package/toast-notification/hooks/useCloseToastNotification.js +6 -9
- package/toast-notification/hooks/useOpenToastNotification.js +10 -15
- package/toast-notification/hooks/useToastNotificationItems.d.ts +1 -1
- package/toast-notification/hooks/useToastNotificationItems.js +4 -7
- package/toast-notification/index.js +3 -22
- package/transport/InMemoryDataService/index.js +1 -5
- package/transport/RestDataService/index.js +5 -10
- package/transport/context.js +4 -7
- package/transport/hooks/index.js +2 -18
- package/transport/hooks/useDataService.js +4 -7
- package/transport/hooks/useFileService.js +4 -7
- package/transport/hooks/useRetriveRecords.d.ts +1 -1
- package/transport/hooks/useRetriveRecords.js +12 -17
- package/transport/index.js +2 -20
- package/utils/calculateColumnWidths.js +1 -4
- package/utils/color.js +1 -4
- package/utils/getAttributeFormattedValue.js +12 -18
- package/utils/index.js +2 -18
- package/widget/context.js +2 -5
- package/widget/hooks/index.js +4 -7
- package/widget/index.js +1 -5
package/dialog/hooks/index.js
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useCloseDialog"), exports);
|
|
18
|
-
__exportStar(require("./useDialogItem"), exports);
|
|
19
|
-
__exportStar(require("./useDialogItems"), exports);
|
|
20
|
-
__exportStar(require("./useOpenAlertDialog"), exports);
|
|
21
|
-
__exportStar(require("./useOpenConfirmDialog"), exports);
|
|
22
|
-
__exportStar(require("./useOpenDialog"), exports);
|
|
23
|
-
__exportStar(require("./useOpenErrorDialog"), exports);
|
|
24
|
-
__exportStar(require("./useOpenPromptDialog"), exports);
|
|
1
|
+
export * from './useCloseDialog';
|
|
2
|
+
export * from './useDialogItem';
|
|
3
|
+
export * from './useDialogItems';
|
|
4
|
+
export * from './useOpenAlertDialog';
|
|
5
|
+
export * from './useOpenConfirmDialog';
|
|
6
|
+
export * from './useOpenDialog';
|
|
7
|
+
export * from './useOpenErrorDialog';
|
|
8
|
+
export * from './useOpenPromptDialog';
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const context_1 = require("../../mutable/context");
|
|
6
|
-
const context_2 = require("../context");
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useContextSetValue } from '../../mutable/context';
|
|
3
|
+
import { DialogContext } from '../context';
|
|
7
4
|
function markDialogAsClosed(items, id) {
|
|
8
5
|
return items.map((item) => {
|
|
9
6
|
if (item.id === id) {
|
|
@@ -15,9 +12,9 @@ function markDialogAsClosed(items, id) {
|
|
|
15
12
|
function excludeDialogItemById(items, id) {
|
|
16
13
|
return items.filter((item) => item.id !== id);
|
|
17
14
|
}
|
|
18
|
-
function useCloseDialog() {
|
|
19
|
-
const setValue =
|
|
20
|
-
const closeDialog =
|
|
15
|
+
export function useCloseDialog() {
|
|
16
|
+
const setValue = useContextSetValue(DialogContext);
|
|
17
|
+
const closeDialog = useCallback((id) => {
|
|
21
18
|
setValue((state) => ({
|
|
22
19
|
items: markDialogAsClosed(state.items, id),
|
|
23
20
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useDialogItem(id: string): import("
|
|
1
|
+
export declare function useDialogItem(id: string): import("..").DialogItemState | undefined;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const context_2 = require("../context");
|
|
6
|
-
function useDialogItem(id) {
|
|
7
|
-
return (0, context_1.useContextSelector)(context_2.DialogContext, (state) => state.items.find((item) => item.id === id));
|
|
1
|
+
import { useContextSelector } from '../../mutable/context';
|
|
2
|
+
import { DialogContext } from '../context';
|
|
3
|
+
export function useDialogItem(id) {
|
|
4
|
+
return useContextSelector(DialogContext, (state) => state.items.find((item) => item.id === id));
|
|
8
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useDialogItems(): import("
|
|
1
|
+
export declare function useDialogItems(): import("..").DialogItemState[];
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const context_2 = require("../context");
|
|
6
|
-
function useDialogItems() {
|
|
7
|
-
return (0, context_1.useContextSelector)(context_2.DialogContext, (state) => state.items);
|
|
1
|
+
import { useContextSelector } from '../../mutable/context';
|
|
2
|
+
import { DialogContext } from '../context';
|
|
3
|
+
export function useDialogItems() {
|
|
4
|
+
return useContextSelector(DialogContext, (state) => state.items);
|
|
8
5
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
function useOpenAlertDialog() {
|
|
7
|
-
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
-
const openAlertDialog = (0, react_1.useCallback)((options) => {
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useOpenDialog } from './useOpenDialog';
|
|
3
|
+
export function useOpenAlertDialog() {
|
|
4
|
+
const openDialog = useOpenDialog();
|
|
5
|
+
const openAlertDialog = useCallback((options) => {
|
|
9
6
|
return new Promise((resolve) => {
|
|
10
7
|
const { close } = openDialog(Object.assign(Object.assign({ type: 'alert' }, options), { onDismiss: () => {
|
|
11
8
|
close();
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
function useOpenConfirmDialog() {
|
|
7
|
-
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
-
const openConfirmDialog = (0, react_1.useCallback)((options) => {
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useOpenDialog } from './useOpenDialog';
|
|
3
|
+
export function useOpenConfirmDialog() {
|
|
4
|
+
const openDialog = useOpenDialog();
|
|
5
|
+
const openConfirmDialog = useCallback((options) => {
|
|
9
6
|
return new Promise((resolve) => {
|
|
10
7
|
const { close } = openDialog(Object.assign(Object.assign({ type: 'confirm' }, options), { onDismiss: () => {
|
|
11
8
|
if (!options.allowDismiss) {
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function useOpenDialog() {
|
|
12
|
-
const setValue = (0, context_1.useContextSetValue)(context_2.DialogContext);
|
|
13
|
-
const closeDialog = (0, useCloseDialog_1.useCloseDialog)();
|
|
14
|
-
const openDialog = (0, react_1.useCallback)((options) => {
|
|
15
|
-
const id = randomId();
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
|
+
import { useContextSetValue } from '../../mutable/context';
|
|
4
|
+
import { DialogContext } from '../context';
|
|
5
|
+
import { useCloseDialog } from './useCloseDialog';
|
|
6
|
+
export function useOpenDialog() {
|
|
7
|
+
const setValue = useContextSetValue(DialogContext);
|
|
8
|
+
const closeDialog = useCloseDialog();
|
|
9
|
+
const openDialog = useCallback((options) => {
|
|
10
|
+
const id = uuid();
|
|
16
11
|
setValue((state) => {
|
|
17
12
|
return {
|
|
18
13
|
items: [
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
function useOpenErrorDialog() {
|
|
7
|
-
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
-
const openErrorDialog = (0, react_1.useCallback)((options) => {
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useOpenDialog } from './useOpenDialog';
|
|
3
|
+
export function useOpenErrorDialog() {
|
|
4
|
+
const openDialog = useOpenDialog();
|
|
5
|
+
const openErrorDialog = useCallback((options) => {
|
|
9
6
|
const { close } = openDialog(Object.assign(Object.assign({ type: 'error' }, options), { onDismiss: () => {
|
|
10
7
|
close();
|
|
11
8
|
}, onConfirm: () => {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
function useOpenPromptDialog() {
|
|
7
|
-
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
-
const openPromptDialog = (0, react_1.useCallback)((options) => {
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useOpenDialog } from './useOpenDialog';
|
|
3
|
+
export function useOpenPromptDialog() {
|
|
4
|
+
const openDialog = useOpenDialog();
|
|
5
|
+
const openPromptDialog = useCallback((options) => {
|
|
9
6
|
return new Promise((resolve) => {
|
|
10
7
|
const { close } = openDialog(Object.assign(Object.assign({ type: 'prompt' }, options), { onDismiss: () => {
|
|
11
8
|
if (!options.allowDismiss) {
|
package/dialog/index.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DialogProvider = exports.DialogContext = void 0;
|
|
18
|
-
var context_1 = require("./context");
|
|
19
|
-
Object.defineProperty(exports, "DialogContext", { enumerable: true, get: function () { return context_1.DialogContext; } });
|
|
20
|
-
var DialogProvider_1 = require("./DialogProvider");
|
|
21
|
-
Object.defineProperty(exports, "DialogProvider", { enumerable: true, get: function () { return DialogProvider_1.DialogProvider; } });
|
|
22
|
-
__exportStar(require("./hooks"), exports);
|
|
1
|
+
export { DialogContext, } from './context';
|
|
2
|
+
export { DialogProvider } from './DialogProvider';
|
|
3
|
+
export * from './hooks';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.FormValidationStringContext = exports.defaultFormValidationStrings = void 0;
|
|
4
|
-
exports.useFormValidationStrings = useFormValidationStrings;
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
exports.defaultFormValidationStrings = {
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const defaultFormValidationStrings = {
|
|
7
3
|
required: 'Required field must be filled in.',
|
|
8
4
|
maxLength: 'Maximum length exceeded.',
|
|
9
5
|
minLength: 'Minimum length not met.',
|
|
@@ -13,8 +9,8 @@ exports.defaultFormValidationStrings = {
|
|
|
13
9
|
atLeastOneRowRequired: 'At least one row required.',
|
|
14
10
|
fileSizeExceeded: 'File size exceeded.',
|
|
15
11
|
};
|
|
16
|
-
|
|
17
|
-
function useFormValidationStrings() {
|
|
18
|
-
const context =
|
|
12
|
+
export const FormValidationStringContext = createContext(defaultFormValidationStrings);
|
|
13
|
+
export function useFormValidationStrings() {
|
|
14
|
+
const context = useContext(FormValidationStringContext);
|
|
19
15
|
return context;
|
|
20
16
|
}
|
package/form/index.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFormValidationStrings = exports.defaultFormValidationStrings = exports.FormValidationStringContext = void 0;
|
|
4
|
-
var FormValidationStringContext_1 = require("./FormValidationStringContext");
|
|
5
|
-
Object.defineProperty(exports, "FormValidationStringContext", { enumerable: true, get: function () { return FormValidationStringContext_1.FormValidationStringContext; } });
|
|
6
|
-
Object.defineProperty(exports, "defaultFormValidationStrings", { enumerable: true, get: function () { return FormValidationStringContext_1.defaultFormValidationStrings; } });
|
|
7
|
-
Object.defineProperty(exports, "useFormValidationStrings", { enumerable: true, get: function () { return FormValidationStringContext_1.useFormValidationStrings; } });
|
|
1
|
+
export { FormValidationStringContext, defaultFormValidationStrings, useFormValidationStrings, } from './FormValidationStringContext';
|
package/hooks/index.d.ts
CHANGED
package/hooks/index.js
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useDebouncedValue"), exports);
|
|
18
|
-
__exportStar(require("./useElementLayout"), exports);
|
|
19
|
-
__exportStar(require("./useIsMobile"), exports);
|
|
20
|
-
__exportStar(require("./useStorageState"), exports);
|
|
21
|
-
__exportStar(require("./useSystemColorScheme"), exports);
|
|
1
|
+
export * from './useDebouncedValue';
|
|
2
|
+
export * from './useElementLayout';
|
|
3
|
+
export * from './useIsMobile';
|
|
4
|
+
export * from './useStorageState';
|
|
5
|
+
export * from './useSystemColorScheme';
|
|
6
|
+
export { useItemsWithKey } from './useItemsWithKey';
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const mountedRef = (0, react_1.useRef)(false);
|
|
8
|
-
const timeoutRef = (0, react_1.useRef)(null);
|
|
9
|
-
const cooldownRef = (0, react_1.useRef)(false);
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
export function useDebouncedValue(value, wait, options = { leading: false }) {
|
|
3
|
+
const [_value, setValue] = useState(value);
|
|
4
|
+
const mountedRef = useRef(false);
|
|
5
|
+
const timeoutRef = useRef(null);
|
|
6
|
+
const cooldownRef = useRef(false);
|
|
10
7
|
const cancel = () => window.clearTimeout(timeoutRef.current);
|
|
11
|
-
|
|
8
|
+
useEffect(() => {
|
|
12
9
|
if (mountedRef.current) {
|
|
13
10
|
if (!cooldownRef.current && options.leading) {
|
|
14
11
|
cooldownRef.current = true;
|
|
@@ -23,7 +20,7 @@ function useDebouncedValue(value, wait, options = { leading: false }) {
|
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
}, [value, options.leading, wait]);
|
|
26
|
-
|
|
23
|
+
useEffect(() => {
|
|
27
24
|
mountedRef.current = true;
|
|
28
25
|
return cancel;
|
|
29
26
|
}, []);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function useElementSize(elementRef, interval) {
|
|
6
|
-
const [size, setSize] = (0, react_1.useState)({ width: 0, height: 0 });
|
|
7
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
1
|
+
import { useLayoutEffect, useState } from 'react';
|
|
2
|
+
export function useElementSize(elementRef, interval) {
|
|
3
|
+
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
4
|
+
useLayoutEffect(() => {
|
|
8
5
|
function updateSize() {
|
|
9
6
|
if (elementRef.current) {
|
|
10
7
|
const element = elementRef.current;
|
package/hooks/useIsMobile.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.useIsMobile = useIsMobile;
|
|
7
|
-
const debounce_1 = __importDefault(require("lodash/debounce"));
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
function useIsMobile() {
|
|
10
|
-
const [isMobile, setIsMobile] = (0, react_1.useState)(false);
|
|
11
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
1
|
+
import debounce from 'lodash/debounce';
|
|
2
|
+
import { useLayoutEffect, useState } from 'react';
|
|
3
|
+
export function useIsMobile() {
|
|
4
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
5
|
+
useLayoutEffect(() => {
|
|
12
6
|
const updateSize = () => {
|
|
13
7
|
setIsMobile(window.innerWidth < 768);
|
|
14
8
|
};
|
|
15
|
-
window.addEventListener('resize', (
|
|
9
|
+
window.addEventListener('resize', debounce(updateSize, 250));
|
|
16
10
|
updateSize();
|
|
17
11
|
return () => window.removeEventListener('resize', updateSize);
|
|
18
12
|
}, []);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ItemWithKey } from '@headless-adminapp/core/types';
|
|
2
|
+
export declare function useItemsWithKey<T>(value: T[]): ItemWithKey<T>[];
|
|
3
|
+
export declare function useItemsWithKey(value: null): null;
|
|
4
|
+
export declare function useItemsWithKey(value: undefined): undefined;
|
|
5
|
+
export declare function useItemsWithKey<T>(value: T[] | null): ItemWithKey<T>[] | null;
|
|
6
|
+
export declare function useItemsWithKey<T>(value: T[] | undefined): ItemWithKey<T>[] | undefined;
|
|
7
|
+
export declare function useItemsWithKey<T>(value: T[] | null | undefined): ItemWithKey<T>[] | null | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createItemsWithKey } from '@headless-adminapp/core/utils';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
export function useItemsWithKey(value) {
|
|
4
|
+
return useMemo(() => {
|
|
5
|
+
if (!value) {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
return createItemsWithKey(value);
|
|
9
|
+
}, [value]);
|
|
10
|
+
}
|
package/hooks/useStorageState.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStorageState = useStorageState;
|
|
4
|
-
const react_1 = require("react");
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
5
2
|
function getStorageValue(key, store) {
|
|
6
3
|
const value = store.getItem(key);
|
|
7
4
|
if (value) {
|
|
@@ -12,10 +9,10 @@ function getStorageValue(key, store) {
|
|
|
12
9
|
function setStorageValue(key, value, store) {
|
|
13
10
|
store.setItem(key, JSON.stringify(value));
|
|
14
11
|
}
|
|
15
|
-
function useStorageState(initialState, key, store = localStorage) {
|
|
12
|
+
export function useStorageState(initialState, key, store = localStorage) {
|
|
16
13
|
var _a;
|
|
17
|
-
const [state, setState] =
|
|
18
|
-
const setStoredState =
|
|
14
|
+
const [state, setState] = useState((_a = getStorageValue(key, store)) !== null && _a !== void 0 ? _a : initialState);
|
|
15
|
+
const setStoredState = useCallback((value) => {
|
|
19
16
|
setState((prevState) => {
|
|
20
17
|
const finalState = value instanceof Function ? value(prevState) : value;
|
|
21
18
|
setStorageValue(key, finalState, store);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSystemColorScheme = useSystemColorScheme;
|
|
4
|
-
const react_1 = require("react");
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
5
2
|
const isSystemDarkMode = () => {
|
|
6
3
|
if (typeof window === 'undefined') {
|
|
7
4
|
return false;
|
|
@@ -9,9 +6,9 @@ const isSystemDarkMode = () => {
|
|
|
9
6
|
return (window.matchMedia &&
|
|
10
7
|
window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
11
8
|
};
|
|
12
|
-
function useSystemColorScheme() {
|
|
13
|
-
const [systemColorScheme, setSystemColorScheme] =
|
|
14
|
-
|
|
9
|
+
export function useSystemColorScheme() {
|
|
10
|
+
const [systemColorScheme, setSystemColorScheme] = useState(isSystemDarkMode() ? 'dark' : 'light');
|
|
11
|
+
useEffect(() => {
|
|
15
12
|
setSystemColorScheme(isSystemDarkMode() ? 'dark' : 'light');
|
|
16
13
|
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
17
14
|
const handleChange = (e) => {
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const context_1 = require("./context");
|
|
8
|
-
function InsightsProvider({ children, experience, insightLookup, onInsightSelect, }) {
|
|
9
|
-
const onInsightSelectRef = (0, react_1.useRef)(onInsightSelect);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { useCreateContextStore } from '../mutable';
|
|
4
|
+
import { InsightsContext } from './context';
|
|
5
|
+
export function InsightsProvider({ children, experience, insightLookup, onInsightSelect, }) {
|
|
6
|
+
const onInsightSelectRef = useRef(onInsightSelect);
|
|
10
7
|
onInsightSelectRef.current = onInsightSelect;
|
|
11
|
-
const onInsightSelectInternal =
|
|
8
|
+
const onInsightSelectInternal = useCallback((id) => {
|
|
12
9
|
onInsightSelectRef.current(id);
|
|
13
10
|
}, [onInsightSelectRef]);
|
|
14
|
-
const insightsValues =
|
|
11
|
+
const insightsValues = useCreateContextStore({
|
|
15
12
|
experience,
|
|
16
13
|
data: experience.defaultData,
|
|
17
14
|
insightLookup: insightLookup,
|
|
18
15
|
onInsightSelect: onInsightSelectInternal,
|
|
19
16
|
});
|
|
20
|
-
|
|
17
|
+
useEffect(() => {
|
|
21
18
|
insightsValues.setValue({
|
|
22
19
|
experience,
|
|
23
20
|
data: experience.defaultData,
|
|
24
21
|
});
|
|
25
22
|
}, [experience, insightsValues]);
|
|
26
|
-
return ((
|
|
23
|
+
return (_jsx(InsightsContext.Provider, { value: insightsValues, children: children }));
|
|
27
24
|
}
|
package/insights/context.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { InsightsState } from '@headless-adminapp/core/experience/insights';
|
|
2
|
-
export declare const InsightsContext: import("react").Context<import("../mutable
|
|
2
|
+
export declare const InsightsContext: import("react").Context<import("../mutable").ContextValue<InsightsState<import("@headless-adminapp/core/schema").SchemaAttributes>>>;
|
package/insights/context.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.InsightsContext = void 0;
|
|
4
|
-
const context_1 = require("../mutable/context");
|
|
5
|
-
exports.InsightsContext = (0, context_1.createContext)();
|
|
1
|
+
import { createContext } from '../mutable/context';
|
|
2
|
+
export const InsightsContext = createContext();
|
package/insights/hooks/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const context_1 = require("../context");
|
|
6
|
-
function useInsightsState() {
|
|
7
|
-
return (0, mutable_1.useContextSelector)(context_1.InsightsContext, (state) => state);
|
|
1
|
+
import { useContextSelector } from '../../mutable';
|
|
2
|
+
import { InsightsContext } from '../context';
|
|
3
|
+
export function useInsightsState() {
|
|
4
|
+
return useContextSelector(InsightsContext, (state) => state);
|
|
8
5
|
}
|
package/insights/index.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.InsightsContext = void 0;
|
|
18
|
-
var context_1 = require("./context");
|
|
19
|
-
Object.defineProperty(exports, "InsightsContext", { enumerable: true, get: function () { return context_1.InsightsContext; } });
|
|
20
|
-
__exportStar(require("./hooks"), exports);
|
|
1
|
+
export { InsightsContext } from './context';
|
|
2
|
+
export * from './hooks';
|
package/locale/LocaleProvider.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const LocaleProvider = ({ children, locale = 'en-US', timezone = 'UTC', options, }) => {
|
|
9
|
-
const localeState = (0, react_1.useMemo)(() => {
|
|
10
|
-
return (0, locale_1.getLocale)(locale, timezone, options);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getLocale } from '@headless-adminapp/core/experience/locale';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { LocaleContext } from './context';
|
|
5
|
+
export const LocaleProvider = ({ children, locale = 'en-US', timezone = 'UTC', options, }) => {
|
|
6
|
+
const localeState = useMemo(() => {
|
|
7
|
+
return getLocale(locale, timezone, options);
|
|
11
8
|
}, [locale, timezone, options]);
|
|
12
|
-
return ((
|
|
9
|
+
return (_jsx(LocaleContext.Provider, { value: localeState, children: children }));
|
|
13
10
|
};
|
|
14
|
-
exports.LocaleProvider = LocaleProvider;
|
package/locale/context.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.LocaleContext = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
exports.LocaleContext = (0, react_1.createContext)(null);
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const LocaleContext = createContext(null);
|
package/locale/index.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.LocaleProvider = exports.LocaleContext = void 0;
|
|
18
|
-
var context_1 = require("./context");
|
|
19
|
-
Object.defineProperty(exports, "LocaleContext", { enumerable: true, get: function () { return context_1.LocaleContext; } });
|
|
20
|
-
__exportStar(require("./useLocale"), exports);
|
|
21
|
-
__exportStar(require("./useCurrencySymbol"), exports);
|
|
22
|
-
var LocaleProvider_1 = require("./LocaleProvider");
|
|
23
|
-
Object.defineProperty(exports, "LocaleProvider", { enumerable: true, get: function () { return LocaleProvider_1.LocaleProvider; } });
|
|
1
|
+
export { LocaleContext } from './context';
|
|
2
|
+
export * from './useLocale';
|
|
3
|
+
export * from './useCurrencySymbol';
|
|
4
|
+
export { LocaleProvider } from './LocaleProvider';
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
function useCurrencySymbol() {
|
|
8
|
-
const locale = (0, useLocale_1.useLocale)();
|
|
9
|
-
return (0, react_1.useMemo)(() => {
|
|
1
|
+
import { getCurrencySymbol } from '@headless-adminapp/core/experience/locale/utils';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useLocale } from './useLocale';
|
|
4
|
+
export function useCurrencySymbol() {
|
|
5
|
+
const locale = useLocale();
|
|
6
|
+
return useMemo(() => {
|
|
10
7
|
var _a;
|
|
11
|
-
return
|
|
8
|
+
return getCurrencySymbol(locale.locale, (_a = locale.currency.currency) !== null && _a !== void 0 ? _a : 'USD');
|
|
12
9
|
}, [locale]);
|
|
13
10
|
}
|