@headless-adminapp/app 0.0.17-alpha.54 → 0.0.17-alpha.55
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.d.ts +2 -2
- 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,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invertValueMapping = invertValueMapping;
|
|
4
|
+
exports.BoardColumnProvider = BoardColumnProvider;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const mutable_1 = require("../mutable");
|
|
7
|
+
const BoardColumnDataResolver_1 = require("./BoardColumnDataResolver");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
const useBoardConfig_1 = require("./hooks/useBoardConfig");
|
|
10
|
+
function invertValueMapping(value) {
|
|
7
11
|
return Object.keys(value).reduce((acc, key) => {
|
|
8
12
|
const toKeys = value[key];
|
|
9
13
|
toKeys.forEach((toKey) => {
|
|
@@ -12,9 +16,9 @@ export function invertValueMapping(value) {
|
|
|
12
16
|
return acc;
|
|
13
17
|
}, {});
|
|
14
18
|
}
|
|
15
|
-
|
|
16
|
-
const { schema } = useBoardConfig();
|
|
17
|
-
const contextValue = useCreateContextStore({
|
|
19
|
+
function BoardColumnProvider(props) {
|
|
20
|
+
const { schema } = (0, useBoardConfig_1.useBoardConfig)();
|
|
21
|
+
const contextValue = (0, mutable_1.useCreateContextStore)({
|
|
18
22
|
config: props.config,
|
|
19
23
|
data: {
|
|
20
24
|
logicalName: schema.logicalName,
|
|
@@ -28,5 +32,5 @@ export function BoardColumnProvider(props) {
|
|
|
28
32
|
},
|
|
29
33
|
fetchNextPage: () => { },
|
|
30
34
|
});
|
|
31
|
-
return (
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(context_1.BoardColumnContext.Provider, { value: contextValue, children: [(0, jsx_runtime_1.jsx)(BoardColumnDataResolver_1.DataResolver, {}), props.children] }));
|
|
32
36
|
}
|
package/board/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
-
import { RetriveRecordsResult } from '@headless-adminapp/core/transport';
|
|
1
|
+
import type { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import type { RetriveRecordsResult } from '@headless-adminapp/core/transport';
|
|
3
3
|
import { BoardColumnConfig, BoardConfig } from './types';
|
|
4
4
|
export interface BoardContextState<S extends SchemaAttributes = SchemaAttributes> {
|
|
5
5
|
config: BoardConfig<S>;
|
package/board/context.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardColumnContext = exports.BoardContext = void 0;
|
|
4
|
+
const mutable_1 = require("../mutable");
|
|
5
|
+
exports.BoardContext = (0, mutable_1.createContext)();
|
|
6
|
+
exports.BoardColumnContext = (0, mutable_1.createContext)();
|
package/board/hooks/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchText = exports.useBoardSchema = exports.useBoardConfig = exports.useBoardColumnDataState = exports.useBoardColumnData = exports.useBoardColumnConfig = void 0;
|
|
4
|
+
var useBoardColumnConfig_1 = require("./useBoardColumnConfig");
|
|
5
|
+
Object.defineProperty(exports, "useBoardColumnConfig", { enumerable: true, get: function () { return useBoardColumnConfig_1.useBoardColumnConfig; } });
|
|
6
|
+
var useBoardColumnData_1 = require("./useBoardColumnData");
|
|
7
|
+
Object.defineProperty(exports, "useBoardColumnData", { enumerable: true, get: function () { return useBoardColumnData_1.useBoardColumnData; } });
|
|
8
|
+
var useBoardColumnDataState_1 = require("./useBoardColumnDataState");
|
|
9
|
+
Object.defineProperty(exports, "useBoardColumnDataState", { enumerable: true, get: function () { return useBoardColumnDataState_1.useBoardColumnDataState; } });
|
|
10
|
+
var useBoardConfig_1 = require("./useBoardConfig");
|
|
11
|
+
Object.defineProperty(exports, "useBoardConfig", { enumerable: true, get: function () { return useBoardConfig_1.useBoardConfig; } });
|
|
12
|
+
var useBoardSchema_1 = require("./useBoardSchema");
|
|
13
|
+
Object.defineProperty(exports, "useBoardSchema", { enumerable: true, get: function () { return useBoardSchema_1.useBoardSchema; } });
|
|
14
|
+
var useSearchText_1 = require("./useSearchText");
|
|
15
|
+
Object.defineProperty(exports, "useSearchText", { enumerable: true, get: function () { return useSearchText_1.useSearchText; } });
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardColumnConfig = useBoardColumnConfig;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardColumnConfig() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.BoardColumnContext, (context) => context.config);
|
|
5
8
|
}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { BoardColumnContextState } from '../context';
|
|
3
|
+
export declare function useBoardColumnData<S extends SchemaAttributes = SchemaAttributes>(): BoardColumnContextState<S>['data'];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardColumnData = useBoardColumnData;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardColumnData() {
|
|
7
|
+
const data = (0, context_1.useContextSelector)(context_2.BoardColumnContext, (state) => state.data);
|
|
5
8
|
return data;
|
|
6
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardColumnDataState = useBoardColumnDataState;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardColumnDataState() {
|
|
7
|
+
const data = (0, context_1.useContextSelector)(context_2.BoardColumnContext, (state) => state.dataState);
|
|
5
8
|
return data;
|
|
6
9
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardConfig = useBoardConfig;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useBoardConfig() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.BoardContext, (context) => context.config);
|
|
5
8
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBoardSchema = useBoardSchema;
|
|
4
|
+
const useBoardConfig_1 = require("./useBoardConfig");
|
|
5
|
+
function useBoardSchema() {
|
|
6
|
+
return (0, useBoardConfig_1.useBoardConfig)().schema;
|
|
4
7
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchText = useSearchText;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useSearchText() {
|
|
8
|
+
const searchText = (0, context_1.useContextSelector)(context_2.BoardContext, (context) => context.searchText);
|
|
9
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.BoardContext);
|
|
10
|
+
const setSearchText = (0, react_1.useCallback)((value) => {
|
|
8
11
|
setValue({ searchText: value });
|
|
9
12
|
}, [setValue]);
|
|
10
13
|
return [searchText, setSearchText];
|
package/board/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/board/utils.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandBuilder = void 0;
|
|
4
|
+
const DefaultCommandBuilder_1 = require("./DefaultCommandBuilder");
|
|
5
|
+
const FormCommandBuilder_1 = require("./FormCommandBuilder");
|
|
6
|
+
const SubgridCommandBuilder_1 = require("./SubgridCommandBuilder");
|
|
7
|
+
const ViewCommandBuilder_1 = require("./ViewCommandBuilder");
|
|
8
|
+
var CommandBuilder;
|
|
6
9
|
(function (CommandBuilder) {
|
|
7
|
-
CommandBuilder.View = ViewCommandBuilder;
|
|
8
|
-
CommandBuilder.Form = FormCommandBuilder;
|
|
9
|
-
CommandBuilder.Subgrid = SubgridCommandBuilder;
|
|
10
|
-
CommandBuilder.Default = DefaultCommandBuilder;
|
|
11
|
-
})(CommandBuilder || (CommandBuilder = {}));
|
|
10
|
+
CommandBuilder.View = ViewCommandBuilder_1.ViewCommandBuilder;
|
|
11
|
+
CommandBuilder.Form = FormCommandBuilder_1.FormCommandBuilder;
|
|
12
|
+
CommandBuilder.Subgrid = SubgridCommandBuilder_1.SubgridCommandBuilder;
|
|
13
|
+
CommandBuilder.Default = DefaultCommandBuilder_1.DefaultCommandBuilder;
|
|
14
|
+
})(CommandBuilder || (exports.CommandBuilder = CommandBuilder = {}));
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultCommandBuilder = void 0;
|
|
4
|
+
const FormCommandBuilder_1 = require("./FormCommandBuilder");
|
|
5
|
+
const SubgridCommandBuilder_1 = require("./SubgridCommandBuilder");
|
|
6
|
+
const ViewCommandBuilder_1 = require("./ViewCommandBuilder");
|
|
7
|
+
var DefaultCommandBuilder;
|
|
5
8
|
(function (DefaultCommandBuilder) {
|
|
6
9
|
DefaultCommandBuilder.defaultViewCommandStrings = {
|
|
7
10
|
new: 'New',
|
|
8
11
|
edit: 'Edit',
|
|
9
12
|
delete: 'Delete',
|
|
10
|
-
deleteRecordCommandStringSet: ViewCommandBuilder.defaultDeleteRecordStringSet,
|
|
13
|
+
deleteRecordCommandStringSet: ViewCommandBuilder_1.ViewCommandBuilder.defaultDeleteRecordStringSet,
|
|
11
14
|
refresh: 'Refresh',
|
|
12
15
|
export: 'Export',
|
|
13
16
|
exportCsv: 'CSV',
|
|
@@ -25,31 +28,31 @@ export var DefaultCommandBuilder;
|
|
|
25
28
|
function createDefaultViewCommands({ icons, strings = DefaultCommandBuilder.defaultViewCommandStrings, localizedSrings, }) {
|
|
26
29
|
return [
|
|
27
30
|
[
|
|
28
|
-
ViewCommandBuilder.createNewRecordCommand({
|
|
31
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createNewRecordCommand({
|
|
29
32
|
Icon: icons.New,
|
|
30
33
|
text: strings.new,
|
|
31
34
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.new),
|
|
32
35
|
}),
|
|
33
|
-
ViewCommandBuilder.createEditRecordCommand({
|
|
36
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createEditRecordCommand({
|
|
34
37
|
Icon: icons.Edit,
|
|
35
38
|
text: strings.edit,
|
|
36
39
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.edit),
|
|
37
40
|
}),
|
|
38
|
-
ViewCommandBuilder.createDeleteRecordCommand({
|
|
41
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createDeleteRecordCommand({
|
|
39
42
|
Icon: icons.Delete,
|
|
40
43
|
text: strings.delete,
|
|
41
44
|
localizedText: extractLocalizedStrings(localizedSrings, (x) => x.delete),
|
|
42
45
|
stringSet: strings.deleteRecordCommandStringSet,
|
|
43
46
|
localizedStringSet: extractLocalizedStrings(localizedSrings, (x) => x.deleteRecordCommandStringSet),
|
|
44
47
|
}),
|
|
45
|
-
ViewCommandBuilder.createRefreshCommand({
|
|
48
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createRefreshCommand({
|
|
46
49
|
Icon: icons.Refresh,
|
|
47
50
|
text: strings.refresh,
|
|
48
51
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.refresh),
|
|
49
52
|
}),
|
|
50
53
|
],
|
|
51
54
|
[
|
|
52
|
-
ViewCommandBuilder.createExportCommand({
|
|
55
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createExportCommand({
|
|
53
56
|
button: {
|
|
54
57
|
Icon: icons.Export,
|
|
55
58
|
text: strings.export,
|
|
@@ -75,27 +78,27 @@ export var DefaultCommandBuilder;
|
|
|
75
78
|
saveAndClose: 'Save & Close',
|
|
76
79
|
refresh: 'Refresh',
|
|
77
80
|
delete: 'Delete',
|
|
78
|
-
deleteRecordCommandStringSet: FormCommandBuilder.defaultDeleteRecordStringSet,
|
|
81
|
+
deleteRecordCommandStringSet: FormCommandBuilder_1.FormCommandBuilder.defaultDeleteRecordStringSet,
|
|
79
82
|
};
|
|
80
83
|
function createDefaultFormCommands({ icons, strings = DefaultCommandBuilder.defaultFormCommandStrings, localizedSrings, }) {
|
|
81
84
|
return [
|
|
82
85
|
[
|
|
83
|
-
FormCommandBuilder.createSaveCommand({
|
|
86
|
+
FormCommandBuilder_1.FormCommandBuilder.createSaveCommand({
|
|
84
87
|
Icon: icons.Save,
|
|
85
88
|
text: strings.save,
|
|
86
89
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.save),
|
|
87
90
|
}),
|
|
88
|
-
FormCommandBuilder.createSaveAndCloseCommand({
|
|
91
|
+
FormCommandBuilder_1.FormCommandBuilder.createSaveAndCloseCommand({
|
|
89
92
|
Icon: icons.SaveAndClose,
|
|
90
93
|
text: strings.saveAndClose,
|
|
91
94
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.saveAndClose),
|
|
92
95
|
}),
|
|
93
|
-
FormCommandBuilder.createRefreshCommand({
|
|
96
|
+
FormCommandBuilder_1.FormCommandBuilder.createRefreshCommand({
|
|
94
97
|
Icon: icons.Refresh,
|
|
95
98
|
text: strings.refresh,
|
|
96
99
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.refresh),
|
|
97
100
|
}),
|
|
98
|
-
FormCommandBuilder.createDeleteCommand({
|
|
101
|
+
FormCommandBuilder_1.FormCommandBuilder.createDeleteCommand({
|
|
99
102
|
Icon: icons.Delete,
|
|
100
103
|
text: 'Delete',
|
|
101
104
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.delete),
|
|
@@ -114,36 +117,36 @@ export var DefaultCommandBuilder;
|
|
|
114
117
|
export: 'Export',
|
|
115
118
|
exportCsv: 'CSV',
|
|
116
119
|
exportExcel: 'Excel',
|
|
117
|
-
deleteRecordCommandStringSet: ViewCommandBuilder.defaultDeleteRecordStringSet,
|
|
120
|
+
deleteRecordCommandStringSet: ViewCommandBuilder_1.ViewCommandBuilder.defaultDeleteRecordStringSet,
|
|
118
121
|
};
|
|
119
122
|
function createDefaultSubgridCommands({ icons, strings = defaultSubgridCommandStrings, localizedSrings, }) {
|
|
120
123
|
return [
|
|
121
124
|
[
|
|
122
|
-
SubgridCommandBuilder.createNewRecordCommand({
|
|
125
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createNewRecordCommand({
|
|
123
126
|
Icon: icons.New,
|
|
124
127
|
text: strings.new,
|
|
125
128
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.new),
|
|
126
129
|
}),
|
|
127
|
-
SubgridCommandBuilder.createEditRecordCommand({
|
|
130
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createEditRecordCommand({
|
|
128
131
|
Icon: icons.Edit,
|
|
129
132
|
text: strings.edit,
|
|
130
133
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.edit),
|
|
131
134
|
}),
|
|
132
|
-
SubgridCommandBuilder.createDeleteRecordCommand({
|
|
135
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createDeleteRecordCommand({
|
|
133
136
|
Icon: icons.Delete,
|
|
134
137
|
text: strings.delete,
|
|
135
138
|
localizedText: extractLocalizedStrings(localizedSrings, (x) => x.delete),
|
|
136
139
|
stringSet: strings.deleteRecordCommandStringSet,
|
|
137
140
|
localizedStringSet: extractLocalizedStrings(localizedSrings, (x) => x.deleteRecordCommandStringSet),
|
|
138
141
|
}),
|
|
139
|
-
SubgridCommandBuilder.createRefreshCommand({
|
|
142
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createRefreshCommand({
|
|
140
143
|
Icon: icons.Refresh,
|
|
141
144
|
text: strings.refresh,
|
|
142
145
|
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.refresh),
|
|
143
146
|
}),
|
|
144
147
|
],
|
|
145
148
|
[
|
|
146
|
-
SubgridCommandBuilder.createExportCommand({
|
|
149
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createExportCommand({
|
|
147
150
|
button: {
|
|
148
151
|
Icon: icons.Export,
|
|
149
152
|
text: strings.export,
|
|
@@ -164,7 +167,11 @@ export var DefaultCommandBuilder;
|
|
|
164
167
|
];
|
|
165
168
|
}
|
|
166
169
|
DefaultCommandBuilder.createDefaultSubgridCommands = createDefaultSubgridCommands;
|
|
167
|
-
const defaultCreateCommandStrings =
|
|
170
|
+
const defaultCreateCommandStrings = {
|
|
171
|
+
...DefaultCommandBuilder.defaultViewCommandStrings,
|
|
172
|
+
...DefaultCommandBuilder.defaultFormCommandStrings,
|
|
173
|
+
...defaultSubgridCommandStrings,
|
|
174
|
+
};
|
|
168
175
|
function createDefaultCommands({ icons, strings = defaultCreateCommandStrings, localizedSrings, }) {
|
|
169
176
|
return {
|
|
170
177
|
view: createDefaultViewCommands({
|
|
@@ -185,4 +192,4 @@ export var DefaultCommandBuilder;
|
|
|
185
192
|
};
|
|
186
193
|
}
|
|
187
194
|
DefaultCommandBuilder.createDefaultCommands = createDefaultCommands;
|
|
188
|
-
})(DefaultCommandBuilder || (DefaultCommandBuilder = {}));
|
|
195
|
+
})(DefaultCommandBuilder || (exports.DefaultCommandBuilder = DefaultCommandBuilder = {}));
|
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { createLocalizedSelector, plurialize } from './utils';
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormCommandBuilder = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
11
5
|
var EnabledRules;
|
|
12
6
|
(function (EnabledRules) {
|
|
13
7
|
function HasCreatePermisssion(context) {
|
|
14
|
-
|
|
15
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableCreate);
|
|
8
|
+
return !context.primaryControl.schema.restrictions?.disableCreate;
|
|
16
9
|
}
|
|
17
10
|
EnabledRules.HasCreatePermisssion = HasCreatePermisssion;
|
|
18
11
|
function HasUpdatePermission(context) {
|
|
19
|
-
|
|
20
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableUpdate);
|
|
12
|
+
return !context.primaryControl.schema.restrictions?.disableUpdate;
|
|
21
13
|
}
|
|
22
14
|
EnabledRules.HasUpdatePermission = HasUpdatePermission;
|
|
23
15
|
function HasDeletePermission(context) {
|
|
24
|
-
|
|
25
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete);
|
|
16
|
+
return !context.primaryControl.schema.restrictions?.disableDelete;
|
|
26
17
|
}
|
|
27
18
|
EnabledRules.HasDeletePermission = HasDeletePermission;
|
|
28
19
|
})(EnabledRules || (EnabledRules = {}));
|
|
29
|
-
|
|
20
|
+
var FormCommandBuilder;
|
|
30
21
|
(function (FormCommandBuilder) {
|
|
31
22
|
function createSaveCommand({ Icon, text, localizedTexts, }) {
|
|
32
23
|
return {
|
|
@@ -35,9 +26,9 @@ export var FormCommandBuilder;
|
|
|
35
26
|
text,
|
|
36
27
|
localizedText: localizedTexts,
|
|
37
28
|
isQuickAction: true,
|
|
38
|
-
onClick: (context) =>
|
|
39
|
-
|
|
40
|
-
}
|
|
29
|
+
onClick: async (context) => {
|
|
30
|
+
await context.primaryControl.save('save');
|
|
31
|
+
},
|
|
41
32
|
hidden: [
|
|
42
33
|
(context) => {
|
|
43
34
|
if (context.primaryControl.readonly) {
|
|
@@ -60,9 +51,9 @@ export var FormCommandBuilder;
|
|
|
60
51
|
Icon,
|
|
61
52
|
text,
|
|
62
53
|
localizedText: localizedTexts,
|
|
63
|
-
onClick: (context) =>
|
|
64
|
-
|
|
65
|
-
}
|
|
54
|
+
onClick: async (context) => {
|
|
55
|
+
await context.primaryControl.save('saveandclose');
|
|
56
|
+
},
|
|
66
57
|
hidden: [
|
|
67
58
|
(context) => {
|
|
68
59
|
if (context.primaryControl.readonly) {
|
|
@@ -110,7 +101,7 @@ export var FormCommandBuilder;
|
|
|
110
101
|
}
|
|
111
102
|
return !EnabledRules.HasDeletePermission(context);
|
|
112
103
|
},
|
|
113
|
-
onClick: (context) =>
|
|
104
|
+
onClick: async (context) => {
|
|
114
105
|
const recordId = context.primaryControl.recordId;
|
|
115
106
|
if (!recordId) {
|
|
116
107
|
return;
|
|
@@ -118,22 +109,22 @@ export var FormCommandBuilder;
|
|
|
118
109
|
// if (typeof stringSet === 'function') {
|
|
119
110
|
// stringSet = stringSet(context);
|
|
120
111
|
// }
|
|
121
|
-
const localizeSelector = createLocalizedSelector(stringSet, localizedStringSet, context.locale.language);
|
|
112
|
+
const localizeSelector = (0, utils_1.createLocalizedSelector)(stringSet, localizedStringSet, context.locale.language);
|
|
122
113
|
try {
|
|
123
|
-
const confirmResult =
|
|
124
|
-
title: plurialize(1, localizeSelector((s) => s.confirmation.title)),
|
|
125
|
-
text: plurialize(1, localizeSelector((s) => s.confirmation.text)),
|
|
114
|
+
const confirmResult = await context.utility.openConfirmDialog({
|
|
115
|
+
title: (0, utils_1.plurialize)(1, localizeSelector((s) => s.confirmation.title)),
|
|
116
|
+
text: (0, utils_1.plurialize)(1, localizeSelector((s) => s.confirmation.text)),
|
|
126
117
|
cancelButtonLabel: stringSet.confirmation.buttonCancel,
|
|
127
118
|
confirmButtonLabel: stringSet.confirmation.buttonConfirm,
|
|
128
119
|
});
|
|
129
|
-
if (!
|
|
120
|
+
if (!confirmResult?.confirmed) {
|
|
130
121
|
return;
|
|
131
122
|
}
|
|
132
|
-
context.utility.showProgressIndicator(plurialize(1, localizeSelector((s) => s.status.deleting)) + '...');
|
|
133
|
-
|
|
123
|
+
context.utility.showProgressIndicator((0, utils_1.plurialize)(1, localizeSelector((s) => s.status.deleting)) + '...');
|
|
124
|
+
await context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
|
|
134
125
|
context.utility.showNotification({
|
|
135
|
-
title: plurialize(1, localizeSelector((s) => s.successNotification.title)),
|
|
136
|
-
text: plurialize(1, localizeSelector((s) => s.successNotification.text)),
|
|
126
|
+
title: (0, utils_1.plurialize)(1, localizeSelector((s) => s.successNotification.title)),
|
|
127
|
+
text: (0, utils_1.plurialize)(1, localizeSelector((s) => s.successNotification.text)),
|
|
137
128
|
type: 'success',
|
|
138
129
|
});
|
|
139
130
|
context.primaryControl.close();
|
|
@@ -148,7 +139,7 @@ export var FormCommandBuilder;
|
|
|
148
139
|
finally {
|
|
149
140
|
context.utility.hideProgressIndicator();
|
|
150
141
|
}
|
|
151
|
-
}
|
|
142
|
+
},
|
|
152
143
|
};
|
|
153
144
|
}
|
|
154
145
|
FormCommandBuilder.createDeleteCommand = createDeleteCommand;
|
|
@@ -158,11 +149,11 @@ export var FormCommandBuilder;
|
|
|
158
149
|
type: 'button',
|
|
159
150
|
text,
|
|
160
151
|
localizedText: localizedTexts,
|
|
161
|
-
onClick: (context) =>
|
|
162
|
-
|
|
163
|
-
}
|
|
152
|
+
onClick: async (context) => {
|
|
153
|
+
await context.primaryControl.refresh();
|
|
154
|
+
},
|
|
164
155
|
hidden: (context) => !context.primaryControl.recordId,
|
|
165
156
|
};
|
|
166
157
|
}
|
|
167
158
|
FormCommandBuilder.createRefreshCommand = createRefreshCommand;
|
|
168
|
-
})(FormCommandBuilder || (FormCommandBuilder = {}));
|
|
159
|
+
})(FormCommandBuilder || (exports.FormCommandBuilder = FormCommandBuilder = {}));
|