@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,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenDialog = useOpenDialog;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
const context_1 = require("../../mutable/context");
|
|
7
|
+
const context_2 = require("../context");
|
|
8
|
+
const useCloseDialog_1 = require("./useCloseDialog");
|
|
9
|
+
function useOpenDialog() {
|
|
10
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.DialogContext);
|
|
11
|
+
const closeDialog = (0, useCloseDialog_1.useCloseDialog)();
|
|
12
|
+
const openDialog = (0, react_1.useCallback)((options) => {
|
|
13
|
+
const id = (0, uuid_1.v4)();
|
|
11
14
|
setValue((state) => {
|
|
12
15
|
return {
|
|
13
16
|
items: [
|
|
14
17
|
...state.items,
|
|
15
|
-
|
|
18
|
+
{
|
|
19
|
+
id,
|
|
20
|
+
isOpen: true,
|
|
21
|
+
...options,
|
|
22
|
+
},
|
|
16
23
|
],
|
|
17
24
|
};
|
|
18
25
|
});
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenErrorDialog = useOpenErrorDialog;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useOpenDialog_1 = require("./useOpenDialog");
|
|
6
|
+
function useOpenErrorDialog() {
|
|
7
|
+
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
+
const openErrorDialog = (0, react_1.useCallback)((options) => {
|
|
9
|
+
const { close } = openDialog({
|
|
10
|
+
type: 'error',
|
|
11
|
+
...options,
|
|
12
|
+
onDismiss: () => {
|
|
7
13
|
close();
|
|
8
|
-
},
|
|
14
|
+
},
|
|
15
|
+
onConfirm: () => {
|
|
9
16
|
close();
|
|
10
|
-
}
|
|
17
|
+
},
|
|
18
|
+
});
|
|
11
19
|
}, [openDialog]);
|
|
12
20
|
return openErrorDialog;
|
|
13
21
|
}
|
|
@@ -1,22 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenPromptDialog = useOpenPromptDialog;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useOpenDialog_1 = require("./useOpenDialog");
|
|
6
|
+
function useOpenPromptDialog() {
|
|
7
|
+
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
+
const openPromptDialog = (0, react_1.useCallback)((options) => {
|
|
6
9
|
return new Promise((resolve) => {
|
|
7
|
-
const { close } = openDialog(
|
|
10
|
+
const { close } = openDialog({
|
|
11
|
+
type: 'prompt',
|
|
12
|
+
...options,
|
|
13
|
+
onDismiss: () => {
|
|
8
14
|
if (!options.allowDismiss) {
|
|
9
15
|
return;
|
|
10
16
|
}
|
|
11
17
|
close();
|
|
12
18
|
resolve(null);
|
|
13
|
-
},
|
|
19
|
+
},
|
|
20
|
+
onConfirm: (result) => {
|
|
14
21
|
close();
|
|
15
22
|
resolve(result);
|
|
16
|
-
},
|
|
23
|
+
},
|
|
24
|
+
onCancel: () => {
|
|
17
25
|
close();
|
|
18
26
|
resolve(null);
|
|
19
|
-
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
20
29
|
});
|
|
21
30
|
}, [openDialog]);
|
|
22
31
|
return openPromptDialog;
|
package/dialog/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.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,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormValidationStringContext = exports.defaultFormValidationStrings = void 0;
|
|
4
|
+
exports.useFormValidationStrings = useFormValidationStrings;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.defaultFormValidationStrings = {
|
|
3
7
|
required: 'Required field must be filled in.',
|
|
4
8
|
maxLength: 'Maximum length exceeded.',
|
|
5
9
|
minLength: 'Minimum length not met.',
|
|
@@ -9,8 +13,8 @@ export const defaultFormValidationStrings = {
|
|
|
9
13
|
atLeastOneRowRequired: 'At least one row required.',
|
|
10
14
|
fileSizeExceeded: 'File size exceeded.',
|
|
11
15
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const context = useContext(FormValidationStringContext);
|
|
16
|
+
exports.FormValidationStringContext = (0, react_1.createContext)(exports.defaultFormValidationStrings);
|
|
17
|
+
function useFormValidationStrings() {
|
|
18
|
+
const context = (0, react_1.useContext)(exports.FormValidationStringContext);
|
|
15
19
|
return context;
|
|
16
20
|
}
|
package/form/index.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
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; } });
|
package/hooks/index.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
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
|
+
exports.useItemsWithKey = void 0;
|
|
18
|
+
__exportStar(require("./useDebouncedValue"), exports);
|
|
19
|
+
__exportStar(require("./useElementLayout"), exports);
|
|
20
|
+
__exportStar(require("./useIsMobile"), exports);
|
|
21
|
+
__exportStar(require("./useStorageState"), exports);
|
|
22
|
+
__exportStar(require("./useSystemColorScheme"), exports);
|
|
23
|
+
var useItemsWithKey_1 = require("./useItemsWithKey");
|
|
24
|
+
Object.defineProperty(exports, "useItemsWithKey", { enumerable: true, get: function () { return useItemsWithKey_1.useItemsWithKey; } });
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDebouncedValue = useDebouncedValue;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function useDebouncedValue(value, wait, options = { leading: false }) {
|
|
6
|
+
const [_value, setValue] = (0, react_1.useState)(value);
|
|
7
|
+
const mountedRef = (0, react_1.useRef)(false);
|
|
8
|
+
const timeoutRef = (0, react_1.useRef)(null);
|
|
9
|
+
const cooldownRef = (0, react_1.useRef)(false);
|
|
7
10
|
const cancel = () => window.clearTimeout(timeoutRef.current);
|
|
8
|
-
useEffect(() => {
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
9
12
|
if (mountedRef.current) {
|
|
10
13
|
if (!cooldownRef.current && options.leading) {
|
|
11
14
|
cooldownRef.current = true;
|
|
@@ -20,7 +23,7 @@ export function useDebouncedValue(value, wait, options = { leading: false }) {
|
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
}, [value, options.leading, wait]);
|
|
23
|
-
useEffect(() => {
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
24
27
|
mountedRef.current = true;
|
|
25
28
|
return cancel;
|
|
26
29
|
}, []);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useElementSize = useElementSize;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function useElementSize(elementRef, interval) {
|
|
6
|
+
const [size, setSize] = (0, react_1.useState)({ width: 0, height: 0 });
|
|
7
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
5
8
|
function updateSize() {
|
|
6
9
|
if (elementRef.current) {
|
|
7
10
|
const element = elementRef.current;
|
package/hooks/useIsMobile.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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)(() => {
|
|
6
12
|
const updateSize = () => {
|
|
7
13
|
setIsMobile(window.innerWidth < 768);
|
|
8
14
|
};
|
|
9
|
-
window.addEventListener('resize',
|
|
15
|
+
window.addEventListener('resize', (0, debounce_1.default)(updateSize, 250));
|
|
10
16
|
updateSize();
|
|
11
17
|
return () => window.removeEventListener('resize', updateSize);
|
|
12
18
|
}, []);
|
package/hooks/useItemsWithKey.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useItemsWithKey = useItemsWithKey;
|
|
4
|
+
const utils_1 = require("@headless-adminapp/core/utils");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
function useItemsWithKey(value) {
|
|
7
|
+
return (0, react_1.useMemo)(() => {
|
|
5
8
|
if (!value) {
|
|
6
9
|
return value;
|
|
7
10
|
}
|
|
8
|
-
return createItemsWithKey(value);
|
|
11
|
+
return (0, utils_1.createItemsWithKey)(value);
|
|
9
12
|
}, [value]);
|
|
10
13
|
}
|
package/hooks/useStorageState.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStorageState = useStorageState;
|
|
4
|
+
const react_1 = require("react");
|
|
2
5
|
function getStorageValue(key, store) {
|
|
3
6
|
const value = store.getItem(key);
|
|
4
7
|
if (value) {
|
|
@@ -9,10 +12,9 @@ function getStorageValue(key, store) {
|
|
|
9
12
|
function setStorageValue(key, value, store) {
|
|
10
13
|
store.setItem(key, JSON.stringify(value));
|
|
11
14
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const setStoredState = useCallback((value) => {
|
|
15
|
+
function useStorageState(initialState, key, store = localStorage) {
|
|
16
|
+
const [state, setState] = (0, react_1.useState)(getStorageValue(key, store) ?? initialState);
|
|
17
|
+
const setStoredState = (0, react_1.useCallback)((value) => {
|
|
16
18
|
setState((prevState) => {
|
|
17
19
|
const finalState = value instanceof Function ? value(prevState) : value;
|
|
18
20
|
setStorageValue(key, finalState, store);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSystemColorScheme = useSystemColorScheme;
|
|
4
|
+
const react_1 = require("react");
|
|
2
5
|
const isSystemDarkMode = () => {
|
|
3
6
|
if (typeof window === 'undefined') {
|
|
4
7
|
return false;
|
|
@@ -6,9 +9,9 @@ const isSystemDarkMode = () => {
|
|
|
6
9
|
return (window.matchMedia &&
|
|
7
10
|
window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
8
11
|
};
|
|
9
|
-
|
|
10
|
-
const [systemColorScheme, setSystemColorScheme] = useState(isSystemDarkMode() ? 'dark' : 'light');
|
|
11
|
-
useEffect(() => {
|
|
12
|
+
function useSystemColorScheme() {
|
|
13
|
+
const [systemColorScheme, setSystemColorScheme] = (0, react_1.useState)(isSystemDarkMode() ? 'dark' : 'light');
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
12
15
|
setSystemColorScheme(isSystemDarkMode() ? 'dark' : 'light');
|
|
13
16
|
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
14
17
|
const handleChange = (e) => {
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsightsProvider = InsightsProvider;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const mutable_1 = require("../mutable");
|
|
7
|
+
const context_1 = require("./context");
|
|
8
|
+
function InsightsProvider({ children, experience, insightLookup, onInsightSelect, }) {
|
|
9
|
+
const onInsightSelectRef = (0, react_1.useRef)(onInsightSelect);
|
|
7
10
|
onInsightSelectRef.current = onInsightSelect;
|
|
8
|
-
const onInsightSelectInternal = useCallback((id) => {
|
|
11
|
+
const onInsightSelectInternal = (0, react_1.useCallback)((id) => {
|
|
9
12
|
onInsightSelectRef.current(id);
|
|
10
13
|
}, [onInsightSelectRef]);
|
|
11
|
-
const insightsValues = useCreateContextStore({
|
|
14
|
+
const insightsValues = (0, mutable_1.useCreateContextStore)({
|
|
12
15
|
experience,
|
|
13
16
|
data: experience.defaultData,
|
|
14
17
|
insightLookup: insightLookup,
|
|
15
18
|
onInsightSelect: onInsightSelectInternal,
|
|
16
19
|
});
|
|
17
|
-
useEffect(() => {
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
18
21
|
insightsValues.setValue({
|
|
19
22
|
experience,
|
|
20
23
|
data: experience.defaultData,
|
|
21
24
|
});
|
|
22
25
|
}, [experience, insightsValues]);
|
|
23
|
-
return (
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(context_1.InsightsContext.Provider, { value: insightsValues, children: children }));
|
|
24
27
|
}
|
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").ContextValue<InsightsState<import("@headless-adminapp/core/schema").SchemaAttributes>>>;
|
|
2
|
+
export declare const InsightsContext: import("react").Context<import("../mutable/context").ContextValue<InsightsState<import("@headless-adminapp/core/schema").SchemaAttributes>>>;
|
package/insights/context.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsightsContext = void 0;
|
|
4
|
+
const context_1 = require("../mutable/context");
|
|
5
|
+
exports.InsightsContext = (0, context_1.createContext)();
|
package/insights/hooks/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInsightsState = useInsightsState;
|
|
4
|
+
const mutable_1 = require("../../mutable");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useInsightsState() {
|
|
7
|
+
return (0, mutable_1.useContextSelector)(context_1.InsightsContext, (state) => state);
|
|
5
8
|
}
|
package/insights/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.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);
|
package/locale/LocaleProvider.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocaleProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const locale_1 = require("@headless-adminapp/core/experience/locale");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const context_1 = require("./context");
|
|
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);
|
|
8
11
|
}, [locale, timezone, options]);
|
|
9
|
-
return (
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(context_1.LocaleContext.Provider, { value: localeState, children: children }));
|
|
10
13
|
};
|
|
14
|
+
exports.LocaleProvider = LocaleProvider;
|
package/locale/context.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocaleContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.LocaleContext = (0, react_1.createContext)(null);
|
package/locale/index.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.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,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCurrencySymbol = useCurrencySymbol;
|
|
4
|
+
const utils_1 = require("@headless-adminapp/core/experience/locale/utils");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useLocale_1 = require("./useLocale");
|
|
7
|
+
function useCurrencySymbol() {
|
|
8
|
+
const locale = (0, useLocale_1.useLocale)();
|
|
9
|
+
return (0, react_1.useMemo)(() => {
|
|
10
|
+
return (0, utils_1.getCurrencySymbol)(locale.locale, locale.currency.currency ?? 'USD');
|
|
9
11
|
}, [locale]);
|
|
10
12
|
}
|
package/locale/useLocale.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLocale = useLocale;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("./context");
|
|
6
|
+
function useLocale() {
|
|
7
|
+
const context = (0, react_1.useContext)(context_1.LocaleContext);
|
|
5
8
|
if (!context) {
|
|
6
9
|
throw new Error('useLocale must be used within a LocaleProvider');
|
|
7
10
|
}
|
package/locale/utils.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.localizedLabel = localizedLabel;
|
|
4
|
+
function localizedLabel(language, value, fallback) {
|
|
5
|
+
return (value.localizedLabels?.[language] ??
|
|
6
|
+
fallback?.localizedLabels?.[language] ??
|
|
7
|
+
value.label ??
|
|
8
|
+
fallback?.label);
|
|
4
9
|
}
|
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetadataProvider = exports.defaultExperienceStore = exports.defaultSchemaStore = exports.defaultAppStore = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const app_1 = require("@headless-adminapp/core/experience/app");
|
|
6
|
+
const store_1 = require("@headless-adminapp/core/store");
|
|
7
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
8
|
+
const context_1 = require("../mutable/context");
|
|
9
|
+
const store_2 = require("../store");
|
|
10
|
+
const context_2 = require("./context");
|
|
11
|
+
exports.defaultAppStore = new store_2.ClientAppStore();
|
|
12
|
+
exports.defaultSchemaStore = new store_1.SchemaStore();
|
|
13
|
+
exports.defaultExperienceStore = new store_2.SchemaExperienceStore({
|
|
14
|
+
schemaStore: exports.defaultSchemaStore,
|
|
12
15
|
});
|
|
13
|
-
defaultAppStore.register({
|
|
16
|
+
exports.defaultAppStore.register({
|
|
14
17
|
id: 'default',
|
|
15
18
|
title: 'Demo App',
|
|
16
19
|
navItems: [],
|
|
17
20
|
defaultPage: {
|
|
18
21
|
label: 'Home',
|
|
19
22
|
link: '/home',
|
|
20
|
-
type: PageType.Custom,
|
|
21
|
-
icon: IconPlaceholder,
|
|
23
|
+
type: app_1.PageType.Custom,
|
|
24
|
+
icon: icons_1.IconPlaceholder,
|
|
22
25
|
},
|
|
23
26
|
logo: {},
|
|
24
27
|
});
|
|
25
|
-
|
|
26
|
-
const contextValue = useCreateContextStore({
|
|
28
|
+
const MetadataProvider = ({ children, experienceStore = exports.defaultExperienceStore, schemaStore = exports.defaultSchemaStore, appStore = exports.defaultAppStore, }) => {
|
|
29
|
+
const contextValue = (0, context_1.useCreateContextStore)({
|
|
27
30
|
experienceStore,
|
|
28
31
|
schemaStore,
|
|
29
32
|
appStore,
|
|
30
33
|
});
|
|
31
|
-
return (
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(context_2.MetadataContext.Provider, { value: contextValue, children: children }));
|
|
32
35
|
};
|
|
36
|
+
exports.MetadataProvider = MetadataProvider;
|
package/metadata/context.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export interface MetadataContextState {
|
|
|
4
4
|
schemaStore: ISchemaStore;
|
|
5
5
|
experienceStore: ISchemaExperienceStore;
|
|
6
6
|
}
|
|
7
|
-
export declare const MetadataContext: import("react").Context<import("../mutable").ContextValue<MetadataContextState>>;
|
|
7
|
+
export declare const MetadataContext: import("react").Context<import("../mutable/context").ContextValue<MetadataContextState>>;
|