@axelor/aos-mobile-core 7.1.3 → 7.2.1

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 (211) hide show
  1. package/lib/api/anomaly-api.d.ts +4 -0
  2. package/lib/api/anomaly-api.js +24 -0
  3. package/lib/api/anomaly-api.js.map +1 -0
  4. package/lib/api/login-api.js +2 -3
  5. package/lib/api/login-api.js.map +1 -1
  6. package/lib/api/user-api.d.ts +4 -0
  7. package/lib/api/user-api.js +31 -0
  8. package/lib/api/user-api.js.map +1 -0
  9. package/lib/apiProviders/Standard/ObjectFieldsProvider.d.ts +1 -0
  10. package/lib/apiProviders/Standard/ObjectFieldsProvider.js +21 -4
  11. package/lib/apiProviders/Standard/ObjectFieldsProvider.js.map +1 -1
  12. package/lib/apiProviders/middlewares/fieldParser.d.ts +2 -0
  13. package/lib/apiProviders/middlewares/fieldParser.js +53 -0
  14. package/lib/apiProviders/middlewares/fieldParser.js.map +1 -0
  15. package/lib/apiProviders/middlewares/index.d.ts +1 -0
  16. package/lib/apiProviders/middlewares/index.js +1 -0
  17. package/lib/apiProviders/middlewares/index.js.map +1 -1
  18. package/lib/apiProviders/utils.js +1 -1
  19. package/lib/apiProviders/utils.js.map +1 -1
  20. package/lib/app/ContextsProvider.js +12 -4
  21. package/lib/app/ContextsProvider.js.map +1 -1
  22. package/lib/app/Module.d.ts +2 -0
  23. package/lib/app/context.helper.js +6 -1
  24. package/lib/app/context.helper.js.map +1 -1
  25. package/lib/auth/models/objectFields.js +3 -3
  26. package/lib/auth/models/objectFields.js.map +1 -1
  27. package/lib/auth/screens/UserScreen.js +12 -5
  28. package/lib/auth/screens/UserScreen.js.map +1 -1
  29. package/lib/components/index.d.ts +1 -0
  30. package/lib/components/index.js +1 -0
  31. package/lib/components/index.js.map +1 -1
  32. package/lib/components/molecules/CameraButton/CameraButton.js +3 -3
  33. package/lib/components/molecules/CameraButton/CameraButton.js.map +1 -1
  34. package/lib/components/molecules/UploadFileInput/UploadFileInput.js +3 -1
  35. package/lib/components/molecules/UploadFileInput/UploadFileInput.js.map +1 -1
  36. package/lib/components/organisms/AnomalyBubble/AnomalyBubble.d.ts +11 -0
  37. package/lib/components/organisms/AnomalyBubble/AnomalyBubble.js +60 -0
  38. package/lib/components/organisms/AnomalyBubble/AnomalyBubble.js.map +1 -0
  39. package/lib/components/organisms/AnomalyList/AnomalyList.d.ts +7 -0
  40. package/lib/components/organisms/AnomalyList/AnomalyList.js +59 -0
  41. package/lib/components/organisms/AnomalyList/AnomalyList.js.map +1 -0
  42. package/lib/components/organisms/DateInput/DateInput.js +3 -3
  43. package/lib/components/organisms/DateInput/DateInput.js.map +1 -1
  44. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +2 -1
  45. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +18 -5
  46. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -1
  47. package/lib/components/organisms/index.d.ts +2 -0
  48. package/lib/components/organisms/index.js +2 -0
  49. package/lib/components/organisms/index.js.map +1 -1
  50. package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.d.ts +11 -0
  51. package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.js +33 -0
  52. package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.js.map +1 -0
  53. package/lib/components/pages/FormView/Alerts/index.d.ts +1 -0
  54. package/lib/{sessions/components/buttons → components/pages/FormView/Alerts}/index.js +1 -3
  55. package/lib/components/pages/FormView/Alerts/index.js.map +1 -0
  56. package/lib/components/pages/FormView/Components/Field.d.ts +10 -0
  57. package/lib/components/pages/FormView/Components/Field.js +146 -0
  58. package/lib/components/pages/FormView/Components/Field.js.map +1 -0
  59. package/lib/components/pages/FormView/Components/Panel.d.ts +9 -0
  60. package/lib/components/pages/FormView/Components/Panel.js +96 -0
  61. package/lib/components/pages/FormView/Components/Panel.js.map +1 -0
  62. package/lib/components/pages/FormView/Components/index.d.ts +2 -0
  63. package/lib/components/pages/FormView/Components/index.js +20 -0
  64. package/lib/components/pages/FormView/Components/index.js.map +1 -0
  65. package/lib/components/pages/FormView/Custom/CustomButton.d.ts +10 -0
  66. package/lib/components/pages/FormView/Custom/CustomButton.js +31 -0
  67. package/lib/components/pages/FormView/Custom/CustomButton.js.map +1 -0
  68. package/lib/components/pages/FormView/Custom/CustomPasswordInput.d.ts +11 -0
  69. package/lib/components/pages/FormView/Custom/CustomPasswordInput.js +40 -0
  70. package/lib/components/pages/FormView/Custom/CustomPasswordInput.js.map +1 -0
  71. package/lib/components/pages/FormView/Custom/CustomPicker.d.ts +12 -0
  72. package/lib/components/pages/FormView/Custom/CustomPicker.js +33 -0
  73. package/lib/components/pages/FormView/Custom/CustomPicker.js.map +1 -0
  74. package/lib/components/pages/FormView/Custom/CustomSearchBar.d.ts +12 -0
  75. package/lib/components/pages/FormView/Custom/CustomSearchBar.js +69 -0
  76. package/lib/components/pages/FormView/Custom/CustomSearchBar.js.map +1 -0
  77. package/lib/components/pages/FormView/Custom/index.d.ts +4 -0
  78. package/lib/components/pages/FormView/Custom/index.js +22 -0
  79. package/lib/components/pages/FormView/Custom/index.js.map +1 -0
  80. package/lib/components/pages/FormView/FormView.d.ts +8 -0
  81. package/lib/components/pages/FormView/FormView.js +193 -0
  82. package/lib/components/pages/FormView/FormView.js.map +1 -0
  83. package/lib/components/pages/index.d.ts +4 -0
  84. package/lib/components/pages/index.js +22 -0
  85. package/lib/components/pages/index.js.map +1 -0
  86. package/lib/components/templates/MailMessageView/MailMessageView.js +8 -2
  87. package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -1
  88. package/lib/components/templates/PopupApplicationNotConfigured/PopupApplicationNotConfigured.js +10 -13
  89. package/lib/components/templates/PopupApplicationNotConfigured/PopupApplicationNotConfigured.js.map +1 -1
  90. package/lib/components/templates/PopupMinimalRequiredVersion/PopupMinimalRequiredVersion.js +15 -25
  91. package/lib/components/templates/PopupMinimalRequiredVersion/PopupMinimalRequiredVersion.js.map +1 -1
  92. package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.d.ts +9 -6
  93. package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.js +30 -10
  94. package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.js.map +1 -1
  95. package/lib/components/templates/UserSearchBar/UserSearchBar.d.ts +14 -0
  96. package/lib/components/templates/UserSearchBar/UserSearchBar.js +34 -0
  97. package/lib/components/templates/UserSearchBar/UserSearchBar.js.map +1 -0
  98. package/lib/components/templates/index.d.ts +1 -0
  99. package/lib/components/templates/index.js +1 -0
  100. package/lib/components/templates/index.js.map +1 -1
  101. package/lib/config/routes.d.ts +3 -0
  102. package/lib/config/routes.js +2 -0
  103. package/lib/config/routes.js.map +1 -1
  104. package/lib/features/formSlice.d.ts +34 -0
  105. package/lib/features/formSlice.js +70 -0
  106. package/lib/features/formSlice.js.map +1 -0
  107. package/lib/features/index.d.ts +3 -0
  108. package/lib/features/index.js +3 -0
  109. package/lib/features/index.js.map +1 -1
  110. package/lib/features/metaJsonFieldSlice.d.ts +34 -0
  111. package/lib/features/metaJsonFieldSlice.js +68 -0
  112. package/lib/features/metaJsonFieldSlice.js.map +1 -0
  113. package/lib/features/userSlice.d.ts +16 -0
  114. package/lib/features/userSlice.js +49 -0
  115. package/lib/features/userSlice.js.map +1 -0
  116. package/lib/forms/FormConfigsProvider.d.ts +20 -0
  117. package/lib/forms/FormConfigsProvider.js +56 -0
  118. package/lib/forms/FormConfigsProvider.js.map +1 -0
  119. package/lib/forms/api.helpers.d.ts +12 -0
  120. package/lib/forms/api.helpers.js +59 -0
  121. package/lib/forms/api.helpers.js.map +1 -0
  122. package/lib/forms/display.helpers.d.ts +18 -0
  123. package/lib/forms/display.helpers.js +225 -0
  124. package/lib/forms/display.helpers.js.map +1 -0
  125. package/lib/forms/index.d.ts +7 -0
  126. package/lib/forms/index.js +25 -0
  127. package/lib/forms/index.js.map +1 -0
  128. package/lib/forms/register.helpers.d.ts +6 -0
  129. package/lib/forms/register.helpers.js +96 -0
  130. package/lib/forms/register.helpers.js.map +1 -0
  131. package/lib/forms/studio/api.helpers.d.ts +37 -0
  132. package/lib/forms/studio/api.helpers.js +162 -0
  133. package/lib/forms/studio/api.helpers.js.map +1 -0
  134. package/lib/forms/studio/display.helpers.d.ts +7 -0
  135. package/lib/forms/studio/display.helpers.js +256 -0
  136. package/lib/forms/studio/display.helpers.js.map +1 -0
  137. package/lib/forms/studio/index.d.ts +2 -0
  138. package/lib/forms/studio/index.js +20 -0
  139. package/lib/forms/studio/index.js.map +1 -0
  140. package/lib/forms/types.d.ts +100 -0
  141. package/lib/forms/types.js +19 -0
  142. package/lib/forms/types.js.map +1 -0
  143. package/lib/forms/validation.helpers.d.ts +10 -0
  144. package/lib/forms/validation.helpers.js +234 -0
  145. package/lib/forms/validation.helpers.js.map +1 -0
  146. package/lib/header/hooks.d.ts +15 -1
  147. package/lib/header/hooks.js +57 -2
  148. package/lib/header/hooks.js.map +1 -1
  149. package/lib/header/types.d.ts +1 -0
  150. package/lib/hooks/use-navigation.d.ts +1 -0
  151. package/lib/hooks/use-navigation.js +4 -1
  152. package/lib/hooks/use-navigation.js.map +1 -1
  153. package/lib/i18n/translations/en.json +52 -1
  154. package/lib/i18n/translations/fr.json +52 -1
  155. package/lib/index.d.ts +2 -1
  156. package/lib/index.js +2 -1
  157. package/lib/index.js.map +1 -1
  158. package/lib/models/index.d.ts +2 -0
  159. package/lib/models/index.js +2 -0
  160. package/lib/models/index.js.map +1 -1
  161. package/lib/models/objectFields.js +3 -0
  162. package/lib/models/objectFields.js.map +1 -1
  163. package/lib/models/searchFields.d.ts +2 -0
  164. package/lib/{sessions/components/buttons/LoginButton.js → models/searchFields.js} +3 -6
  165. package/lib/models/searchFields.js.map +1 -0
  166. package/lib/models/sortFields.d.ts +2 -0
  167. package/lib/{sessions/components/buttons/UpdateButton.js → models/sortFields.js} +3 -6
  168. package/lib/models/sortFields.js.map +1 -0
  169. package/lib/navigator/drawer/Header.js +1 -1
  170. package/lib/navigator/drawer/Header.js.map +1 -1
  171. package/lib/screens/ErrorScreen.js +1 -1
  172. package/lib/screens/ErrorScreen.js.map +1 -1
  173. package/lib/screens/JsonFieldScreen.d.ts +4 -0
  174. package/lib/screens/JsonFieldScreen.js +92 -0
  175. package/lib/screens/JsonFieldScreen.js.map +1 -0
  176. package/lib/screens/index.d.ts +13 -0
  177. package/lib/screens/index.js +9 -0
  178. package/lib/screens/index.js.map +1 -1
  179. package/lib/sessions/components/alerts/PopupCreateSession.js +8 -16
  180. package/lib/sessions/components/alerts/PopupCreateSession.js.map +1 -1
  181. package/lib/sessions/components/alerts/PopupEditSession.js +8 -16
  182. package/lib/sessions/components/alerts/PopupEditSession.js.map +1 -1
  183. package/lib/sessions/components/alerts/PopupSession.js +7 -16
  184. package/lib/sessions/components/alerts/PopupSession.js.map +1 -1
  185. package/lib/sessions/components/index.d.ts +0 -1
  186. package/lib/sessions/components/index.js +0 -1
  187. package/lib/sessions/components/index.js.map +1 -1
  188. package/lib/sessions/components/inputs/SessionInputs.js +9 -7
  189. package/lib/sessions/components/inputs/SessionInputs.js.map +1 -1
  190. package/lib/types/anomaly-type.d.ts +16 -0
  191. package/lib/types/anomaly-type.js +56 -0
  192. package/lib/types/anomaly-type.js.map +1 -0
  193. package/lib/types/index.d.ts +1 -0
  194. package/lib/types/index.js +1 -0
  195. package/lib/types/index.js.map +1 -1
  196. package/lib/utils/displayers.d.ts +1 -0
  197. package/lib/utils/displayers.js +1 -0
  198. package/lib/utils/displayers.js.map +1 -1
  199. package/lib/utils/index.d.ts +1 -1
  200. package/lib/utils/index.js +1 -1
  201. package/lib/utils/index.js.map +1 -1
  202. package/package.json +3 -3
  203. package/lib/sessions/components/buttons/DisabledButton.d.ts +0 -7
  204. package/lib/sessions/components/buttons/DisabledButton.js +0 -45
  205. package/lib/sessions/components/buttons/DisabledButton.js.map +0 -1
  206. package/lib/sessions/components/buttons/LoginButton.d.ts +0 -6
  207. package/lib/sessions/components/buttons/LoginButton.js.map +0 -1
  208. package/lib/sessions/components/buttons/UpdateButton.d.ts +0 -6
  209. package/lib/sessions/components/buttons/UpdateButton.js.map +0 -1
  210. package/lib/sessions/components/buttons/index.d.ts +0 -3
  211. package/lib/sessions/components/buttons/index.js.map +0 -1
@@ -0,0 +1,100 @@
1
+ import { Dispatch } from '@reduxjs/toolkit';
2
+ import { ReactElement } from 'react';
3
+ import { Color } from '@axelor/aos-mobile-ui';
4
+ export declare const DEFAULT_COLSPAN = 12;
5
+ export interface States {
6
+ objectState?: any;
7
+ storeState?: any;
8
+ }
9
+ export interface DependsOnStates extends States {
10
+ newValue?: any;
11
+ dispatch?: any;
12
+ }
13
+ export interface customComponentOptions {
14
+ style?: any;
15
+ title?: string;
16
+ defaultValue?: any;
17
+ onChange: (value?: any) => void;
18
+ required?: boolean;
19
+ readonly?: boolean;
20
+ }
21
+ export interface Field {
22
+ parentPanel?: string;
23
+ order?: number;
24
+ titleKey?: string;
25
+ helperKey?: string;
26
+ type: InputType;
27
+ required?: boolean;
28
+ requiredIf?: (values?: States) => boolean;
29
+ readonly?: boolean;
30
+ readonlyIf?: (values?: States) => boolean;
31
+ hideIf?: (values?: States) => boolean;
32
+ dependsOn?: {
33
+ [fieldName: string]: (values: DependsOnStates) => any;
34
+ };
35
+ widget?: Widget;
36
+ customComponent?: (options?: customComponentOptions) => ReactElement | JSX.Element;
37
+ options?: {
38
+ [propsKey: string]: any;
39
+ };
40
+ validationOptions?: {
41
+ [key: string]: {
42
+ value?: any;
43
+ customErrorKey?: string;
44
+ };
45
+ };
46
+ }
47
+ export type Widget = 'default' | 'increment' | 'star' | 'HTML' | 'label' | 'password' | 'file' | 'date' | 'checkbox' | 'custom';
48
+ export type InputType = 'string' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'time' | 'number' | 'boolean' | 'array' | 'object';
49
+ export interface Panel {
50
+ titleKey?: string;
51
+ isCollapsible?: boolean;
52
+ order?: number;
53
+ colSpan?: number;
54
+ direction?: 'row' | 'column';
55
+ parent?: string;
56
+ }
57
+ export interface JSONObject<Type> {
58
+ [Key: string]: Type;
59
+ }
60
+ export interface Form {
61
+ readonlyIf?: (values?: States) => boolean;
62
+ modelName?: string;
63
+ panels?: JSONObject<Panel>;
64
+ /** Fields attribut is a JSON object contening all fields of object.
65
+ * When defining a field you need to define as key in the JSON object
66
+ * the fieldName of the object.
67
+ */
68
+ fields: JSONObject<Field>;
69
+ }
70
+ export interface FormConfigs {
71
+ [formKey: string]: Form;
72
+ }
73
+ export interface DisplayPanel extends Panel {
74
+ key: string;
75
+ content?: (DisplayPanel | DisplayField)[];
76
+ }
77
+ export interface DisplayField extends Field {
78
+ key: string;
79
+ }
80
+ export interface Action {
81
+ key: string;
82
+ type: FormActionType;
83
+ titleKey?: string;
84
+ iconName?: string;
85
+ color?: Color;
86
+ hideIf?: (_states: States) => boolean;
87
+ disabledIf?: (_states: States) => boolean;
88
+ customAction?: (_options: ActionProps) => void;
89
+ needValidation?: boolean;
90
+ needRequiredFields?: boolean;
91
+ }
92
+ interface ActionProps {
93
+ handleReset?: () => void;
94
+ objectState?: any;
95
+ storeState?: any;
96
+ handleObjectChange?: (newValue?: any) => void;
97
+ dispatch?: Dispatch<any>;
98
+ }
99
+ export type FormActionType = 'update' | 'create' | 'reset' | 'refresh' | 'custom';
100
+ export {};
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export const DEFAULT_COLSPAN = 12;
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/forms/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { DisplayField, Form } from './types';
2
+ export declare const updateRequiredFieldsOfConfig: (config: Form, { objectState, storeState }: {
3
+ objectState: any;
4
+ storeState: any;
5
+ }) => Form;
6
+ export declare const isObjectMissingRequiredField: (content: any, config: Form) => boolean;
7
+ export declare const mapErrorWithTranslationKey: () => void;
8
+ export declare function validateSchema(content: Form, value: any): Promise<any>;
9
+ export declare function validateFieldSchema(field: DisplayField, value: any): Promise<any>;
10
+ export declare function getValidationErrors(err: any): any[];
@@ -0,0 +1,234 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { array, boolean, number, object, setLocale, string } from 'yup';
19
+ import { getFields } from './display.helpers';
20
+ export const updateRequiredFieldsOfConfig = (config, { objectState, storeState }) => {
21
+ if (config == null) {
22
+ return null;
23
+ }
24
+ const fields = getFields(config);
25
+ const result = { ...config.fields };
26
+ fields.forEach(_item => {
27
+ result[_item.key] = {
28
+ ..._item,
29
+ required: _item.required || _item.requiredIf({ objectState, storeState }),
30
+ };
31
+ });
32
+ return { ...config, fields: result };
33
+ };
34
+ export const isObjectMissingRequiredField = (content, config) => {
35
+ if (config == null) {
36
+ return false;
37
+ }
38
+ if (content == null) {
39
+ return true;
40
+ }
41
+ const fields = getFields(config);
42
+ const requiredFieldNames = fields
43
+ .filter(_item => _item.required === true)
44
+ .map(_item => _item.key);
45
+ return requiredFieldNames.some(_fieldName => content?.[_fieldName] == null);
46
+ };
47
+ export const mapErrorWithTranslationKey = () => {
48
+ setLocale({
49
+ mixed: {
50
+ notType: function notType(_ref) {
51
+ switch (_ref.type) {
52
+ case 'string':
53
+ return 'Base_FormValidation_String';
54
+ case 'number':
55
+ return 'Base_FormValidation_Number';
56
+ case 'boolean':
57
+ return 'Base_FormValidation_Boolean';
58
+ case 'array':
59
+ return 'Base_FormValidation_Array';
60
+ default:
61
+ return 'Base_FormValidation_Object';
62
+ }
63
+ },
64
+ required: 'Base_FormValidation_Required',
65
+ },
66
+ string: {
67
+ length: ({ length }) => ({
68
+ key: 'Base_FormValidation_String_Length',
69
+ values: { length },
70
+ }),
71
+ min: ({ min }) => ({ key: 'Base_FormValidation_String_Min', values: { min } }),
72
+ max: ({ max }) => ({ key: 'Base_FormValidation_String_Max', values: { max } }),
73
+ matches: ({ regex }) => ({
74
+ key: 'Base_FormValidation_String_Match',
75
+ values: { regex },
76
+ }),
77
+ email: 'Base_FormValidation_String_Email',
78
+ url: 'Base_FormValidation_String_Url',
79
+ uuid: 'Base_FormValidation_String_UUID',
80
+ trim: 'Base_FormValidation_String_Trim',
81
+ lowercase: 'Base_FormValidation_String_Lowercase',
82
+ uppercase: 'Base_FormValidation_String_Uppercase',
83
+ },
84
+ number: {
85
+ min: ({ min }) => ({ key: 'Base_FormValidation_Number_Min', values: { min } }),
86
+ max: ({ max }) => ({ key: 'Base_FormValidation_Number_Max', values: { max } }),
87
+ lessThan: ({ less }) => ({
88
+ key: 'Base_FormValidation_Number_LessThan',
89
+ values: { less },
90
+ }),
91
+ moreThan: ({ more }) => ({
92
+ key: 'Base_FormValidation_Number_MoreThan',
93
+ values: { more },
94
+ }),
95
+ positive: 'Base_FormValidation_Number_Positive',
96
+ negative: 'Base_FormValidation_Number_Negative',
97
+ integer: 'Base_FormValidation_Number_Integer',
98
+ },
99
+ date: {
100
+ min: ({ min }) => ({ key: 'Base_FormValidation_Date_Min', values: { min } }),
101
+ max: ({ max }) => ({ key: 'Base_FormValidation_Date_Max', values: { max } }),
102
+ },
103
+ boolean: {
104
+ isValue: ({ value }) => ({
105
+ key: 'Base_FormValidation_Boolean_IsValue',
106
+ values: { value },
107
+ }),
108
+ },
109
+ object: {
110
+ noUnknown: ({ unknown }) => ({
111
+ key: 'Base_FormValidation_Object_Unknown',
112
+ values: { unknown },
113
+ }),
114
+ },
115
+ array: {
116
+ min: ({ min }) => ({ key: 'Base_FormValidation_Array_Min', values: { min } }),
117
+ max: ({ max }) => ({ key: 'Base_FormValidation_Array_Max', values: { max } }),
118
+ length: ({ length }) => ({
119
+ key: 'Base_FormValidation_Array_Length',
120
+ values: { length },
121
+ }),
122
+ },
123
+ });
124
+ };
125
+ const createValidationSchema = (config) => {
126
+ const fields = getFields(config);
127
+ let schemaConfig = {};
128
+ fields
129
+ .filter(_field => !_field.readonly)
130
+ .filter(_field => _field.widget !== 'label')
131
+ .forEach(_field => {
132
+ schemaConfig[_field.key] = getFieldSchema(_field);
133
+ });
134
+ return object(schemaConfig);
135
+ };
136
+ const getRequiredCondition = (schema, _field) => {
137
+ if (_field.required) {
138
+ return schema.required();
139
+ }
140
+ return schema.nullable();
141
+ };
142
+ const getFieldSchema = (field) => {
143
+ let schema = null;
144
+ switch (field.type) {
145
+ case 'string':
146
+ case 'email':
147
+ case 'url':
148
+ case 'phone':
149
+ case 'date':
150
+ case 'datetime':
151
+ case 'time':
152
+ schema = string();
153
+ break;
154
+ case 'number':
155
+ schema = number();
156
+ break;
157
+ case 'boolean':
158
+ schema = boolean();
159
+ break;
160
+ case 'array':
161
+ schema = array().of(object());
162
+ break;
163
+ case 'object':
164
+ schema = object().shape({
165
+ id: getRequiredCondition(number().positive().integer(), field),
166
+ version: number().min(0).integer().nullable(),
167
+ });
168
+ break;
169
+ default:
170
+ throw new Error(`Type ${field.type} is not managed for schema creation`);
171
+ }
172
+ if (field.validationOptions == null) {
173
+ switch (field.type) {
174
+ case 'email':
175
+ schema = schema.email();
176
+ break;
177
+ case 'url':
178
+ schema = schema.url();
179
+ break;
180
+ case 'phone':
181
+ schema = schema.matches(/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s./0-9]*$/g, 'Base_FormValidation_PhoneNumber');
182
+ break;
183
+ case 'date':
184
+ schema = schema.matches(/^\d{4}-\d{2}-\d{2}$/g, 'Base_FormValidation_Date');
185
+ break;
186
+ case 'datetime':
187
+ schema = schema.matches(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?Z$/g, 'Base_FormValidation_DateTime');
188
+ break;
189
+ default:
190
+ break;
191
+ }
192
+ }
193
+ else {
194
+ for (const [key, _options] of Object.entries(field.validationOptions)) {
195
+ if (_options?.value != null) {
196
+ if (_options?.customErrorKey != null) {
197
+ schema = schema?.[key](_options.value, _options.customErrorKey);
198
+ }
199
+ else {
200
+ schema = schema?.[key](_options.value);
201
+ }
202
+ }
203
+ else {
204
+ if (_options?.customErrorKey != null) {
205
+ schema = schema?.[key](_options.customErrorKey);
206
+ }
207
+ else {
208
+ schema = schema?.[key]();
209
+ }
210
+ }
211
+ }
212
+ }
213
+ return getRequiredCondition(schema, field);
214
+ };
215
+ export async function validateSchema(content, value) {
216
+ return createValidationSchema(content).validate(value, {
217
+ abortEarly: false,
218
+ });
219
+ }
220
+ export async function validateFieldSchema(field, value) {
221
+ return getFieldSchema(field).validate(value);
222
+ }
223
+ export function getValidationErrors(err) {
224
+ return err.inner?.map(e => {
225
+ const message = typeof e.message === 'object' ? e.message?.key : e.message;
226
+ return {
227
+ attr: e.path,
228
+ message: message,
229
+ values: typeof e.message === 'object' ? e.message?.values : null,
230
+ translatable: !message.includes(e.path),
231
+ };
232
+ });
233
+ }
234
+ //# sourceMappingURL=validation.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.helpers.js","sourceRoot":"","sources":["../../src/forms/validation.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAS,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG5C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,MAAY,EACZ,EAAC,WAAW,EAAE,UAAU,EAAsC,EACxD,EAAE;IACR,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEjC,MAAM,MAAM,GAAG,EAAC,GAAG,MAAM,CAAC,MAAM,EAAC,CAAC;IAElC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG;YAClB,GAAG,KAAK;YACR,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,EAAC,WAAW,EAAE,UAAU,EAAC,CAAC;SACxE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAC,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,OAAY,EACZ,MAAY,EACH,EAAE;IACX,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,MAA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cAAc,CAAC,CAAC;iBACjD;qBAAM;oBACL,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;iBAC1B;aACF;SACF;KACF;IAED,OAAO,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAa,EAAE,KAAU;IAC5D,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE;QACrD,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAAmB,EACnB,KAAU;IAEV,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAQ;IAC1C,OAAO,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;QACxB,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAE3E,OAAO;YACL,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI;YAChE,YAAY,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,8 @@
1
- export function useBasicActions({ model, modelId, disableMailMessages, attachedFileScreenTitle, barcodeFieldname, }: {
1
+ export function useBasicActions({ model, modelId, disableMailMessages, disableJsonFields, attachedFileScreenTitle, barcodeFieldname, }: {
2
2
  model: any;
3
3
  modelId: any;
4
4
  disableMailMessages: any;
5
+ disableJsonFields?: boolean;
5
6
  attachedFileScreenTitle: any;
6
7
  barcodeFieldname?: string;
7
8
  }): {
@@ -35,6 +36,15 @@ export function useBasicActions({ model, modelId, disableMailMessages, attachedF
35
36
  onPress: () => void;
36
37
  showInHeader: boolean;
37
38
  };
39
+ jsonFieldsAction: {
40
+ key: string;
41
+ order: number;
42
+ title: string;
43
+ iconName: string;
44
+ hideIf: boolean;
45
+ onPress: () => void;
46
+ showInHeader: boolean;
47
+ };
38
48
  } | {
39
49
  mailMessagesAction: {
40
50
  key: string;
@@ -48,4 +58,8 @@ export function useBasicActions({ model, modelId, disableMailMessages, attachedF
48
58
  key: string;
49
59
  hideIf: boolean;
50
60
  };
61
+ jsonFieldsAction: {
62
+ key: string;
63
+ hideIf: boolean;
64
+ };
51
65
  };
@@ -23,14 +23,20 @@ import { countUnreadMailMessages } from '../features/mailMessageSlice';
23
23
  import { useTranslator } from '../i18n';
24
24
  import { checkNullString } from '../utils';
25
25
  import { fetchModel } from '../api/model-api';
26
- export const useBasicActions = ({ model, modelId, disableMailMessages, attachedFileScreenTitle, barcodeFieldname = 'barCode', }) => {
26
+ import { useOnline } from '../features/onlineSlice';
27
+ import { getNetInfo } from '../api/net-info-utils';
28
+ import { fetchJsonFieldsOfModel } from '../forms';
29
+ export const useBasicActions = ({ model, modelId, disableMailMessages, disableJsonFields = false, attachedFileScreenTitle, barcodeFieldname = 'barCode', }) => {
27
30
  const navigation = useNavigation();
28
31
  const I18n = useTranslator();
32
+ const online = useOnline();
29
33
  const dispatch = useDispatch();
30
34
  const { attachments } = useSelector(state => state.attachedFiles);
31
35
  const { unreadMessages } = useSelector(state => state.mailMessages);
32
36
  const [disableAttachementFiles, setDisableAttachementFiles] = useState(true);
33
37
  const [disableBarcode, setDisableBarcode] = useState(true);
38
+ const [disableCustomView, setDisableCustomView] = useState(true);
39
+ const [isConnected, setIsConnected] = useState(true);
34
40
  const modelConfigured = useMemo(() => !checkNullString(model) && modelId != null, [model, modelId]);
35
41
  const countUnreadMessagesAPI = useCallback(() => {
36
42
  if (modelConfigured) {
@@ -58,6 +64,21 @@ export const useBasicActions = ({ model, modelId, disableMailMessages, attachedF
58
64
  })
59
65
  .then(object => setDisableBarcode(object?.[barcodeFieldname] == null));
60
66
  }, [barcodeFieldname, model, modelId]);
67
+ useEffect(() => {
68
+ fetchJsonFieldsOfModel({ modelName: model })
69
+ .catch(() => setDisableCustomView(true))
70
+ .then(res => {
71
+ setDisableCustomView(res?.data?.total == null || res.data.total === 0);
72
+ });
73
+ }, [model]);
74
+ const checkInternetConnection = useCallback(async () => {
75
+ const { isConnected: _isConnected } = await getNetInfo();
76
+ setIsConnected(_isConnected);
77
+ }, []);
78
+ useEffect(() => {
79
+ const interval = setInterval(checkInternetConnection, 2000);
80
+ return () => clearInterval(interval.current);
81
+ }, [checkInternetConnection]);
61
82
  const mailMessagesAction = useMemo(() => {
62
83
  return {
63
84
  key: 'mailMessages',
@@ -113,19 +134,53 @@ export const useBasicActions = ({ model, modelId, disableMailMessages, attachedF
113
134
  showInHeader: true,
114
135
  };
115
136
  }, [I18n, barcodeFieldname, disableBarcode, model, modelId, navigation]);
137
+ const jsonFieldsAction = useMemo(() => {
138
+ return {
139
+ key: 'metaJsonFields',
140
+ order: 30,
141
+ title: I18n.t('Base_MetaJsonFields'),
142
+ iconName: 'object-group',
143
+ hideIf: disableCustomView ||
144
+ disableJsonFields ||
145
+ !online.isEnabled ||
146
+ !isConnected,
147
+ onPress: () => navigation.navigate('JsonFieldScreen', {
148
+ model,
149
+ modelId,
150
+ }),
151
+ showInHeader: true,
152
+ };
153
+ }, [
154
+ I18n,
155
+ disableCustomView,
156
+ disableJsonFields,
157
+ online.isEnabled,
158
+ isConnected,
159
+ navigation,
160
+ model,
161
+ modelId,
162
+ ]);
116
163
  return useMemo(() => {
117
164
  if (modelConfigured) {
118
165
  return {
119
166
  mailMessagesAction,
120
167
  attachedFilesAction,
121
168
  barcodeAction,
169
+ jsonFieldsAction,
122
170
  };
123
171
  }
124
172
  return {
125
173
  mailMessagesAction: { key: 'mailMessages', hideIf: true },
126
174
  attachedFilesAction: { key: 'attachedFiles', hideIf: true },
127
175
  barcodeAction: { key: 'barcode', hideIf: true },
176
+ jsonFieldsAction: { key: 'metaJsonFields', hideIf: true },
128
177
  };
129
- }, [attachedFilesAction, mailMessagesAction, modelConfigured, barcodeAction]);
178
+ }, [
179
+ attachedFilesAction,
180
+ barcodeAction,
181
+ jsonFieldsAction,
182
+ mailMessagesAction,
183
+ modelConfigured,
184
+ ]);
130
185
  };
131
186
  //# sourceMappingURL=hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/header/hooks.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAE5C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,OAAO,EACP,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,GAAG,SAAS,GAC7B,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,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B,EAAE,EAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAC;YACvD,mBAAmB,EAAE,EAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAC;YACzD,aAAa,EAAE,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC;YAC7C,gBAAgB,EAAE,EAAC,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC;SACxD,CAAC;IACJ,CAAC,EAAE;QACD,mBAAmB;QACnB,aAAa;QACb,gBAAgB;QAChB,kBAAkB;QAClB,eAAe;KAChB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -6,6 +6,7 @@ export interface HeaderOptions {
6
6
  model?: string;
7
7
  modelId?: number;
8
8
  disableMailMessages?: boolean;
9
+ disableJsonFields?: boolean;
9
10
  attachedFileScreenTitle?: string;
10
11
  barcodeFieldname?: string;
11
12
  headerTitle?: string;
@@ -1 +1,2 @@
1
1
  export declare const useNavigation: () => any;
2
+ export declare const useIsFocused: () => boolean;
@@ -15,8 +15,11 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { useNavigation as useReactNavigation } from '@react-navigation/native';
18
+ import { useNavigation as useReactNavigation, useIsFocused as useReactIsFocused, } from '@react-navigation/native';
19
19
  export const useNavigation = () => {
20
20
  return useReactNavigation();
21
21
  };
22
+ export const useIsFocused = () => {
23
+ return useReactIsFocused();
24
+ };
22
25
  //# sourceMappingURL=use-navigation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-navigation.js","sourceRoot":"","sources":["../../src/hooks/use-navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,aAAa,IAAI,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE7E,MAAM,CAAC,MAAM,aAAa,GAAG,GAAQ,EAAE;IACrC,OAAO,kBAAkB,EAAE,CAAC;AAC9B,CAAC,CAAC"}
1
+ {"version":3,"file":"use-navigation.js","sourceRoot":"","sources":["../../src/hooks/use-navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,aAAa,IAAI,kBAAkB,EACnC,YAAY,IAAI,iBAAiB,GAClC,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAQ,EAAE;IACrC,OAAO,kBAAkB,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAY,EAAE;IACxC,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  {
2
+ "Base_User": "User",
2
3
  "Base_AddedOn": "Added on",
3
4
  "Base_OK": "Ok",
4
5
  "Base_NoMoreItems": "No more items.",
@@ -108,6 +109,48 @@
108
109
  "Base_Month_Oct": "Oct",
109
110
  "Base_Month_Nov": "Nov",
110
111
  "Base_Month_Dec": "Dec",
112
+ "Base_InvalidConstraints": "Some constraints are invalid.",
113
+ "Base_MetaJsonFields": "Custom fields",
114
+ "Base_Studio_RefreshConfig": "Refresh view",
115
+ "Base_FormNotFound": "The requested form cannot be found, please contact an administrator.",
116
+ "Base_FormValidation_String": "must be a string",
117
+ "Base_FormValidation_Number": "must be a number",
118
+ "Base_FormValidation_Boolean": "must be a boolean",
119
+ "Base_FormValidation_Array": "must be an array",
120
+ "Base_FormValidation_Object": "must be an object",
121
+ "Base_FormValidation_Required": "is required",
122
+ "Base_FormValidation_PhoneNumber": "must be a valid phone number",
123
+ "Base_FormValidation_String_Email": "must be a valid email",
124
+ "Base_FormValidation_String_Url": "must be a valid url",
125
+ "Base_FormValidation_String_Length": "must be exactly {{length}} characters",
126
+ "Base_FormValidation_String_Min": "must be at least {{min}} characters",
127
+ "Base_FormValidation_String_Max": "must be at most {{max}} characters",
128
+ "Base_FormValidation_String_Match": "must match the following: {{regex}}",
129
+ "Base_FormValidation_String_UUID": "must be a valid UUID",
130
+ "Base_FormValidation_String_Trim": "must be a trimmed string",
131
+ "Base_FormValidation_String_Lowercase": "must be a lowercase string",
132
+ "Base_FormValidation_String_Uppercase": "must be a uppercase string",
133
+ "Base_FormValidation_Number_Min": "must be greater than or equal to {{min}}",
134
+ "Base_FormValidation_Number_Max": "must be less than or equal to {{max}}",
135
+ "Base_FormValidation_Number_LessThan": "must be less than {{less}}",
136
+ "Base_FormValidation_Number_MoreThan": "must be greater than {{more}}",
137
+ "Base_FormValidation_Number_Positive": "must be a positive number",
138
+ "Base_FormValidation_Number_Negative": "must be a negative number",
139
+ "Base_FormValidation_Number_Integer": "must be an integer",
140
+ "Base_FormValidation_Date": "must be a date",
141
+ "Base_FormValidation_DateTime": "must be a datetime",
142
+ "Base_FormValidation_Date_Min": "must be later than {{min}}",
143
+ "Base_FormValidation_Date_Max": "must be at earlier than {{max}}",
144
+ "Base_FormValidation_Boolean_IsValue": "must be {{value}}",
145
+ "Base_FormValidation_Object_Unknown": "has unspecified keys: {{unknown}}",
146
+ "Base_FormValidation_Array_Min": "must have at least {{min}} items",
147
+ "Base_FormValidation_Array_Max": "must have less than or equal to {{max}} items",
148
+ "Base_FormValidation_Array_Length": "must have {{length}} items",
149
+ "Base_FormAction_Save": "Save",
150
+ "Base_FormAction_Create": "Create",
151
+ "Base_FormAction_Update": "update",
152
+ "Base_FormAction_Refresh": "Refresh",
153
+ "Base_FormAction_Reset": "Reset",
111
154
  "Base_SliceAction_FetchAttachedFiles": "fetch attached files",
112
155
  "Base_SliceAction_FetchFilesDetails": "fetch file details",
113
156
  "Base_SliceAction_FetchMetaModule": "fetch meta modules",
@@ -121,5 +164,13 @@
121
164
  "Base_SliceAction_MarkMailMessageAsRead": "mark mail message as read",
122
165
  "Base_SliceAction_MarkAllMailMessageAsRead": "mark all mail messages as read",
123
166
  "Base_SliceAction_FetchMenuConfig": "fetch menu config",
124
- "Base_SliceAction_FetchMobileConfig": "fetch mobile config"
167
+ "Base_SliceAction_FetchMobileConfig": "fetch mobile config",
168
+ "Base_SliceAction_CreateRecord": "create record",
169
+ "Base_SliceAction_UpdateRecord": "update record",
170
+ "Base_SliceAction_RefreshRecord": "refresh record",
171
+ "Base_SliceAction_FetchJsonFieldsOfModel": "fetch custom fields of model",
172
+ "Base_SliceAction_FetchDataOfModel": "fetch data of model",
173
+ "Base_SliceAction_UpdateJsonFieldsObject": "update custom fields of object",
174
+ "Base_SliceAction_FetchAnomalies": "fetch anomalies of object",
175
+ "Base_SliceAction_SearchUser": "search user"
125
176
  }