@fctc/interface-logic 2.0.4 → 2.0.6
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/dist/configs.d.mts +6 -6
- package/dist/configs.d.ts +6 -6
- package/dist/configs.js +40 -15
- package/dist/configs.mjs +40 -15
- package/dist/environment.js +40 -15
- package/dist/environment.mjs +40 -15
- package/dist/hooks.d.mts +15 -5
- package/dist/hooks.d.ts +15 -5
- package/dist/hooks.js +182 -187
- package/dist/hooks.mjs +182 -187
- package/dist/provider.d.mts +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +222 -202
- package/dist/provider.mjs +222 -202
- package/dist/services.d.mts +23 -16
- package/dist/services.d.ts +23 -16
- package/dist/services.js +141 -162
- package/dist/services.mjs +141 -162
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{view-type-BGJfDe73.d.mts → view-type-p4JdAOsz.d.mts} +5 -0
- package/dist/{view-type-BGJfDe73.d.ts → view-type-p4JdAOsz.d.ts} +5 -0
- package/package.json +85 -85
package/dist/provider.js
CHANGED
|
@@ -2891,15 +2891,21 @@ function useActionService() {
|
|
|
2891
2891
|
const loadAction = (0, import_react2.useCallback)(
|
|
2892
2892
|
async ({
|
|
2893
2893
|
idAction,
|
|
2894
|
-
context
|
|
2894
|
+
context,
|
|
2895
|
+
service
|
|
2895
2896
|
}) => {
|
|
2896
2897
|
const jsonData = {
|
|
2897
2898
|
action_id: idAction,
|
|
2898
2899
|
with_context: { ...context }
|
|
2899
2900
|
};
|
|
2900
|
-
return env.requests.post(
|
|
2901
|
-
|
|
2902
|
-
|
|
2901
|
+
return env.requests.post(
|
|
2902
|
+
"/load_action" /* LOAD_ACTION */,
|
|
2903
|
+
jsonData,
|
|
2904
|
+
{
|
|
2905
|
+
headers: { "Content-Type": "application/json" }
|
|
2906
|
+
},
|
|
2907
|
+
service
|
|
2908
|
+
);
|
|
2903
2909
|
},
|
|
2904
2910
|
[env]
|
|
2905
2911
|
);
|
|
@@ -2908,7 +2914,8 @@ function useActionService() {
|
|
|
2908
2914
|
model,
|
|
2909
2915
|
ids = [],
|
|
2910
2916
|
context,
|
|
2911
|
-
method
|
|
2917
|
+
method,
|
|
2918
|
+
service
|
|
2912
2919
|
}) => {
|
|
2913
2920
|
try {
|
|
2914
2921
|
const jsonData = {
|
|
@@ -2917,9 +2924,14 @@ function useActionService() {
|
|
|
2917
2924
|
ids,
|
|
2918
2925
|
with_context: context
|
|
2919
2926
|
};
|
|
2920
|
-
return env.requests.post(
|
|
2921
|
-
|
|
2922
|
-
|
|
2927
|
+
return env.requests.post(
|
|
2928
|
+
"/call" /* CALL_PATH */,
|
|
2929
|
+
jsonData,
|
|
2930
|
+
{
|
|
2931
|
+
headers: { "Content-Type": "application/json" }
|
|
2932
|
+
},
|
|
2933
|
+
service
|
|
2934
|
+
);
|
|
2923
2935
|
} catch (error) {
|
|
2924
2936
|
console.error("Error when calling button action:", error);
|
|
2925
2937
|
throw error;
|
|
@@ -2931,7 +2943,8 @@ function useActionService() {
|
|
|
2931
2943
|
async ({
|
|
2932
2944
|
model,
|
|
2933
2945
|
ids,
|
|
2934
|
-
context
|
|
2946
|
+
context,
|
|
2947
|
+
service
|
|
2935
2948
|
}) => {
|
|
2936
2949
|
const jsonData = {
|
|
2937
2950
|
model,
|
|
@@ -2939,9 +2952,14 @@ function useActionService() {
|
|
|
2939
2952
|
ids,
|
|
2940
2953
|
with_context: context
|
|
2941
2954
|
};
|
|
2942
|
-
return env.requests.post(
|
|
2943
|
-
|
|
2944
|
-
|
|
2955
|
+
return env.requests.post(
|
|
2956
|
+
"/call" /* CALL_PATH */,
|
|
2957
|
+
jsonData,
|
|
2958
|
+
{
|
|
2959
|
+
headers: { "Content-Type": "application/json" }
|
|
2960
|
+
},
|
|
2961
|
+
service
|
|
2962
|
+
);
|
|
2945
2963
|
},
|
|
2946
2964
|
[env]
|
|
2947
2965
|
);
|
|
@@ -2949,7 +2967,8 @@ function useActionService() {
|
|
|
2949
2967
|
async ({
|
|
2950
2968
|
model,
|
|
2951
2969
|
id,
|
|
2952
|
-
context
|
|
2970
|
+
context,
|
|
2971
|
+
service
|
|
2953
2972
|
}) => {
|
|
2954
2973
|
const jsonData = {
|
|
2955
2974
|
model,
|
|
@@ -2957,9 +2976,14 @@ function useActionService() {
|
|
|
2957
2976
|
ids: id,
|
|
2958
2977
|
with_context: context
|
|
2959
2978
|
};
|
|
2960
|
-
return env.requests.post(
|
|
2961
|
-
|
|
2962
|
-
|
|
2979
|
+
return env.requests.post(
|
|
2980
|
+
"/call" /* CALL_PATH */,
|
|
2981
|
+
jsonData,
|
|
2982
|
+
{
|
|
2983
|
+
headers: { "Content-Type": "application/json" }
|
|
2984
|
+
},
|
|
2985
|
+
service
|
|
2986
|
+
);
|
|
2963
2987
|
},
|
|
2964
2988
|
[env]
|
|
2965
2989
|
);
|
|
@@ -3002,15 +3026,21 @@ function useActionService() {
|
|
|
3002
3026
|
const runAction = (0, import_react2.useCallback)(
|
|
3003
3027
|
async ({
|
|
3004
3028
|
idAction,
|
|
3005
|
-
context
|
|
3029
|
+
context,
|
|
3030
|
+
service
|
|
3006
3031
|
}) => {
|
|
3007
3032
|
const jsonData = {
|
|
3008
3033
|
action_id: idAction,
|
|
3009
3034
|
with_context: { ...context }
|
|
3010
3035
|
};
|
|
3011
|
-
return env.requests.post(
|
|
3012
|
-
|
|
3013
|
-
|
|
3036
|
+
return env.requests.post(
|
|
3037
|
+
"/run_action" /* RUN_ACTION_PATH */,
|
|
3038
|
+
jsonData,
|
|
3039
|
+
{
|
|
3040
|
+
headers: { "Content-Type": "application/json" }
|
|
3041
|
+
},
|
|
3042
|
+
service
|
|
3043
|
+
);
|
|
3014
3044
|
},
|
|
3015
3045
|
[env]
|
|
3016
3046
|
);
|
|
@@ -3291,11 +3321,7 @@ function useExcelService() {
|
|
|
3291
3321
|
const { env } = useEnv();
|
|
3292
3322
|
const uploadFile = (0, import_react5.useCallback)(
|
|
3293
3323
|
async ({ formData }) => {
|
|
3294
|
-
return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData
|
|
3295
|
-
headers: {
|
|
3296
|
-
"Content-Type": "multipart/form-data"
|
|
3297
|
-
}
|
|
3298
|
-
});
|
|
3324
|
+
return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData);
|
|
3299
3325
|
},
|
|
3300
3326
|
[env]
|
|
3301
3327
|
);
|
|
@@ -3539,12 +3565,8 @@ function useFormService() {
|
|
|
3539
3565
|
[env]
|
|
3540
3566
|
);
|
|
3541
3567
|
const uploadImage = (0, import_react6.useCallback)(
|
|
3542
|
-
async ({
|
|
3543
|
-
return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */,
|
|
3544
|
-
headers: {
|
|
3545
|
-
"Content-Type": "multipart/form-data"
|
|
3546
|
-
}
|
|
3547
|
-
});
|
|
3568
|
+
async ({ formData }) => {
|
|
3569
|
+
return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, formData);
|
|
3548
3570
|
},
|
|
3549
3571
|
[env]
|
|
3550
3572
|
);
|
|
@@ -3733,7 +3755,7 @@ function useModelService() {
|
|
|
3733
3755
|
});
|
|
3734
3756
|
}, [env]);
|
|
3735
3757
|
const getAll = (0, import_react8.useCallback)(
|
|
3736
|
-
async ({ data }) => {
|
|
3758
|
+
async ({ data, service }) => {
|
|
3737
3759
|
const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
3738
3760
|
fields: data.fields,
|
|
3739
3761
|
groupby: data.groupby
|
|
@@ -3754,11 +3776,16 @@ function useModelService() {
|
|
|
3754
3776
|
...jsonReadGroup
|
|
3755
3777
|
}
|
|
3756
3778
|
};
|
|
3757
|
-
return env.requests.post(
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3779
|
+
return env.requests.post(
|
|
3780
|
+
"/call" /* CALL_PATH */,
|
|
3781
|
+
jsonData,
|
|
3782
|
+
{
|
|
3783
|
+
headers: {
|
|
3784
|
+
"Content-Type": "application/json"
|
|
3785
|
+
}
|
|
3786
|
+
},
|
|
3787
|
+
service
|
|
3788
|
+
);
|
|
3762
3789
|
},
|
|
3763
3790
|
[env]
|
|
3764
3791
|
);
|
|
@@ -3826,7 +3853,13 @@ function useModelService() {
|
|
|
3826
3853
|
[env]
|
|
3827
3854
|
);
|
|
3828
3855
|
const getDetail = (0, import_react8.useCallback)(
|
|
3829
|
-
async ({
|
|
3856
|
+
async ({
|
|
3857
|
+
ids = [],
|
|
3858
|
+
model,
|
|
3859
|
+
specification,
|
|
3860
|
+
context,
|
|
3861
|
+
service
|
|
3862
|
+
}) => {
|
|
3830
3863
|
const jsonData = {
|
|
3831
3864
|
model,
|
|
3832
3865
|
method: "web_read" /* WEB_READ */,
|
|
@@ -3836,11 +3869,16 @@ function useModelService() {
|
|
|
3836
3869
|
specification
|
|
3837
3870
|
}
|
|
3838
3871
|
};
|
|
3839
|
-
return env.requests.post(
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3872
|
+
return env.requests.post(
|
|
3873
|
+
"/call" /* CALL_PATH */,
|
|
3874
|
+
jsonData,
|
|
3875
|
+
{
|
|
3876
|
+
headers: {
|
|
3877
|
+
"Content-Type": "application/json"
|
|
3878
|
+
}
|
|
3879
|
+
},
|
|
3880
|
+
service
|
|
3881
|
+
);
|
|
3844
3882
|
},
|
|
3845
3883
|
[env]
|
|
3846
3884
|
);
|
|
@@ -3851,7 +3889,8 @@ function useModelService() {
|
|
|
3851
3889
|
data = {},
|
|
3852
3890
|
specification = {},
|
|
3853
3891
|
context = {},
|
|
3854
|
-
path
|
|
3892
|
+
path,
|
|
3893
|
+
service
|
|
3855
3894
|
}) => {
|
|
3856
3895
|
const jsonData = {
|
|
3857
3896
|
model,
|
|
@@ -3863,26 +3902,36 @@ function useModelService() {
|
|
|
3863
3902
|
specification
|
|
3864
3903
|
}
|
|
3865
3904
|
};
|
|
3866
|
-
return env.requests.post(
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3905
|
+
return env.requests.post(
|
|
3906
|
+
path ?? "/call" /* CALL_PATH */,
|
|
3907
|
+
jsonData,
|
|
3908
|
+
{
|
|
3909
|
+
headers: {
|
|
3910
|
+
"Content-Type": "application/json"
|
|
3911
|
+
}
|
|
3912
|
+
},
|
|
3913
|
+
service
|
|
3914
|
+
);
|
|
3871
3915
|
},
|
|
3872
3916
|
[env]
|
|
3873
3917
|
);
|
|
3874
3918
|
const deleteApi = (0, import_react8.useCallback)(
|
|
3875
|
-
async ({ ids = [], model }) => {
|
|
3919
|
+
async ({ ids = [], model, service }) => {
|
|
3876
3920
|
const jsonData = {
|
|
3877
3921
|
model,
|
|
3878
3922
|
method: "unlink" /* UNLINK */,
|
|
3879
3923
|
ids
|
|
3880
3924
|
};
|
|
3881
|
-
return env.requests.post(
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3925
|
+
return env.requests.post(
|
|
3926
|
+
"/call" /* CALL_PATH */,
|
|
3927
|
+
jsonData,
|
|
3928
|
+
{
|
|
3929
|
+
headers: {
|
|
3930
|
+
"Content-Type": "application/json"
|
|
3931
|
+
}
|
|
3932
|
+
},
|
|
3933
|
+
service
|
|
3934
|
+
);
|
|
3886
3935
|
},
|
|
3887
3936
|
[env]
|
|
3888
3937
|
);
|
|
@@ -3893,7 +3942,8 @@ function useModelService() {
|
|
|
3893
3942
|
object,
|
|
3894
3943
|
specification,
|
|
3895
3944
|
context,
|
|
3896
|
-
fieldChange
|
|
3945
|
+
fieldChange,
|
|
3946
|
+
service
|
|
3897
3947
|
}) => {
|
|
3898
3948
|
const jsonData = {
|
|
3899
3949
|
model,
|
|
@@ -3906,11 +3956,16 @@ function useModelService() {
|
|
|
3906
3956
|
specification
|
|
3907
3957
|
]
|
|
3908
3958
|
};
|
|
3909
|
-
return env.requests.post(
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3959
|
+
return env.requests.post(
|
|
3960
|
+
"/call" /* CALL_PATH */,
|
|
3961
|
+
jsonData,
|
|
3962
|
+
{
|
|
3963
|
+
headers: {
|
|
3964
|
+
"Content-Type": "application/json"
|
|
3965
|
+
}
|
|
3966
|
+
},
|
|
3967
|
+
service
|
|
3968
|
+
);
|
|
3914
3969
|
},
|
|
3915
3970
|
[env]
|
|
3916
3971
|
);
|
|
@@ -4084,7 +4139,8 @@ function useViewService() {
|
|
|
4084
4139
|
views,
|
|
4085
4140
|
context = {},
|
|
4086
4141
|
options = {},
|
|
4087
|
-
aid
|
|
4142
|
+
aid,
|
|
4143
|
+
service
|
|
4088
4144
|
}) => {
|
|
4089
4145
|
const defaultOptions = {
|
|
4090
4146
|
load_filters: true,
|
|
@@ -4100,110 +4156,28 @@ function useViewService() {
|
|
|
4100
4156
|
},
|
|
4101
4157
|
with_context: context
|
|
4102
4158
|
};
|
|
4103
|
-
return env?.requests?.post(
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4159
|
+
return env?.requests?.post(
|
|
4160
|
+
"/call" /* CALL_PATH */,
|
|
4161
|
+
jsonDataView,
|
|
4162
|
+
{
|
|
4163
|
+
headers: {
|
|
4164
|
+
"Content-Type": "application/json"
|
|
4165
|
+
}
|
|
4166
|
+
},
|
|
4167
|
+
service
|
|
4168
|
+
);
|
|
4108
4169
|
},
|
|
4109
4170
|
[env]
|
|
4110
4171
|
);
|
|
4111
4172
|
const getMenu = (0, import_react10.useCallback)(
|
|
4112
|
-
async (context) => {
|
|
4173
|
+
async (context, specification) => {
|
|
4113
4174
|
const jsonData = {
|
|
4114
4175
|
model: "ir.ui.menu" /* MENU */,
|
|
4115
4176
|
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
4116
4177
|
ids: [],
|
|
4117
4178
|
with_context: context,
|
|
4118
4179
|
kwargs: {
|
|
4119
|
-
specification
|
|
4120
|
-
active: {},
|
|
4121
|
-
name: {},
|
|
4122
|
-
is_display: {},
|
|
4123
|
-
sequence: {},
|
|
4124
|
-
complete_name: {},
|
|
4125
|
-
action: {
|
|
4126
|
-
fields: {
|
|
4127
|
-
display_name: {},
|
|
4128
|
-
type: {},
|
|
4129
|
-
binding_view_types: {}
|
|
4130
|
-
}
|
|
4131
|
-
},
|
|
4132
|
-
url_icon: {},
|
|
4133
|
-
web_icon: {},
|
|
4134
|
-
web_icon_data: {},
|
|
4135
|
-
groups_id: {
|
|
4136
|
-
fields: {
|
|
4137
|
-
full_name: {}
|
|
4138
|
-
},
|
|
4139
|
-
limit: 40,
|
|
4140
|
-
order: ""
|
|
4141
|
-
},
|
|
4142
|
-
display_name: {},
|
|
4143
|
-
child_id: {
|
|
4144
|
-
fields: {
|
|
4145
|
-
active: {},
|
|
4146
|
-
name: {},
|
|
4147
|
-
is_display: {},
|
|
4148
|
-
sequence: {},
|
|
4149
|
-
complete_name: {},
|
|
4150
|
-
action: {
|
|
4151
|
-
fields: {
|
|
4152
|
-
display_name: {},
|
|
4153
|
-
type: {},
|
|
4154
|
-
binding_view_types: {}
|
|
4155
|
-
}
|
|
4156
|
-
},
|
|
4157
|
-
url_icon: {},
|
|
4158
|
-
web_icon: {},
|
|
4159
|
-
web_icon_data: {},
|
|
4160
|
-
groups_id: {
|
|
4161
|
-
fields: {
|
|
4162
|
-
full_name: {}
|
|
4163
|
-
},
|
|
4164
|
-
limit: 40,
|
|
4165
|
-
order: ""
|
|
4166
|
-
},
|
|
4167
|
-
display_name: {},
|
|
4168
|
-
child_id: {
|
|
4169
|
-
fields: {
|
|
4170
|
-
active: {},
|
|
4171
|
-
name: {},
|
|
4172
|
-
is_display: {},
|
|
4173
|
-
sequence: {},
|
|
4174
|
-
complete_name: {},
|
|
4175
|
-
action: {
|
|
4176
|
-
fields: {
|
|
4177
|
-
display_name: {},
|
|
4178
|
-
type: {},
|
|
4179
|
-
binding_view_types: {}
|
|
4180
|
-
}
|
|
4181
|
-
},
|
|
4182
|
-
url_icon: {},
|
|
4183
|
-
web_icon: {},
|
|
4184
|
-
web_icon_data: {},
|
|
4185
|
-
groups_id: {
|
|
4186
|
-
fields: {
|
|
4187
|
-
full_name: {}
|
|
4188
|
-
},
|
|
4189
|
-
limit: 40,
|
|
4190
|
-
order: ""
|
|
4191
|
-
},
|
|
4192
|
-
display_name: {},
|
|
4193
|
-
child_id: {
|
|
4194
|
-
fields: {},
|
|
4195
|
-
limit: 40,
|
|
4196
|
-
order: ""
|
|
4197
|
-
}
|
|
4198
|
-
},
|
|
4199
|
-
limit: 40,
|
|
4200
|
-
order: ""
|
|
4201
|
-
}
|
|
4202
|
-
},
|
|
4203
|
-
limit: 40,
|
|
4204
|
-
order: ""
|
|
4205
|
-
}
|
|
4206
|
-
},
|
|
4180
|
+
specification,
|
|
4207
4181
|
domain: [
|
|
4208
4182
|
"&",
|
|
4209
4183
|
["is_display", "=", true],
|
|
@@ -4274,7 +4248,7 @@ function useViewService() {
|
|
|
4274
4248
|
[env]
|
|
4275
4249
|
);
|
|
4276
4250
|
const getSelectionItem = (0, import_react10.useCallback)(
|
|
4277
|
-
async ({ data }) => {
|
|
4251
|
+
async ({ data, service }) => {
|
|
4278
4252
|
const jsonData = {
|
|
4279
4253
|
model: data.model,
|
|
4280
4254
|
ids: [],
|
|
@@ -4292,11 +4266,16 @@ function useViewService() {
|
|
|
4292
4266
|
}
|
|
4293
4267
|
}
|
|
4294
4268
|
};
|
|
4295
|
-
return env?.requests.post(
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4269
|
+
return env?.requests.post(
|
|
4270
|
+
"/call" /* CALL_PATH */,
|
|
4271
|
+
jsonData,
|
|
4272
|
+
{
|
|
4273
|
+
headers: {
|
|
4274
|
+
"Content-Type": "application/json"
|
|
4275
|
+
}
|
|
4276
|
+
},
|
|
4277
|
+
service
|
|
4278
|
+
);
|
|
4300
4279
|
},
|
|
4301
4280
|
[env]
|
|
4302
4281
|
);
|
|
@@ -4589,7 +4568,6 @@ var sessionStorageUtils = () => {
|
|
|
4589
4568
|
// src/configs/axios-client.ts
|
|
4590
4569
|
var axiosClient = {
|
|
4591
4570
|
init(config) {
|
|
4592
|
-
console.log("config", config);
|
|
4593
4571
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
4594
4572
|
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
4595
4573
|
const db = config?.db;
|
|
@@ -4608,7 +4586,7 @@ var axiosClient = {
|
|
|
4608
4586
|
};
|
|
4609
4587
|
const instance = import_axios.default.create({
|
|
4610
4588
|
adapter: import_axios.default.defaults.adapter,
|
|
4611
|
-
baseURL: config
|
|
4589
|
+
baseURL: config?.baseUrl,
|
|
4612
4590
|
timeout: 5e4,
|
|
4613
4591
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
4614
4592
|
});
|
|
@@ -4620,7 +4598,6 @@ var axiosClient = {
|
|
|
4620
4598
|
if (database) {
|
|
4621
4599
|
config2.headers["DATABASE"] = database;
|
|
4622
4600
|
}
|
|
4623
|
-
console.log("database", database);
|
|
4624
4601
|
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
4625
4602
|
const token = await getToken?.();
|
|
4626
4603
|
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
@@ -4678,7 +4655,7 @@ var axiosClient = {
|
|
|
4678
4655
|
);
|
|
4679
4656
|
return new Promise(function(resolve) {
|
|
4680
4657
|
import_axios.default.post(
|
|
4681
|
-
`${config
|
|
4658
|
+
`${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
4682
4659
|
payload,
|
|
4683
4660
|
{
|
|
4684
4661
|
headers: {
|
|
@@ -4746,20 +4723,47 @@ var axiosClient = {
|
|
|
4746
4723
|
function formatUrl(url, db2) {
|
|
4747
4724
|
return url + (db2 ? "?db=" + db2 : "");
|
|
4748
4725
|
}
|
|
4726
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
4727
|
+
const service = serviceName || config?.default_service;
|
|
4728
|
+
return `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
4729
|
+
};
|
|
4749
4730
|
const responseBody = (response) => response;
|
|
4750
4731
|
const requests = {
|
|
4751
|
-
get: (url, headers) => instance.get(
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4732
|
+
get: (url, headers, serviceName) => instance.get(
|
|
4733
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
4734
|
+
headers
|
|
4735
|
+
).then(responseBody),
|
|
4736
|
+
post: (url, body, headers, serviceName) => instance.post(
|
|
4737
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
4738
|
+
body,
|
|
4739
|
+
headers
|
|
4740
|
+
).then(responseBody),
|
|
4741
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
4742
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
4743
|
+
body,
|
|
4744
|
+
{
|
|
4745
|
+
responseType: "arraybuffer",
|
|
4746
|
+
headers: {
|
|
4747
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
4748
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
4749
|
+
...headers
|
|
4750
|
+
}
|
|
4758
4751
|
}
|
|
4759
|
-
|
|
4760
|
-
put: (url, body, headers) => instance.put(
|
|
4761
|
-
|
|
4762
|
-
|
|
4752
|
+
).then(responseBody),
|
|
4753
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
4754
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
4755
|
+
body,
|
|
4756
|
+
headers
|
|
4757
|
+
).then(responseBody),
|
|
4758
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
4759
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
4760
|
+
body,
|
|
4761
|
+
headers
|
|
4762
|
+
).then(responseBody),
|
|
4763
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
4764
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
4765
|
+
headers
|
|
4766
|
+
).then(responseBody)
|
|
4763
4767
|
};
|
|
4764
4768
|
return requests;
|
|
4765
4769
|
}
|
|
@@ -5343,8 +5347,8 @@ var import_react_query31 = require("@tanstack/react-query");
|
|
|
5343
5347
|
var useUploadImage = () => {
|
|
5344
5348
|
const { uploadImage } = useFormService();
|
|
5345
5349
|
return (0, import_react_query31.useMutation)({
|
|
5346
|
-
mutationFn: ({
|
|
5347
|
-
|
|
5350
|
+
mutationFn: ({ formData }) => uploadImage({
|
|
5351
|
+
formData
|
|
5348
5352
|
})
|
|
5349
5353
|
});
|
|
5350
5354
|
};
|
|
@@ -5355,7 +5359,7 @@ var import_react_query32 = require("@tanstack/react-query");
|
|
|
5355
5359
|
var useDelete = () => {
|
|
5356
5360
|
const { deleteApi } = useModelService();
|
|
5357
5361
|
return (0, import_react_query32.useMutation)({
|
|
5358
|
-
mutationFn: ({ ids, model }) => deleteApi({ ids, model })
|
|
5362
|
+
mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
|
|
5359
5363
|
});
|
|
5360
5364
|
};
|
|
5361
5365
|
var use_delete_default = useDelete;
|
|
@@ -5418,12 +5422,14 @@ var useGetDetail = () => {
|
|
|
5418
5422
|
model,
|
|
5419
5423
|
ids,
|
|
5420
5424
|
specification,
|
|
5421
|
-
context
|
|
5425
|
+
context,
|
|
5426
|
+
service
|
|
5422
5427
|
}) => getDetail({
|
|
5423
5428
|
model,
|
|
5424
5429
|
ids,
|
|
5425
5430
|
specification,
|
|
5426
|
-
context
|
|
5431
|
+
context,
|
|
5432
|
+
service
|
|
5427
5433
|
})
|
|
5428
5434
|
});
|
|
5429
5435
|
};
|
|
@@ -5619,14 +5625,16 @@ var useOnChangeForm = () => {
|
|
|
5619
5625
|
specification,
|
|
5620
5626
|
context,
|
|
5621
5627
|
object,
|
|
5622
|
-
fieldChange
|
|
5628
|
+
fieldChange,
|
|
5629
|
+
service
|
|
5623
5630
|
}) => onChange({
|
|
5624
5631
|
ids,
|
|
5625
5632
|
model,
|
|
5626
5633
|
specification,
|
|
5627
5634
|
context,
|
|
5628
5635
|
object,
|
|
5629
|
-
fieldChange
|
|
5636
|
+
fieldChange,
|
|
5637
|
+
service
|
|
5630
5638
|
})
|
|
5631
5639
|
});
|
|
5632
5640
|
};
|
|
@@ -5643,8 +5651,9 @@ var useSave = () => {
|
|
|
5643
5651
|
data,
|
|
5644
5652
|
specification,
|
|
5645
5653
|
context,
|
|
5646
|
-
path
|
|
5647
|
-
|
|
5654
|
+
path,
|
|
5655
|
+
service
|
|
5656
|
+
}) => save({ ids, model, data, specification, context, path, service })
|
|
5648
5657
|
});
|
|
5649
5658
|
};
|
|
5650
5659
|
var use_save_default = useSave;
|
|
@@ -5696,12 +5705,14 @@ var useButton = () => {
|
|
|
5696
5705
|
model,
|
|
5697
5706
|
ids,
|
|
5698
5707
|
context,
|
|
5699
|
-
method
|
|
5708
|
+
method,
|
|
5709
|
+
service
|
|
5700
5710
|
}) => callButton({
|
|
5701
5711
|
model,
|
|
5702
5712
|
ids,
|
|
5703
5713
|
context,
|
|
5704
|
-
method
|
|
5714
|
+
method,
|
|
5715
|
+
service
|
|
5705
5716
|
}),
|
|
5706
5717
|
onSuccess: (response) => {
|
|
5707
5718
|
return response;
|
|
@@ -5718,11 +5729,13 @@ var useDuplicateRecord = () => {
|
|
|
5718
5729
|
mutationFn: ({
|
|
5719
5730
|
id,
|
|
5720
5731
|
model,
|
|
5721
|
-
context
|
|
5732
|
+
context,
|
|
5733
|
+
service
|
|
5722
5734
|
}) => duplicateRecord({
|
|
5723
5735
|
id,
|
|
5724
5736
|
model,
|
|
5725
|
-
context
|
|
5737
|
+
context,
|
|
5738
|
+
service
|
|
5726
5739
|
})
|
|
5727
5740
|
});
|
|
5728
5741
|
};
|
|
@@ -5805,11 +5818,11 @@ var use_get_groups_default = useGetGroups;
|
|
|
5805
5818
|
|
|
5806
5819
|
// src/hooks/view/use-get-list-data.ts
|
|
5807
5820
|
var import_react_query49 = require("@tanstack/react-query");
|
|
5808
|
-
var useGetListData = (listDataProps, queryKey, enabled) => {
|
|
5821
|
+
var useGetListData = (listDataProps, queryKey, enabled, service) => {
|
|
5809
5822
|
const { getAll } = useModelService();
|
|
5810
5823
|
return (0, import_react_query49.useQuery)({
|
|
5811
5824
|
queryKey,
|
|
5812
|
-
queryFn: () => getAll({ data: listDataProps }).then((res) => {
|
|
5825
|
+
queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
|
|
5813
5826
|
if (res) {
|
|
5814
5827
|
return res;
|
|
5815
5828
|
}
|
|
@@ -5824,11 +5837,11 @@ var use_get_list_data_default = useGetListData;
|
|
|
5824
5837
|
|
|
5825
5838
|
// src/hooks/view/use-get-menu.ts
|
|
5826
5839
|
var import_react_query50 = require("@tanstack/react-query");
|
|
5827
|
-
var useGetMenu = (context, enabled) => {
|
|
5840
|
+
var useGetMenu = (context, specification, enabled) => {
|
|
5828
5841
|
const { getMenu } = useViewService();
|
|
5829
5842
|
return (0, import_react_query50.useQuery)({
|
|
5830
5843
|
queryKey: ["menus" /* MENU */, context],
|
|
5831
|
-
queryFn: () => getMenu(context).then((res) => {
|
|
5844
|
+
queryFn: () => getMenu(context, specification).then((res) => {
|
|
5832
5845
|
if (res && res?.records && res?.records?.length > 0) {
|
|
5833
5846
|
return res?.records;
|
|
5834
5847
|
}
|
|
@@ -5885,12 +5898,13 @@ var import_react_query53 = require("@tanstack/react-query");
|
|
|
5885
5898
|
var useGetSelection = ({
|
|
5886
5899
|
data,
|
|
5887
5900
|
queryKey,
|
|
5888
|
-
enabled
|
|
5901
|
+
enabled,
|
|
5902
|
+
service
|
|
5889
5903
|
}) => {
|
|
5890
5904
|
const { getSelectionItem } = useViewService();
|
|
5891
5905
|
return (0, import_react_query53.useQuery)({
|
|
5892
5906
|
queryKey,
|
|
5893
|
-
queryFn: () => getSelectionItem({ data }),
|
|
5907
|
+
queryFn: () => getSelectionItem({ data, service }),
|
|
5894
5908
|
enabled,
|
|
5895
5909
|
refetchOnWindowFocus: false
|
|
5896
5910
|
});
|
|
@@ -5918,11 +5932,13 @@ var useLoadAction = () => {
|
|
|
5918
5932
|
return (0, import_react_query55.useMutation)({
|
|
5919
5933
|
mutationFn: ({
|
|
5920
5934
|
idAction,
|
|
5921
|
-
context
|
|
5935
|
+
context,
|
|
5936
|
+
service
|
|
5922
5937
|
}) => {
|
|
5923
5938
|
return loadAction({
|
|
5924
5939
|
idAction,
|
|
5925
|
-
context
|
|
5940
|
+
context,
|
|
5941
|
+
service
|
|
5926
5942
|
});
|
|
5927
5943
|
}
|
|
5928
5944
|
});
|
|
@@ -5963,11 +5979,13 @@ var useRemoveRow = () => {
|
|
|
5963
5979
|
mutationFn: ({
|
|
5964
5980
|
model,
|
|
5965
5981
|
ids,
|
|
5966
|
-
context
|
|
5982
|
+
context,
|
|
5983
|
+
service
|
|
5967
5984
|
}) => removeRows({
|
|
5968
5985
|
model,
|
|
5969
5986
|
ids,
|
|
5970
|
-
context
|
|
5987
|
+
context,
|
|
5988
|
+
service
|
|
5971
5989
|
})
|
|
5972
5990
|
});
|
|
5973
5991
|
};
|
|
@@ -5998,10 +6016,12 @@ var useRunAction = () => {
|
|
|
5998
6016
|
return (0, import_react_query60.useMutation)({
|
|
5999
6017
|
mutationFn: ({
|
|
6000
6018
|
idAction,
|
|
6001
|
-
context
|
|
6019
|
+
context,
|
|
6020
|
+
service
|
|
6002
6021
|
}) => runAction({
|
|
6003
6022
|
idAction,
|
|
6004
|
-
context
|
|
6023
|
+
context,
|
|
6024
|
+
service
|
|
6005
6025
|
})
|
|
6006
6026
|
});
|
|
6007
6027
|
};
|