aq-fe-framework 0.1.659 → 0.1.660

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.
@@ -1,3 +1,7 @@
1
+ import {
2
+ createGenericStore,
3
+ useStore_Permission
4
+ } from "./chunk-SUH3FFFV.mjs";
1
5
  import {
2
6
  U0MyValidateEmail,
3
7
  updateEnableList,
@@ -10,10 +14,6 @@ import {
10
14
  utils_mantineReactTable_sortColumnsByKeyOrder,
11
15
  utils_pdf_download
12
16
  } from "./chunk-GMM6RIVS.mjs";
13
- import {
14
- createGenericStore,
15
- useStore_Permission
16
- } from "./chunk-SUH3FFFV.mjs";
17
17
  import {
18
18
  baseColumns
19
19
  } from "./chunk-7PUDC2WF.mjs";
@@ -23,7 +23,7 @@ import {
23
23
  import {
24
24
  const_object_colors,
25
25
  const_object_documentTypes
26
- } from "./chunk-IUTUR43V.mjs";
26
+ } from "./chunk-REMYBOSK.mjs";
27
27
  import {
28
28
  enum_daysOfWeek,
29
29
  enum_emailConfigModule
@@ -38,7 +38,7 @@ import {
38
38
  useMyRouter,
39
39
  useQ_AQ_GetAQModule,
40
40
  useQ_SkillCenter_GetAll
41
- } from "./chunk-CZWDOLZ3.mjs";
41
+ } from "./chunk-XGQBU5PL.mjs";
42
42
  import {
43
43
  utils_notification_show
44
44
  } from "./chunk-7ZCOFATU.mjs";
@@ -162,6 +162,33 @@ function createBaseUrl(baseUrl) {
162
162
  };
163
163
  }
164
164
 
165
+ // src/hooks/custom-hooks/createMapper.ts
166
+ var createMapper = (config) => {
167
+ const toUI = (apiObj) => {
168
+ const result = {};
169
+ for (const uiKey in config) {
170
+ const field = config[uiKey];
171
+ const apiKey = field.apiKey;
172
+ const apiValue = apiObj[apiKey];
173
+ const value = field.toUI ? field.toUI(apiValue, apiObj) : apiValue;
174
+ result[uiKey] = value;
175
+ }
176
+ return result;
177
+ };
178
+ const toAPI = (uiObj) => {
179
+ const result = {};
180
+ for (const uiKey in config) {
181
+ const field = config[uiKey];
182
+ const apiKey = field.apiKey;
183
+ const uiValue = uiObj[uiKey];
184
+ const value = field.toAPI ? field.toAPI(uiValue, uiObj) : uiValue;
185
+ result[apiKey] = value;
186
+ }
187
+ return result;
188
+ };
189
+ return { toUI, toAPI };
190
+ };
191
+
165
192
  // src/api/config/baseAxios.ts
166
193
  import axios from "axios";
167
194
  var baseAxios = axios.create({
@@ -344,6 +371,7 @@ export {
344
371
  useMyRouter,
345
372
  createBaseApi,
346
373
  createBaseUrl,
374
+ createMapper,
347
375
  baseAxios_default,
348
376
  useLoadAxiosConfig,
349
377
  useMyReactMutation,
@@ -70,14 +70,14 @@ import {
70
70
  useHeaderMegaMenuStore,
71
71
  useS_ButtonImport,
72
72
  useStore_BasicAppShell
73
- } from "../chunk-LWDDJFT3.mjs";
74
- import "../chunk-GMM6RIVS.mjs";
73
+ } from "../chunk-MGMU4NZS.mjs";
75
74
  import "../chunk-SUH3FFFV.mjs";
75
+ import "../chunk-GMM6RIVS.mjs";
76
76
  import "../chunk-7PUDC2WF.mjs";
77
77
  import "../chunk-EWDS5IOF.mjs";
78
- import "../chunk-IUTUR43V.mjs";
78
+ import "../chunk-REMYBOSK.mjs";
79
79
  import "../chunk-MNJNQRZU.mjs";
80
- import "../chunk-CZWDOLZ3.mjs";
80
+ import "../chunk-XGQBU5PL.mjs";
81
81
  import "../chunk-WZ6PXGGC.mjs";
82
82
  import "../chunk-7ZCOFATU.mjs";
83
83
  import "../chunk-FWCSY2DS.mjs";
@@ -3,7 +3,7 @@ import {
3
3
  const_object_colors,
4
4
  const_object_documentTypes,
5
5
  const_object_generalMenuData
6
- } from "../chunk-IUTUR43V.mjs";
6
+ } from "../chunk-REMYBOSK.mjs";
7
7
  import "../chunk-FWCSY2DS.mjs";
8
8
  export {
9
9
  const_array_daysOfWeek,
@@ -23,14 +23,14 @@ import {
23
23
  MyStatsCard,
24
24
  MyTextInput2 as MyTextInput,
25
25
  MyWeeklySessionSchedulerPicker
26
- } from "../chunk-LWDDJFT3.mjs";
27
- import "../chunk-GMM6RIVS.mjs";
26
+ } from "../chunk-MGMU4NZS.mjs";
28
27
  import "../chunk-SUH3FFFV.mjs";
28
+ import "../chunk-GMM6RIVS.mjs";
29
29
  import "../chunk-7PUDC2WF.mjs";
30
30
  import "../chunk-EWDS5IOF.mjs";
31
- import "../chunk-IUTUR43V.mjs";
31
+ import "../chunk-REMYBOSK.mjs";
32
32
  import "../chunk-MNJNQRZU.mjs";
33
- import "../chunk-CZWDOLZ3.mjs";
33
+ import "../chunk-XGQBU5PL.mjs";
34
34
  import "../chunk-WZ6PXGGC.mjs";
35
35
  import "../chunk-7ZCOFATU.mjs";
36
36
  import "../chunk-FWCSY2DS.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  MyModalDelete
3
- } from "../chunk-LWDDJFT3.mjs";
4
- import "../chunk-GMM6RIVS.mjs";
3
+ } from "../chunk-MGMU4NZS.mjs";
5
4
  import "../chunk-SUH3FFFV.mjs";
5
+ import "../chunk-GMM6RIVS.mjs";
6
6
  import "../chunk-7PUDC2WF.mjs";
7
7
  import "../chunk-EWDS5IOF.mjs";
8
- import "../chunk-IUTUR43V.mjs";
8
+ import "../chunk-REMYBOSK.mjs";
9
9
  import "../chunk-MNJNQRZU.mjs";
10
10
  import {
11
11
  useMyReactMutation
12
- } from "../chunk-CZWDOLZ3.mjs";
12
+ } from "../chunk-XGQBU5PL.mjs";
13
13
  import "../chunk-WZ6PXGGC.mjs";
14
14
  import "../chunk-7ZCOFATU.mjs";
15
15
  import {
@@ -66,6 +66,19 @@ declare function createBaseUrl(baseUrl: string): {
66
66
  deleteList: string;
67
67
  };
68
68
 
69
+ type MapperField<UI, API> = {
70
+ apiKey: keyof API;
71
+ toUI?: (val: any, fullApiObj?: API) => any;
72
+ toAPI?: (val: any, fullUiObj?: UI) => any;
73
+ };
74
+ type MapperConfig<UI, API> = {
75
+ [K in keyof UI]?: MapperField<UI, API>;
76
+ };
77
+ declare const createMapper: <UI, API>(config: MapperConfig<UI, API>) => {
78
+ toUI: (apiObj: API) => UI;
79
+ toAPI: (uiObj: UI) => API;
80
+ };
81
+
69
82
  declare const useLoadAxiosConfig: ({ axiosInstance, url, }: {
70
83
  axiosInstance?: AxiosInstance;
71
84
  url?: string;
@@ -246,4 +259,4 @@ declare function useMyReactQuery<IRes, IBody>({ queryKey, axiosFn, options, mock
246
259
 
247
260
  declare function useQ_AQ_GetAQModule(): _tanstack_react_query.UseQueryResult<IAQModule, Error>;
248
261
 
249
- export { MyApiResponse, type MyReactQueryProps, createBaseUrl, useCreateUpdate, useEditableRows, useLoadAxiosConfig, useMyDevice, useMyReactQuery, useMyRouter, useQ_AQ_GetAQModule };
262
+ export { MyApiResponse, type MyReactQueryProps, createBaseUrl, createMapper, useCreateUpdate, useEditableRows, useLoadAxiosConfig, useMyDevice, useMyReactQuery, useMyRouter, useQ_AQ_GetAQModule };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createBaseApi,
3
3
  createBaseUrl,
4
+ createMapper,
4
5
  useCreateUpdate,
5
6
  useEditableRows,
6
7
  useLoadAxiosConfig,
@@ -9,13 +10,14 @@ import {
9
10
  useMyReactQuery,
10
11
  useMyRouter,
11
12
  useQ_AQ_GetAQModule
12
- } from "../chunk-CZWDOLZ3.mjs";
13
+ } from "../chunk-XGQBU5PL.mjs";
13
14
  import "../chunk-WZ6PXGGC.mjs";
14
15
  import "../chunk-7ZCOFATU.mjs";
15
16
  import "../chunk-FWCSY2DS.mjs";
16
17
  export {
17
18
  createBaseApi,
18
19
  createBaseUrl,
20
+ createMapper,
19
21
  useCreateUpdate,
20
22
  useEditableRows,
21
23
  useLoadAxiosConfig,
@@ -106,14 +106,14 @@ import {
106
106
  Feat_accessControlLevel,
107
107
  useS_authenticate,
108
108
  useS_moduleConfig
109
- } from "../chunk-LWDDJFT3.mjs";
110
- import "../chunk-GMM6RIVS.mjs";
109
+ } from "../chunk-MGMU4NZS.mjs";
111
110
  import "../chunk-SUH3FFFV.mjs";
111
+ import "../chunk-GMM6RIVS.mjs";
112
112
  import "../chunk-7PUDC2WF.mjs";
113
113
  import "../chunk-EWDS5IOF.mjs";
114
- import "../chunk-IUTUR43V.mjs";
114
+ import "../chunk-REMYBOSK.mjs";
115
115
  import "../chunk-MNJNQRZU.mjs";
116
- import "../chunk-CZWDOLZ3.mjs";
116
+ import "../chunk-XGQBU5PL.mjs";
117
117
  import "../chunk-WZ6PXGGC.mjs";
118
118
  import "../chunk-7ZCOFATU.mjs";
119
119
  import "../chunk-FWCSY2DS.mjs";
package/package.json CHANGED
@@ -50,7 +50,7 @@
50
50
  "types": "./dist/types/index.d.mts"
51
51
  }
52
52
  },
53
- "version": "0.1.659",
53
+ "version": "0.1.660",
54
54
  "private": false,
55
55
  "files": [
56
56
  "dist"
@@ -72,8 +72,8 @@ var const_object_generalMenuData = {
72
72
  };
73
73
 
74
74
  export {
75
- const_object_colors,
76
75
  const_array_daysOfWeek,
76
+ const_object_colors,
77
77
  const_object_documentTypes,
78
78
  const_object_generalMenuData
79
79
  };