@headless-adminapp/app 1.4.49 → 1.5.0

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 (170) hide show
  1. package/app/AppProvider.d.ts +1 -1
  2. package/app/AuthWrapper.d.ts +2 -2
  3. package/app/LayoutProvider.d.ts +7 -7
  4. package/app/context.d.ts +2 -2
  5. package/app/hooks/useAppContext.d.ts +1 -1
  6. package/auth/AuthProvider.d.ts +2 -2
  7. package/auth/context.d.ts +1 -1
  8. package/auth/hooks/useAuthSession.d.ts +1 -1
  9. package/auth/index.d.ts +1 -1
  10. package/auth/index.js +0 -1
  11. package/auth/types.d.ts +1 -1
  12. package/board/BoardColumnProvider.d.ts +2 -2
  13. package/board/context.d.ts +1 -1
  14. package/board/hooks/useBoardColumnConfig.d.ts +1 -1
  15. package/board/hooks/useBoardColumnData.d.ts +2 -2
  16. package/board/hooks/useBoardConfig.d.ts +2 -2
  17. package/board/hooks/useBoardSchema.d.ts +1 -1
  18. package/board/types.d.ts +7 -7
  19. package/board/utils.d.ts +2 -2
  20. package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +4 -4
  21. package/builders/CommandBuilder/FormCommandBuilder.d.ts +3 -3
  22. package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +3 -3
  23. package/builders/CommandBuilder/ViewCommandBuilder.d.ts +3 -3
  24. package/builders/CommandBuilder/ViewCommandBuilder.js +7 -3
  25. package/builders/CommandBuilder/utils.d.ts +1 -1
  26. package/builders/SchemaExperienceBuilder.d.ts +4 -4
  27. package/builders/utils.d.ts +6 -6
  28. package/builders/utils.js +5 -1
  29. package/calendar/CalendarProvider.d.ts +3 -3
  30. package/calendar/context.d.ts +1 -1
  31. package/calendar/hooks/useConfig.d.ts +2 -2
  32. package/calendar/hooks/useOpenDetailDialog.d.ts +1 -1
  33. package/calendar/types.d.ts +5 -5
  34. package/calendar/utils.d.ts +2 -2
  35. package/command/hooks/useBaseCommandHandlerContext.d.ts +2 -2
  36. package/command/hooks/useBaseCommandHandlerContext.js +10 -2
  37. package/command/hooks/useCommands.d.ts +2 -2
  38. package/command/index.d.ts +1 -1
  39. package/command/index.js +0 -1
  40. package/command/types.d.ts +5 -5
  41. package/command/utils/index.d.ts +2 -2
  42. package/components/ScrollView/index.d.ts +1 -1
  43. package/components/ScrollbarWithMoreDataRequest/index.d.ts +1 -1
  44. package/dataform/DataFormProvider/CalculatedField.d.ts +1 -1
  45. package/dataform/DataFormProvider/CalculatedField.js +1 -0
  46. package/dataform/DataFormProvider/DataResolver.d.ts +2 -2
  47. package/dataform/DataFormProvider/DataResolver.js +1 -0
  48. package/dataform/DataFormProvider/UnsavedChangesInfoSetter.d.ts +1 -1
  49. package/dataform/DataFormProvider/getRecord.d.ts +5 -5
  50. package/dataform/DataFormProvider/getRecord.js +1 -0
  51. package/dataform/DataFormProvider/index.d.ts +5 -5
  52. package/dataform/DataFormProvider/index.js +1 -0
  53. package/dataform/DataFormProvider/types.d.ts +4 -4
  54. package/dataform/DataFormProvider/utils.d.ts +6 -6
  55. package/dataform/FormManager.d.ts +7 -7
  56. package/dataform/context.d.ts +8 -8
  57. package/dataform/hooks/useFormNotifications.d.ts +5 -3
  58. package/dataform/hooks/useFormNotifications.js +5 -8
  59. package/dataform/hooks/useFormSave.d.ts +1 -1
  60. package/dataform/hooks/useFormSchema.d.ts +1 -1
  61. package/dataform/hooks/useLoadFormGridPage.d.ts +2 -2
  62. package/dataform/hooks/useMainFormCommands.d.ts +2 -2
  63. package/dataform/hooks/useMainFormCommands.js +2 -1
  64. package/dataform/hooks/useOnFieldValueChangeListener.js +3 -1
  65. package/dataform/hooks/useProcessFlowSteps.js +3 -1
  66. package/dataform/hooks/useSelectedForm.d.ts +2 -2
  67. package/dataform/utils/defaultParameters.d.ts +3 -3
  68. package/dataform/utils/defaultParameters.js +4 -1
  69. package/dataform/utils/index.d.ts +7 -7
  70. package/dataform/utils/index.js +31 -8
  71. package/dataform/utils/saveRecord.d.ts +6 -6
  72. package/dataform/utils/saveRecord.js +11 -2
  73. package/datagrid/DataGridProvider/DataResolver.d.ts +1 -1
  74. package/datagrid/DataGridProvider/index.d.ts +6 -6
  75. package/datagrid/DataGridProvider/transformViewColumns.d.ts +4 -4
  76. package/datagrid/DataGridProvider/useGridCellRangeResolver.d.ts +4 -4
  77. package/datagrid/DataGridProvider/utils.d.ts +5 -5
  78. package/datagrid/DataGridProvider/utils.js +3 -0
  79. package/datagrid/column-filter/constants.d.ts +1 -1
  80. package/datagrid/column-filter/utils.d.ts +1 -1
  81. package/datagrid/context.d.ts +5 -5
  82. package/datagrid/hooks/useGridColumnFilter.d.ts +1 -1
  83. package/datagrid/hooks/useGridColumns.d.ts +2 -2
  84. package/datagrid/hooks/useGridCommands.d.ts +2 -2
  85. package/datagrid/hooks/useGridOptions.js +1 -0
  86. package/datagrid/hooks/useGridPagination.js +1 -0
  87. package/datagrid/hooks/useGridSchema.d.ts +1 -1
  88. package/datagrid/hooks/useGridSorting.d.ts +2 -2
  89. package/datagrid/hooks/useGridSorting.js +1 -0
  90. package/datagrid/hooks/useLoadMainGridPage.d.ts +3 -3
  91. package/datagrid/hooks/useMainGridCommands.d.ts +2 -2
  92. package/datagrid/hooks/useMainGridCommands.js +2 -0
  93. package/datagrid/hooks/useSelectedView.d.ts +2 -2
  94. package/datagrid/hooks/useSubGridCommands.d.ts +2 -2
  95. package/dialog/DialogProvider.d.ts +1 -1
  96. package/dialog/context.d.ts +1 -1
  97. package/dialog/hooks/useOpenAlertDialog.d.ts +1 -1
  98. package/dialog/hooks/useOpenConfirmDialog.d.ts +1 -1
  99. package/dialog/hooks/useOpenDialog.d.ts +1 -1
  100. package/dialog/hooks/useOpenErrorDialog.d.ts +1 -1
  101. package/dialog/hooks/useOpenPromptDialog.d.ts +2 -2
  102. package/header/HeaderProvider.d.ts +1 -1
  103. package/header/components/MobileHeaderLeftContent.d.ts +1 -1
  104. package/header/components/MobileHeaderRightContent.d.ts +1 -1
  105. package/header/components/MobileHeaderTitle.d.ts +1 -1
  106. package/header/hooks/useHeaderValue.d.ts +1 -1
  107. package/header/hooks/useMobileHeaderSetValue.d.ts +1 -1
  108. package/historystate/provider.d.ts +1 -1
  109. package/hooks/useDebouncedValue.js +5 -2
  110. package/hooks/useElementLayout.d.ts +2 -2
  111. package/hooks/useItemsWithKey.d.ts +1 -1
  112. package/hooks/useLongPress.js +4 -2
  113. package/hooks/useStorageState.d.ts +1 -1
  114. package/insights/context.d.ts +1 -1
  115. package/insights/hooks/index.d.ts +2 -2
  116. package/insights/hooks/index.js +1 -0
  117. package/locale/LocaleProvider.d.ts +2 -2
  118. package/locale/context.d.ts +1 -1
  119. package/locale/utils.d.ts +1 -1
  120. package/metadata/MetadataProvider.d.ts +5 -5
  121. package/metadata/context.d.ts +2 -2
  122. package/metadata/hooks/useExperienceView.d.ts +1 -1
  123. package/metadata/hooks/useExperienceView.js +3 -1
  124. package/metadata/hooks/useMetadata.d.ts +1 -1
  125. package/metadata/hooks/useRecentItemStore.d.ts +1 -1
  126. package/metadata/hooks/useSchema.d.ts +1 -1
  127. package/mutable/context.d.ts +1 -1
  128. package/mutable/context.js +1 -0
  129. package/mutable/index.d.ts +1 -1
  130. package/mutable/index.js +0 -15
  131. package/mutable/state.d.ts +1 -1
  132. package/mutable/utils.d.ts +1 -1
  133. package/mutable/utils.js +1 -1
  134. package/navigation/hooks/useOpenForm.d.ts +1 -1
  135. package/navigation/unsaved-changes/useUnsavedChangesRouteGuard.js +1 -0
  136. package/package.json +3 -3
  137. package/progress-indicator/ProgressIndicatorProvider.d.ts +1 -1
  138. package/progress-indicator/ProgressIndicatorProvider.js +1 -1
  139. package/progress-indicator/context.js +3 -1
  140. package/providers/PageEntityFormProvider/index.d.ts +5 -5
  141. package/providers/PageEntityViewProvider/index.d.ts +4 -4
  142. package/quickcreate/QuickCreateProvider.d.ts +1 -1
  143. package/quickcreate/context.d.ts +2 -2
  144. package/quickcreate/hooks/useFormSave.d.ts +1 -1
  145. package/quickcreate/hooks/useOpenQuickCreate.d.ts +2 -2
  146. package/recordset/RecordSetProvider.d.ts +1 -1
  147. package/recordset/RecordSetProvider.js +1 -1
  148. package/recordset/context.d.ts +1 -1
  149. package/recordset/hooks/useRecordSetResult.d.ts +1 -1
  150. package/route/RouteProvider.d.ts +4 -4
  151. package/route/context.d.ts +3 -3
  152. package/route/context.js +8 -2
  153. package/store/ComponentStore.d.ts +1 -1
  154. package/store/EventManager.d.ts +1 -1
  155. package/store/EventManager.js +1 -0
  156. package/store/RecentItemStore.d.ts +1 -1
  157. package/store/SchemaExperienceStore.d.ts +6 -6
  158. package/store/SchemaExperienceStore.js +2 -2
  159. package/toast-notification/ToastNotificationProvider.d.ts +1 -1
  160. package/toast-notification/hooks/useOpenToastNotification.d.ts +1 -1
  161. package/transport/InMemoryDataService/index.d.ts +3 -3
  162. package/transport/InMemoryDataService/index.js +5 -0
  163. package/transport/RestDataService/index.d.ts +2 -2
  164. package/transport/context.d.ts +1 -1
  165. package/transport/hooks/useCustomActionQuery.d.ts +2 -1
  166. package/transport/hooks/useDataService.d.ts +1 -1
  167. package/transport/hooks/useRetriveRecords.d.ts +6 -16
  168. package/transport/hooks/useRetriveRecords.js +2 -1
  169. package/utils/getAttributeFormattedValue.d.ts +3 -3
  170. package/utils/getAttributeFormattedValue.js +20 -3
@@ -1,4 +1,4 @@
1
- import { ToastNotificationItem } from '../context';
1
+ import { type ToastNotificationItem } from '../context';
2
2
  export declare function useOpenToastNotification(): (options: Omit<ToastNotificationItem, "id" | "isOpen">) => {
3
3
  id: string;
4
4
  close: () => void;
@@ -1,7 +1,7 @@
1
1
  import type { Id } from '@headless-adminapp/core/attributes';
2
- import { Schema } from '@headless-adminapp/core/schema';
3
- import { AggregateAttribute, CreateRecordResult, Data, IDataService, InferredAggregateQueryResult } from '@headless-adminapp/core/transport';
4
- import { RetriveRecordsFnOptions, RetriveRecordsResult } from '@headless-adminapp/core/transport/operations';
2
+ import type { Schema } from '@headless-adminapp/core/schema';
3
+ import type { AggregateAttribute, CreateRecordResult, Data, IDataService, InferredAggregateQueryResult } from '@headless-adminapp/core/transport';
4
+ import type { RetriveRecordsFnOptions, RetriveRecordsResult } from '@headless-adminapp/core/transport/operations';
5
5
  interface Options {
6
6
  data: Record<string, unknown[]>;
7
7
  schemas: Record<string, Schema>;
@@ -29,6 +29,7 @@ class InMemoryDataService {
29
29
  if (!record) {
30
30
  throw new Error(`Record with id ${id} not found`);
31
31
  }
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
33
  return record;
33
34
  }
34
35
  async retriveRecords({ logicalName, }) {
@@ -37,6 +38,7 @@ class InMemoryDataService {
37
38
  logicalName,
38
39
  records: records,
39
40
  count: records.length,
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
42
  };
41
43
  }
42
44
  async createRecord(logicalName, data) {
@@ -48,6 +50,7 @@ class InMemoryDataService {
48
50
  [schema.idAttribute]: newId,
49
51
  };
50
52
  records.push(newRecord);
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
54
  return { id: newId };
52
55
  }
53
56
  async updateRecord(logicalName, id, data) {
@@ -60,6 +63,7 @@ class InMemoryDataService {
60
63
  throw new Error(`Record with id ${id} not found`);
61
64
  }
62
65
  Object.assign(record, data);
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
67
  return { id };
64
68
  }
65
69
  async deleteRecord(logicalName, id) {
@@ -80,6 +84,7 @@ class InMemoryDataService {
80
84
  return {};
81
85
  }
82
86
  async retriveAggregate() {
87
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
88
  return [];
84
89
  }
85
90
  async customAction() {
@@ -1,5 +1,5 @@
1
- import { AggregateAttribute, AggregateQuery, CreateRecordResult, Data, IDataService, InferredAggregateQueryResult } from '@headless-adminapp/core/transport';
2
- import { RetriveRecordsFnOptions, RetriveRecordsResult } from '@headless-adminapp/core/transport/operations';
1
+ import { type AggregateAttribute, type AggregateQuery, type CreateRecordResult, type Data, type IDataService, type InferredAggregateQueryResult } from '@headless-adminapp/core/transport';
2
+ import type { RetriveRecordsFnOptions, RetriveRecordsResult } from '@headless-adminapp/core/transport/operations';
3
3
  interface RestDataServiceOptions {
4
4
  endpoint: string;
5
5
  }
@@ -1,3 +1,3 @@
1
- import { IDataService, IFileService } from '@headless-adminapp/core/transport';
1
+ import type { IDataService, IFileService } from '@headless-adminapp/core/transport';
2
2
  export declare const DataServiceContext: import("react").Context<IDataService | undefined>;
3
3
  export declare const FileServiceContext: import("react").Context<IFileService | null>;
@@ -1 +1,2 @@
1
- export declare function useCustomActionQuery<T = unknown>(actionName: string, payload: unknown): import("@tanstack/react-query").UseQueryResult<T, Error>;
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ export declare function useCustomActionQuery<T = unknown>(actionName: string, payload: unknown): UseQueryResult<T, Error>;
@@ -1,2 +1,2 @@
1
- import { IDataService } from '@headless-adminapp/core/transport';
1
+ import type { IDataService } from '@headless-adminapp/core/transport';
2
2
  export declare function useDataService<T extends IDataService = IDataService>(): T;
@@ -1,7 +1,7 @@
1
- import { SortingState } from '@headless-adminapp/core/experience/view';
2
- import { InferredSchemaType, Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
3
- import { Filter } from '@headless-adminapp/core/transport';
4
- import { QueryKey } from '@tanstack/react-query';
1
+ import type { SortingState } from '@headless-adminapp/core/experience/view';
2
+ import type { InferredSchemaType, Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ import type { Filter } from '@headless-adminapp/core/transport';
4
+ import { type QueryKey } from '@tanstack/react-query';
5
5
  interface UseRetriveRecordProps<S extends SchemaAttributes = SchemaAttributes> {
6
6
  schema: Schema<S>;
7
7
  search?: string;
@@ -22,12 +22,7 @@ export declare function useRetriveRecordsInternal<S extends SchemaAttributes = S
22
22
  } | null;
23
23
  isFetching: boolean;
24
24
  hasNextPage: boolean;
25
- fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
26
- params: {
27
- pageIndex: number;
28
- };
29
- data: import("@headless-adminapp/core/transport").RetriveRecordsResult<InferredSchemaType<S>>;
30
- }, unknown>, Error>>;
25
+ fetchNextPage: () => Promise<void>;
31
26
  isFetchingNextPage: boolean;
32
27
  refetch: () => void;
33
28
  };
@@ -40,12 +35,7 @@ export declare function useRetriveRecords<S extends SchemaAttributes = SchemaAtt
40
35
  } | null;
41
36
  isFetching: boolean;
42
37
  hasNextPage: boolean;
43
- fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
44
- params: {
45
- pageIndex: number;
46
- };
47
- data: import("@headless-adminapp/core/transport").RetriveRecordsResult<InferredSchemaType<S>>;
48
- }, unknown>, Error>>;
38
+ fetchNextPage: () => Promise<void>;
49
39
  isFetchingNextPage: boolean;
50
40
  refetch: () => void;
51
41
  };
@@ -77,6 +77,7 @@ function useRetriveRecordsInternal(queryKey, { columns, expand, filter, maxRecor
77
77
  filter,
78
78
  skip,
79
79
  limit,
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
81
  sort: sorting,
81
82
  });
82
83
  return {
@@ -121,7 +122,7 @@ function useRetriveRecordsInternal(queryKey, { columns, expand, filter, maxRecor
121
122
  data: finalData,
122
123
  isFetching,
123
124
  hasNextPage,
124
- fetchNextPage,
125
+ fetchNextPage: fetchNextPage,
125
126
  isFetchingNextPage,
126
127
  refetch: refech,
127
128
  };
@@ -1,6 +1,6 @@
1
- import { Attribute, BooleanAttribute, ChoiceAttribute, DateAttribute, InferredAttributeType } from '@headless-adminapp/core/attributes';
2
- import { ChoicesAttribute } from '@headless-adminapp/core/attributes/ChoiceAttribute';
3
- import { Locale } from '@headless-adminapp/core/experience/locale/types';
1
+ import type { Attribute, BooleanAttribute, ChoiceAttribute, DateAttribute, InferredAttributeType } from '@headless-adminapp/core/attributes';
2
+ import type { ChoicesAttribute } from '@headless-adminapp/core/attributes/ChoiceAttribute';
3
+ import type { Locale } from '@headless-adminapp/core/experience/locale/types';
4
4
  interface AttributeFormattedValueStringsSet {
5
5
  yes: string;
6
6
  no: string;
@@ -98,9 +98,26 @@ function getAttributeBooleanFormattedValue(attribute, value, options) {
98
98
  : (attribute.falseLabel ?? strings.no);
99
99
  }
100
100
  function getAttributeChoiceFormattedValue(attribute, value) {
101
- return (attribute.options.find((option) => option.value === value) ?? {
102
- label: '',
103
- }).label;
101
+ if (!value) {
102
+ return '';
103
+ }
104
+ if (typeof value === 'string' || typeof value === 'number') {
105
+ attribute.options.find((option) => option.value === value) ?? {
106
+ label: '',
107
+ };
108
+ }
109
+ if (typeof value !== 'object') {
110
+ return '';
111
+ }
112
+ if ('label' in value) {
113
+ return value.label;
114
+ }
115
+ if ('value' in value) {
116
+ return (attribute.options.find((option) => option.value === value.value) ?? {
117
+ label: '',
118
+ }).label;
119
+ }
120
+ return '';
104
121
  }
105
122
  function getAttributeChoicesFormattedValue(attribute, value) {
106
123
  return value