@headless-adminapp/app 0.0.17-alpha.52 → 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 -13
- 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.js +6 -24
- package/hooks/useDebouncedValue.js +8 -11
- package/hooks/useElementLayout.js +4 -7
- package/hooks/useIsMobile.js +6 -12
- package/hooks/useItemsWithKey.js +5 -8
- 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 +7 -11
- package/navigation/hooks/index.js +1 -17
- package/navigation/hooks/useOpenForm.js +11 -14
- package/navigation/index.js +1 -17
- package/package.json +3 -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 -13
- 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/store/EventManager.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,9 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.EventManager = void 0;
|
|
13
|
-
class EventManager {
|
|
10
|
+
export class EventManager {
|
|
14
11
|
constructor() {
|
|
15
12
|
this.handlers = {};
|
|
16
13
|
}
|
|
@@ -39,4 +36,3 @@ class EventManager {
|
|
|
39
36
|
return handlers.map((handler) => handler(...args));
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
exports.EventManager = EventManager;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,15 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.SchemaExperienceStore = void 0;
|
|
13
|
-
exports.getDefaultCardView = getDefaultCardView;
|
|
14
|
-
function getDefaultCardView(schema) {
|
|
10
|
+
export function getDefaultCardView(schema) {
|
|
15
11
|
return {
|
|
16
12
|
primaryColumn: schema.primaryAttribute,
|
|
17
13
|
};
|
|
18
14
|
}
|
|
19
|
-
class SchemaExperienceStore {
|
|
15
|
+
export class SchemaExperienceStore {
|
|
20
16
|
constructor(options) {
|
|
21
17
|
this.options = options;
|
|
22
18
|
this.experiences = {};
|
|
@@ -261,4 +257,3 @@ class SchemaExperienceStore {
|
|
|
261
257
|
});
|
|
262
258
|
}
|
|
263
259
|
}
|
|
264
|
-
exports.SchemaExperienceStore = SchemaExperienceStore;
|
package/store/index.js
CHANGED
|
@@ -1,20 +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
|
-
__exportStar(require("./ClientAppStore"), exports);
|
|
18
|
-
__exportStar(require("./ComponentStore"), exports);
|
|
19
|
-
__exportStar(require("./EventManager"), exports);
|
|
20
|
-
__exportStar(require("./SchemaExperienceStore"), exports);
|
|
1
|
+
export * from './ClientAppStore';
|
|
2
|
+
export * from './ComponentStore';
|
|
3
|
+
export * from './EventManager';
|
|
4
|
+
export * from './SchemaExperienceStore';
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const context_2 = require("./context");
|
|
7
|
-
const ToastNotificationProvider = ({ children }) => {
|
|
8
|
-
const contextState = (0, context_1.useCreateContextStore)({
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCreateContextStore } from '../mutable/context';
|
|
3
|
+
import { ToastNotificationContext, } from './context';
|
|
4
|
+
export const ToastNotificationProvider = ({ children }) => {
|
|
5
|
+
const contextState = useCreateContextStore({
|
|
9
6
|
items: [],
|
|
10
7
|
});
|
|
11
|
-
return ((
|
|
8
|
+
return (_jsx(ToastNotificationContext.Provider, { value: contextState, children: children }));
|
|
12
9
|
};
|
|
13
|
-
exports.ToastNotificationProvider = ToastNotificationProvider;
|
|
@@ -12,4 +12,4 @@ export interface ToastNotificationItem {
|
|
|
12
12
|
export interface ToastNotificationContextState {
|
|
13
13
|
items: ToastNotificationItem[];
|
|
14
14
|
}
|
|
15
|
-
export declare const ToastNotificationContext: import("react").Context<import("../mutable
|
|
15
|
+
export declare const ToastNotificationContext: import("react").Context<import("../mutable").ContextValue<ToastNotificationContextState>>;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ToastNotificationContext = void 0;
|
|
4
|
-
const context_1 = require("../mutable/context");
|
|
5
|
-
exports.ToastNotificationContext = (0, context_1.createContext)();
|
|
1
|
+
import { createContext } from '../mutable/context';
|
|
2
|
+
export const ToastNotificationContext = createContext();
|
|
@@ -1,19 +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
|
-
__exportStar(require("./useCloseToastNotification"), exports);
|
|
18
|
-
__exportStar(require("./useOpenToastNotification"), exports);
|
|
19
|
-
__exportStar(require("./useToastNotificationItems"), exports);
|
|
1
|
+
export * from './useCloseToastNotification';
|
|
2
|
+
export * from './useOpenToastNotification';
|
|
3
|
+
export * from './useToastNotificationItems';
|
|
@@ -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 { ToastNotificationContext } from '../context';
|
|
7
4
|
function markToastNotificationAsClosed(items, id) {
|
|
8
5
|
return items.map((item) => {
|
|
9
6
|
if (item.id === id) {
|
|
@@ -15,9 +12,9 @@ function markToastNotificationAsClosed(items, id) {
|
|
|
15
12
|
function excludeToastNotificationItemById(items, id) {
|
|
16
13
|
return items.filter((item) => item.id !== id);
|
|
17
14
|
}
|
|
18
|
-
function useCloseToastNotification() {
|
|
19
|
-
const setValue =
|
|
20
|
-
const closeDialog =
|
|
15
|
+
export function useCloseToastNotification() {
|
|
16
|
+
const setValue = useContextSetValue(ToastNotificationContext);
|
|
17
|
+
const closeDialog = useCallback((id) => {
|
|
21
18
|
setValue((state) => ({
|
|
22
19
|
items: markToastNotificationAsClosed(state.items, id),
|
|
23
20
|
}));
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const closeDialog = (0, useCloseToastNotification_1.useCloseToastNotification)();
|
|
12
|
-
const openToastNotification = (0, react_1.useCallback)((options) => {
|
|
13
|
-
const id = (0, uuid_1.v4)();
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
|
+
import { useContextSetValue } from '../../mutable/context';
|
|
4
|
+
import { ToastNotificationContext } from '../context';
|
|
5
|
+
import { useCloseToastNotification } from './useCloseToastNotification';
|
|
6
|
+
export function useOpenToastNotification() {
|
|
7
|
+
const setValue = useContextSetValue(ToastNotificationContext);
|
|
8
|
+
const closeDialog = useCloseToastNotification();
|
|
9
|
+
const openToastNotification = useCallback((options) => {
|
|
10
|
+
const id = uuid();
|
|
14
11
|
setValue((state) => {
|
|
15
12
|
return {
|
|
16
13
|
items: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useToastNotificationItems(): import("
|
|
1
|
+
export declare function useToastNotificationItems(): import("..").ToastNotificationItem[];
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const context_2 = require("../context");
|
|
6
|
-
function useToastNotificationItems() {
|
|
7
|
-
return (0, context_1.useContextSelector)(context_2.ToastNotificationContext, (state) => state.items);
|
|
1
|
+
import { useContextSelector } from '../../mutable/context';
|
|
2
|
+
import { ToastNotificationContext } from '../context';
|
|
3
|
+
export function useToastNotificationItems() {
|
|
4
|
+
return useContextSelector(ToastNotificationContext, (state) => state.items);
|
|
8
5
|
}
|
|
@@ -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.ToastNotificationProvider = exports.ToastNotificationContext = void 0;
|
|
18
|
-
var context_1 = require("./context");
|
|
19
|
-
Object.defineProperty(exports, "ToastNotificationContext", { enumerable: true, get: function () { return context_1.ToastNotificationContext; } });
|
|
20
|
-
var ToastNotificationProvider_1 = require("./ToastNotificationProvider");
|
|
21
|
-
Object.defineProperty(exports, "ToastNotificationProvider", { enumerable: true, get: function () { return ToastNotificationProvider_1.ToastNotificationProvider; } });
|
|
22
|
-
__exportStar(require("./hooks"), exports);
|
|
1
|
+
export { ToastNotificationContext, } from './context';
|
|
2
|
+
export { ToastNotificationProvider } from './ToastNotificationProvider';
|
|
3
|
+
export * from './hooks';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,9 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.InMemoryDataService = void 0;
|
|
13
|
-
class InMemoryDataService {
|
|
10
|
+
export class InMemoryDataService {
|
|
14
11
|
// , IActionService, IReportService
|
|
15
12
|
constructor(options) {
|
|
16
13
|
this.options = options;
|
|
@@ -109,4 +106,3 @@ class InMemoryDataService {
|
|
|
109
106
|
});
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
|
-
exports.InMemoryDataService = InMemoryDataService;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,11 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.handleResponseError = handleResponseError;
|
|
14
|
-
const transport_1 = require("@headless-adminapp/core/transport");
|
|
15
|
-
function handleResponseError(response) {
|
|
10
|
+
import { HttpError, } from '@headless-adminapp/core/transport';
|
|
11
|
+
export function handleResponseError(response) {
|
|
16
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
13
|
var _a;
|
|
18
14
|
if (response.ok) {
|
|
@@ -21,13 +17,13 @@ function handleResponseError(response) {
|
|
|
21
17
|
if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
|
|
22
18
|
const data = yield response.json();
|
|
23
19
|
if (data.error) {
|
|
24
|
-
throw new
|
|
20
|
+
throw new HttpError(response.status, data.error);
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
|
-
throw new
|
|
23
|
+
throw new HttpError(response.status, response.statusText);
|
|
28
24
|
});
|
|
29
25
|
}
|
|
30
|
-
class RestDataService {
|
|
26
|
+
export class RestDataService {
|
|
31
27
|
constructor(options) {
|
|
32
28
|
this.options = options;
|
|
33
29
|
this.headers = {};
|
|
@@ -122,4 +118,3 @@ class RestDataService {
|
|
|
122
118
|
});
|
|
123
119
|
}
|
|
124
120
|
}
|
|
125
|
-
exports.RestDataService = RestDataService;
|
package/transport/context.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,13 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
exports.DataServiceContext = (0, react_1.createContext)(undefined);
|
|
15
|
-
exports.noopFileService = {
|
|
10
|
+
import { createContext } from 'react';
|
|
11
|
+
export const DataServiceContext = createContext(undefined);
|
|
12
|
+
export const noopFileService = {
|
|
16
13
|
uploadFile: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
14
|
throw new Error('File service not implemented');
|
|
18
15
|
}),
|
|
19
16
|
};
|
|
20
|
-
|
|
17
|
+
export const FileServiceContext = createContext(noopFileService);
|
package/transport/hooks/index.js
CHANGED
|
@@ -1,18 +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
|
-
__exportStar(require("./useDataService"), exports);
|
|
18
|
-
__exportStar(require("./useFileService"), exports);
|
|
1
|
+
export * from './useDataService';
|
|
2
|
+
export * from './useFileService';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const context_1 = require("../context");
|
|
6
|
-
function useDataService() {
|
|
7
|
-
const context = (0, react_1.useContext)(context_1.DataServiceContext);
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { DataServiceContext } from '../context';
|
|
3
|
+
export function useDataService() {
|
|
4
|
+
const context = useContext(DataServiceContext);
|
|
8
5
|
if (!context) {
|
|
9
6
|
throw new Error('DataServiceContext must be used within a DataServiceProvider');
|
|
10
7
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const context_1 = require("../context");
|
|
6
|
-
function useFileService() {
|
|
7
|
-
const context = (0, react_1.useContext)(context_1.FileServiceContext);
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { FileServiceContext } from '../context';
|
|
3
|
+
export function useFileService() {
|
|
4
|
+
const context = useContext(FileServiceContext);
|
|
8
5
|
if (!context) {
|
|
9
6
|
throw new Error('FileServiceContext must be used within a FileServiceProvider');
|
|
10
7
|
}
|
|
@@ -11,7 +11,7 @@ interface UseRetriveRecordProps<S extends SchemaAttributes = SchemaAttributes> {
|
|
|
11
11
|
expand?: Partial<Record<string, string[]>>;
|
|
12
12
|
maxRecords: number;
|
|
13
13
|
}
|
|
14
|
-
export declare function useRetrieveRecordsKey<S extends SchemaAttributes = SchemaAttributes>({ schema, search, filter, sorting, columns, expand, maxRecords, }: UseRetriveRecordProps<S>): (string | number | string[] | Filter | Partial<Record<string, string[]>> |
|
|
14
|
+
export declare function useRetrieveRecordsKey<S extends SchemaAttributes = SchemaAttributes>({ schema, search, filter, sorting, columns, expand, maxRecords, }: UseRetriveRecordProps<S>): (string | number | string[] | Filter | SortingState<S> | Partial<Record<string, string[]>> | null | undefined)[];
|
|
15
15
|
export declare function useClearDataExceptFirstPage(queryKey: QueryKey): void;
|
|
16
16
|
export declare function useRetriveRecords<S extends SchemaAttributes = SchemaAttributes>(queryKey: QueryKey, { columns, expand, filter, maxRecords, schema, search, sorting, }: UseRetriveRecordProps): {
|
|
17
17
|
data: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,16 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.useRetriveRecords = useRetriveRecords;
|
|
15
|
-
const transport_1 = require("@headless-adminapp/app/transport");
|
|
16
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
17
|
-
const react_1 = require("react");
|
|
10
|
+
import { useDataService } from '@headless-adminapp/app/transport';
|
|
11
|
+
import { useInfiniteQuery, useQueryClient, } from '@tanstack/react-query';
|
|
12
|
+
import { useEffect, useMemo } from 'react';
|
|
18
13
|
const ROWS_PER_PAGE = 100;
|
|
19
|
-
function useRetrieveRecordsKey({ schema, search, filter, sorting, columns, expand, maxRecords, }) {
|
|
20
|
-
const queryKey =
|
|
14
|
+
export function useRetrieveRecordsKey({ schema, search, filter, sorting, columns, expand, maxRecords, }) {
|
|
15
|
+
const queryKey = useMemo(() => [
|
|
21
16
|
'data',
|
|
22
17
|
'retriveRecords',
|
|
23
18
|
schema.logicalName,
|
|
@@ -30,9 +25,9 @@ function useRetrieveRecordsKey({ schema, search, filter, sorting, columns, expan
|
|
|
30
25
|
], [schema.logicalName, search, filter, sorting, columns, expand, maxRecords]);
|
|
31
26
|
return queryKey;
|
|
32
27
|
}
|
|
33
|
-
function useClearDataExceptFirstPage(queryKey) {
|
|
34
|
-
const queryClient =
|
|
35
|
-
|
|
28
|
+
export function useClearDataExceptFirstPage(queryKey) {
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
useEffect(() => {
|
|
36
31
|
return () => {
|
|
37
32
|
// Clear all pages except the first one when the component is unmounted
|
|
38
33
|
queryClient.setQueryData(queryKey, (oldData) => {
|
|
@@ -50,9 +45,9 @@ function useClearDataExceptFirstPage(queryKey) {
|
|
|
50
45
|
};
|
|
51
46
|
}, [queryClient, queryKey]);
|
|
52
47
|
}
|
|
53
|
-
function useRetriveRecords(queryKey, { columns, expand, filter, maxRecords, schema, search, sorting, }) {
|
|
54
|
-
const dataService =
|
|
55
|
-
const { data, isFetching, hasNextPage, fetchNextPage, isFetchingNextPage } =
|
|
48
|
+
export function useRetriveRecords(queryKey, { columns, expand, filter, maxRecords, schema, search, sorting, }) {
|
|
49
|
+
const dataService = useDataService();
|
|
50
|
+
const { data, isFetching, hasNextPage, fetchNextPage, isFetchingNextPage } = useInfiniteQuery({
|
|
56
51
|
queryKey: queryKey,
|
|
57
52
|
queryFn: (queryContext) => __awaiter(this, void 0, void 0, function* () {
|
|
58
53
|
var _a;
|
|
@@ -99,7 +94,7 @@ function useRetriveRecords(queryKey, { columns, expand, filter, maxRecords, sche
|
|
|
99
94
|
pageIndex: 0,
|
|
100
95
|
},
|
|
101
96
|
});
|
|
102
|
-
const finalData =
|
|
97
|
+
const finalData = useMemo(() => {
|
|
103
98
|
var _a, _b, _c, _d;
|
|
104
99
|
if (!(data === null || data === void 0 ? void 0 : data.pages.length)) {
|
|
105
100
|
return null;
|
package/transport/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.DataServiceContext = void 0;
|
|
18
|
-
var context_1 = require("./context");
|
|
19
|
-
Object.defineProperty(exports, "DataServiceContext", { enumerable: true, get: function () { return context_1.DataServiceContext; } });
|
|
20
|
-
__exportStar(require("./hooks"), exports);
|
|
1
|
+
export { DataServiceContext } from './context';
|
|
2
|
+
export * from './hooks';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateColumnWidths = calculateColumnWidths;
|
|
4
|
-
function calculateColumnWidths(params) {
|
|
1
|
+
export function calculateColumnWidths(params) {
|
|
5
2
|
const { columns, availableWidth, gapWidth } = params;
|
|
6
3
|
const totalGapWidth = gapWidth * (columns.length - 1);
|
|
7
4
|
const remainingWidth = availableWidth - totalGapWidth;
|
package/utils/color.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.getAttributeFormattedValue = getAttributeFormattedValue;
|
|
7
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
-
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
9
|
-
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
10
|
-
dayjs_1.default.extend(utc_1.default);
|
|
11
|
-
dayjs_1.default.extend(timezone_1.default);
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
3
|
+
import utc from 'dayjs/plugin/utc';
|
|
4
|
+
dayjs.extend(utc);
|
|
5
|
+
dayjs.extend(timezone);
|
|
12
6
|
const defaultAttributeFormattedValueStrings = {
|
|
13
7
|
yes: 'Yes',
|
|
14
8
|
no: 'No',
|
|
@@ -38,12 +32,12 @@ function getAttributeDateFormattedValue(attribute, value, options) {
|
|
|
38
32
|
const dateFormat = (_a = options === null || options === void 0 ? void 0 : options.dateFormat) !== null && _a !== void 0 ? _a : defaultDateFormat;
|
|
39
33
|
const timeFormat = (_b = options === null || options === void 0 ? void 0 : options.timeFormat) !== null && _b !== void 0 ? _b : defaultTimeFormat;
|
|
40
34
|
if (attribute.format === 'datetime') {
|
|
41
|
-
return (
|
|
35
|
+
return dayjs(value)
|
|
42
36
|
.tz(options === null || options === void 0 ? void 0 : options.timezone)
|
|
43
37
|
.format(dateFormat + ' ' + timeFormat);
|
|
44
38
|
}
|
|
45
39
|
else {
|
|
46
|
-
return (
|
|
40
|
+
return dayjs(value)
|
|
47
41
|
.tz(options === null || options === void 0 ? void 0 : options.timezone)
|
|
48
42
|
.format(dateFormat);
|
|
49
43
|
}
|
|
@@ -59,15 +53,15 @@ function getAttributeDateRangeFormattedValue(value, options) {
|
|
|
59
53
|
return null;
|
|
60
54
|
}
|
|
61
55
|
if (from && to) {
|
|
62
|
-
return ((
|
|
56
|
+
return (dayjs(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat) +
|
|
63
57
|
' - ' +
|
|
64
|
-
(
|
|
58
|
+
dayjs(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat));
|
|
65
59
|
}
|
|
66
60
|
if (from) {
|
|
67
|
-
return 'After ' + (
|
|
61
|
+
return 'After ' + dayjs(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
|
|
68
62
|
}
|
|
69
63
|
if (to) {
|
|
70
|
-
return 'Before ' + (
|
|
64
|
+
return 'Before ' + dayjs(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
|
|
71
65
|
}
|
|
72
66
|
return null;
|
|
73
67
|
}
|
|
@@ -110,7 +104,7 @@ function getAttributeMoneyFormattedValue(value, options) {
|
|
|
110
104
|
currencyDisplay,
|
|
111
105
|
}).format(value);
|
|
112
106
|
}
|
|
113
|
-
function getAttributeFormattedValue(attribute, value, options) {
|
|
107
|
+
export function getAttributeFormattedValue(attribute, value, options) {
|
|
114
108
|
var _a;
|
|
115
109
|
if (value === null || value === undefined) {
|
|
116
110
|
return null;
|
package/utils/index.js
CHANGED
|
@@ -1,18 +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
|
-
__exportStar(require("./calculateColumnWidths"), exports);
|
|
18
|
-
__exportStar(require("./getAttributeFormattedValue"), exports);
|
|
1
|
+
export * from './calculateColumnWidths';
|
|
2
|
+
export * from './getAttributeFormattedValue';
|
package/widget/context.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.WidgetContext = void 0;
|
|
4
|
-
const mutable_1 = require("../mutable");
|
|
5
|
-
exports.WidgetContext = (0, mutable_1.createContext)();
|
|
1
|
+
import { createContext } from '../mutable';
|
|
2
|
+
export const WidgetContext = createContext();
|
package/widget/hooks/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const context_1 = require("../context");
|
|
6
|
-
function useWidgetState() {
|
|
7
|
-
return (0, mutable_1.useContextSelector)(context_1.WidgetContext, (state) => state);
|
|
1
|
+
import { useContextSelector } from '../../mutable';
|
|
2
|
+
import { WidgetContext } from '../context';
|
|
3
|
+
export function useWidgetState() {
|
|
4
|
+
return useContextSelector(WidgetContext, (state) => state);
|
|
8
5
|
}
|
package/widget/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WidgetContext = void 0;
|
|
4
|
-
var context_1 = require("./context");
|
|
5
|
-
Object.defineProperty(exports, "WidgetContext", { enumerable: true, get: function () { return context_1.WidgetContext; } });
|
|
1
|
+
export { WidgetContext } from './context';
|