@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.
Files changed (220) hide show
  1. package/app/AppProvider.js +24 -32
  2. package/app/AuthWrapper.js +13 -9
  3. package/app/LayoutProvider.js +34 -39
  4. package/app/context.js +5 -2
  5. package/app/hooks/index.js +17 -1
  6. package/app/hooks/useAppContext.js +7 -4
  7. package/app/index.js +11 -4
  8. package/auth/AuthProvider.js +27 -36
  9. package/auth/context.d.ts +1 -1
  10. package/auth/context.js +5 -2
  11. package/auth/hooks/index.js +18 -2
  12. package/auth/hooks/useAuthSession.js +7 -4
  13. package/auth/hooks/useIsSkipAuthCheck.js +7 -4
  14. package/auth/hooks/useLogout.js +11 -8
  15. package/auth/index.js +23 -4
  16. package/auth/types.js +2 -1
  17. package/board/BoardColumnDataResolver.js +23 -20
  18. package/board/BoardColumnProvider.js +14 -10
  19. package/board/context.d.ts +2 -2
  20. package/board/context.js +6 -3
  21. package/board/hooks/index.js +15 -6
  22. package/board/hooks/useBoardColumnConfig.js +7 -4
  23. package/board/hooks/useBoardColumnData.d.ts +3 -1
  24. package/board/hooks/useBoardColumnData.js +7 -4
  25. package/board/hooks/useBoardColumnDataState.js +7 -4
  26. package/board/hooks/useBoardConfig.js +7 -4
  27. package/board/hooks/useBoardSchema.js +6 -3
  28. package/board/hooks/useSearchText.js +10 -7
  29. package/board/types.js +2 -1
  30. package/board/utils.js +4 -1
  31. package/builders/CommandBuilder/CommandBuilder.js +13 -10
  32. package/builders/CommandBuilder/DefaultCommandBuilder.js +30 -23
  33. package/builders/CommandBuilder/FormCommandBuilder.js +29 -38
  34. package/builders/CommandBuilder/SubgridCommandBuilder.js +27 -36
  35. package/builders/CommandBuilder/ViewCommandBuilder.js +29 -38
  36. package/builders/CommandBuilder/index.js +5 -1
  37. package/builders/CommandBuilder/utils.js +7 -3
  38. package/builders/SchemaExperienceBuilder.js +55 -31
  39. package/builders/index.js +7 -2
  40. package/builders/utils.js +59 -44
  41. package/command/hooks/index.js +18 -2
  42. package/command/hooks/useBaseCommandHandlerContext.js +29 -25
  43. package/command/hooks/useCommands.js +9 -6
  44. package/command/index.js +18 -2
  45. package/command/types.js +2 -1
  46. package/command/utils/index.js +41 -13
  47. package/components/ScrollView/index.js +11 -4
  48. package/components/ScrollbarWithMoreDataRequest/index.js +14 -11
  49. package/dataform/DataFormProvider/DataResolver.js +81 -89
  50. package/dataform/DataFormProvider/InitialValueResolver.js +22 -20
  51. package/dataform/DataFormProvider/ReadonlyInfoResolver.js +14 -12
  52. package/dataform/DataFormProvider/index.js +26 -32
  53. package/dataform/context.js +5 -2
  54. package/dataform/hooks/index.js +29 -13
  55. package/dataform/hooks/useFormInstance.js +6 -3
  56. package/dataform/hooks/useFormIsDirty.js +6 -3
  57. package/dataform/hooks/useFormIsReadonly.js +7 -4
  58. package/dataform/hooks/useFormNotifications.js +12 -9
  59. package/dataform/hooks/useFormRecord.js +7 -4
  60. package/dataform/hooks/useFormSave.js +40 -46
  61. package/dataform/hooks/useFormSchema.js +7 -4
  62. package/dataform/hooks/useLoadFormGridPage.js +19 -25
  63. package/dataform/hooks/useMainFormCommands.js +37 -30
  64. package/dataform/hooks/useProcessFlowSteps.js +27 -23
  65. package/dataform/hooks/useRecordId.js +7 -4
  66. package/dataform/hooks/useRecordTitle.js +12 -9
  67. package/dataform/hooks/useSelectedForm.js +7 -4
  68. package/dataform/index.js +23 -4
  69. package/dataform/utils/defaultParameters.js +16 -6
  70. package/dataform/utils/index.js +90 -56
  71. package/dataform/utils/saveRecord.js +99 -104
  72. package/datagrid/DataGridProvider/DataResolver.js +36 -34
  73. package/datagrid/DataGridProvider/index.js +31 -32
  74. package/datagrid/DataGridProvider/transformViewColumns.js +17 -6
  75. package/datagrid/DataGridProvider/utils.js +13 -5
  76. package/datagrid/column-filter/constants.js +5 -2
  77. package/datagrid/column-filter/index.js +7 -2
  78. package/datagrid/column-filter/types.js +2 -1
  79. package/datagrid/column-filter/utils.js +13 -3
  80. package/datagrid/context.d.ts +1 -1
  81. package/datagrid/context.js +5 -2
  82. package/datagrid/hooks/index.js +36 -20
  83. package/datagrid/hooks/useChangeView.js +10 -7
  84. package/datagrid/hooks/useGridColumnFilter.js +14 -8
  85. package/datagrid/hooks/useGridColumns.js +7 -4
  86. package/datagrid/hooks/useGridCommands.js +7 -4
  87. package/datagrid/hooks/useGridData.js +7 -4
  88. package/datagrid/hooks/useGridDataState.js +7 -4
  89. package/datagrid/hooks/useGridExtraFilter.js +7 -4
  90. package/datagrid/hooks/useGridOptions.js +4 -1
  91. package/datagrid/hooks/useGridPagination.js +4 -1
  92. package/datagrid/hooks/useGridRefresh.js +10 -7
  93. package/datagrid/hooks/useGridSchema.js +7 -4
  94. package/datagrid/hooks/useGridSelection.js +10 -7
  95. package/datagrid/hooks/useGridSorting.js +10 -7
  96. package/datagrid/hooks/useGridViewLookupData.js +7 -4
  97. package/datagrid/hooks/useLoadMainGridPage.js +12 -9
  98. package/datagrid/hooks/useMainGridCommands.js +62 -54
  99. package/datagrid/hooks/useMaxRecords.js +7 -4
  100. package/datagrid/hooks/useOpenRecord.js +20 -17
  101. package/datagrid/hooks/useSearchText.js +10 -7
  102. package/datagrid/hooks/useSelectedView.js +7 -4
  103. package/datagrid/hooks/useSubGridCommands.js +34 -23
  104. package/datagrid/index.js +27 -5
  105. package/defaults.js +5 -2
  106. package/dialog/DialogProvider.js +10 -6
  107. package/dialog/context.d.ts +1 -1
  108. package/dialog/context.js +5 -2
  109. package/dialog/hooks/index.js +24 -8
  110. package/dialog/hooks/useCloseDialog.js +10 -7
  111. package/dialog/hooks/useDialogItem.d.ts +1 -1
  112. package/dialog/hooks/useDialogItem.js +7 -4
  113. package/dialog/hooks/useDialogItems.d.ts +1 -1
  114. package/dialog/hooks/useDialogItems.js +7 -4
  115. package/dialog/hooks/useOpenAlertDialog.js +16 -8
  116. package/dialog/hooks/useOpenConfirmDialog.js +18 -9
  117. package/dialog/hooks/useOpenDialog.js +18 -11
  118. package/dialog/hooks/useOpenErrorDialog.js +16 -8
  119. package/dialog/hooks/useOpenPromptDialog.js +18 -9
  120. package/dialog/index.js +22 -3
  121. package/form/FormValidationStringContext.js +9 -5
  122. package/form/index.js +7 -1
  123. package/hooks/index.js +24 -6
  124. package/hooks/useDebouncedValue.js +11 -8
  125. package/hooks/useElementLayout.js +7 -4
  126. package/hooks/useIsMobile.js +12 -6
  127. package/hooks/useItemsWithKey.js +8 -5
  128. package/hooks/useStorageState.js +7 -5
  129. package/hooks/useSystemColorScheme.js +7 -4
  130. package/insights/InsightsProvider.js +13 -10
  131. package/insights/context.d.ts +1 -1
  132. package/insights/context.js +5 -2
  133. package/insights/hooks/index.js +7 -4
  134. package/insights/index.js +20 -2
  135. package/locale/LocaleProvider.js +12 -8
  136. package/locale/context.js +5 -2
  137. package/locale/index.js +23 -4
  138. package/locale/useCurrencySymbol.js +10 -8
  139. package/locale/useLocale.js +7 -4
  140. package/locale/utils.js +8 -3
  141. package/metadata/MetadataProvider.js +21 -17
  142. package/metadata/context.d.ts +1 -1
  143. package/metadata/context.js +5 -2
  144. package/metadata/hooks/index.js +24 -8
  145. package/metadata/hooks/useAppStore.js +7 -4
  146. package/metadata/hooks/useExperienceStore.js +7 -4
  147. package/metadata/hooks/useExperienceView.js +11 -17
  148. package/metadata/hooks/useExperienceViewCommands.js +14 -20
  149. package/metadata/hooks/useExperienceViewLookup.js +10 -16
  150. package/metadata/hooks/useExperienceViewSubgridCommands.js +14 -20
  151. package/metadata/hooks/useMetadata.js +11 -8
  152. package/metadata/hooks/useSchema.js +6 -3
  153. package/metadata/index.js +22 -3
  154. package/mutable/context.js +25 -17
  155. package/mutable/index.js +27 -3
  156. package/mutable/state.js +10 -6
  157. package/mutable/type.js +2 -1
  158. package/mutable/utils.js +12 -8
  159. package/navigation/hooks/index.js +17 -1
  160. package/navigation/hooks/useOpenForm.js +14 -11
  161. package/navigation/index.js +17 -1
  162. package/package.json +4 -12
  163. package/progress-indicator/ProgressIndicatorProvider.js +16 -12
  164. package/progress-indicator/context.js +5 -2
  165. package/progress-indicator/hooks/index.js +17 -1
  166. package/progress-indicator/hooks/useProgressIndicator.d.ts +1 -1
  167. package/progress-indicator/hooks/useProgressIndicator.js +7 -4
  168. package/progress-indicator/index.js +22 -3
  169. package/providers/PageEntityFormProvider/index.js +7 -4
  170. package/providers/PageEntityViewProvider/index.js +7 -4
  171. package/recordset/RecordSetProvider.js +16 -12
  172. package/recordset/context.d.ts +1 -1
  173. package/recordset/context.js +5 -2
  174. package/recordset/hooks/index.js +19 -3
  175. package/recordset/hooks/useRecordSetResult.js +22 -29
  176. package/recordset/hooks/useRecordSetSetter.js +9 -6
  177. package/recordset/hooks/useRecordSetVisibility.js +10 -7
  178. package/recordset/index.js +22 -3
  179. package/route/RouteProvider.js +18 -14
  180. package/route/context.js +9 -6
  181. package/route/hooks/index.js +22 -6
  182. package/route/hooks/useBasePath.js +7 -4
  183. package/route/hooks/useIsRouteActive.js +7 -4
  184. package/route/hooks/usePathname.js +7 -4
  185. package/route/hooks/useRouteResolver.js +7 -4
  186. package/route/hooks/useRouter.js +7 -4
  187. package/route/hooks/useSearchParams.js +7 -4
  188. package/route/index.js +20 -2
  189. package/route/types.js +2 -1
  190. package/store/ClientAppStore.js +12 -21
  191. package/store/ComponentStore.js +6 -4
  192. package/store/EventManager.js +20 -32
  193. package/store/SchemaExperienceStore.js +186 -217
  194. package/store/index.js +20 -4
  195. package/toast-notification/ToastNotificationProvider.js +10 -6
  196. package/toast-notification/context.d.ts +1 -1
  197. package/toast-notification/context.js +5 -2
  198. package/toast-notification/hooks/index.js +19 -3
  199. package/toast-notification/hooks/useCloseToastNotification.js +10 -7
  200. package/toast-notification/hooks/useOpenToastNotification.js +18 -11
  201. package/toast-notification/hooks/useToastNotificationItems.d.ts +1 -1
  202. package/toast-notification/hooks/useToastNotificationItems.js +7 -4
  203. package/toast-notification/index.js +22 -3
  204. package/transport/InMemoryDataService/index.js +59 -78
  205. package/transport/RestDataService/index.d.ts +2 -2
  206. package/transport/RestDataService/index.js +72 -91
  207. package/transport/context.js +9 -15
  208. package/transport/hooks/index.js +18 -2
  209. package/transport/hooks/useDataService.js +7 -4
  210. package/transport/hooks/useFileService.js +7 -4
  211. package/transport/hooks/useRetriveRecords.d.ts +1 -1
  212. package/transport/hooks/useRetriveRecords.js +25 -31
  213. package/transport/index.js +20 -2
  214. package/utils/calculateColumnWidths.js +5 -2
  215. package/utils/color.js +4 -1
  216. package/utils/getAttributeFormattedValue.js +38 -40
  217. package/utils/index.js +18 -2
  218. package/widget/context.js +5 -2
  219. package/widget/hooks/index.js +7 -4
  220. package/widget/index.js +5 -1
@@ -1,9 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCreateContextStore } from '../mutable';
3
- import { DataResolver } from './BoardColumnDataResolver';
4
- import { BoardColumnContext } from './context';
5
- import { useBoardConfig } from './hooks/useBoardConfig';
6
- export function invertValueMapping(value) {
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
- export function BoardColumnProvider(props) {
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 (_jsxs(BoardColumnContext.Provider, { value: contextValue, children: [_jsx(DataResolver, {}), props.children] }));
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
  }
@@ -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
- import { createContext } from '../mutable';
2
- export const BoardContext = createContext();
3
- export const BoardColumnContext = createContext();
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)();
@@ -1,6 +1,15 @@
1
- export { useBoardColumnConfig } from './useBoardColumnConfig';
2
- export { useBoardColumnData } from './useBoardColumnData';
3
- export { useBoardColumnDataState } from './useBoardColumnDataState';
4
- export { useBoardConfig } from './useBoardConfig';
5
- export { useBoardSchema } from './useBoardSchema';
6
- export { useSearchText } from './useSearchText';
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
- import { useContextSelector } from '@headless-adminapp/app/mutable/context';
2
- import { BoardColumnContext } from '../context';
3
- export function useBoardColumnConfig() {
4
- return useContextSelector(BoardColumnContext, (context) => context.config);
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
- export declare function useBoardColumnData(): import("@headless-adminapp/core/transport").RetriveRecordsResult<import("@headless-adminapp/core/schema").InferredSchemaType<import("@headless-adminapp/core/schema").SchemaAttributes>> | null;
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
- import { useContextSelector } from '@headless-adminapp/app/mutable/context';
2
- import { BoardColumnContext } from '../context';
3
- export function useBoardColumnData() {
4
- const data = useContextSelector(BoardColumnContext, (state) => state.data);
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
- import { useContextSelector } from '@headless-adminapp/app/mutable/context';
2
- import { BoardColumnContext } from '../context';
3
- export function useBoardColumnDataState() {
4
- const data = useContextSelector(BoardColumnContext, (state) => state.dataState);
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
- import { useContextSelector } from '@headless-adminapp/app/mutable/context';
2
- import { BoardContext } from '../context';
3
- export function useBoardConfig() {
4
- return useContextSelector(BoardContext, (context) => context.config);
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
- import { useBoardConfig } from './useBoardConfig';
2
- export function useBoardSchema() {
3
- return useBoardConfig().schema;
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
- import { useContextSelector, useContextSetValue, } from '@headless-adminapp/app/mutable/context';
2
- import { useCallback } from 'react';
3
- import { BoardContext } from '../context';
4
- export function useSearchText() {
5
- const searchText = useContextSelector(BoardContext, (context) => context.searchText);
6
- const setValue = useContextSetValue(BoardContext);
7
- const setSearchText = useCallback((value) => {
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
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/board/utils.js CHANGED
@@ -1,3 +1,6 @@
1
- export function defineBoardConfig(config) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineBoardConfig = defineBoardConfig;
4
+ function defineBoardConfig(config) {
2
5
  return config;
3
6
  }
@@ -1,11 +1,14 @@
1
- import { DefaultCommandBuilder } from './DefaultCommandBuilder';
2
- import { FormCommandBuilder } from './FormCommandBuilder';
3
- import { SubgridCommandBuilder } from './SubgridCommandBuilder';
4
- import { ViewCommandBuilder } from './ViewCommandBuilder';
5
- export var CommandBuilder;
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
- import { FormCommandBuilder } from './FormCommandBuilder';
2
- import { SubgridCommandBuilder } from './SubgridCommandBuilder';
3
- import { ViewCommandBuilder } from './ViewCommandBuilder';
4
- export var DefaultCommandBuilder;
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 = Object.assign(Object.assign(Object.assign({}, DefaultCommandBuilder.defaultViewCommandStrings), DefaultCommandBuilder.defaultFormCommandStrings), defaultSubgridCommandStrings);
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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
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
- var _a;
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
- var _a;
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
- var _a;
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
- export var FormCommandBuilder;
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) => __awaiter(this, void 0, void 0, function* () {
39
- yield context.primaryControl.save('save');
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) => __awaiter(this, void 0, void 0, function* () {
64
- yield context.primaryControl.save('saveandclose');
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) => __awaiter(this, void 0, void 0, function* () {
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 = yield context.utility.openConfirmDialog({
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 (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
120
+ if (!confirmResult?.confirmed) {
130
121
  return;
131
122
  }
132
- context.utility.showProgressIndicator(plurialize(1, localizeSelector((s) => s.status.deleting)) + '...');
133
- yield context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
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) => __awaiter(this, void 0, void 0, function* () {
162
- yield context.primaryControl.refresh();
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 = {}));