@axelor/aos-mobile-core 7.1.2 → 7.2.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.
- package/lib/api/anomaly-api.d.ts +4 -0
- package/lib/api/anomaly-api.js +24 -0
- package/lib/api/anomaly-api.js.map +1 -0
- package/lib/api/login-api.js +2 -3
- package/lib/api/login-api.js.map +1 -1
- package/lib/api/user-api.d.ts +4 -0
- package/lib/api/user-api.js +31 -0
- package/lib/api/user-api.js.map +1 -0
- package/lib/apiProviders/Standard/ObjectFieldsProvider.d.ts +1 -0
- package/lib/apiProviders/Standard/ObjectFieldsProvider.js +21 -4
- package/lib/apiProviders/Standard/ObjectFieldsProvider.js.map +1 -1
- package/lib/apiProviders/middlewares/fieldParser.d.ts +2 -0
- package/lib/apiProviders/middlewares/fieldParser.js +53 -0
- package/lib/apiProviders/middlewares/fieldParser.js.map +1 -0
- package/lib/apiProviders/middlewares/index.d.ts +1 -0
- package/lib/apiProviders/middlewares/index.js +1 -0
- package/lib/apiProviders/middlewares/index.js.map +1 -1
- package/lib/apiProviders/utils.js +1 -1
- package/lib/apiProviders/utils.js.map +1 -1
- package/lib/app/ContextsProvider.js +12 -4
- package/lib/app/ContextsProvider.js.map +1 -1
- package/lib/app/Module.d.ts +2 -0
- package/lib/app/context.helper.js +6 -1
- package/lib/app/context.helper.js.map +1 -1
- package/lib/auth/models/objectFields.js +3 -3
- package/lib/auth/models/objectFields.js.map +1 -1
- package/lib/auth/screens/UserScreen.js +7 -4
- package/lib/auth/screens/UserScreen.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/molecules/CameraButton/CameraButton.js +3 -3
- package/lib/components/molecules/CameraButton/CameraButton.js.map +1 -1
- package/lib/components/molecules/UploadFileInput/UploadFileInput.js +3 -1
- package/lib/components/molecules/UploadFileInput/UploadFileInput.js.map +1 -1
- package/lib/components/organisms/AnomalyBubble/AnomalyBubble.d.ts +11 -0
- package/lib/components/organisms/AnomalyBubble/AnomalyBubble.js +60 -0
- package/lib/components/organisms/AnomalyBubble/AnomalyBubble.js.map +1 -0
- package/lib/components/organisms/AnomalyList/AnomalyList.d.ts +7 -0
- package/lib/components/organisms/AnomalyList/AnomalyList.js +59 -0
- package/lib/components/organisms/AnomalyList/AnomalyList.js.map +1 -0
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +2 -1
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +18 -5
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -1
- package/lib/components/organisms/index.d.ts +2 -0
- package/lib/components/organisms/index.js +2 -0
- package/lib/components/organisms/index.js.map +1 -1
- package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.d.ts +11 -0
- package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.js +33 -0
- package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.js.map +1 -0
- package/lib/components/pages/FormView/Alerts/index.d.ts +1 -0
- package/lib/{sessions/components/buttons → components/pages/FormView/Alerts}/index.js +1 -3
- package/lib/components/pages/FormView/Alerts/index.js.map +1 -0
- package/lib/components/pages/FormView/Components/Field.d.ts +9 -0
- package/lib/components/pages/FormView/Components/Field.js +149 -0
- package/lib/components/pages/FormView/Components/Field.js.map +1 -0
- package/lib/components/pages/FormView/Components/Panel.d.ts +8 -0
- package/lib/components/pages/FormView/Components/Panel.js +84 -0
- package/lib/components/pages/FormView/Components/Panel.js.map +1 -0
- package/lib/components/pages/FormView/Components/index.d.ts +2 -0
- package/lib/components/pages/FormView/Components/index.js +20 -0
- package/lib/components/pages/FormView/Components/index.js.map +1 -0
- package/lib/components/pages/FormView/Custom/CustomButton.d.ts +10 -0
- package/lib/components/pages/FormView/Custom/CustomButton.js +31 -0
- package/lib/components/pages/FormView/Custom/CustomButton.js.map +1 -0
- package/lib/components/pages/FormView/Custom/CustomPasswordInput.d.ts +11 -0
- package/lib/components/pages/FormView/Custom/CustomPasswordInput.js +40 -0
- package/lib/components/pages/FormView/Custom/CustomPasswordInput.js.map +1 -0
- package/lib/components/pages/FormView/Custom/CustomPicker.d.ts +12 -0
- package/lib/components/pages/FormView/Custom/CustomPicker.js +33 -0
- package/lib/components/pages/FormView/Custom/CustomPicker.js.map +1 -0
- package/lib/components/pages/FormView/Custom/CustomSearchBar.d.ts +12 -0
- package/lib/components/pages/FormView/Custom/CustomSearchBar.js +69 -0
- package/lib/components/pages/FormView/Custom/CustomSearchBar.js.map +1 -0
- package/lib/components/pages/FormView/Custom/index.d.ts +4 -0
- package/lib/components/pages/FormView/Custom/index.js +22 -0
- package/lib/components/pages/FormView/Custom/index.js.map +1 -0
- package/lib/components/pages/FormView/FormView.d.ts +8 -0
- package/lib/components/pages/FormView/FormView.js +199 -0
- package/lib/components/pages/FormView/FormView.js.map +1 -0
- package/lib/components/pages/index.d.ts +4 -0
- package/lib/components/pages/index.js +22 -0
- package/lib/components/pages/index.js.map +1 -0
- package/lib/components/templates/MailMessageView/MailMessageView.js +8 -2
- package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -1
- package/lib/components/templates/PopupApplicationNotConfigured/PopupApplicationNotConfigured.js +10 -13
- package/lib/components/templates/PopupApplicationNotConfigured/PopupApplicationNotConfigured.js.map +1 -1
- package/lib/components/templates/PopupMinimalRequiredVersion/PopupMinimalRequiredVersion.js +15 -25
- package/lib/components/templates/PopupMinimalRequiredVersion/PopupMinimalRequiredVersion.js.map +1 -1
- package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.d.ts +9 -6
- package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.js +30 -10
- package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.js.map +1 -1
- package/lib/components/templates/UserSearchBar/UserSearchBar.d.ts +14 -0
- package/lib/components/templates/UserSearchBar/UserSearchBar.js +34 -0
- package/lib/components/templates/UserSearchBar/UserSearchBar.js.map +1 -0
- package/lib/components/templates/index.d.ts +1 -0
- package/lib/components/templates/index.js +1 -0
- package/lib/components/templates/index.js.map +1 -1
- package/lib/config/routes.d.ts +3 -0
- package/lib/config/routes.js +2 -0
- package/lib/config/routes.js.map +1 -1
- package/lib/features/formSlice.d.ts +34 -0
- package/lib/features/formSlice.js +70 -0
- package/lib/features/formSlice.js.map +1 -0
- package/lib/features/index.d.ts +3 -0
- package/lib/features/index.js +3 -0
- package/lib/features/index.js.map +1 -1
- package/lib/features/metaJsonFieldSlice.d.ts +34 -0
- package/lib/features/metaJsonFieldSlice.js +68 -0
- package/lib/features/metaJsonFieldSlice.js.map +1 -0
- package/lib/features/userSlice.d.ts +16 -0
- package/lib/features/userSlice.js +49 -0
- package/lib/features/userSlice.js.map +1 -0
- package/lib/forms/FormConfigsProvider.d.ts +20 -0
- package/lib/forms/FormConfigsProvider.js +56 -0
- package/lib/forms/FormConfigsProvider.js.map +1 -0
- package/lib/forms/api.helpers.d.ts +12 -0
- package/lib/forms/api.helpers.js +59 -0
- package/lib/forms/api.helpers.js.map +1 -0
- package/lib/forms/display.helpers.d.ts +9 -0
- package/lib/forms/display.helpers.js +150 -0
- package/lib/forms/display.helpers.js.map +1 -0
- package/lib/forms/index.d.ts +7 -0
- package/lib/forms/index.js +25 -0
- package/lib/forms/index.js.map +1 -0
- package/lib/forms/register.helpers.d.ts +6 -0
- package/lib/forms/register.helpers.js +96 -0
- package/lib/forms/register.helpers.js.map +1 -0
- package/lib/forms/studio/api.helpers.d.ts +37 -0
- package/lib/forms/studio/api.helpers.js +162 -0
- package/lib/forms/studio/api.helpers.js.map +1 -0
- package/lib/forms/studio/display.helpers.d.ts +7 -0
- package/lib/forms/studio/display.helpers.js +256 -0
- package/lib/forms/studio/display.helpers.js.map +1 -0
- package/lib/forms/studio/index.d.ts +2 -0
- package/lib/forms/studio/index.js +20 -0
- package/lib/forms/studio/index.js.map +1 -0
- package/lib/forms/types.d.ts +100 -0
- package/lib/forms/types.js +19 -0
- package/lib/forms/types.js.map +1 -0
- package/lib/forms/validation.helpers.d.ts +10 -0
- package/lib/forms/validation.helpers.js +234 -0
- package/lib/forms/validation.helpers.js.map +1 -0
- package/lib/header/hooks.d.ts +15 -1
- package/lib/header/hooks.js +57 -2
- package/lib/header/hooks.js.map +1 -1
- package/lib/header/types.d.ts +1 -0
- package/lib/hooks/use-navigation.d.ts +1 -0
- package/lib/hooks/use-navigation.js +4 -1
- package/lib/hooks/use-navigation.js.map +1 -1
- package/lib/i18n/translations/en.json +52 -1
- package/lib/i18n/translations/fr.json +52 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/models/index.d.ts +2 -0
- package/lib/models/index.js +2 -0
- package/lib/models/index.js.map +1 -1
- package/lib/models/objectFields.js +3 -0
- package/lib/models/objectFields.js.map +1 -1
- package/lib/models/searchFields.d.ts +2 -0
- package/lib/{sessions/components/buttons/LoginButton.js → models/searchFields.js} +3 -6
- package/lib/models/searchFields.js.map +1 -0
- package/lib/models/sortFields.d.ts +2 -0
- package/lib/{sessions/components/buttons/UpdateButton.js → models/sortFields.js} +3 -6
- package/lib/models/sortFields.js.map +1 -0
- package/lib/navigator/drawer/Header.js +1 -1
- package/lib/navigator/drawer/Header.js.map +1 -1
- package/lib/screens/ErrorScreen.js +1 -1
- package/lib/screens/ErrorScreen.js.map +1 -1
- package/lib/screens/JsonFieldScreen.d.ts +4 -0
- package/lib/screens/JsonFieldScreen.js +92 -0
- package/lib/screens/JsonFieldScreen.js.map +1 -0
- package/lib/screens/index.d.ts +13 -0
- package/lib/screens/index.js +9 -0
- package/lib/screens/index.js.map +1 -1
- package/lib/sessions/components/alerts/PopupCreateSession.js +8 -16
- package/lib/sessions/components/alerts/PopupCreateSession.js.map +1 -1
- package/lib/sessions/components/alerts/PopupEditSession.js +8 -16
- package/lib/sessions/components/alerts/PopupEditSession.js.map +1 -1
- package/lib/sessions/components/alerts/PopupSession.js +7 -16
- package/lib/sessions/components/alerts/PopupSession.js.map +1 -1
- package/lib/sessions/components/index.d.ts +0 -1
- package/lib/sessions/components/index.js +0 -1
- package/lib/sessions/components/index.js.map +1 -1
- package/lib/sessions/components/inputs/SessionInputs.js +9 -7
- package/lib/sessions/components/inputs/SessionInputs.js.map +1 -1
- package/lib/types/anomaly-type.d.ts +16 -0
- package/lib/types/anomaly-type.js +56 -0
- package/lib/types/anomaly-type.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/utils/displayers.d.ts +1 -0
- package/lib/utils/displayers.js +1 -0
- package/lib/utils/displayers.js.map +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/lib/sessions/components/buttons/DisabledButton.d.ts +0 -7
- package/lib/sessions/components/buttons/DisabledButton.js +0 -45
- package/lib/sessions/components/buttons/DisabledButton.js.map +0 -1
- package/lib/sessions/components/buttons/LoginButton.d.ts +0 -6
- package/lib/sessions/components/buttons/LoginButton.js.map +0 -1
- package/lib/sessions/components/buttons/UpdateButton.d.ts +0 -6
- package/lib/sessions/components/buttons/UpdateButton.js.map +0 -1
- package/lib/sessions/components/buttons/index.d.ts +0 -3
- package/lib/sessions/components/buttons/index.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const searchUser: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
2
|
+
state?: unknown;
|
|
3
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction>;
|
|
4
|
+
extra?: unknown;
|
|
5
|
+
rejectValue?: unknown;
|
|
6
|
+
serializedErrorType?: unknown;
|
|
7
|
+
pendingMeta?: unknown;
|
|
8
|
+
fulfilledMeta?: unknown;
|
|
9
|
+
rejectedMeta?: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
export const userListReducer: import("redux").Reducer<{
|
|
12
|
+
loadingUser: boolean;
|
|
13
|
+
moreLoading: boolean;
|
|
14
|
+
isListEnd: boolean;
|
|
15
|
+
userList: any[];
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
19
|
+
import { generateInifiniteScrollCases, handlerApiCall, } from '../apiProviders/utils';
|
|
20
|
+
import { searchUser as _searchUser } from '../api/user-api';
|
|
21
|
+
export const searchUser = createAsyncThunk('user/searchUser', async function (data, { getState }) {
|
|
22
|
+
return handlerApiCall({
|
|
23
|
+
fetchFunction: _searchUser,
|
|
24
|
+
data,
|
|
25
|
+
action: 'Base_SliceAction_SearchUser',
|
|
26
|
+
getState,
|
|
27
|
+
responseOptions: { isArrayResponse: true },
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
const initialState = {
|
|
31
|
+
loadingUser: true,
|
|
32
|
+
moreLoading: false,
|
|
33
|
+
isListEnd: false,
|
|
34
|
+
userList: [],
|
|
35
|
+
};
|
|
36
|
+
const userSlice = createSlice({
|
|
37
|
+
name: 'user',
|
|
38
|
+
initialState,
|
|
39
|
+
extraReducers: builder => {
|
|
40
|
+
generateInifiniteScrollCases(builder, searchUser, {
|
|
41
|
+
loading: 'loadingUser',
|
|
42
|
+
moreLoading: 'moreLoading',
|
|
43
|
+
isListEnd: 'isListEnd',
|
|
44
|
+
list: 'userList',
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
export const userListReducer = userSlice.reducer;
|
|
49
|
+
//# sourceMappingURL=userSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userSlice.js","sourceRoot":"","sources":["../../src/features/userSlice.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,4BAA4B,EAC5B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,UAAU,IAAI,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE1D,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CACxC,iBAAiB,EACjB,KAAK,WAAW,IAAI,EAAE,EAAC,QAAQ,EAAC;IAC9B,OAAO,cAAc,CAAC;QACpB,aAAa,EAAE,WAAW;QAC1B,IAAI;QACJ,MAAM,EAAE,6BAA6B;QACrC,QAAQ;QACR,eAAe,EAAE,EAAC,eAAe,EAAE,IAAI,EAAC;KACzC,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,SAAS,GAAG,WAAW,CAAC;IAC5B,IAAI,EAAE,MAAM;IACZ,YAAY;IACZ,aAAa,EAAE,OAAO,CAAC,EAAE;QACvB,4BAA4B,CAAC,OAAO,EAAE,UAAU,EAAE;YAChD,OAAO,EAAE,aAAa;YACtB,WAAW,EAAE,aAAa;YAC1B,SAAS,EAAE,WAAW;YACtB,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Form, FormConfigs } from './types';
|
|
2
|
+
export interface RegisterOptions {
|
|
3
|
+
replaceOld?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare class FormConfigsProvider {
|
|
6
|
+
private formConfigs;
|
|
7
|
+
private refreshCallBack;
|
|
8
|
+
constructor();
|
|
9
|
+
register(callBack: any): void;
|
|
10
|
+
init(configs: FormConfigs): void;
|
|
11
|
+
private updateState;
|
|
12
|
+
getFormConfig(key: string): Form;
|
|
13
|
+
registerForm(key: string, options: Form, registerOptions: RegisterOptions): void;
|
|
14
|
+
getAllConfigs(): FormConfigs;
|
|
15
|
+
}
|
|
16
|
+
export declare const formConfigsProvider: FormConfigsProvider;
|
|
17
|
+
export declare const useFormConfig: (modelKey: string) => {
|
|
18
|
+
config: Form;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { useCallback, useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import { addModuleForms, fetchOptionsOfFormKey } from './register.helpers';
|
|
20
|
+
class FormConfigsProvider {
|
|
21
|
+
formConfigs;
|
|
22
|
+
refreshCallBack;
|
|
23
|
+
constructor() {
|
|
24
|
+
this.formConfigs = {};
|
|
25
|
+
this.refreshCallBack = () => { };
|
|
26
|
+
}
|
|
27
|
+
register(callBack) {
|
|
28
|
+
this.refreshCallBack = callBack;
|
|
29
|
+
}
|
|
30
|
+
init(configs) {
|
|
31
|
+
this.formConfigs = configs;
|
|
32
|
+
}
|
|
33
|
+
updateState() {
|
|
34
|
+
this.refreshCallBack(this.formConfigs);
|
|
35
|
+
}
|
|
36
|
+
getFormConfig(key) {
|
|
37
|
+
return fetchOptionsOfFormKey(this.formConfigs, key);
|
|
38
|
+
}
|
|
39
|
+
registerForm(key, options, registerOptions) {
|
|
40
|
+
this.formConfigs = addModuleForms({ ...this.formConfigs }, { [key]: options }, registerOptions);
|
|
41
|
+
this.updateState();
|
|
42
|
+
}
|
|
43
|
+
getAllConfigs() {
|
|
44
|
+
return this.formConfigs;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export const formConfigsProvider = new FormConfigsProvider();
|
|
48
|
+
export const useFormConfig = (modelKey) => {
|
|
49
|
+
const [forms, setForms] = useState(formConfigsProvider.getAllConfigs());
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
formConfigsProvider.register(setForms);
|
|
52
|
+
}, []);
|
|
53
|
+
const getFormConfigOfModel = useCallback(key => fetchOptionsOfFormKey(forms, key), [forms]);
|
|
54
|
+
return useMemo(() => ({ config: getFormConfigOfModel(modelKey) }), [getFormConfigOfModel, modelKey]);
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=FormConfigsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormConfigsProvider.js","sourceRoot":"","sources":["../../src/forms/FormConfigs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AAmB,CAAC,aAAa,EAAE,CAAC,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,oBAAoB,GAAG,WAAW,CACtC,GAAG,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,EACxC,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EAAC,CAAC,EAChD,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CACjC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function createRecord({ modelName, data, }: {
|
|
2
|
+
modelName: string;
|
|
3
|
+
data: any;
|
|
4
|
+
}): Promise<void>;
|
|
5
|
+
export declare function updateRecord({ modelName, data, }: {
|
|
6
|
+
modelName: string;
|
|
7
|
+
data: any;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
export declare function refreshRecord({ modelName, id, }: {
|
|
10
|
+
modelName: string;
|
|
11
|
+
id: number;
|
|
12
|
+
}): Promise<import("../apiProviders").RequestResponse>;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { getActionApi, getModelApi } from '../apiProviders';
|
|
19
|
+
const getMatcherFields = (data) => {
|
|
20
|
+
const fields = {};
|
|
21
|
+
Object.keys(data).forEach(key => {
|
|
22
|
+
fields[`data.${key}`] = key;
|
|
23
|
+
});
|
|
24
|
+
return fields;
|
|
25
|
+
};
|
|
26
|
+
export async function createRecord({ modelName, data, }) {
|
|
27
|
+
return getActionApi().send({
|
|
28
|
+
method: 'put',
|
|
29
|
+
url: `ws/rest/${modelName}`,
|
|
30
|
+
body: {
|
|
31
|
+
data,
|
|
32
|
+
},
|
|
33
|
+
description: `create new ${modelName}`,
|
|
34
|
+
matchers: {
|
|
35
|
+
modelName,
|
|
36
|
+
id: Date.now(),
|
|
37
|
+
fields: getMatcherFields(data),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export async function updateRecord({ modelName, data, }) {
|
|
42
|
+
return getActionApi().send({
|
|
43
|
+
method: 'post',
|
|
44
|
+
url: `ws/rest/${modelName}/${data?.id}`,
|
|
45
|
+
body: {
|
|
46
|
+
data,
|
|
47
|
+
},
|
|
48
|
+
description: `update ${modelName} with id ${data?.id}`,
|
|
49
|
+
matchers: {
|
|
50
|
+
modelName,
|
|
51
|
+
id: data?.id,
|
|
52
|
+
fields: getMatcherFields(data),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export async function refreshRecord({ modelName, id, }) {
|
|
57
|
+
return getModelApi().get({ modelName, id });
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=api.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.helpers.js","sourceRoot":"","sources":["../../src/forms/api.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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C,EAClC,SAAS,EACT,EAAE,GAIH;IACC,OAAO,WAAW,EAAE,CAAC,GAAG,CAAC,EAAC,SAAS,EAAE,EAAE,EAAC,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KeyboardType } from 'react-native';
|
|
2
|
+
import { Action, DisplayField, DisplayPanel, Form, Widget } from './types';
|
|
3
|
+
export declare const isField: (_object: DisplayPanel | DisplayField) => boolean;
|
|
4
|
+
export declare const getFields: (config: Form) => DisplayField[];
|
|
5
|
+
export declare const getPanels: (config: Form) => DisplayPanel[];
|
|
6
|
+
export declare const sortContent: (config: Form) => (DisplayPanel | DisplayField)[];
|
|
7
|
+
export declare const getWidget: (_field: DisplayField) => Widget;
|
|
8
|
+
export declare const getKeyboardType: (_field: DisplayField) => KeyboardType;
|
|
9
|
+
export declare const getButtonTitleKey: (_action: Action) => string;
|
|
@@ -0,0 +1,150 @@
|
|
|
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 { checkNullString } from '@axelor/aos-mobile-ui';
|
|
19
|
+
import { DEFAULT_COLSPAN, } from './types';
|
|
20
|
+
export const isField = (_object) => {
|
|
21
|
+
return _object.type != null;
|
|
22
|
+
};
|
|
23
|
+
export const getFields = (config) => {
|
|
24
|
+
return Object.entries(config.fields)
|
|
25
|
+
.map(([fieldName, _field], index) => ({
|
|
26
|
+
..._field,
|
|
27
|
+
key: fieldName,
|
|
28
|
+
order: _field.order != null ? _field.order : index * 10,
|
|
29
|
+
hideIf: _field.hideIf != null ? _field.hideIf : () => false,
|
|
30
|
+
requiredIf: _field.requiredIf != null ? _field.requiredIf : () => false,
|
|
31
|
+
readonlyIf: _field.readonlyIf != null ? _field.readonlyIf : () => false,
|
|
32
|
+
}))
|
|
33
|
+
.sort((a, b) => a.order - b.order);
|
|
34
|
+
};
|
|
35
|
+
export const getPanels = (config) => {
|
|
36
|
+
return Object.entries(config.panels)
|
|
37
|
+
.map(([panelKey, _panel], index) => ({
|
|
38
|
+
..._panel,
|
|
39
|
+
key: panelKey,
|
|
40
|
+
order: _panel.order != null ? _panel.order : index * 10,
|
|
41
|
+
}))
|
|
42
|
+
.sort((a, b) => a.order - b.order);
|
|
43
|
+
};
|
|
44
|
+
export const sortContent = (config) => {
|
|
45
|
+
if (config == null) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const fields = getFields(config);
|
|
49
|
+
if (config.panels == null || Object.keys(config.panels).length === 0) {
|
|
50
|
+
return fields;
|
|
51
|
+
}
|
|
52
|
+
const panels = getPanels(config);
|
|
53
|
+
const rootPanels = panels.filter(_item => checkNullString(_item.parent));
|
|
54
|
+
if (rootPanels.length === 0) {
|
|
55
|
+
return fields;
|
|
56
|
+
}
|
|
57
|
+
const result = fields.filter(_item => checkNullString(_item.parentPanel));
|
|
58
|
+
rootPanels.forEach(_panel => {
|
|
59
|
+
result.push({
|
|
60
|
+
..._panel,
|
|
61
|
+
content: getContentOfPanel(_panel.key, fields, panels),
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
return result.sort((a, b) => a.order - b.order);
|
|
65
|
+
};
|
|
66
|
+
const getContentOfPanel = (panelKey, fields, panels) => {
|
|
67
|
+
if (fields.length === 0) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
let result = fields.filter(_item => _item.parentPanel === panelKey);
|
|
71
|
+
if (panels.length === 0) {
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
panels
|
|
75
|
+
.filter(_item => _item.parent === panelKey)
|
|
76
|
+
.forEach(_item => {
|
|
77
|
+
result.push({
|
|
78
|
+
colSpan: DEFAULT_COLSPAN,
|
|
79
|
+
..._item,
|
|
80
|
+
content: getContentOfPanel(_item.key, fields.filter(_field => _field.parentPanel !== panelKey), panels.filter(_panel => _panel.parent !== panelKey)),
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return result.sort((a, b) => a.order - b.order);
|
|
84
|
+
};
|
|
85
|
+
export const getWidget = (_field) => {
|
|
86
|
+
if (_field.widget === 'custom' && _field.customComponent != null) {
|
|
87
|
+
return 'custom';
|
|
88
|
+
}
|
|
89
|
+
if (_field.widget === 'file') {
|
|
90
|
+
return 'file';
|
|
91
|
+
}
|
|
92
|
+
if (_field.widget === 'label' && _field.type === 'string') {
|
|
93
|
+
return 'label';
|
|
94
|
+
}
|
|
95
|
+
if (_field.type === 'boolean') {
|
|
96
|
+
return 'checkbox';
|
|
97
|
+
}
|
|
98
|
+
if (_field.widget === 'star' && _field.type === 'number') {
|
|
99
|
+
return 'star';
|
|
100
|
+
}
|
|
101
|
+
if (_field.widget === 'increment' || _field.type === 'number') {
|
|
102
|
+
return 'increment';
|
|
103
|
+
}
|
|
104
|
+
if (_field.type === 'date' ||
|
|
105
|
+
_field.type === 'datetime' ||
|
|
106
|
+
_field.type === 'time') {
|
|
107
|
+
return 'date';
|
|
108
|
+
}
|
|
109
|
+
if (_field.widget === 'password' && _field.type === 'string') {
|
|
110
|
+
return 'password';
|
|
111
|
+
}
|
|
112
|
+
if (_field.widget === 'HTML' && _field.type === 'string') {
|
|
113
|
+
return 'HTML';
|
|
114
|
+
}
|
|
115
|
+
return 'default';
|
|
116
|
+
};
|
|
117
|
+
export const getKeyboardType = (_field) => {
|
|
118
|
+
switch (_field.type) {
|
|
119
|
+
case 'number':
|
|
120
|
+
if (_field.validationOptions != null &&
|
|
121
|
+
Object.keys(_field.validationOptions).includes('integer')) {
|
|
122
|
+
return 'number-pad';
|
|
123
|
+
}
|
|
124
|
+
return 'decimal-pad';
|
|
125
|
+
case 'phone':
|
|
126
|
+
return 'phone-pad';
|
|
127
|
+
case 'email':
|
|
128
|
+
return 'email-address';
|
|
129
|
+
default:
|
|
130
|
+
return 'default';
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
export const getButtonTitleKey = (_action) => {
|
|
134
|
+
if (_action.titleKey != null) {
|
|
135
|
+
return _action.titleKey;
|
|
136
|
+
}
|
|
137
|
+
switch (_action.type) {
|
|
138
|
+
case 'create':
|
|
139
|
+
return 'Base_FormAction_Create';
|
|
140
|
+
case 'update':
|
|
141
|
+
return 'Base_FormAction_Update';
|
|
142
|
+
case 'refresh':
|
|
143
|
+
return 'Base_FormAction_Refresh';
|
|
144
|
+
case 'reset':
|
|
145
|
+
return 'Base_FormAction_Reset';
|
|
146
|
+
default:
|
|
147
|
+
return 'Base_FormAction_Save';
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=display.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.helpers.js","sourceRoot":"","sources":["../../src/forms/display.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAEL,eAAe,GAKhB,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAoC,EAAW,EAAE;IACvE,OAAQ,OAAe,CAAC,IAAI,IAAI,IAAI,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAY,EAAkB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AAC;KACpB;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAU,EAAE;IAC3D,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;QAC5B,OAAO,OAAO,CAAC,QAAQ,CAAC;KACzB;IAED,QAAQ,OAAO,CAAC,IAAI,EAAE;QACpB,KAAK,QAAQ;YACX,OAAO,wBAAwB,CAAC;QAClC,KAAK,QAAQ;YACX,OAAO,wBAAwB,CAAC;QAClC,KAAK,SAAS;YACZ,OAAO,yBAAyB,CAAC;QACnC,KAAK,OAAO;YACV,OAAO,uBAAuB,CAAC;QACjC;YACE,OAAO,sBAAsB,CAAC;KACjC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 * from './studio';
|
|
19
|
+
export * from './api.helpers';
|
|
20
|
+
export * from './display.helpers';
|
|
21
|
+
export * from './FormConfigsProvider';
|
|
22
|
+
export * from './register.helpers';
|
|
23
|
+
export * from './types';
|
|
24
|
+
export * from './validation.helpers';
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Field, Form, FormConfigs, JSONObject, Panel } from './types';
|
|
2
|
+
import { RegisterOptions } from './FormConfigsProvider';
|
|
3
|
+
export declare const mergePanels: (currentPanels: JSONObject<Panel>, newPanels: JSONObject<Panel>) => JSONObject<Panel>;
|
|
4
|
+
export declare const mergeFields: (currentFields: JSONObject<Field>, newFields: JSONObject<Field>) => JSONObject<Field>;
|
|
5
|
+
export declare const addModuleForms: (forms: FormConfigs, _moduleForms: FormConfigs, registerOptions?: RegisterOptions) => FormConfigs;
|
|
6
|
+
export declare const fetchOptionsOfFormKey: (forms: FormConfigs, key: string) => Form;
|
|
@@ -0,0 +1,96 @@
|
|
|
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 { checkNullString } from '@axelor/aos-mobile-ui';
|
|
19
|
+
export const mergePanels = (currentPanels, newPanels) => {
|
|
20
|
+
if (newPanels == null || Object.keys(newPanels).length === 0) {
|
|
21
|
+
return currentPanels;
|
|
22
|
+
}
|
|
23
|
+
if (currentPanels == null || Object.keys(currentPanels).length === 0) {
|
|
24
|
+
return newPanels;
|
|
25
|
+
}
|
|
26
|
+
const resultPanels = { ...currentPanels };
|
|
27
|
+
Object.entries(newPanels).forEach(([panelKey, _panel]) => {
|
|
28
|
+
if (!Object.keys(resultPanels).includes(panelKey)) {
|
|
29
|
+
resultPanels[panelKey] = _panel;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const oldPanel = { ...resultPanels[panelKey] };
|
|
33
|
+
resultPanels[panelKey] = {
|
|
34
|
+
...oldPanel,
|
|
35
|
+
..._panel,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return resultPanels;
|
|
40
|
+
};
|
|
41
|
+
export const mergeFields = (currentFields, newFields) => {
|
|
42
|
+
if (newFields == null || Object.keys(newFields).length === 0) {
|
|
43
|
+
return currentFields;
|
|
44
|
+
}
|
|
45
|
+
if (currentFields == null || Object.keys(currentFields).length === 0) {
|
|
46
|
+
return newFields;
|
|
47
|
+
}
|
|
48
|
+
const resultFields = { ...currentFields };
|
|
49
|
+
Object.entries(newFields).forEach(([fieldKey, _field]) => {
|
|
50
|
+
if (!Object.keys(resultFields).includes(fieldKey)) {
|
|
51
|
+
resultFields[fieldKey] = _field;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const oldFields = { ...resultFields[fieldKey] };
|
|
55
|
+
resultFields[fieldKey] = {
|
|
56
|
+
...oldFields,
|
|
57
|
+
..._field,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return resultFields;
|
|
62
|
+
};
|
|
63
|
+
export const addModuleForms = (forms, _moduleForms, registerOptions) => {
|
|
64
|
+
if (_moduleForms == null || Object.keys(_moduleForms).length === 0) {
|
|
65
|
+
return forms;
|
|
66
|
+
}
|
|
67
|
+
if (forms == null || Object.keys(forms).length === 0) {
|
|
68
|
+
return _moduleForms;
|
|
69
|
+
}
|
|
70
|
+
let result = { ...forms };
|
|
71
|
+
for (const [key, config] of Object.entries(_moduleForms)) {
|
|
72
|
+
if (!Object.keys(result).includes(key) || registerOptions?.replaceOld) {
|
|
73
|
+
result[key] = config;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const oldOptions = { ...result[key] };
|
|
77
|
+
result[key] = {
|
|
78
|
+
...oldOptions,
|
|
79
|
+
...config,
|
|
80
|
+
panels: mergePanels(oldOptions.panels, config.panels),
|
|
81
|
+
fields: mergeFields(oldOptions.fields, config.fields),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
export const fetchOptionsOfFormKey = (forms = {}, key) => {
|
|
88
|
+
if (checkNullString(key)) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
if (!Object.keys(forms).includes(key)) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return forms[key];
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=register.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.helpers.js","sourceRoot":"","sources":["../../src/forms/register.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAItD,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,aAAgC,EAChC,SAA4B,EAC5B,EAAE;IACF,IAAI,SAAS,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5D,OAAO,aAAa,CAAC;KACtB;IAED,IAAI,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EAAE,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;aACtD,CAAC;SACH;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAAqB,EAAE,EACvB,GAAW,EACL,EAAE;IACR,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare function fetchJsonFieldsOfModel({ modelName }: {
|
|
2
|
+
modelName: string;
|
|
3
|
+
}): Promise<any>;
|
|
4
|
+
export declare function fetchObject({ modelName, id, }: {
|
|
5
|
+
modelName: string;
|
|
6
|
+
id: number;
|
|
7
|
+
}): Promise<any>;
|
|
8
|
+
export declare function updateJsonFieldsObject({ modelName, id, version, values, }: {
|
|
9
|
+
modelName: string;
|
|
10
|
+
id: number;
|
|
11
|
+
version: number;
|
|
12
|
+
values: any;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
export declare function fetchData({ modelName, domain, searchValue, page, searchFields, }: {
|
|
15
|
+
modelName: string;
|
|
16
|
+
domain?: string;
|
|
17
|
+
searchValue?: string;
|
|
18
|
+
page?: number;
|
|
19
|
+
searchFields?: string[];
|
|
20
|
+
}): Promise<any>;
|
|
21
|
+
export declare function fetchMetaConfig({ modelName, }: {
|
|
22
|
+
modelName: string;
|
|
23
|
+
}): Promise<any>;
|
|
24
|
+
export declare function fetchModelFields({ modelName, }: {
|
|
25
|
+
modelName: string;
|
|
26
|
+
}): Promise<string[]>;
|
|
27
|
+
interface SelectionItem {
|
|
28
|
+
name: string;
|
|
29
|
+
id: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function fetchSelectionOptions({ modelName, attrsPanelName, fieldName, }: {
|
|
32
|
+
modelName: string;
|
|
33
|
+
attrsPanelName: string;
|
|
34
|
+
fieldName: string;
|
|
35
|
+
}): Promise<SelectionItem[]>;
|
|
36
|
+
export declare function executeButtonAction(actions: string, model: string, object: any): Promise<any>;
|
|
37
|
+
export {};
|