@headless-adminapp/app 0.0.17-alpha.52 → 0.0.17-alpha.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/app/AppProvider.js +13 -17
  2. package/app/AuthWrapper.js +9 -13
  3. package/app/LayoutProvider.js +16 -20
  4. package/app/context.js +2 -5
  5. package/app/hooks/index.js +1 -17
  6. package/app/hooks/useAppContext.js +4 -7
  7. package/app/index.js +4 -11
  8. package/auth/AuthProvider.js +17 -21
  9. package/auth/context.d.ts +1 -1
  10. package/auth/context.js +2 -5
  11. package/auth/hooks/index.js +2 -18
  12. package/auth/hooks/useAuthSession.js +4 -7
  13. package/auth/hooks/useIsSkipAuthCheck.js +4 -7
  14. package/auth/hooks/useLogout.js +7 -10
  15. package/auth/index.js +4 -23
  16. package/auth/types.js +1 -2
  17. package/board/BoardColumnDataResolver.js +20 -23
  18. package/board/BoardColumnProvider.js +10 -14
  19. package/board/context.js +3 -6
  20. package/board/hooks/index.js +6 -15
  21. package/board/hooks/useBoardColumnConfig.js +4 -7
  22. package/board/hooks/useBoardColumnData.js +4 -7
  23. package/board/hooks/useBoardColumnDataState.js +4 -7
  24. package/board/hooks/useBoardConfig.js +4 -7
  25. package/board/hooks/useBoardSchema.js +3 -6
  26. package/board/hooks/useSearchText.js +7 -10
  27. package/board/types.js +1 -2
  28. package/board/utils.js +1 -4
  29. package/builders/CommandBuilder/CommandBuilder.js +10 -13
  30. package/builders/CommandBuilder/DefaultCommandBuilder.js +22 -25
  31. package/builders/CommandBuilder/FormCommandBuilder.js +9 -12
  32. package/builders/CommandBuilder/SubgridCommandBuilder.js +11 -14
  33. package/builders/CommandBuilder/ViewCommandBuilder.js +14 -17
  34. package/builders/CommandBuilder/index.js +1 -5
  35. package/builders/CommandBuilder/utils.js +2 -6
  36. package/builders/SchemaExperienceBuilder.js +1 -5
  37. package/builders/index.js +2 -7
  38. package/builders/utils.js +12 -41
  39. package/command/hooks/index.js +2 -18
  40. package/command/hooks/useBaseCommandHandlerContext.js +25 -29
  41. package/command/hooks/useCommands.js +6 -9
  42. package/command/index.js +2 -18
  43. package/command/types.js +1 -2
  44. package/command/utils/index.js +4 -7
  45. package/components/ScrollView/index.js +4 -11
  46. package/components/ScrollbarWithMoreDataRequest/index.js +9 -13
  47. package/dataform/DataFormProvider/DataResolver.d.ts +2 -2
  48. package/dataform/DataFormProvider/DataResolver.js +31 -32
  49. package/dataform/DataFormProvider/InitialValueResolver.js +19 -22
  50. package/dataform/DataFormProvider/ReadonlyInfoResolver.js +9 -12
  51. package/dataform/DataFormProvider/index.js +22 -25
  52. package/dataform/context.js +2 -5
  53. package/dataform/hooks/index.js +13 -29
  54. package/dataform/hooks/useFormInstance.js +3 -6
  55. package/dataform/hooks/useFormIsDirty.js +3 -6
  56. package/dataform/hooks/useFormIsReadonly.js +4 -7
  57. package/dataform/hooks/useFormNotifications.js +7 -10
  58. package/dataform/hooks/useFormRecord.js +4 -7
  59. package/dataform/hooks/useFormSave.js +30 -33
  60. package/dataform/hooks/useFormSchema.js +4 -7
  61. package/dataform/hooks/useLoadFormGridPage.js +10 -13
  62. package/dataform/hooks/useMainFormCommands.js +27 -32
  63. package/dataform/hooks/useProcessFlowSteps.js +18 -21
  64. package/dataform/hooks/useRecordId.js +4 -7
  65. package/dataform/hooks/useRecordTitle.d.ts +3 -1
  66. package/dataform/hooks/useRecordTitle.js +11 -14
  67. package/dataform/hooks/useSelectedForm.js +4 -7
  68. package/dataform/index.js +4 -23
  69. package/dataform/utils/defaultParameters.js +2 -6
  70. package/dataform/utils/index.d.ts +1 -1
  71. package/dataform/utils/index.js +17 -45
  72. package/dataform/utils/saveRecord.js +5 -9
  73. package/datagrid/DataGridProvider/DataResolver.js +42 -39
  74. package/datagrid/DataGridProvider/index.js +22 -25
  75. package/datagrid/DataGridProvider/transformViewColumns.js +4 -7
  76. package/datagrid/DataGridProvider/utils.js +5 -13
  77. package/datagrid/column-filter/constants.js +2 -5
  78. package/datagrid/column-filter/index.js +2 -7
  79. package/datagrid/column-filter/types.js +1 -2
  80. package/datagrid/column-filter/utils.js +3 -7
  81. package/datagrid/context.d.ts +1 -1
  82. package/datagrid/context.js +2 -5
  83. package/datagrid/hooks/index.js +20 -36
  84. package/datagrid/hooks/useChangeView.js +6 -9
  85. package/datagrid/hooks/useGridColumnFilter.js +7 -10
  86. package/datagrid/hooks/useGridColumns.js +4 -7
  87. package/datagrid/hooks/useGridCommands.js +4 -7
  88. package/datagrid/hooks/useGridData.js +4 -7
  89. package/datagrid/hooks/useGridDataState.js +4 -7
  90. package/datagrid/hooks/useGridExtraFilter.js +4 -7
  91. package/datagrid/hooks/useGridOptions.js +1 -4
  92. package/datagrid/hooks/useGridPagination.js +1 -4
  93. package/datagrid/hooks/useGridRefresh.js +7 -10
  94. package/datagrid/hooks/useGridSchema.js +4 -7
  95. package/datagrid/hooks/useGridSelection.js +7 -10
  96. package/datagrid/hooks/useGridSorting.js +7 -10
  97. package/datagrid/hooks/useGridViewLookupData.js +4 -7
  98. package/datagrid/hooks/useLoadMainGridPage.js +9 -12
  99. package/datagrid/hooks/useMainGridCommands.js +50 -57
  100. package/datagrid/hooks/useMaxRecords.js +4 -7
  101. package/datagrid/hooks/useOpenRecord.js +15 -18
  102. package/datagrid/hooks/useSearchText.js +7 -10
  103. package/datagrid/hooks/useSelectedView.js +4 -7
  104. package/datagrid/hooks/useSubGridCommands.js +19 -24
  105. package/datagrid/index.js +5 -27
  106. package/defaults.js +2 -5
  107. package/dialog/DialogProvider.js +6 -10
  108. package/dialog/context.d.ts +1 -1
  109. package/dialog/context.js +2 -5
  110. package/dialog/hooks/index.js +8 -24
  111. package/dialog/hooks/useCloseDialog.js +6 -9
  112. package/dialog/hooks/useDialogItem.d.ts +1 -1
  113. package/dialog/hooks/useDialogItem.js +4 -7
  114. package/dialog/hooks/useDialogItems.d.ts +1 -1
  115. package/dialog/hooks/useDialogItems.js +4 -7
  116. package/dialog/hooks/useOpenAlertDialog.js +5 -8
  117. package/dialog/hooks/useOpenConfirmDialog.js +5 -8
  118. package/dialog/hooks/useOpenDialog.js +10 -13
  119. package/dialog/hooks/useOpenErrorDialog.js +5 -8
  120. package/dialog/hooks/useOpenPromptDialog.js +5 -8
  121. package/dialog/index.js +3 -22
  122. package/form/FormValidationStringContext.js +5 -9
  123. package/form/index.js +1 -7
  124. package/hooks/index.js +6 -24
  125. package/hooks/useDebouncedValue.js +8 -11
  126. package/hooks/useElementLayout.js +4 -7
  127. package/hooks/useIsMobile.js +6 -12
  128. package/hooks/useItemsWithKey.js +5 -8
  129. package/hooks/useStorageState.js +4 -7
  130. package/hooks/useSystemColorScheme.js +4 -7
  131. package/insights/InsightsProvider.js +10 -13
  132. package/insights/context.d.ts +1 -1
  133. package/insights/context.js +2 -5
  134. package/insights/hooks/index.js +4 -7
  135. package/insights/index.js +2 -20
  136. package/locale/LocaleProvider.js +8 -12
  137. package/locale/context.js +2 -5
  138. package/locale/index.js +4 -23
  139. package/locale/useCurrencySymbol.js +7 -10
  140. package/locale/useLocale.js +4 -7
  141. package/locale/utils.js +1 -4
  142. package/metadata/MetadataProvider.js +17 -21
  143. package/metadata/context.d.ts +1 -1
  144. package/metadata/context.js +2 -5
  145. package/metadata/hooks/index.js +8 -24
  146. package/metadata/hooks/useAppStore.js +4 -7
  147. package/metadata/hooks/useExperienceStore.js +4 -7
  148. package/metadata/hooks/useExperienceView.js +6 -9
  149. package/metadata/hooks/useExperienceViewCommands.js +7 -10
  150. package/metadata/hooks/useExperienceViewLookup.js +5 -8
  151. package/metadata/hooks/useExperienceViewSubgridCommands.js +7 -10
  152. package/metadata/hooks/useMetadata.js +8 -11
  153. package/metadata/hooks/useSchema.js +3 -6
  154. package/metadata/index.js +3 -22
  155. package/mutable/context.js +17 -25
  156. package/mutable/index.js +3 -27
  157. package/mutable/state.js +6 -10
  158. package/mutable/type.js +1 -2
  159. package/mutable/utils.js +7 -11
  160. package/navigation/hooks/index.js +1 -17
  161. package/navigation/hooks/useOpenForm.js +11 -14
  162. package/navigation/index.js +1 -17
  163. package/package.json +3 -2
  164. package/progress-indicator/ProgressIndicatorProvider.js +12 -16
  165. package/progress-indicator/context.js +2 -5
  166. package/progress-indicator/hooks/index.js +1 -17
  167. package/progress-indicator/hooks/useProgressIndicator.d.ts +1 -1
  168. package/progress-indicator/hooks/useProgressIndicator.js +4 -7
  169. package/progress-indicator/index.js +3 -22
  170. package/providers/PageEntityFormProvider/index.js +4 -7
  171. package/providers/PageEntityViewProvider/index.js +4 -7
  172. package/recordset/RecordSetProvider.js +12 -16
  173. package/recordset/context.d.ts +1 -1
  174. package/recordset/context.js +2 -5
  175. package/recordset/hooks/index.js +3 -19
  176. package/recordset/hooks/useRecordSetResult.js +15 -18
  177. package/recordset/hooks/useRecordSetSetter.js +6 -9
  178. package/recordset/hooks/useRecordSetVisibility.js +7 -10
  179. package/recordset/index.js +3 -22
  180. package/route/RouteProvider.js +14 -18
  181. package/route/context.js +6 -9
  182. package/route/hooks/index.js +6 -22
  183. package/route/hooks/useBasePath.js +4 -7
  184. package/route/hooks/useIsRouteActive.js +4 -7
  185. package/route/hooks/usePathname.js +4 -7
  186. package/route/hooks/useRouteResolver.js +4 -7
  187. package/route/hooks/useRouter.js +4 -7
  188. package/route/hooks/useSearchParams.js +4 -7
  189. package/route/index.js +2 -20
  190. package/route/types.js +1 -2
  191. package/store/ClientAppStore.js +1 -5
  192. package/store/ComponentStore.js +1 -5
  193. package/store/EventManager.js +1 -5
  194. package/store/SchemaExperienceStore.js +2 -7
  195. package/store/index.js +4 -20
  196. package/toast-notification/ToastNotificationProvider.js +6 -10
  197. package/toast-notification/context.d.ts +1 -1
  198. package/toast-notification/context.js +2 -5
  199. package/toast-notification/hooks/index.js +3 -19
  200. package/toast-notification/hooks/useCloseToastNotification.js +6 -9
  201. package/toast-notification/hooks/useOpenToastNotification.js +10 -13
  202. package/toast-notification/hooks/useToastNotificationItems.d.ts +1 -1
  203. package/toast-notification/hooks/useToastNotificationItems.js +4 -7
  204. package/toast-notification/index.js +3 -22
  205. package/transport/InMemoryDataService/index.js +1 -5
  206. package/transport/RestDataService/index.js +5 -10
  207. package/transport/context.js +4 -7
  208. package/transport/hooks/index.js +2 -18
  209. package/transport/hooks/useDataService.js +4 -7
  210. package/transport/hooks/useFileService.js +4 -7
  211. package/transport/hooks/useRetriveRecords.d.ts +1 -1
  212. package/transport/hooks/useRetriveRecords.js +12 -17
  213. package/transport/index.js +2 -20
  214. package/utils/calculateColumnWidths.js +1 -4
  215. package/utils/color.js +1 -4
  216. package/utils/getAttributeFormattedValue.js +12 -18
  217. package/utils/index.js +2 -18
  218. package/widget/context.js +2 -5
  219. package/widget/hooks/index.js +4 -7
  220. package/widget/index.js +1 -5
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,9 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.EventManager = void 0;
13
- class EventManager {
10
+ export class EventManager {
14
11
  constructor() {
15
12
  this.handlers = {};
16
13
  }
@@ -39,4 +36,3 @@ class EventManager {
39
36
  return handlers.map((handler) => handler(...args));
40
37
  }
41
38
  }
42
- exports.EventManager = EventManager;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,15 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SchemaExperienceStore = void 0;
13
- exports.getDefaultCardView = getDefaultCardView;
14
- function getDefaultCardView(schema) {
10
+ export function getDefaultCardView(schema) {
15
11
  return {
16
12
  primaryColumn: schema.primaryAttribute,
17
13
  };
18
14
  }
19
- class SchemaExperienceStore {
15
+ export class SchemaExperienceStore {
20
16
  constructor(options) {
21
17
  this.options = options;
22
18
  this.experiences = {};
@@ -261,4 +257,3 @@ class SchemaExperienceStore {
261
257
  });
262
258
  }
263
259
  }
264
- exports.SchemaExperienceStore = SchemaExperienceStore;
package/store/index.js CHANGED
@@ -1,20 +1,4 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ClientAppStore"), exports);
18
- __exportStar(require("./ComponentStore"), exports);
19
- __exportStar(require("./EventManager"), exports);
20
- __exportStar(require("./SchemaExperienceStore"), exports);
1
+ export * from './ClientAppStore';
2
+ export * from './ComponentStore';
3
+ export * from './EventManager';
4
+ export * from './SchemaExperienceStore';
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ToastNotificationProvider = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const context_1 = require("../mutable/context");
6
- const context_2 = require("./context");
7
- const ToastNotificationProvider = ({ children }) => {
8
- const contextState = (0, context_1.useCreateContextStore)({
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCreateContextStore } from '../mutable/context';
3
+ import { ToastNotificationContext, } from './context';
4
+ export const ToastNotificationProvider = ({ children }) => {
5
+ const contextState = useCreateContextStore({
9
6
  items: [],
10
7
  });
11
- return ((0, jsx_runtime_1.jsx)(context_2.ToastNotificationContext.Provider, { value: contextState, children: children }));
8
+ return (_jsx(ToastNotificationContext.Provider, { value: contextState, children: children }));
12
9
  };
13
- exports.ToastNotificationProvider = ToastNotificationProvider;
@@ -12,4 +12,4 @@ export interface ToastNotificationItem {
12
12
  export interface ToastNotificationContextState {
13
13
  items: ToastNotificationItem[];
14
14
  }
15
- export declare const ToastNotificationContext: import("react").Context<import("../mutable/context").ContextValue<ToastNotificationContextState>>;
15
+ export declare const ToastNotificationContext: import("react").Context<import("../mutable").ContextValue<ToastNotificationContextState>>;
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ToastNotificationContext = void 0;
4
- const context_1 = require("../mutable/context");
5
- exports.ToastNotificationContext = (0, context_1.createContext)();
1
+ import { createContext } from '../mutable/context';
2
+ export const ToastNotificationContext = createContext();
@@ -1,19 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./useCloseToastNotification"), exports);
18
- __exportStar(require("./useOpenToastNotification"), exports);
19
- __exportStar(require("./useToastNotificationItems"), exports);
1
+ export * from './useCloseToastNotification';
2
+ export * from './useOpenToastNotification';
3
+ export * from './useToastNotificationItems';
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCloseToastNotification = useCloseToastNotification;
4
- const react_1 = require("react");
5
- const context_1 = require("../../mutable/context");
6
- const context_2 = require("../context");
1
+ import { useCallback } from 'react';
2
+ import { useContextSetValue } from '../../mutable/context';
3
+ import { ToastNotificationContext } from '../context';
7
4
  function markToastNotificationAsClosed(items, id) {
8
5
  return items.map((item) => {
9
6
  if (item.id === id) {
@@ -15,9 +12,9 @@ function markToastNotificationAsClosed(items, id) {
15
12
  function excludeToastNotificationItemById(items, id) {
16
13
  return items.filter((item) => item.id !== id);
17
14
  }
18
- function useCloseToastNotification() {
19
- const setValue = (0, context_1.useContextSetValue)(context_2.ToastNotificationContext);
20
- const closeDialog = (0, react_1.useCallback)((id) => {
15
+ export function useCloseToastNotification() {
16
+ const setValue = useContextSetValue(ToastNotificationContext);
17
+ const closeDialog = useCallback((id) => {
21
18
  setValue((state) => ({
22
19
  items: markToastNotificationAsClosed(state.items, id),
23
20
  }));
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useOpenToastNotification = useOpenToastNotification;
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 useCloseToastNotification_1 = require("./useCloseToastNotification");
9
- function useOpenToastNotification() {
10
- const setValue = (0, context_1.useContextSetValue)(context_2.ToastNotificationContext);
11
- const closeDialog = (0, useCloseToastNotification_1.useCloseToastNotification)();
12
- const openToastNotification = (0, react_1.useCallback)((options) => {
13
- const id = (0, uuid_1.v4)();
1
+ import { useCallback } from 'react';
2
+ import { v4 as uuid } from 'uuid';
3
+ import { useContextSetValue } from '../../mutable/context';
4
+ import { ToastNotificationContext } from '../context';
5
+ import { useCloseToastNotification } from './useCloseToastNotification';
6
+ export function useOpenToastNotification() {
7
+ const setValue = useContextSetValue(ToastNotificationContext);
8
+ const closeDialog = useCloseToastNotification();
9
+ const openToastNotification = useCallback((options) => {
10
+ const id = uuid();
14
11
  setValue((state) => {
15
12
  return {
16
13
  items: [
@@ -1 +1 @@
1
- export declare function useToastNotificationItems(): import("../context").ToastNotificationItem[];
1
+ export declare function useToastNotificationItems(): import("..").ToastNotificationItem[];
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useToastNotificationItems = useToastNotificationItems;
4
- const context_1 = require("../../mutable/context");
5
- const context_2 = require("../context");
6
- function useToastNotificationItems() {
7
- return (0, context_1.useContextSelector)(context_2.ToastNotificationContext, (state) => state.items);
1
+ import { useContextSelector } from '../../mutable/context';
2
+ import { ToastNotificationContext } from '../context';
3
+ export function useToastNotificationItems() {
4
+ return useContextSelector(ToastNotificationContext, (state) => state.items);
8
5
  }
@@ -1,22 +1,3 @@
1
- "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.ToastNotificationProvider = exports.ToastNotificationContext = void 0;
18
- var context_1 = require("./context");
19
- Object.defineProperty(exports, "ToastNotificationContext", { enumerable: true, get: function () { return context_1.ToastNotificationContext; } });
20
- var ToastNotificationProvider_1 = require("./ToastNotificationProvider");
21
- Object.defineProperty(exports, "ToastNotificationProvider", { enumerable: true, get: function () { return ToastNotificationProvider_1.ToastNotificationProvider; } });
22
- __exportStar(require("./hooks"), exports);
1
+ export { ToastNotificationContext, } from './context';
2
+ export { ToastNotificationProvider } from './ToastNotificationProvider';
3
+ export * from './hooks';
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,9 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.InMemoryDataService = void 0;
13
- class InMemoryDataService {
10
+ export class InMemoryDataService {
14
11
  // , IActionService, IReportService
15
12
  constructor(options) {
16
13
  this.options = options;
@@ -109,4 +106,3 @@ class InMemoryDataService {
109
106
  });
110
107
  }
111
108
  }
112
- exports.InMemoryDataService = InMemoryDataService;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,11 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RestDataService = void 0;
13
- exports.handleResponseError = handleResponseError;
14
- const transport_1 = require("@headless-adminapp/core/transport");
15
- function handleResponseError(response) {
10
+ import { HttpError, } from '@headless-adminapp/core/transport';
11
+ export function handleResponseError(response) {
16
12
  return __awaiter(this, void 0, void 0, function* () {
17
13
  var _a;
18
14
  if (response.ok) {
@@ -21,13 +17,13 @@ function handleResponseError(response) {
21
17
  if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
22
18
  const data = yield response.json();
23
19
  if (data.error) {
24
- throw new transport_1.HttpError(response.status, data.error);
20
+ throw new HttpError(response.status, data.error);
25
21
  }
26
22
  }
27
- throw new transport_1.HttpError(response.status, response.statusText);
23
+ throw new HttpError(response.status, response.statusText);
28
24
  });
29
25
  }
30
- class RestDataService {
26
+ export class RestDataService {
31
27
  constructor(options) {
32
28
  this.options = options;
33
29
  this.headers = {};
@@ -122,4 +118,3 @@ class RestDataService {
122
118
  });
123
119
  }
124
120
  }
125
- exports.RestDataService = RestDataService;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.FileServiceContext = exports.noopFileService = exports.DataServiceContext = void 0;
13
- const react_1 = require("react");
14
- exports.DataServiceContext = (0, react_1.createContext)(undefined);
15
- exports.noopFileService = {
10
+ import { createContext } from 'react';
11
+ export const DataServiceContext = createContext(undefined);
12
+ export const noopFileService = {
16
13
  uploadFile: () => __awaiter(void 0, void 0, void 0, function* () {
17
14
  throw new Error('File service not implemented');
18
15
  }),
19
16
  };
20
- exports.FileServiceContext = (0, react_1.createContext)(exports.noopFileService);
17
+ export const FileServiceContext = createContext(noopFileService);
@@ -1,18 +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
- __exportStar(require("./useDataService"), exports);
18
- __exportStar(require("./useFileService"), exports);
1
+ export * from './useDataService';
2
+ export * from './useFileService';
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDataService = useDataService;
4
- const react_1 = require("react");
5
- const context_1 = require("../context");
6
- function useDataService() {
7
- const context = (0, react_1.useContext)(context_1.DataServiceContext);
1
+ import { useContext } from 'react';
2
+ import { DataServiceContext } from '../context';
3
+ export function useDataService() {
4
+ const context = useContext(DataServiceContext);
8
5
  if (!context) {
9
6
  throw new Error('DataServiceContext must be used within a DataServiceProvider');
10
7
  }
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFileService = useFileService;
4
- const react_1 = require("react");
5
- const context_1 = require("../context");
6
- function useFileService() {
7
- const context = (0, react_1.useContext)(context_1.FileServiceContext);
1
+ import { useContext } from 'react';
2
+ import { FileServiceContext } from '../context';
3
+ export function useFileService() {
4
+ const context = useContext(FileServiceContext);
8
5
  if (!context) {
9
6
  throw new Error('FileServiceContext must be used within a FileServiceProvider');
10
7
  }
@@ -11,7 +11,7 @@ interface UseRetriveRecordProps<S extends SchemaAttributes = SchemaAttributes> {
11
11
  expand?: Partial<Record<string, string[]>>;
12
12
  maxRecords: number;
13
13
  }
14
- export declare function useRetrieveRecordsKey<S extends SchemaAttributes = SchemaAttributes>({ schema, search, filter, sorting, columns, expand, maxRecords, }: UseRetriveRecordProps<S>): (string | number | string[] | Filter | Partial<Record<string, string[]>> | SortingState<S> | null | undefined)[];
14
+ export declare function useRetrieveRecordsKey<S extends SchemaAttributes = SchemaAttributes>({ schema, search, filter, sorting, columns, expand, maxRecords, }: UseRetriveRecordProps<S>): (string | number | string[] | Filter | SortingState<S> | Partial<Record<string, string[]>> | null | undefined)[];
15
15
  export declare function useClearDataExceptFirstPage(queryKey: QueryKey): void;
16
16
  export declare function useRetriveRecords<S extends SchemaAttributes = SchemaAttributes>(queryKey: QueryKey, { columns, expand, filter, maxRecords, schema, search, sorting, }: UseRetriveRecordProps): {
17
17
  data: {
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,16 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useRetrieveRecordsKey = useRetrieveRecordsKey;
13
- exports.useClearDataExceptFirstPage = useClearDataExceptFirstPage;
14
- exports.useRetriveRecords = useRetriveRecords;
15
- const transport_1 = require("@headless-adminapp/app/transport");
16
- const react_query_1 = require("@tanstack/react-query");
17
- const react_1 = require("react");
10
+ import { useDataService } from '@headless-adminapp/app/transport';
11
+ import { useInfiniteQuery, useQueryClient, } from '@tanstack/react-query';
12
+ import { useEffect, useMemo } from 'react';
18
13
  const ROWS_PER_PAGE = 100;
19
- function useRetrieveRecordsKey({ schema, search, filter, sorting, columns, expand, maxRecords, }) {
20
- const queryKey = (0, react_1.useMemo)(() => [
14
+ export function useRetrieveRecordsKey({ schema, search, filter, sorting, columns, expand, maxRecords, }) {
15
+ const queryKey = useMemo(() => [
21
16
  'data',
22
17
  'retriveRecords',
23
18
  schema.logicalName,
@@ -30,9 +25,9 @@ function useRetrieveRecordsKey({ schema, search, filter, sorting, columns, expan
30
25
  ], [schema.logicalName, search, filter, sorting, columns, expand, maxRecords]);
31
26
  return queryKey;
32
27
  }
33
- function useClearDataExceptFirstPage(queryKey) {
34
- const queryClient = (0, react_query_1.useQueryClient)();
35
- (0, react_1.useEffect)(() => {
28
+ export function useClearDataExceptFirstPage(queryKey) {
29
+ const queryClient = useQueryClient();
30
+ useEffect(() => {
36
31
  return () => {
37
32
  // Clear all pages except the first one when the component is unmounted
38
33
  queryClient.setQueryData(queryKey, (oldData) => {
@@ -50,9 +45,9 @@ function useClearDataExceptFirstPage(queryKey) {
50
45
  };
51
46
  }, [queryClient, queryKey]);
52
47
  }
53
- function useRetriveRecords(queryKey, { columns, expand, filter, maxRecords, schema, search, sorting, }) {
54
- const dataService = (0, transport_1.useDataService)();
55
- const { data, isFetching, hasNextPage, fetchNextPage, isFetchingNextPage } = (0, react_query_1.useInfiniteQuery)({
48
+ export function useRetriveRecords(queryKey, { columns, expand, filter, maxRecords, schema, search, sorting, }) {
49
+ const dataService = useDataService();
50
+ const { data, isFetching, hasNextPage, fetchNextPage, isFetchingNextPage } = useInfiniteQuery({
56
51
  queryKey: queryKey,
57
52
  queryFn: (queryContext) => __awaiter(this, void 0, void 0, function* () {
58
53
  var _a;
@@ -99,7 +94,7 @@ function useRetriveRecords(queryKey, { columns, expand, filter, maxRecords, sche
99
94
  pageIndex: 0,
100
95
  },
101
96
  });
102
- const finalData = (0, react_1.useMemo)(() => {
97
+ const finalData = useMemo(() => {
103
98
  var _a, _b, _c, _d;
104
99
  if (!(data === null || data === void 0 ? void 0 : data.pages.length)) {
105
100
  return null;
@@ -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.DataServiceContext = void 0;
18
- var context_1 = require("./context");
19
- Object.defineProperty(exports, "DataServiceContext", { enumerable: true, get: function () { return context_1.DataServiceContext; } });
20
- __exportStar(require("./hooks"), exports);
1
+ export { DataServiceContext } from './context';
2
+ export * from './hooks';
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calculateColumnWidths = calculateColumnWidths;
4
- function calculateColumnWidths(params) {
1
+ export function calculateColumnWidths(params) {
5
2
  const { columns, availableWidth, gapWidth } = params;
6
3
  const totalGapWidth = gapWidth * (columns.length - 1);
7
4
  const remainingWidth = availableWidth - totalGapWidth;
package/utils/color.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isColorDark = isColorDark;
4
- function isColorDark(color) {
1
+ export function isColorDark(color) {
5
2
  if (color.startsWith('#')) {
6
3
  color = color.substring(1);
7
4
  }
@@ -1,14 +1,8 @@
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.getAttributeFormattedValue = getAttributeFormattedValue;
7
- const dayjs_1 = __importDefault(require("dayjs"));
8
- const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
9
- const utc_1 = __importDefault(require("dayjs/plugin/utc"));
10
- dayjs_1.default.extend(utc_1.default);
11
- dayjs_1.default.extend(timezone_1.default);
1
+ import dayjs from 'dayjs';
2
+ import timezone from 'dayjs/plugin/timezone';
3
+ import utc from 'dayjs/plugin/utc';
4
+ dayjs.extend(utc);
5
+ dayjs.extend(timezone);
12
6
  const defaultAttributeFormattedValueStrings = {
13
7
  yes: 'Yes',
14
8
  no: 'No',
@@ -38,12 +32,12 @@ function getAttributeDateFormattedValue(attribute, value, options) {
38
32
  const dateFormat = (_a = options === null || options === void 0 ? void 0 : options.dateFormat) !== null && _a !== void 0 ? _a : defaultDateFormat;
39
33
  const timeFormat = (_b = options === null || options === void 0 ? void 0 : options.timeFormat) !== null && _b !== void 0 ? _b : defaultTimeFormat;
40
34
  if (attribute.format === 'datetime') {
41
- return (0, dayjs_1.default)(value)
35
+ return dayjs(value)
42
36
  .tz(options === null || options === void 0 ? void 0 : options.timezone)
43
37
  .format(dateFormat + ' ' + timeFormat);
44
38
  }
45
39
  else {
46
- return (0, dayjs_1.default)(value)
40
+ return dayjs(value)
47
41
  .tz(options === null || options === void 0 ? void 0 : options.timezone)
48
42
  .format(dateFormat);
49
43
  }
@@ -59,15 +53,15 @@ function getAttributeDateRangeFormattedValue(value, options) {
59
53
  return null;
60
54
  }
61
55
  if (from && to) {
62
- return ((0, dayjs_1.default)(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat) +
56
+ return (dayjs(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat) +
63
57
  ' - ' +
64
- (0, dayjs_1.default)(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat));
58
+ dayjs(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat));
65
59
  }
66
60
  if (from) {
67
- return 'After ' + (0, dayjs_1.default)(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
61
+ return 'After ' + dayjs(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
68
62
  }
69
63
  if (to) {
70
- return 'Before ' + (0, dayjs_1.default)(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
64
+ return 'Before ' + dayjs(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
71
65
  }
72
66
  return null;
73
67
  }
@@ -110,7 +104,7 @@ function getAttributeMoneyFormattedValue(value, options) {
110
104
  currencyDisplay,
111
105
  }).format(value);
112
106
  }
113
- function getAttributeFormattedValue(attribute, value, options) {
107
+ export function getAttributeFormattedValue(attribute, value, options) {
114
108
  var _a;
115
109
  if (value === null || value === undefined) {
116
110
  return null;
package/utils/index.js CHANGED
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./calculateColumnWidths"), exports);
18
- __exportStar(require("./getAttributeFormattedValue"), exports);
1
+ export * from './calculateColumnWidths';
2
+ export * from './getAttributeFormattedValue';
package/widget/context.js CHANGED
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WidgetContext = void 0;
4
- const mutable_1 = require("../mutable");
5
- exports.WidgetContext = (0, mutable_1.createContext)();
1
+ import { createContext } from '../mutable';
2
+ export const WidgetContext = createContext();
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useWidgetState = useWidgetState;
4
- const mutable_1 = require("../../mutable");
5
- const context_1 = require("../context");
6
- function useWidgetState() {
7
- return (0, mutable_1.useContextSelector)(context_1.WidgetContext, (state) => state);
1
+ import { useContextSelector } from '../../mutable';
2
+ import { WidgetContext } from '../context';
3
+ export function useWidgetState() {
4
+ return useContextSelector(WidgetContext, (state) => state);
8
5
  }
package/widget/index.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WidgetContext = void 0;
4
- var context_1 = require("./context");
5
- Object.defineProperty(exports, "WidgetContext", { enumerable: true, get: function () { return context_1.WidgetContext; } });
1
+ export { WidgetContext } from './context';