@headless-adminapp/app 0.0.17-alpha.1 → 0.0.17-alpha.10

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 (78) hide show
  1. package/app/AuthWrapper.d.ts +7 -0
  2. package/app/AuthWrapper.js +23 -0
  3. package/app/LayoutProvider.d.ts +22 -0
  4. package/app/LayoutProvider.js +19 -0
  5. package/app/index.d.ts +1 -0
  6. package/app/index.js +3 -1
  7. package/builders/CommandBuilder/CommandBuilder.d.ts +10 -0
  8. package/builders/CommandBuilder/CommandBuilder.js +14 -0
  9. package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +81 -0
  10. package/builders/CommandBuilder/DefaultCommandBuilder.js +173 -0
  11. package/builders/CommandBuilder/FormCommandBuilder.d.ts +45 -0
  12. package/builders/CommandBuilder/FormCommandBuilder.js +145 -0
  13. package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +64 -0
  14. package/builders/CommandBuilder/SubgridCommandBuilder.js +170 -0
  15. package/builders/CommandBuilder/ViewCommandBuilder.d.ts +63 -0
  16. package/builders/CommandBuilder/ViewCommandBuilder.js +250 -0
  17. package/builders/CommandBuilder/index.d.ts +1 -0
  18. package/builders/CommandBuilder/index.js +5 -0
  19. package/builders/CommandBuilder/utils.d.ts +3 -0
  20. package/builders/CommandBuilder/utils.js +21 -0
  21. package/builders/SchemaExperienceBuilder.d.ts +2 -5
  22. package/builders/SchemaExperienceBuilder.js +16 -26
  23. package/builders/index.d.ts +1 -1
  24. package/builders/index.js +1 -2
  25. package/builders/utils.d.ts +28 -0
  26. package/builders/utils.js +185 -0
  27. package/command/hooks/useBaseCommandHandlerContext.js +9 -0
  28. package/command/hooks/useCommands.d.ts +1 -1
  29. package/command/hooks/useCommands.js +1 -1
  30. package/dataform/DataFormProvider/DataResolver.js +4 -4
  31. package/dataform/DataFormProvider/InitialValueResolver.js +0 -1
  32. package/dataform/DataFormProvider/index.js +3 -3
  33. package/dataform/hooks/useFormSave.js +2 -2
  34. package/dataform/hooks/useLoadFormGridPage.js +7 -1
  35. package/dataform/utils/index.d.ts +4 -3
  36. package/dataform/utils/index.js +23 -28
  37. package/datagrid/DataGridProvider/DataResolver.js +3 -48
  38. package/datagrid/DataGridProvider/transformViewColumns.js +4 -4
  39. package/datagrid/DataGridProvider/utils.d.ts +7 -2
  40. package/datagrid/DataGridProvider/utils.js +52 -2
  41. package/datagrid/context.d.ts +4 -6
  42. package/datagrid/hooks/useGridCommands.d.ts +3 -0
  43. package/datagrid/hooks/useGridCommands.js +3 -0
  44. package/datagrid/hooks/useMainGridCommands.d.ts +1 -13
  45. package/datagrid/hooks/useMainGridCommands.js +23 -146
  46. package/datagrid/hooks/useOpenRecord.d.ts +1 -0
  47. package/datagrid/hooks/useOpenRecord.js +34 -0
  48. package/datagrid/hooks/useSubGridCommands.js +15 -30
  49. package/hooks/useSystemColorScheme.d.ts +1 -1
  50. package/locale/LocaleProvider.js +1 -1
  51. package/locale/utils.d.ts +5 -0
  52. package/locale/utils.js +7 -0
  53. package/metadata/hooks/useExperienceViewCommands.js +7 -1
  54. package/metadata/hooks/useExperienceViewSubgridCommands.js +7 -1
  55. package/metadata/hooks/useMetadata.d.ts +1 -0
  56. package/metadata/hooks/useMetadata.js +2 -0
  57. package/metadata/hooks/useSchema.js +2 -2
  58. package/mutable/context.js +1 -1
  59. package/navigation/hooks/index.d.ts +1 -0
  60. package/{appearance → navigation}/hooks/index.js +1 -1
  61. package/navigation/hooks/useOpenForm.d.ts +2 -4
  62. package/navigation/hooks/useOpenForm.js +7 -3
  63. package/navigation/index.d.ts +1 -0
  64. package/{appearance → navigation}/index.js +0 -3
  65. package/package.json +12 -3
  66. package/recordset/RecordSetProvider.js +1 -1
  67. package/recordset/hooks/useRecordSetResult.js +1 -2
  68. package/store/SchemaExperienceStore.d.ts +3 -3
  69. package/appearance/context.d.ts +0 -7
  70. package/appearance/context.js +0 -5
  71. package/appearance/hooks/index.d.ts +0 -1
  72. package/appearance/hooks/useAppearanceContext.d.ts +0 -1
  73. package/appearance/hooks/useAppearanceContext.js +0 -12
  74. package/appearance/index.d.ts +0 -2
  75. package/builders/CommandBuilder.d.ts +0 -176
  76. package/builders/CommandBuilder.js +0 -474
  77. package/locale/types.d.ts +0 -2
  78. package/locale/types.js +0 -2
@@ -1,4 +1,2 @@
1
- import { PageEntiyForm } from '@headless-adminapp/core/experience/app';
2
- export declare function useOpenForm(): (formOptions: Omit<PageEntiyForm, "type">, navigationOptions: {
3
- replace?: boolean;
4
- }) => void;
1
+ import { OpenFormOptions } from '@headless-adminapp/core/experience/command';
2
+ export declare function useOpenForm(): (options: OpenFormOptions) => void;
@@ -8,9 +8,13 @@ const useRouteResolver_1 = require("../../route/hooks/useRouteResolver");
8
8
  function useOpenForm() {
9
9
  const routeResolver = (0, useRouteResolver_1.useRouteResolver)();
10
10
  const router = (0, hooks_1.useRouter)();
11
- return (0, react_1.useCallback)((formOptions, navigationOptions) => {
12
- const path = routeResolver(Object.assign({ type: app_1.PageType.EntityForm }, formOptions));
13
- if (navigationOptions.replace) {
11
+ return (0, react_1.useCallback)((options) => {
12
+ const path = routeResolver({
13
+ logicalName: options.logicalName,
14
+ type: app_1.PageType.EntityForm,
15
+ id: options.id,
16
+ });
17
+ if (options.replace) {
14
18
  router.replace(path);
15
19
  }
16
20
  else {
@@ -0,0 +1 @@
1
+ export * from './hooks';
@@ -14,7 +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
- exports.AppearanceContext = void 0;
18
- var context_1 = require("./context");
19
- Object.defineProperty(exports, "AppearanceContext", { enumerable: true, get: function () { return context_1.AppearanceContext; } });
20
17
  __exportStar(require("./hooks"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "0.0.17-alpha.1",
3
+ "version": "0.0.17-alpha.10",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsc",
21
+ "clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
21
22
  "ts-check": "tsc --noEmit",
22
23
  "copy-files": "cp package.json dist && cp src/index.css dist",
23
24
  "prepublishOnly": "pnpm run build && pnpm run copy-files",
@@ -27,8 +28,16 @@
27
28
  "author": "",
28
29
  "license": "ISC",
29
30
  "dependencies": {
31
+ "@hookform/resolvers": "^3.9.0",
32
+ "@tanstack/react-query": "5.51.1",
30
33
  "clsx": "2.1.1",
31
- "react-custom-scrollbars-2": "^4.5.0"
34
+ "dayjs": "^1.11.13",
35
+ "exceljs": "^4.4.0",
36
+ "json-to-csv-export": "^2.1.1",
37
+ "lodash": "^4.17.21",
38
+ "react-custom-scrollbars-2": "^4.5.0",
39
+ "react-hook-form": "7.52.2",
40
+ "yup": "^1.4.0"
32
41
  },
33
- "gitHead": "86b3b0f6764173ba69e71d81ef613ec570ae4a35"
42
+ "gitHead": "533252eef44109b7973eefdda309a87407ad0ce3"
34
43
  }
@@ -35,6 +35,6 @@ const CardViewSetter = () => {
35
35
  });
36
36
  })
37
37
  .catch(console.error);
38
- }, [experienceStore, logicalName]);
38
+ }, [experienceStore, logicalName, setValue]);
39
39
  return null;
40
40
  };
@@ -26,7 +26,7 @@ function useRecordSetResult() {
26
26
  return null;
27
27
  }
28
28
  return schemaStore.getSchema(context.logicalName);
29
- }, [context.logicalName]);
29
+ }, [context.logicalName, schemaStore]);
30
30
  const cardView = context.cardView;
31
31
  const columns = (0, react_1.useMemo)(() => {
32
32
  var _a;
@@ -44,7 +44,6 @@ function useRecordSetResult() {
44
44
  const { isPending, data, error } = (0, react_query_1.useQuery)({
45
45
  queryKey: ['data', 'recordset', context.logicalName, context.ids, columns],
46
46
  queryFn: () => __awaiter(this, void 0, void 0, function* () {
47
- console.log('fetching data', context.ids, !context.logicalName, !context.ids.length, !cardView);
48
47
  if (!context.logicalName || !context.ids.length || !cardView) {
49
48
  return [];
50
49
  }
@@ -23,9 +23,9 @@ export declare class SchemaExperienceStore implements ISchemaExperienceStore {
23
23
  getDefaultViewLookupId(logicalName: string): Promise<string>;
24
24
  getForm<S extends SchemaAttributes = SchemaAttributes>(logicalName: string, formId: string): Promise<Form<S>>;
25
25
  getQuickCreateForm<S extends SchemaAttributes = SchemaAttributes>(logicalName: string, formId: string): Promise<QuickCreateForm<S>>;
26
- getViewCommands(logicalName: string): Promise<EntityMainGridCommandItemExperience[][]>;
27
- getFormCommands(logicalName: string): Promise<EntityMainFormCommandItemExperience[][]>;
28
- getSubgridCommands(logicalName: string): Promise<SubGridCommandItemExperience[][]>;
26
+ getViewCommands(logicalName: string): Promise<EntityMainGridCommandItemExperience[][] | undefined>;
27
+ getFormCommands(logicalName: string): Promise<EntityMainFormCommandItemExperience[][] | undefined>;
28
+ getSubgridCommands(logicalName: string): Promise<SubGridCommandItemExperience[][] | undefined>;
29
29
  getSchemaMetadataList(): SchemaMetadata[];
30
30
  getExperienceSchemaMetadatList(): Promise<SchemaExperienceMetadata[]>;
31
31
  }
@@ -1,7 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
- export type ColorScheme = 'system' | 'light' | 'dark';
3
- export interface AppearanceContextState {
4
- colorScheme: ColorScheme;
5
- brandColor: string;
6
- }
7
- export declare const AppearanceContext: import("react").Context<[AppearanceContextState, Dispatch<SetStateAction<AppearanceContextState>>] | null>;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppearanceContext = void 0;
4
- const react_1 = require("react");
5
- exports.AppearanceContext = (0, react_1.createContext)(null);
@@ -1 +0,0 @@
1
- export * from './useAppearanceContext';
@@ -1 +0,0 @@
1
- export declare function useAppearanceContext(): [import("../context").AppearanceContextState, import("react").Dispatch<import("react").SetStateAction<import("../context").AppearanceContextState>>];
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAppearanceContext = useAppearanceContext;
4
- const react_1 = require("react");
5
- const context_1 = require("../context");
6
- function useAppearanceContext() {
7
- const context = (0, react_1.useContext)(context_1.AppearanceContext);
8
- if (!context) {
9
- throw new Error('useAppContext must be used within a AppContextProvider');
10
- }
11
- return context;
12
- }
@@ -1,2 +0,0 @@
1
- export { AppearanceContext, type ColorScheme, type AppearanceContextState, } from './context';
2
- export * from './hooks';
@@ -1,176 +0,0 @@
1
- import { EntityFormCommandContext, EntityMainFormCommandItemExperience } from '@headless-adminapp/core/experience/form';
2
- import { EntityMainGridCommandItemExperience, SubGridCommandItemExperience } from '@headless-adminapp/core/experience/view';
3
- import { Localized } from '@headless-adminapp/core/types';
4
- import { Icon } from '@headless-adminapp/icons';
5
- export declare function localizedLabel<T extends {
6
- label: string;
7
- localizedLabels?: Localized<string>;
8
- }>(language: string, value: T, fallback?: T): string;
9
- export declare function createLocalizedSelector<T>(stringSet: T, localizedStringSet: Localized<T> | undefined, language: string): <U>(selector: (stringSet: T) => U) => U;
10
- export declare namespace CommandBuilder {
11
- namespace View {
12
- export function createNewRecordCommand({ Icon, text, localizedTexts, }: {
13
- Icon: Icon;
14
- text: string;
15
- localizedTexts?: Record<string, string>;
16
- }): EntityMainGridCommandItemExperience;
17
- export function createEditRecordCommand({ Icon, text, localizedTexts, }: {
18
- Icon: Icon;
19
- text: string;
20
- localizedTexts?: Record<string, string>;
21
- }): EntityMainGridCommandItemExperience;
22
- interface DeleteRecordCommandStringSet {
23
- confirmation: {
24
- title: string | string[];
25
- text: string | string[];
26
- buttonCancel: string;
27
- buttonConfirm: string;
28
- };
29
- status: {
30
- deleting: string | string[];
31
- };
32
- successNotification: {
33
- title: string | string[];
34
- text: string | string[];
35
- };
36
- errorNotification: {
37
- title: string;
38
- };
39
- }
40
- export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
41
- export function createDeleteRecordCommand({ Icon, localizedText, text, stringSet, localizedStringSet, }: {
42
- Icon: Icon;
43
- text: string;
44
- localizedText?: Record<string, string>;
45
- stringSet?: DeleteRecordCommandStringSet;
46
- localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
47
- }): EntityMainGridCommandItemExperience;
48
- export function createRefreshCommand({ Icon, localizedTexts, text, }: {
49
- Icon: Icon;
50
- text: string;
51
- localizedTexts?: Record<string, string>;
52
- }): EntityMainGridCommandItemExperience;
53
- export function createExportCommand({ button, csv, excel, }: {
54
- button: {
55
- Icon: Icon;
56
- text: string;
57
- localizedTexts?: Record<string, string>;
58
- };
59
- excel: {
60
- Icon: Icon;
61
- text: string;
62
- localizedTexts?: Record<string, string>;
63
- };
64
- csv: {
65
- Icon: Icon;
66
- text: string;
67
- localizedTexts?: Record<string, string>;
68
- };
69
- }): EntityMainGridCommandItemExperience;
70
- export {};
71
- }
72
- namespace Form {
73
- export function createSaveCommand({ Icon, text, localizedTexts, }: {
74
- Icon: Icon;
75
- text: string;
76
- localizedTexts?: Record<string, string>;
77
- }): EntityMainFormCommandItemExperience;
78
- export function createSaveAndCloseCommand({ Icon, text, localizedTexts, }: {
79
- Icon: Icon;
80
- text: string;
81
- localizedTexts?: Record<string, string>;
82
- }): EntityMainFormCommandItemExperience;
83
- interface DeleteRecordCommandStringSet {
84
- confirmation: {
85
- title: string;
86
- text: string;
87
- buttonCancel: string;
88
- buttonConfirm: string;
89
- };
90
- status: {
91
- deleting: string;
92
- };
93
- successNotification: {
94
- title: string;
95
- text: string;
96
- };
97
- errorNotification: {
98
- title: string;
99
- };
100
- }
101
- export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
102
- export function createDeleteCommand({ Icon, text, localizedTexts, stringSet, }: {
103
- Icon: Icon;
104
- text: string;
105
- localizedTexts?: Record<string, string>;
106
- stringSet: DeleteRecordCommandStringSet | ((context: EntityFormCommandContext) => DeleteRecordCommandStringSet);
107
- }): EntityMainFormCommandItemExperience;
108
- export function createRefreshCommand({ Icon, text, localizedTexts, }: {
109
- Icon: Icon;
110
- text: string;
111
- localizedTexts?: Record<string, string>;
112
- }): EntityMainFormCommandItemExperience;
113
- export {};
114
- }
115
- namespace Subgrid {
116
- export function createNewRecordCommand({ Icon, text, localizedTexts, }: {
117
- Icon: Icon;
118
- text: string;
119
- localizedTexts?: Record<string, string>;
120
- }): SubGridCommandItemExperience;
121
- export function createEditRecordCommand({ Icon, text, localizedTexts, }: {
122
- Icon: Icon;
123
- text: string;
124
- localizedTexts?: Record<string, string>;
125
- }): SubGridCommandItemExperience;
126
- interface DeleteRecordCommandStringSet {
127
- confirmation: {
128
- title: string | string[];
129
- text: string | string[];
130
- buttonCancel: string;
131
- buttonConfirm: string;
132
- };
133
- status: {
134
- deleting: string | string[];
135
- };
136
- successNotification: {
137
- title: string | string[];
138
- text: string | string[];
139
- };
140
- errorNotification: {
141
- title: string;
142
- };
143
- }
144
- export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
145
- export function createDeleteRecordCommand({ Icon, localizedText, text, stringSet, localizedStringSet, }: {
146
- Icon: Icon;
147
- text: string;
148
- localizedText?: Record<string, string>;
149
- stringSet?: DeleteRecordCommandStringSet;
150
- localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
151
- }): SubGridCommandItemExperience;
152
- export function createRefreshCommand({ Icon, localizedTexts, text, }: {
153
- Icon: Icon;
154
- text: string;
155
- localizedTexts?: Record<string, string>;
156
- }): SubGridCommandItemExperience;
157
- export function createExportCommand({ button, csv, excel, }: {
158
- button: {
159
- Icon: Icon;
160
- text: string;
161
- localizedTexts?: Record<string, string>;
162
- };
163
- excel: {
164
- Icon: Icon;
165
- text: string;
166
- localizedTexts?: Record<string, string>;
167
- };
168
- csv: {
169
- Icon: Icon;
170
- text: string;
171
- localizedTexts?: Record<string, string>;
172
- };
173
- }): SubGridCommandItemExperience;
174
- export {};
175
- }
176
- }