@headless-adminapp/app 0.0.17-alpha.8 → 1.0.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 (243) hide show
  1. package/app/AppProvider.d.ts +0 -3
  2. package/app/AppProvider.js +10 -33
  3. package/app/AuthWrapper.d.ts +1 -1
  4. package/app/AuthWrapper.js +4 -1
  5. package/app/LayoutProvider.d.ts +8 -7
  6. package/app/LayoutProvider.js +28 -2
  7. package/app/context.d.ts +1 -1
  8. package/auth/AuthProvider.d.ts +1 -1
  9. package/auth/AuthProvider.js +30 -23
  10. package/auth/context.d.ts +2 -0
  11. package/auth/hooks/useIsSkipAuthCheck.d.ts +1 -0
  12. package/auth/hooks/useIsSkipAuthCheck.js +8 -0
  13. package/auth/hooks/useLogout.js +1 -1
  14. package/board/BoardColumnDataResolver.d.ts +1 -0
  15. package/board/BoardColumnDataResolver.js +64 -0
  16. package/board/BoardColumnProvider.d.ts +7 -0
  17. package/board/BoardColumnProvider.js +36 -0
  18. package/board/context.d.ts +19 -0
  19. package/board/context.js +6 -0
  20. package/board/hooks/index.d.ts +6 -0
  21. package/board/hooks/index.js +15 -0
  22. package/board/hooks/useBoardColumnConfig.d.ts +2 -0
  23. package/board/hooks/useBoardColumnConfig.js +8 -0
  24. package/board/hooks/useBoardColumnData.d.ts +3 -0
  25. package/board/hooks/useBoardColumnData.js +9 -0
  26. package/board/hooks/useBoardColumnDataState.d.ts +5 -0
  27. package/board/hooks/useBoardColumnDataState.js +9 -0
  28. package/board/hooks/useBoardConfig.d.ts +3 -0
  29. package/board/hooks/useBoardConfig.js +8 -0
  30. package/board/hooks/useBoardSchema.d.ts +2 -0
  31. package/board/hooks/useBoardSchema.js +7 -0
  32. package/board/hooks/useSearchText.d.ts +1 -0
  33. package/board/hooks/useSearchText.js +14 -0
  34. package/board/types.d.ts +47 -0
  35. package/board/utils.d.ts +3 -0
  36. package/board/utils.js +6 -0
  37. package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +15 -6
  38. package/builders/CommandBuilder/DefaultCommandBuilder.js +42 -20
  39. package/builders/CommandBuilder/FormCommandBuilder.d.ts +14 -13
  40. package/builders/CommandBuilder/FormCommandBuilder.js +66 -52
  41. package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +8 -27
  42. package/builders/CommandBuilder/SubgridCommandBuilder.js +115 -57
  43. package/builders/CommandBuilder/ViewCommandBuilder.js +32 -52
  44. package/builders/CommandBuilder/utils.js +1 -1
  45. package/builders/DefineFormExperience.d.ts +27 -0
  46. package/builders/DefineFormExperience.js +99 -0
  47. package/builders/DefineViewExperience.d.ts +13 -0
  48. package/builders/DefineViewExperience.js +33 -0
  49. package/builders/SchemaExperienceBuilder.d.ts +9 -7
  50. package/builders/SchemaExperienceBuilder.js +62 -40
  51. package/builders/utils.js +30 -44
  52. package/calendar/baseEventAttributes.d.ts +35 -0
  53. package/calendar/baseEventAttributes.js +38 -0
  54. package/calendar/context.d.ts +6 -0
  55. package/calendar/context.js +5 -0
  56. package/calendar/hooks/index.d.ts +1 -0
  57. package/{appearance → calendar}/hooks/index.js +1 -1
  58. package/calendar/hooks/useConfig.d.ts +3 -0
  59. package/calendar/hooks/useConfig.js +8 -0
  60. package/calendar/types.d.ts +41 -0
  61. package/calendar/types.js +2 -0
  62. package/calendar/utils.d.ts +3 -0
  63. package/calendar/utils.js +6 -0
  64. package/command/hooks/useBaseCommandHandlerContext.js +15 -6
  65. package/command/hooks/useCommands.js +1 -1
  66. package/command/utils/index.js +34 -9
  67. package/components/ScrollView/index.d.ts +1 -1
  68. package/components/ScrollView/index.js +2 -2
  69. package/components/ScrollbarWithMoreDataRequest/index.d.ts +9 -0
  70. package/components/ScrollbarWithMoreDataRequest/index.js +32 -0
  71. package/dataform/DataFormProvider/CustomHookExecuter.d.ts +5 -0
  72. package/dataform/DataFormProvider/CustomHookExecuter.js +14 -0
  73. package/dataform/DataFormProvider/DataResolver.d.ts +6 -4
  74. package/dataform/DataFormProvider/DataResolver.js +11 -94
  75. package/dataform/DataFormProvider/InitialValueResolver.js +3 -2
  76. package/dataform/DataFormProvider/ReadonlyInfoResolver.js +2 -3
  77. package/dataform/DataFormProvider/getRecord.d.ts +3 -0
  78. package/dataform/DataFormProvider/getRecord.js +56 -0
  79. package/dataform/DataFormProvider/index.d.ts +4 -0
  80. package/dataform/DataFormProvider/index.js +34 -12
  81. package/dataform/DataFormProvider/types.d.ts +13 -0
  82. package/dataform/DataFormProvider/types.js +2 -0
  83. package/dataform/DataFormProvider/utils.d.ts +23 -0
  84. package/dataform/DataFormProvider/utils.js +105 -0
  85. package/dataform/FormManager.d.ts +57 -0
  86. package/dataform/FormManager.js +247 -0
  87. package/dataform/constants.d.ts +1 -0
  88. package/dataform/constants.js +4 -0
  89. package/dataform/context.d.ts +26 -1
  90. package/dataform/hooks/index.d.ts +11 -0
  91. package/dataform/hooks/index.js +11 -0
  92. package/dataform/hooks/useContextKey.d.ts +1 -0
  93. package/dataform/hooks/useContextKey.js +8 -0
  94. package/dataform/hooks/useDisabledControlsManager.d.ts +6 -0
  95. package/dataform/hooks/useDisabledControlsManager.js +46 -0
  96. package/dataform/hooks/useEventManager.d.ts +1 -0
  97. package/dataform/hooks/useEventManager.js +8 -0
  98. package/dataform/hooks/useFormManager.d.ts +2 -0
  99. package/dataform/hooks/useFormManager.js +13 -0
  100. package/dataform/hooks/useFormNotifications.js +2 -2
  101. package/dataform/hooks/useFormSave.js +28 -31
  102. package/dataform/hooks/useHiddenControlsManager.d.ts +7 -0
  103. package/dataform/hooks/useHiddenControlsManager.js +50 -0
  104. package/dataform/hooks/useIsControlDisabled.d.ts +1 -0
  105. package/dataform/hooks/useIsControlDisabled.js +27 -0
  106. package/dataform/hooks/useIsControlHiddenByAttributeName.d.ts +1 -0
  107. package/dataform/hooks/useIsControlHiddenByAttributeName.js +17 -0
  108. package/dataform/hooks/useIsControlHiddenByKey.d.ts +1 -0
  109. package/dataform/hooks/useIsControlHiddenByKey.js +17 -0
  110. package/dataform/hooks/useIsFieldRequired.d.ts +1 -0
  111. package/dataform/hooks/useIsFieldRequired.js +25 -0
  112. package/dataform/hooks/useLoadFormGridPage.js +8 -17
  113. package/dataform/hooks/useMainFormCommands.d.ts +1 -12
  114. package/dataform/hooks/useMainFormCommands.js +13 -3
  115. package/dataform/hooks/useOnFieldValueChangeListener.d.ts +1 -0
  116. package/dataform/hooks/useOnFieldValueChangeListener.js +30 -0
  117. package/dataform/hooks/useProcessFlowSteps.d.ts +1 -0
  118. package/dataform/hooks/useProcessFlowSteps.js +45 -0
  119. package/dataform/hooks/useRecordTitle.d.ts +3 -1
  120. package/dataform/hooks/useRecordTitle.js +12 -5
  121. package/dataform/hooks/useRequiredFieldManager.d.ts +6 -0
  122. package/dataform/hooks/useRequiredFieldManager.js +49 -0
  123. package/dataform/test.d.ts +57 -0
  124. package/dataform/test.js +247 -0
  125. package/dataform/utils/defaultParameters.d.ts +6 -0
  126. package/dataform/utils/defaultParameters.js +54 -0
  127. package/dataform/utils/index.d.ts +6 -24
  128. package/dataform/utils/index.js +164 -190
  129. package/dataform/utils/saveRecord.d.ts +27 -0
  130. package/dataform/utils/saveRecord.js +163 -0
  131. package/datagrid/DataGridProvider/DataResolver.js +38 -109
  132. package/datagrid/DataGridProvider/index.d.ts +6 -0
  133. package/datagrid/DataGridProvider/index.js +18 -8
  134. package/datagrid/DataGridProvider/transformViewColumns.js +10 -2
  135. package/datagrid/DataGridProvider/utils.js +8 -8
  136. package/datagrid/column-filter/constants.js +38 -3
  137. package/datagrid/column-filter/utils.js +7 -1
  138. package/datagrid/context.d.ts +6 -0
  139. package/datagrid/hooks/useChangeView.js +1 -1
  140. package/datagrid/hooks/useGridColumnFilter.js +4 -1
  141. package/datagrid/hooks/useGridDisabled.d.ts +1 -0
  142. package/datagrid/hooks/useGridDisabled.js +8 -0
  143. package/datagrid/hooks/useLoadMainGridPage.js +1 -1
  144. package/datagrid/hooks/useMainGridCommands.js +23 -9
  145. package/datagrid/hooks/useOpenRecord.js +2 -2
  146. package/datagrid/hooks/useSubGridCommands.js +23 -45
  147. package/defaults.d.ts +2 -0
  148. package/defaults.js +5 -0
  149. package/dialog/hooks/useCloseDialog.js +17 -15
  150. package/dialog/hooks/useOpenAlertDialog.js +8 -3
  151. package/dialog/hooks/useOpenConfirmDialog.js +10 -4
  152. package/dialog/hooks/useOpenDialog.js +7 -5
  153. package/dialog/hooks/useOpenErrorDialog.js +8 -3
  154. package/dialog/hooks/useOpenPromptDialog.js +10 -4
  155. package/form/FormValidationStringContext.d.ts +1 -0
  156. package/form/FormValidationStringContext.js +1 -0
  157. package/hooks/index.d.ts +1 -0
  158. package/hooks/index.js +3 -0
  159. package/hooks/useDebouncedValue.js +0 -1
  160. package/hooks/useElementLayout.js +1 -1
  161. package/hooks/useIsMobile.js +0 -1
  162. package/hooks/useItemsWithKey.d.ts +7 -0
  163. package/hooks/useItemsWithKey.js +13 -0
  164. package/hooks/useStorageState.js +1 -2
  165. package/hooks/useSystemColorScheme.d.ts +1 -1
  166. package/hooks/useSystemColorScheme.js +0 -1
  167. package/insights/InsightsProvider.d.ts +8 -0
  168. package/insights/InsightsProvider.js +27 -0
  169. package/locale/LocaleProvider.d.ts +2 -1
  170. package/locale/LocaleProvider.js +3 -3
  171. package/locale/index.d.ts +1 -0
  172. package/locale/index.js +1 -0
  173. package/locale/useCurrencySymbol.d.ts +1 -0
  174. package/locale/useCurrencySymbol.js +12 -0
  175. package/locale/utils.js +4 -2
  176. package/metadata/MetadataProvider.d.ts +8 -4
  177. package/metadata/MetadataProvider.js +23 -17
  178. package/metadata/context.d.ts +3 -2
  179. package/metadata/hooks/index.d.ts +1 -1
  180. package/metadata/hooks/index.js +1 -1
  181. package/metadata/hooks/useAppExperience.d.ts +1 -0
  182. package/metadata/hooks/useAppExperience.js +8 -0
  183. package/metadata/hooks/useAppStore.d.ts +1 -1
  184. package/metadata/hooks/useAppStore.js +3 -3
  185. package/metadata/hooks/useExperienceView.js +2 -11
  186. package/metadata/hooks/useExperienceViewCommands.d.ts +1 -1
  187. package/metadata/hooks/useExperienceViewCommands.js +5 -14
  188. package/metadata/hooks/useExperienceViewLookup.js +2 -11
  189. package/metadata/hooks/useExperienceViewSubgridCommands.d.ts +1 -1
  190. package/metadata/hooks/useExperienceViewSubgridCommands.js +5 -14
  191. package/metadata/hooks/useMetadata.d.ts +11 -10
  192. package/metadata/hooks/useMetadata.js +4 -16
  193. package/metadata/hooks/useSchema.d.ts +1 -1
  194. package/metadata/hooks/useSchema.js +3 -0
  195. package/mutable/context.d.ts +3 -0
  196. package/mutable/context.js +8 -0
  197. package/mutable/utils.js +5 -12
  198. package/navigation/hooks/useOpenForm.js +4 -0
  199. package/package.json +6 -10
  200. package/providers/PageEntityFormProvider/index.d.ts +5 -1
  201. package/providers/PageEntityFormProvider/index.js +2 -2
  202. package/recordset/hooks/useRecordSetResult.js +4 -14
  203. package/route/RouteProvider.d.ts +2 -2
  204. package/route/RouteProvider.js +4 -1
  205. package/store/ClientAppStore.js +7 -20
  206. package/store/ComponentStore.d.ts +1 -1
  207. package/store/ComponentStore.js +6 -12
  208. package/store/EventManager.d.ts +2 -2
  209. package/store/EventManager.js +13 -29
  210. package/store/SchemaExperienceStore.js +179 -215
  211. package/store/index.d.ts +0 -1
  212. package/store/index.js +0 -1
  213. package/toast-notification/hooks/useCloseToastNotification.js +17 -15
  214. package/toast-notification/hooks/useOpenToastNotification.js +7 -5
  215. package/transport/InMemoryDataService/index.js +54 -77
  216. package/transport/RestDataService/index.d.ts +3 -3
  217. package/transport/RestDataService/index.js +68 -91
  218. package/transport/context.d.ts +2 -1
  219. package/transport/context.js +7 -1
  220. package/transport/hooks/index.d.ts +1 -0
  221. package/transport/hooks/index.js +1 -0
  222. package/transport/hooks/useFileService.d.ts +1 -0
  223. package/transport/hooks/useFileService.js +9 -0
  224. package/transport/hooks/useRetriveRecords.d.ts +33 -0
  225. package/transport/hooks/useRetriveRecords.js +110 -0
  226. package/utils/calculateColumnWidths.js +1 -1
  227. package/utils/color.d.ts +1 -0
  228. package/utils/color.js +14 -0
  229. package/utils/getAttributeFormattedValue.d.ts +4 -1
  230. package/utils/getAttributeFormattedValue.js +109 -54
  231. package/utils/phone.d.ts +13 -0
  232. package/utils/phone.js +33 -0
  233. package/appearance/context.d.ts +0 -7
  234. package/appearance/context.js +0 -5
  235. package/appearance/hooks/index.d.ts +0 -1
  236. package/appearance/hooks/useAppearanceContext.d.ts +0 -1
  237. package/appearance/hooks/useAppearanceContext.js +0 -12
  238. package/appearance/index.d.ts +0 -2
  239. package/appearance/index.js +0 -20
  240. package/builders/CommandBuilder.d.ts +0 -176
  241. package/builders/CommandBuilder.js +0 -567
  242. package/locale/types.d.ts +0 -2
  243. /package/{locale → board}/types.js +0 -0
@@ -2,6 +2,8 @@ import { AsyncForm, AsyncQuickCreateForm, Form, FormExperience, QuickCreateForm
2
2
  import { SchemaExperience } from '@headless-adminapp/core/experience/schema';
3
3
  import { AsyncView, View, ViewExperience } from '@headless-adminapp/core/experience/view';
4
4
  import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
5
+ import { DefineFormExperience } from './DefineFormExperience';
6
+ import { DefineViewExperience } from './DefineViewExperience';
5
7
  declare abstract class BaseSchemaExperienceBuilder<S extends SchemaAttributes> {
6
8
  protected readonly logicalName: string;
7
9
  protected views: View<S>[];
@@ -26,7 +28,6 @@ declare abstract class BaseSchemaExperienceBuilder<S extends SchemaAttributes> {
26
28
  defaultQuickCreateFormId: string | null;
27
29
  quickCreateForms: QuickCreateForm<S>[];
28
30
  };
29
- defineFormExperience(formExperience: FormExperience<S>): FormExperience<S>;
30
31
  }
31
32
  export interface SchemaExperienceBuilderDefaults {
32
33
  localizedViewNames?: Record<string, string>;
@@ -34,14 +35,15 @@ export interface SchemaExperienceBuilderDefaults {
34
35
  interface SchemaExperienceBuilderOptions {
35
36
  }
36
37
  export declare class SchemaExperienceBuilder<S extends SchemaAttributes = SchemaAttributes> extends BaseSchemaExperienceBuilder<S> {
37
- private schema;
38
- private defaults?;
39
- private options?;
38
+ private readonly schema;
39
+ private readonly defaults?;
40
+ private readonly options?;
40
41
  constructor(schema: Schema<S>, defaults?: SchemaExperienceBuilderDefaults | undefined, options?: SchemaExperienceBuilderOptions | undefined);
41
- defineViewExperience(viewExperience: Pick<ViewExperience<S>, 'filter' | 'defaultSorting'> & {
42
- card?: ViewExperience<S>['card'];
43
- grid?: ViewExperience<S>['grid'];
42
+ defineViewExperience(viewExperience: Pick<DefineViewExperience.Experience<S>, 'filter' | 'defaultSorting'> & {
43
+ grid?: DefineViewExperience.Experience<S>['grid'];
44
+ card?: DefineViewExperience.Experience<S>['card'];
44
45
  }): ViewExperience<S>;
46
+ defineFormExperience(formExperience: DefineFormExperience.Experience<S>): FormExperience<S>;
45
47
  defineDefaultViewGrid(): ViewExperience<S>['grid'];
46
48
  defineDefaultViewCard(): ViewExperience<S>['card'];
47
49
  defineDefaultViewExperience(): ViewExperience<S>;
@@ -1,18 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SchemaExperienceBuilder = void 0;
4
+ const DefineFormExperience_1 = require("./DefineFormExperience");
5
+ const DefineViewExperience_1 = require("./DefineViewExperience");
4
6
  class BaseSchemaExperienceBuilder {
7
+ logicalName;
8
+ views = [];
9
+ forms = [];
10
+ lookups = [];
11
+ quickCreateForms = [];
12
+ defaultViewId = null;
13
+ defaultFormId = null;
14
+ defaultLookupId = null;
15
+ defaultQuickCreateFormId = null;
16
+ locked = false;
5
17
  constructor(logicalName) {
6
18
  this.logicalName = logicalName;
7
- this.views = [];
8
- this.forms = [];
9
- this.lookups = [];
10
- this.quickCreateForms = [];
11
- this.defaultViewId = null;
12
- this.defaultFormId = null;
13
- this.defaultLookupId = null;
14
- this.defaultQuickCreateFormId = null;
15
- this.locked = false;
16
19
  }
17
20
  reset() {
18
21
  this.views = [];
@@ -36,17 +39,17 @@ class BaseSchemaExperienceBuilder {
36
39
  if (!this.defaultLookupId) {
37
40
  throw new Error('Default lookup is required');
38
41
  }
39
- if (!this.views.find(v => v.id === this.defaultViewId)) {
42
+ if (!this.views.find((v) => v.id === this.defaultViewId)) {
40
43
  throw new Error('Default view not found');
41
44
  }
42
- if (!this.forms.find(f => f.id === this.defaultFormId)) {
45
+ if (!this.forms.find((f) => f.id === this.defaultFormId)) {
43
46
  throw new Error('Default form not found');
44
47
  }
45
- if (!this.lookups.find(l => l.id === this.defaultLookupId)) {
48
+ if (!this.lookups.find((l) => l.id === this.defaultLookupId)) {
46
49
  throw new Error('Default lookup not found');
47
50
  }
48
51
  if (this.defaultQuickCreateFormId &&
49
- !this.quickCreateForms.find(f => f.id === this.defaultQuickCreateFormId)) {
52
+ !this.quickCreateForms.find((f) => f.id === this.defaultQuickCreateFormId)) {
50
53
  throw new Error('Default quick create form not found');
51
54
  }
52
55
  return {
@@ -61,11 +64,11 @@ class BaseSchemaExperienceBuilder {
61
64
  quickCreateForms: this.quickCreateForms,
62
65
  };
63
66
  }
64
- defineFormExperience(formExperience) {
65
- return formExperience;
66
- }
67
67
  }
68
68
  class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
69
+ schema;
70
+ defaults;
71
+ options;
69
72
  constructor(schema, defaults, options) {
70
73
  super(schema.logicalName);
71
74
  this.schema = schema;
@@ -73,10 +76,16 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
73
76
  this.options = options;
74
77
  }
75
78
  defineViewExperience(viewExperience) {
76
- var _a, _b;
77
- const cardView = (_a = viewExperience.card) !== null && _a !== void 0 ? _a : this.defineDefaultViewCard();
78
- const gridView = (_b = viewExperience.grid) !== null && _b !== void 0 ? _b : this.defineDefaultViewGrid();
79
- return Object.assign(Object.assign({}, viewExperience), { grid: gridView, card: cardView });
79
+ const cardView = viewExperience.card ?? this.defineDefaultViewCard();
80
+ const gridView = viewExperience.grid ?? this.defineDefaultViewGrid();
81
+ return DefineViewExperience_1.DefineViewExperience.resolveExperience({
82
+ ...viewExperience,
83
+ grid: gridView,
84
+ card: cardView,
85
+ });
86
+ }
87
+ defineFormExperience(formExperience) {
88
+ return DefineFormExperience_1.DefineFormExperience.resolveExperience(formExperience);
80
89
  }
81
90
  defineDefaultViewGrid() {
82
91
  const columns = [];
@@ -155,16 +164,15 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
155
164
  };
156
165
  }
157
166
  getLocalizedViewNames() {
158
- var _a;
159
167
  const langugesSet = new Set();
160
168
  this.schema.localizedPluralLabels &&
161
- Object.keys(this.schema.localizedPluralLabels).forEach(key => langugesSet.add(key));
162
- ((_a = this.defaults) === null || _a === void 0 ? void 0 : _a.localizedViewNames) &&
163
- Object.keys(this.defaults.localizedViewNames).forEach(key => langugesSet.add(key));
169
+ Object.keys(this.schema.localizedPluralLabels).forEach((key) => langugesSet.add(key));
170
+ this.defaults?.localizedViewNames &&
171
+ Object.keys(this.defaults.localizedViewNames).forEach((key) => langugesSet.add(key));
164
172
  const localizedLabels = Array.from(langugesSet).reduce((acc, key) => {
165
- var _a, _b, _c, _d, _e, _f;
166
- const localizedPluralName = (_c = (_b = (_a = this.schema.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : this.schema.pluralLabel.toLowerCase();
167
- const localizedPlaceholder = (_f = (_e = (_d = this.defaults) === null || _d === void 0 ? void 0 : _d.localizedViewNames) === null || _e === void 0 ? void 0 : _e[key]) !== null && _f !== void 0 ? _f : `All {label}`;
173
+ const localizedPluralName = this.schema.localizedPluralLabels?.[key]?.toLowerCase() ??
174
+ this.schema.pluralLabel.toLowerCase();
175
+ const localizedPlaceholder = this.defaults?.localizedViewNames?.[key] ?? `All {label}`;
168
176
  const localeName = localizedPlaceholder.replace('{label}', localizedPluralName);
169
177
  acc[key] = localeName;
170
178
  return acc;
@@ -178,18 +186,17 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
178
186
  if (!defaultId) {
179
187
  return data[0].id;
180
188
  }
181
- if (!data.find(x => x.id === defaultId)) {
189
+ if (!data.find((x) => x.id === defaultId)) {
182
190
  return data[0].id;
183
191
  }
184
192
  return defaultId;
185
193
  }
186
194
  defineExperience(experience) {
187
- var _a, _b, _c, _d, _e, _f, _g, _h;
188
195
  let lookups = experience.lookups;
189
196
  let views = experience.views;
190
197
  let forms = experience.forms;
191
198
  let associatedViews = experience.associatedViews;
192
- if (!(lookups === null || lookups === void 0 ? void 0 : lookups.length)) {
199
+ if (!lookups?.length) {
193
200
  lookups = [
194
201
  {
195
202
  id: 'default',
@@ -198,7 +205,7 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
198
205
  },
199
206
  ];
200
207
  }
201
- if (!(views === null || views === void 0 ? void 0 : views.length)) {
208
+ if (!views?.length) {
202
209
  views = [
203
210
  {
204
211
  id: 'default',
@@ -208,7 +215,7 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
208
215
  },
209
216
  ];
210
217
  }
211
- if (!(associatedViews === null || associatedViews === void 0 ? void 0 : associatedViews.length)) {
218
+ if (!associatedViews?.length) {
212
219
  associatedViews = [
213
220
  {
214
221
  id: 'default',
@@ -218,7 +225,7 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
218
225
  },
219
226
  ];
220
227
  }
221
- if (!(forms === null || forms === void 0 ? void 0 : forms.length)) {
228
+ if (!forms?.length) {
222
229
  forms = [
223
230
  {
224
231
  id: 'default',
@@ -232,8 +239,8 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
232
239
  const defaultLookupId = this.resolveDefaultId(lookups, experience.defaultLookupId);
233
240
  const defaultAssociatedViewId = this.resolveDefaultId(associatedViews, experience.defaultAssociatedViewId);
234
241
  let defaultQuickCreateFormId = null;
235
- if ((_a = experience.quickCreateForms) === null || _a === void 0 ? void 0 : _a.length) {
236
- defaultQuickCreateFormId = this.resolveDefaultId((_b = experience.quickCreateForms) !== null && _b !== void 0 ? _b : [], experience.defaultQuickCreateFormId);
242
+ if (experience.quickCreateForms?.length) {
243
+ defaultQuickCreateFormId = this.resolveDefaultId(experience.quickCreateForms ?? [], experience.defaultQuickCreateFormId);
237
244
  }
238
245
  return {
239
246
  logicalName: this.logicalName,
@@ -243,11 +250,26 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
243
250
  defaultViewId,
244
251
  defaultLookupId,
245
252
  defaultAssociatedViewId,
246
- quickCreateForms: (_d = (_c = experience.quickCreateForms) === null || _c === void 0 ? void 0 : _c.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _d !== void 0 ? _d : [],
247
- views: (_e = views.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _e !== void 0 ? _e : [],
248
- forms: (_f = forms.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _f !== void 0 ? _f : [],
249
- lookups: (_g = lookups.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _g !== void 0 ? _g : [],
250
- associatedViews: (_h = associatedViews.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _h !== void 0 ? _h : [],
253
+ quickCreateForms: experience.quickCreateForms?.map((x) => ({
254
+ ...x,
255
+ logicalName: this.logicalName,
256
+ })) ?? [],
257
+ views: views.map((x) => ({
258
+ ...x,
259
+ logicalName: this.logicalName,
260
+ })) ?? [],
261
+ forms: forms.map((x) => ({
262
+ ...x,
263
+ logicalName: this.logicalName,
264
+ })) ?? [],
265
+ lookups: lookups.map((x) => ({
266
+ ...x,
267
+ logicalName: this.logicalName,
268
+ })) ?? [],
269
+ associatedViews: associatedViews.map((x) => ({
270
+ ...x,
271
+ logicalName: this.logicalName,
272
+ })) ?? [],
251
273
  formCommands: experience.formCommands,
252
274
  subgridCommands: experience.subgridCommands,
253
275
  viewCommands: experience.viewCommands,
package/builders/utils.js CHANGED
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
25
  Object.defineProperty(exports, "__esModule", { value: true });
35
26
  exports.exportRecordsXLS = exports.exportRecordsCSV = void 0;
36
27
  exports.retriveRecords = retriveRecords;
@@ -38,14 +29,13 @@ const utils_1 = require("../datagrid/DataGridProvider/utils");
38
29
  const utils_2 = require("../utils");
39
30
  const getHeaders = (schema, gridColumns, schemaStore) => {
40
31
  const headers = gridColumns.map((column) => {
41
- var _a, _b, _c;
42
32
  if (column.name.indexOf('.') !== -1) {
43
33
  const [lookup, field] = column.name.split('.');
44
34
  const entity = schema.attributes[lookup].entity;
45
35
  const lookupSchema = schemaStore.getSchema(entity);
46
- return `${(_a = lookupSchema.attributes[field]) === null || _a === void 0 ? void 0 : _a.label} (${(_b = schema.attributes[lookup]) === null || _b === void 0 ? void 0 : _b.label})`;
36
+ return `${lookupSchema.attributes[field]?.label} (${schema.attributes[lookup]?.label})`;
47
37
  }
48
- return (_c = schema.attributes[column.name]) === null || _c === void 0 ? void 0 : _c.label;
38
+ return schema.attributes[column.name]?.label;
49
39
  });
50
40
  return headers;
51
41
  };
@@ -64,13 +54,12 @@ function getAttribute({ column, schema, schemaStore, }) {
64
54
  return attribute;
65
55
  }
66
56
  function extractAttributeData({ column, record, schema, schemaStore, }) {
67
- var _a, _b;
68
57
  const attribute = getAttribute({ column, schema, schemaStore });
69
58
  let value;
70
59
  if (column.expandedKey) {
71
60
  const lookup = column.name;
72
61
  const field = column.expandedKey;
73
- value = (_b = (_a = record.$expand) === null || _a === void 0 ? void 0 : _a[lookup]) === null || _b === void 0 ? void 0 : _b[field];
62
+ value = record.$expand?.[lookup]?.[field];
74
63
  }
75
64
  else {
76
65
  value = record[column.name];
@@ -80,12 +69,11 @@ function extractAttributeData({ column, record, schema, schemaStore, }) {
80
69
  value,
81
70
  };
82
71
  }
83
- const exportRecordsCSV = (_a) => __awaiter(void 0, [_a], void 0, function* ({ schema, records, gridColumns, schemaStore, fileName, }) {
84
- const csvDownload = yield Promise.resolve().then(() => __importStar(require('json-to-csv-export')));
72
+ const exportRecordsCSV = async ({ schema, records, gridColumns, schemaStore, fileName, }) => {
73
+ const csvDownload = await Promise.resolve().then(() => __importStar(require('json-to-csv-export')));
85
74
  const headers = getHeaders(schema, gridColumns, schemaStore);
86
75
  const cellData = records.map((record) => {
87
76
  return gridColumns.map((column) => {
88
- var _a, _b;
89
77
  const { attribute, value } = extractAttributeData({
90
78
  column,
91
79
  record,
@@ -93,9 +81,9 @@ const exportRecordsCSV = (_a) => __awaiter(void 0, [_a], void 0, function* ({ sc
93
81
  schemaStore,
94
82
  });
95
83
  if (attribute.type === 'money' || attribute.type === 'number') {
96
- return (_a = value === null || value === void 0 ? void 0 : value.toString()) !== null && _a !== void 0 ? _a : '';
84
+ return value?.toString() ?? '';
97
85
  }
98
- return (_b = (0, utils_2.getAttributeFormattedValue)(attribute, value)) !== null && _b !== void 0 ? _b : '';
86
+ return (0, utils_2.getAttributeFormattedValue)(attribute, value) ?? '';
99
87
  });
100
88
  });
101
89
  csvDownload.default({
@@ -104,10 +92,10 @@ const exportRecordsCSV = (_a) => __awaiter(void 0, [_a], void 0, function* ({ sc
104
92
  delimiter: ',',
105
93
  filename: fileName,
106
94
  });
107
- });
95
+ };
108
96
  exports.exportRecordsCSV = exportRecordsCSV;
109
- const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fileName, gridColumns, records, schema, schemaStore, }) {
110
- const ExcelJS = yield Promise.resolve().then(() => __importStar(require('exceljs')));
97
+ const exportRecordsXLS = async ({ fileName, gridColumns, records, schema, schemaStore, }) => {
98
+ const ExcelJS = await Promise.resolve().then(() => __importStar(require('exceljs')));
111
99
  const headers = getHeaders(schema, gridColumns, schemaStore);
112
100
  const cellData = records.map((item) => {
113
101
  return gridColumns.map((column) => {
@@ -120,7 +108,7 @@ const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fi
120
108
  if (!value) {
121
109
  return '';
122
110
  }
123
- switch (attribute === null || attribute === void 0 ? void 0 : attribute.type) {
111
+ switch (attribute?.type) {
124
112
  case 'money':
125
113
  case 'number':
126
114
  return value;
@@ -142,8 +130,8 @@ const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fi
142
130
  gridColumns.forEach((column, index) => {
143
131
  const attribute = getAttribute({ column, schema, schemaStore });
144
132
  const sheetColumn = worksheet.getColumn(index + 1);
145
- let formatFn = (value) => { var _a; return (_a = (0, utils_2.getAttributeFormattedValue)(attribute, value)) !== null && _a !== void 0 ? _a : ''; };
146
- if ((attribute === null || attribute === void 0 ? void 0 : attribute.type) === 'money') {
133
+ let formatFn = (value) => (0, utils_2.getAttributeFormattedValue)(attribute, value) ?? '';
134
+ if (attribute?.type === 'money') {
147
135
  sheetColumn.numFmt = '"₹" #,##0.00';
148
136
  }
149
137
  let maxLength = 0;
@@ -156,30 +144,28 @@ const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fi
156
144
  sheetColumn.width = Math.max(maxLength, 10) * 1.2;
157
145
  });
158
146
  // Generate the Excel file
159
- const buffer = yield workbook.xlsx.writeBuffer();
160
- var blob = new Blob([buffer], {
147
+ const buffer = await workbook.xlsx.writeBuffer();
148
+ const blob = new Blob([buffer], {
161
149
  type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
162
150
  });
163
- var link = document.createElement('a');
151
+ const link = document.createElement('a');
164
152
  link.href = window.URL.createObjectURL(blob);
165
153
  link.download = fileName;
166
154
  link.click();
167
- });
155
+ };
168
156
  exports.exportRecordsXLS = exportRecordsXLS;
169
- function retriveRecords(_a) {
170
- return __awaiter(this, arguments, void 0, function* ({ gridColumns, dataService, schema, search, view, extraFilter, columnFilters, schemaStore, sorting, skip, limit, }) {
171
- const expand = (0, utils_1.collectExpandedKeys)(gridColumns);
172
- const columns = Array.from(new Set([...gridColumns.filter((x) => !x.expandedKey).map((x) => x.name)]));
173
- const result = yield dataService.retriveRecords({
174
- logicalName: schema.logicalName,
175
- search,
176
- columns: columns,
177
- expand,
178
- filter: (0, utils_1.mergeConditions)(schema, view.experience.filter, extraFilter, columnFilters, schemaStore),
179
- skip,
180
- limit,
181
- sort: sorting,
182
- });
183
- return result;
157
+ async function retriveRecords({ gridColumns, dataService, schema, search, view, extraFilter, columnFilters, schemaStore, sorting, skip, limit, }) {
158
+ const expand = (0, utils_1.collectExpandedKeys)(gridColumns);
159
+ const columns = Array.from(new Set([...gridColumns.filter((x) => !x.expandedKey).map((x) => x.name)]));
160
+ const result = await dataService.retriveRecords({
161
+ logicalName: schema.logicalName,
162
+ search,
163
+ columns: columns,
164
+ expand,
165
+ filter: (0, utils_1.mergeConditions)(schema, view.experience.filter, extraFilter, columnFilters, schemaStore),
166
+ skip,
167
+ limit,
168
+ sort: sorting,
184
169
  });
170
+ return result;
185
171
  }
@@ -0,0 +1,35 @@
1
+ export declare const baseEventAttributes: {
2
+ id: {
3
+ type: "id";
4
+ label: string;
5
+ string: true;
6
+ };
7
+ title: {
8
+ type: "string";
9
+ format: "text";
10
+ label: string;
11
+ required: true;
12
+ };
13
+ start: {
14
+ type: "date";
15
+ format: "datetime";
16
+ label: string;
17
+ required: true;
18
+ };
19
+ end: {
20
+ type: "date";
21
+ format: "datetime";
22
+ label: string;
23
+ required: true;
24
+ };
25
+ allDay: {
26
+ type: "boolean";
27
+ label: string;
28
+ };
29
+ description: {
30
+ type: "string";
31
+ format: "textarea";
32
+ label: string;
33
+ };
34
+ };
35
+ export type BaseEventAttributes = typeof baseEventAttributes;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.baseEventAttributes = void 0;
4
+ const utils_1 = require("@headless-adminapp/core/schema/utils");
5
+ exports.baseEventAttributes = (0, utils_1.defineSchemaAttributes)({
6
+ id: {
7
+ type: 'id',
8
+ label: 'ID',
9
+ string: true,
10
+ },
11
+ title: {
12
+ type: 'string',
13
+ format: 'text',
14
+ label: 'Title',
15
+ required: true,
16
+ },
17
+ start: {
18
+ type: 'date',
19
+ format: 'datetime',
20
+ label: 'Start',
21
+ required: true,
22
+ },
23
+ end: {
24
+ type: 'date',
25
+ format: 'datetime',
26
+ label: 'End',
27
+ required: true,
28
+ },
29
+ allDay: {
30
+ type: 'boolean',
31
+ label: 'All day',
32
+ },
33
+ description: {
34
+ type: 'string',
35
+ format: 'textarea',
36
+ label: 'Description',
37
+ },
38
+ });
@@ -0,0 +1,6 @@
1
+ import type { SchemaAttributes } from '@headless-adminapp/core/schema';
2
+ import { CalendarConfig } from './types';
3
+ export interface CalendarContextState<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes> {
4
+ config: CalendarConfig<SA1, SA2, SA3>;
5
+ }
6
+ export declare const CalendarContext: import("react").Context<import("@headless-adminapp/app/mutable").ContextValue<CalendarContextState<SchemaAttributes, SchemaAttributes, SchemaAttributes>>>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CalendarContext = void 0;
4
+ const mutable_1 = require("@headless-adminapp/app/mutable");
5
+ exports.CalendarContext = (0, mutable_1.createContext)();
@@ -0,0 +1 @@
1
+ export * from './useConfig';
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./useAppearanceContext"), exports);
17
+ __exportStar(require("./useConfig"), exports);
@@ -0,0 +1,3 @@
1
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
2
+ import { CalendarConfig } from '../types';
3
+ export declare function useConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes>(): CalendarConfig<SA1, SA2, SA3>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useConfig = useConfig;
4
+ const mutable_1 = require("@headless-adminapp/app/mutable");
5
+ const context_1 = require("../context");
6
+ function useConfig() {
7
+ return (0, mutable_1.useContextSelector)(context_1.CalendarContext, (state) => state.config);
8
+ }
@@ -0,0 +1,41 @@
1
+ import { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
2
+ import { AuthSession } from '../auth';
3
+ export interface CalendarEvent {
4
+ id: string;
5
+ title: string;
6
+ start?: Date | null;
7
+ end?: Date | null;
8
+ allDay?: boolean | null;
9
+ description?: string | null;
10
+ }
11
+ export type CalendarEventExtended<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> = CalendarEvent & InferredSchemaType<SA1> & InferredSchemaType<SA2>;
12
+ export interface CalendarEventsResolverFnOptions<SA extends SchemaAttributes = SchemaAttributes> {
13
+ start: Date;
14
+ end: Date;
15
+ filter?: InferredSchemaType<SA>;
16
+ auth: AuthSession | null;
17
+ }
18
+ export type CalendarEventsResolverFn<SA extends SchemaAttributes = SchemaAttributes> = (options: CalendarEventsResolverFnOptions<SA>) => Promise<CalendarEvent[]>;
19
+ export type CalendarEventResolverFn<T extends CalendarEvent = CalendarEvent> = (id: string) => Promise<T>;
20
+ export type CalendarEventSaveData<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> = Omit<CalendarEvent, 'id'> & {
21
+ id?: CalendarEvent['id'];
22
+ } & InferredSchemaType<SA1> & InferredSchemaType<SA2>;
23
+ export interface CalendarEventSaveFnOptions<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> {
24
+ event: CalendarEventSaveData<SA1, SA2>;
25
+ modifiedValues: Partial<CalendarEventSaveData<SA1, SA2>>;
26
+ }
27
+ export type CalendarEventSaveFn<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> = ({ event, modifiedValues, }: CalendarEventSaveFnOptions<SA1, SA2>) => Promise<void>;
28
+ export interface CalendarConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes> {
29
+ eventsResolver: CalendarEventsResolverFn<SA3>;
30
+ eventResolver?: CalendarEventResolverFn;
31
+ saveEvent: CalendarEventSaveFn<SA1, SA2>;
32
+ beforeDescriptionAttributes?: SA1;
33
+ afterDescriptionAttributes?: SA2;
34
+ filterAttributes?: SA3;
35
+ defaultFilter?: InferredSchemaType<SA3>;
36
+ openRecord?: (id: string) => void;
37
+ deleteEvent: (id: string) => Promise<void>;
38
+ title: string;
39
+ description: string;
40
+ eventLabel: string;
41
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
2
+ import { CalendarConfig } from './types';
3
+ export declare function defineCalendarConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes>(config: CalendarConfig<SA1, SA2, SA3>): CalendarConfig<SA1, SA2, SA3>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineCalendarConfig = defineCalendarConfig;
4
+ function defineCalendarConfig(config) {
5
+ return config;
6
+ }
@@ -4,6 +4,7 @@ exports.useUtility = useUtility;
4
4
  exports.useBaseCommandHandlerContext = useBaseCommandHandlerContext;
5
5
  const navigation_1 = require("@headless-adminapp/app/navigation");
6
6
  const react_query_1 = require("@tanstack/react-query");
7
+ const react_1 = require("react");
7
8
  const hooks_1 = require("../../dialog/hooks");
8
9
  const locale_1 = require("../../locale");
9
10
  const hooks_2 = require("../../metadata/hooks");
@@ -17,7 +18,7 @@ function useUtility() {
17
18
  const openErrorDialog = (0, hooks_1.useOpenErrorDialog)();
18
19
  const openPromptDialog = (0, hooks_1.useOpenPromptDialog)();
19
20
  const openToastNotification = (0, useOpenToastNotification_1.useOpenToastNotification)();
20
- return {
21
+ return (0, react_1.useMemo)(() => ({
21
22
  hideProgressIndicator,
22
23
  showProgressIndicator,
23
24
  openAlertDialog,
@@ -25,13 +26,21 @@ function useUtility() {
25
26
  openErrorDialog,
26
27
  openPromptDialog,
27
28
  showNotification: openToastNotification,
28
- };
29
+ }), [
30
+ hideProgressIndicator,
31
+ openAlertDialog,
32
+ openConfirmDialog,
33
+ openErrorDialog,
34
+ openPromptDialog,
35
+ openToastNotification,
36
+ showProgressIndicator,
37
+ ]);
29
38
  }
30
39
  function useNavigation() {
31
40
  const openForm = (0, navigation_1.useOpenForm)();
32
- return {
41
+ return (0, react_1.useMemo)(() => ({
33
42
  openForm,
34
- };
43
+ }), [openForm]);
35
44
  }
36
45
  function useBaseCommandHandlerContext() {
37
46
  const dataService = (0, transport_1.useDataService)();
@@ -40,12 +49,12 @@ function useBaseCommandHandlerContext() {
40
49
  const utility = useUtility();
41
50
  const locale = (0, locale_1.useLocale)();
42
51
  const navigation = useNavigation();
43
- return {
52
+ return (0, react_1.useMemo)(() => ({
44
53
  dataService,
45
54
  queryClient,
46
55
  utility,
47
56
  stores,
48
57
  locale,
49
58
  navigation,
50
- };
59
+ }), [dataService, queryClient, stores, utility, locale, navigation]);
51
60
  }
@@ -11,6 +11,6 @@ function useCommands(commands, handlerContext, selector) {
11
11
  const selectorRef = (0, react_1.useRef)(selector);
12
12
  selectorRef.current = selector;
13
13
  return (0, react_1.useMemo)(() => {
14
- return (0, utils_1.transformCommadnGroups)(commands !== null && commands !== void 0 ? commands : [], handlerContext, selectorRef.current);
14
+ return (0, utils_1.transformCommadnGroups)(commands ?? [], handlerContext, selectorRef.current);
15
15
  }, [commands, handlerContext]);
16
16
  }