@headless-adminapp/app 0.0.17-alpha.54 → 0.0.17-alpha.56
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 +24 -32
- package/app/AuthWrapper.js +13 -9
- package/app/LayoutProvider.js +34 -39
- package/app/context.js +5 -2
- package/app/hooks/index.js +17 -1
- package/app/hooks/useAppContext.js +7 -4
- package/app/index.js +11 -4
- package/auth/AuthProvider.js +27 -36
- package/auth/context.d.ts +1 -1
- package/auth/context.js +5 -2
- package/auth/hooks/index.js +18 -2
- package/auth/hooks/useAuthSession.js +7 -4
- package/auth/hooks/useIsSkipAuthCheck.js +7 -4
- package/auth/hooks/useLogout.js +11 -8
- package/auth/index.js +23 -4
- package/auth/types.js +2 -1
- package/board/BoardColumnDataResolver.js +23 -20
- package/board/BoardColumnProvider.js +14 -10
- package/board/context.d.ts +2 -2
- package/board/context.js +6 -3
- package/board/hooks/index.js +15 -6
- package/board/hooks/useBoardColumnConfig.js +7 -4
- package/board/hooks/useBoardColumnData.d.ts +3 -1
- package/board/hooks/useBoardColumnData.js +7 -4
- package/board/hooks/useBoardColumnDataState.js +7 -4
- package/board/hooks/useBoardConfig.js +7 -4
- package/board/hooks/useBoardSchema.js +6 -3
- package/board/hooks/useSearchText.js +10 -7
- package/board/types.js +2 -1
- package/board/utils.js +4 -1
- package/builders/CommandBuilder/CommandBuilder.js +13 -10
- package/builders/CommandBuilder/DefaultCommandBuilder.js +30 -23
- package/builders/CommandBuilder/FormCommandBuilder.js +29 -38
- package/builders/CommandBuilder/SubgridCommandBuilder.js +27 -36
- package/builders/CommandBuilder/ViewCommandBuilder.js +29 -38
- package/builders/CommandBuilder/index.js +5 -1
- package/builders/CommandBuilder/utils.js +7 -3
- package/builders/SchemaExperienceBuilder.js +55 -31
- package/builders/index.js +7 -2
- package/builders/utils.js +59 -44
- package/command/hooks/index.js +18 -2
- package/command/hooks/useBaseCommandHandlerContext.js +29 -25
- package/command/hooks/useCommands.js +9 -6
- package/command/index.js +18 -2
- package/command/types.js +2 -1
- package/command/utils/index.js +41 -13
- package/components/ScrollView/index.js +11 -4
- package/components/ScrollbarWithMoreDataRequest/index.js +14 -11
- package/dataform/DataFormProvider/DataResolver.js +81 -89
- package/dataform/DataFormProvider/InitialValueResolver.js +22 -20
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +14 -12
- package/dataform/DataFormProvider/index.js +26 -32
- package/dataform/context.js +5 -2
- package/dataform/hooks/index.js +29 -13
- package/dataform/hooks/useFormInstance.js +6 -3
- package/dataform/hooks/useFormIsDirty.js +6 -3
- package/dataform/hooks/useFormIsReadonly.js +7 -4
- package/dataform/hooks/useFormNotifications.js +12 -9
- package/dataform/hooks/useFormRecord.js +7 -4
- package/dataform/hooks/useFormSave.js +40 -46
- package/dataform/hooks/useFormSchema.js +7 -4
- package/dataform/hooks/useLoadFormGridPage.js +19 -25
- package/dataform/hooks/useMainFormCommands.js +37 -30
- package/dataform/hooks/useProcessFlowSteps.js +27 -23
- package/dataform/hooks/useRecordId.js +7 -4
- package/dataform/hooks/useRecordTitle.js +12 -9
- package/dataform/hooks/useSelectedForm.js +7 -4
- package/dataform/index.js +23 -4
- package/dataform/utils/defaultParameters.js +16 -6
- package/dataform/utils/index.js +90 -56
- package/dataform/utils/saveRecord.js +99 -104
- package/datagrid/DataGridProvider/DataResolver.js +36 -34
- package/datagrid/DataGridProvider/index.js +31 -32
- package/datagrid/DataGridProvider/transformViewColumns.js +17 -6
- package/datagrid/DataGridProvider/utils.js +13 -5
- package/datagrid/column-filter/constants.js +5 -2
- package/datagrid/column-filter/index.js +7 -2
- package/datagrid/column-filter/types.js +2 -1
- package/datagrid/column-filter/utils.js +13 -3
- package/datagrid/context.d.ts +1 -1
- package/datagrid/context.js +5 -2
- package/datagrid/hooks/index.js +36 -20
- package/datagrid/hooks/useChangeView.js +10 -7
- package/datagrid/hooks/useGridColumnFilter.js +14 -8
- package/datagrid/hooks/useGridColumns.js +7 -4
- package/datagrid/hooks/useGridCommands.js +7 -4
- package/datagrid/hooks/useGridData.js +7 -4
- package/datagrid/hooks/useGridDataState.js +7 -4
- package/datagrid/hooks/useGridExtraFilter.js +7 -4
- package/datagrid/hooks/useGridOptions.js +4 -1
- package/datagrid/hooks/useGridPagination.js +4 -1
- package/datagrid/hooks/useGridRefresh.js +10 -7
- package/datagrid/hooks/useGridSchema.js +7 -4
- package/datagrid/hooks/useGridSelection.js +10 -7
- package/datagrid/hooks/useGridSorting.js +10 -7
- package/datagrid/hooks/useGridViewLookupData.js +7 -4
- package/datagrid/hooks/useLoadMainGridPage.js +12 -9
- package/datagrid/hooks/useMainGridCommands.js +62 -54
- package/datagrid/hooks/useMaxRecords.js +7 -4
- package/datagrid/hooks/useOpenRecord.js +20 -17
- package/datagrid/hooks/useSearchText.js +10 -7
- package/datagrid/hooks/useSelectedView.js +7 -4
- package/datagrid/hooks/useSubGridCommands.js +34 -23
- package/datagrid/index.js +27 -5
- package/defaults.js +5 -2
- package/dialog/DialogProvider.js +10 -6
- package/dialog/context.d.ts +1 -1
- package/dialog/context.js +5 -2
- package/dialog/hooks/index.js +24 -8
- package/dialog/hooks/useCloseDialog.js +10 -7
- package/dialog/hooks/useDialogItem.d.ts +1 -1
- package/dialog/hooks/useDialogItem.js +7 -4
- package/dialog/hooks/useDialogItems.d.ts +1 -1
- package/dialog/hooks/useDialogItems.js +7 -4
- package/dialog/hooks/useOpenAlertDialog.js +16 -8
- package/dialog/hooks/useOpenConfirmDialog.js +18 -9
- package/dialog/hooks/useOpenDialog.js +18 -11
- package/dialog/hooks/useOpenErrorDialog.js +16 -8
- package/dialog/hooks/useOpenPromptDialog.js +18 -9
- package/dialog/index.js +22 -3
- package/form/FormValidationStringContext.js +9 -5
- package/form/index.js +7 -1
- package/hooks/index.js +24 -6
- package/hooks/useDebouncedValue.js +11 -8
- package/hooks/useElementLayout.js +7 -4
- package/hooks/useIsMobile.js +12 -6
- package/hooks/useItemsWithKey.js +8 -5
- package/hooks/useStorageState.js +7 -5
- package/hooks/useSystemColorScheme.js +7 -4
- package/insights/InsightsProvider.js +13 -10
- package/insights/context.d.ts +1 -1
- package/insights/context.js +5 -2
- package/insights/hooks/index.js +7 -4
- package/insights/index.js +20 -2
- package/locale/LocaleProvider.js +12 -8
- package/locale/context.js +5 -2
- package/locale/index.js +23 -4
- package/locale/useCurrencySymbol.js +10 -8
- package/locale/useLocale.js +7 -4
- package/locale/utils.js +8 -3
- package/metadata/MetadataProvider.js +21 -17
- package/metadata/context.d.ts +1 -1
- package/metadata/context.js +5 -2
- package/metadata/hooks/index.js +24 -8
- package/metadata/hooks/useAppStore.js +7 -4
- package/metadata/hooks/useExperienceStore.js +7 -4
- package/metadata/hooks/useExperienceView.js +11 -17
- package/metadata/hooks/useExperienceViewCommands.js +14 -20
- package/metadata/hooks/useExperienceViewLookup.js +10 -16
- package/metadata/hooks/useExperienceViewSubgridCommands.js +14 -20
- package/metadata/hooks/useMetadata.js +11 -8
- package/metadata/hooks/useSchema.js +6 -3
- package/metadata/index.js +22 -3
- package/mutable/context.js +25 -17
- package/mutable/index.js +27 -3
- package/mutable/state.js +10 -6
- package/mutable/type.js +2 -1
- package/mutable/utils.js +12 -8
- package/navigation/hooks/index.js +17 -1
- package/navigation/hooks/useOpenForm.js +14 -11
- package/navigation/index.js +17 -1
- package/package.json +4 -12
- package/progress-indicator/ProgressIndicatorProvider.js +16 -12
- package/progress-indicator/context.js +5 -2
- package/progress-indicator/hooks/index.js +17 -1
- package/progress-indicator/hooks/useProgressIndicator.d.ts +1 -1
- package/progress-indicator/hooks/useProgressIndicator.js +7 -4
- package/progress-indicator/index.js +22 -3
- package/providers/PageEntityFormProvider/index.js +7 -4
- package/providers/PageEntityViewProvider/index.js +7 -4
- package/recordset/RecordSetProvider.js +16 -12
- package/recordset/context.d.ts +1 -1
- package/recordset/context.js +5 -2
- package/recordset/hooks/index.js +19 -3
- package/recordset/hooks/useRecordSetResult.js +22 -29
- package/recordset/hooks/useRecordSetSetter.js +9 -6
- package/recordset/hooks/useRecordSetVisibility.js +10 -7
- package/recordset/index.js +22 -3
- package/route/RouteProvider.js +18 -14
- package/route/context.js +9 -6
- package/route/hooks/index.js +22 -6
- package/route/hooks/useBasePath.js +7 -4
- package/route/hooks/useIsRouteActive.js +7 -4
- package/route/hooks/usePathname.js +7 -4
- package/route/hooks/useRouteResolver.js +7 -4
- package/route/hooks/useRouter.js +7 -4
- package/route/hooks/useSearchParams.js +7 -4
- package/route/index.js +20 -2
- package/route/types.js +2 -1
- package/store/ClientAppStore.js +12 -21
- package/store/ComponentStore.js +6 -4
- package/store/EventManager.js +20 -32
- package/store/SchemaExperienceStore.js +186 -217
- package/store/index.js +20 -4
- package/toast-notification/ToastNotificationProvider.js +10 -6
- package/toast-notification/context.d.ts +1 -1
- package/toast-notification/context.js +5 -2
- package/toast-notification/hooks/index.js +19 -3
- package/toast-notification/hooks/useCloseToastNotification.js +10 -7
- package/toast-notification/hooks/useOpenToastNotification.js +18 -11
- package/toast-notification/hooks/useToastNotificationItems.d.ts +1 -1
- package/toast-notification/hooks/useToastNotificationItems.js +7 -4
- package/toast-notification/index.js +22 -3
- package/transport/InMemoryDataService/index.js +59 -78
- package/transport/RestDataService/index.js +72 -91
- package/transport/context.js +9 -15
- package/transport/hooks/index.js +18 -2
- package/transport/hooks/useDataService.js +7 -4
- package/transport/hooks/useFileService.js +7 -4
- package/transport/hooks/useRetriveRecords.d.ts +1 -1
- package/transport/hooks/useRetriveRecords.js +25 -31
- package/transport/index.js +20 -2
- package/utils/calculateColumnWidths.js +5 -2
- package/utils/color.js +4 -1
- package/utils/getAttributeFormattedValue.js +38 -40
- package/utils/index.js +18 -2
- package/widget/context.js +5 -2
- package/widget/hooks/index.js +7 -4
- package/widget/index.js +5 -1
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressIndicatorProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const context_1 = require("./context");
|
|
7
|
+
const ProgressIndicatorProvider = ({ children, }) => {
|
|
8
|
+
const [overlayVisible, setOverlayVisible] = (0, react_1.useState)(false);
|
|
9
|
+
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
10
|
+
const [message, setMessage] = (0, react_1.useState)(undefined);
|
|
11
|
+
const showTimeoutRef = (0, react_1.useRef)();
|
|
12
|
+
const showProgressIndicator = (0, react_1.useCallback)((message, delay) => {
|
|
10
13
|
setOverlayVisible(true);
|
|
11
14
|
setMessage(message);
|
|
12
15
|
if (delay) {
|
|
@@ -25,7 +28,7 @@ export const ProgressIndicatorProvider = ({ children, }) => {
|
|
|
25
28
|
setVisible(true);
|
|
26
29
|
}
|
|
27
30
|
}, []);
|
|
28
|
-
const hideProgressIndicator = useCallback(() => {
|
|
31
|
+
const hideProgressIndicator = (0, react_1.useCallback)(() => {
|
|
29
32
|
setVisible(false);
|
|
30
33
|
setOverlayVisible(false);
|
|
31
34
|
if (showTimeoutRef.current) {
|
|
@@ -33,7 +36,7 @@ export const ProgressIndicatorProvider = ({ children, }) => {
|
|
|
33
36
|
showTimeoutRef.current = undefined;
|
|
34
37
|
}
|
|
35
38
|
}, []);
|
|
36
|
-
const contextValue = useMemo(() => ({
|
|
39
|
+
const contextValue = (0, react_1.useMemo)(() => ({
|
|
37
40
|
overlayVisible,
|
|
38
41
|
visible,
|
|
39
42
|
message,
|
|
@@ -46,5 +49,6 @@ export const ProgressIndicatorProvider = ({ children, }) => {
|
|
|
46
49
|
showProgressIndicator,
|
|
47
50
|
hideProgressIndicator,
|
|
48
51
|
]);
|
|
49
|
-
return (
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(context_1.ProgressIndicatorContext.Provider, { value: contextValue, children: children }));
|
|
50
53
|
};
|
|
54
|
+
exports.ProgressIndicatorProvider = ProgressIndicatorProvider;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressIndicatorContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.ProgressIndicatorContext = (0, react_1.createContext)(null);
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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("./useProgressIndicator"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useProgressIndicator(): import("
|
|
1
|
+
export declare function useProgressIndicator(): import("../context").ProgressIndicatorContextState;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useProgressIndicator = useProgressIndicator;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useProgressIndicator() {
|
|
7
|
+
const context = (0, react_1.useContext)(context_1.ProgressIndicatorContext);
|
|
5
8
|
if (!context) {
|
|
6
9
|
throw new Error('useProgressIndicator must be used within a ProgressIndicatorProvider');
|
|
7
10
|
}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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.ProgressIndicatorProvider = exports.ProgressIndicatorContext = void 0;
|
|
18
|
+
var context_1 = require("./context");
|
|
19
|
+
Object.defineProperty(exports, "ProgressIndicatorContext", { enumerable: true, get: function () { return context_1.ProgressIndicatorContext; } });
|
|
20
|
+
var ProgressIndicatorProvider_1 = require("./ProgressIndicatorProvider");
|
|
21
|
+
Object.defineProperty(exports, "ProgressIndicatorProvider", { enumerable: true, get: function () { return ProgressIndicatorProvider_1.ProgressIndicatorProvider; } });
|
|
22
|
+
__exportStar(require("./hooks"), exports);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageEntityFormProvider = PageEntityFormProvider;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
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 }));
|
|
5
8
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageEntityViewProvider = PageEntityViewProvider;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const DataGridProvider_1 = require("../../datagrid/DataGridProvider");
|
|
6
|
+
function PageEntityViewProvider({ availableViews, commands, schema, view, children, onChangeView, }) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: availableViews, onChangeView: onChangeView, commands: commands, allowViewSelection: true, children: children }));
|
|
5
8
|
}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecordSetProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useMetadata_1 = require("../metadata/hooks/useMetadata");
|
|
7
|
+
const context_1 = require("../mutable/context");
|
|
8
|
+
const context_2 = require("./context");
|
|
9
|
+
const RecordSetProvider = ({ children }) => {
|
|
10
|
+
const contextValue = (0, context_1.useCreateContextStore)({
|
|
8
11
|
logicalName: '',
|
|
9
12
|
ids: [],
|
|
10
13
|
cardView: null,
|
|
11
14
|
visibleNavigator: false,
|
|
12
15
|
});
|
|
13
|
-
return (
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(context_2.RecordSetContext.Provider, { value: contextValue, children: [(0, jsx_runtime_1.jsx)(CardViewSetter, {}), children] }));
|
|
14
17
|
};
|
|
18
|
+
exports.RecordSetProvider = RecordSetProvider;
|
|
15
19
|
const CardViewSetter = () => {
|
|
16
|
-
const { experienceStore } = useMetadata();
|
|
17
|
-
const setValue = useContextSetValue(RecordSetContext);
|
|
18
|
-
const logicalName = useContextSelector(RecordSetContext, (state) => state.logicalName);
|
|
19
|
-
useEffect(() => {
|
|
20
|
+
const { experienceStore } = (0, useMetadata_1.useMetadata)();
|
|
21
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.RecordSetContext);
|
|
22
|
+
const logicalName = (0, context_1.useContextSelector)(context_2.RecordSetContext, (state) => state.logicalName);
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
20
24
|
setValue({
|
|
21
25
|
cardView: null,
|
|
22
26
|
});
|
package/recordset/context.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export interface RecordSetContextState {
|
|
|
5
5
|
cardView: CardView | null;
|
|
6
6
|
visibleNavigator: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const RecordSetContext: import("react").Context<import("../mutable").ContextValue<RecordSetContextState>>;
|
|
8
|
+
export declare const RecordSetContext: import("react").Context<import("../mutable/context").ContextValue<RecordSetContextState>>;
|
package/recordset/context.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecordSetContext = void 0;
|
|
4
|
+
const context_1 = require("../mutable/context");
|
|
5
|
+
exports.RecordSetContext = (0, context_1.createContext)();
|
package/recordset/hooks/index.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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("./useRecordSetResult"), exports);
|
|
18
|
+
__exportStar(require("./useRecordSetSetter"), exports);
|
|
19
|
+
__exportStar(require("./useRecordSetVisibility"), exports);
|
|
@@ -1,51 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { RecordSetContext } from '../context';
|
|
17
|
-
export function useRecordSetResult() {
|
|
18
|
-
const context = useContextSelector(RecordSetContext, (state) => state);
|
|
19
|
-
const { schemaStore } = useMetadata();
|
|
20
|
-
const dataService = useDataService();
|
|
21
|
-
const schema = useMemo(() => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRecordSetResult = useRecordSetResult;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const useMetadata_1 = require("../../metadata/hooks/useMetadata");
|
|
8
|
+
const context_1 = require("../../mutable/context");
|
|
9
|
+
const transport_1 = require("../../transport");
|
|
10
|
+
const context_2 = require("../context");
|
|
11
|
+
function useRecordSetResult() {
|
|
12
|
+
const context = (0, context_1.useContextSelector)(context_2.RecordSetContext, (state) => state);
|
|
13
|
+
const { schemaStore } = (0, useMetadata_1.useMetadata)();
|
|
14
|
+
const dataService = (0, transport_1.useDataService)();
|
|
15
|
+
const schema = (0, react_1.useMemo)(() => {
|
|
22
16
|
if (!context.logicalName) {
|
|
23
17
|
return null;
|
|
24
18
|
}
|
|
25
19
|
return schemaStore.getSchema(context.logicalName);
|
|
26
20
|
}, [context.logicalName, schemaStore]);
|
|
27
21
|
const cardView = context.cardView;
|
|
28
|
-
const columns = useMemo(() => {
|
|
29
|
-
var _a;
|
|
22
|
+
const columns = (0, react_1.useMemo)(() => {
|
|
30
23
|
if (!cardView) {
|
|
31
24
|
return [];
|
|
32
25
|
}
|
|
33
26
|
return Array.from(new Set([
|
|
34
27
|
cardView.primaryColumn,
|
|
35
28
|
cardView.avatarColumn,
|
|
36
|
-
...(
|
|
29
|
+
...(cardView.secondaryColumns ?? [])
|
|
37
30
|
.filter((x) => !x.expandedKey)
|
|
38
31
|
.map((x) => x.name),
|
|
39
32
|
])).filter(Boolean);
|
|
40
33
|
}, [cardView]);
|
|
41
|
-
const { isPending, data, error } = useQuery({
|
|
34
|
+
const { isPending, data, error } = (0, react_query_1.useQuery)({
|
|
42
35
|
queryKey: ['data', 'recordset', context.logicalName, context.ids, columns],
|
|
43
|
-
queryFn: () =>
|
|
36
|
+
queryFn: async () => {
|
|
44
37
|
if (!context.logicalName || !context.ids.length || !cardView) {
|
|
45
38
|
return [];
|
|
46
39
|
}
|
|
47
40
|
const schema = schemaStore.getSchema(context.logicalName);
|
|
48
|
-
const result =
|
|
41
|
+
const result = await dataService.retriveRecords({
|
|
49
42
|
logicalName: context.logicalName,
|
|
50
43
|
filter: {
|
|
51
44
|
type: 'and',
|
|
@@ -61,9 +54,9 @@ export function useRecordSetResult() {
|
|
|
61
54
|
sort: [],
|
|
62
55
|
limit: context.ids.length,
|
|
63
56
|
});
|
|
64
|
-
const sortedData = sortBy(result.records, (x) => context.ids.indexOf(x[schema.idAttribute]));
|
|
57
|
+
const sortedData = (0, lodash_1.sortBy)(result.records, (x) => context.ids.indexOf(x[schema.idAttribute]));
|
|
65
58
|
return sortedData;
|
|
66
|
-
}
|
|
59
|
+
},
|
|
67
60
|
});
|
|
68
61
|
if (error) {
|
|
69
62
|
console.error(error);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRecordSetSetter = useRecordSetSetter;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useRecordSetSetter() {
|
|
8
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.RecordSetContext);
|
|
9
|
+
const setRecordSet = (0, react_1.useCallback)((logicalName, ids) => {
|
|
7
10
|
setValue({
|
|
8
11
|
logicalName,
|
|
9
12
|
ids,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRecordSetVisibility = useRecordSetVisibility;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useRecordSetVisibility() {
|
|
8
|
+
const visibleNavigator = (0, context_1.useContextSelector)(context_2.RecordSetContext, (state) => state.visibleNavigator);
|
|
9
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.RecordSetContext);
|
|
10
|
+
const setVisibility = (0, react_1.useCallback)((visible) => {
|
|
8
11
|
setValue({
|
|
9
12
|
visibleNavigator: visible,
|
|
10
13
|
});
|
package/recordset/index.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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.RecordSetContext = exports.RecordSetProvider = void 0;
|
|
18
|
+
var RecordSetProvider_1 = require("./RecordSetProvider");
|
|
19
|
+
Object.defineProperty(exports, "RecordSetProvider", { enumerable: true, get: function () { return RecordSetProvider_1.RecordSetProvider; } });
|
|
20
|
+
var context_1 = require("./context");
|
|
21
|
+
Object.defineProperty(exports, "RecordSetContext", { enumerable: true, get: function () { return context_1.RecordSetContext; } });
|
|
22
|
+
__exportStar(require("./hooks"), exports);
|
package/route/RouteProvider.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const route_1 = require("@headless-adminapp/core/experience/route");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const context_1 = require("./context");
|
|
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, }) => {
|
|
11
|
+
const basePathRef = (0, react_1.useRef)(basePath);
|
|
9
12
|
basePathRef.current = basePath;
|
|
10
|
-
const routeResolverRef = useRef(routeResolver);
|
|
13
|
+
const routeResolverRef = (0, react_1.useRef)(routeResolver);
|
|
11
14
|
routeResolverRef.current = routeResolver;
|
|
12
|
-
const isRouteActiveRef = useRef(isRouteActive);
|
|
15
|
+
const isRouteActiveRef = (0, react_1.useRef)(isRouteActive);
|
|
13
16
|
isRouteActiveRef.current = isRouteActive;
|
|
14
|
-
const internalRouteResolver = useCallback((item) => routeResolverRef.current(item, basePathRef.current), []);
|
|
15
|
-
const internalIsRouteActive = useCallback((path, item) => isRouteActiveRef.current(path, item, basePathRef.current), []);
|
|
16
|
-
const routeHelperContextState = useMemo(() => {
|
|
17
|
+
const internalRouteResolver = (0, react_1.useCallback)((item) => routeResolverRef.current(item, basePathRef.current), []);
|
|
18
|
+
const internalIsRouteActive = (0, react_1.useCallback)((path, item) => isRouteActiveRef.current(path, item, basePathRef.current), []);
|
|
19
|
+
const routeHelperContextState = (0, react_1.useMemo)(() => {
|
|
17
20
|
return {
|
|
18
21
|
routeResolver: internalRouteResolver,
|
|
19
22
|
isRouteActive: internalIsRouteActive,
|
|
20
23
|
};
|
|
21
24
|
}, [internalRouteResolver, internalIsRouteActive]);
|
|
22
|
-
return (
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(context_1.RouterContext.Provider, { value: router, children: (0, jsx_runtime_1.jsx)(context_1.RouterPathnameContext.Provider, { value: pathname, children: (0, jsx_runtime_1.jsx)(context_1.RouterSearchParamsContext.Provider, { value: searchParams, children: (0, jsx_runtime_1.jsx)(context_1.RouterBasePathContext.Provider, { value: basePath, children: (0, jsx_runtime_1.jsx)(context_1.RouteHelperContext.Provider, { value: routeHelperContextState, children: children }) }) }) }) }));
|
|
23
26
|
};
|
|
27
|
+
exports.RouteProvider = RouteProvider;
|
package/route/context.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteHelperContext = exports.RouterBasePathContext = exports.RouterSearchParamsContext = exports.RouterPathnameContext = exports.RouterContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.RouterContext = (0, react_1.createContext)(null);
|
|
6
|
+
exports.RouterPathnameContext = (0, react_1.createContext)(null);
|
|
7
|
+
exports.RouterSearchParamsContext = (0, react_1.createContext)(null);
|
|
8
|
+
exports.RouterBasePathContext = (0, react_1.createContext)(undefined);
|
|
9
|
+
exports.RouteHelperContext = (0, react_1.createContext)(null);
|
package/route/hooks/index.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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("./usePathname"), exports);
|
|
18
|
+
__exportStar(require("./useSearchParams"), exports);
|
|
19
|
+
__exportStar(require("./useRouter"), exports);
|
|
20
|
+
__exportStar(require("./useBasePath"), exports);
|
|
21
|
+
__exportStar(require("./useRouteResolver"), exports);
|
|
22
|
+
__exportStar(require("./useIsRouteActive"), exports);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBasePath = useBasePath;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useBasePath() {
|
|
7
|
+
return (0, react_1.useContext)(context_1.RouterBasePathContext);
|
|
5
8
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsRouteActive = useIsRouteActive;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useIsRouteActive() {
|
|
7
|
+
return (0, react_1.useContext)(context_1.RouteHelperContext).isRouteActive;
|
|
5
8
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePathname = usePathname;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function usePathname() {
|
|
7
|
+
return (0, react_1.useContext)(context_1.RouterPathnameContext);
|
|
5
8
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRouteResolver = useRouteResolver;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useRouteResolver() {
|
|
7
|
+
return (0, react_1.useContext)(context_1.RouteHelperContext).routeResolver;
|
|
5
8
|
}
|
package/route/hooks/useRouter.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRouter = useRouter;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useRouter() {
|
|
7
|
+
return (0, react_1.useContext)(context_1.RouterContext);
|
|
5
8
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchParams = useSearchParams;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useSearchParams() {
|
|
7
|
+
return (0, react_1.useContext)(context_1.RouterSearchParamsContext);
|
|
5
8
|
}
|
package/route/index.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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.RouteProvider = void 0;
|
|
18
|
+
var RouteProvider_1 = require("./RouteProvider");
|
|
19
|
+
Object.defineProperty(exports, "RouteProvider", { enumerable: true, get: function () { return RouteProvider_1.RouteProvider; } });
|
|
20
|
+
__exportStar(require("./hooks"), exports);
|
package/route/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|