@fctc/edu-logic-lib 1.1.5 → 1.1.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/hooks.d.mts +1 -217
- package/dist/hooks.d.ts +1 -217
- package/dist/hooks.js +0 -4863
- package/dist/hooks.mjs +0 -4813
- package/dist/index.d.mts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +121 -746
- package/dist/index.mjs +120 -699
- package/dist/models.d.mts +21 -4
- package/dist/models.d.ts +21 -4
- package/dist/services.d.mts +13 -2
- package/dist/services.d.ts +13 -2
- package/package.json +1 -1
- package/dist/index-C_nK1Mii.d.mts +0 -19
- package/dist/index-C_nK1Mii.d.ts +0 -19
- package/dist/use-get-selection-DFh6sc49.d.mts +0 -26
- package/dist/use-get-selection-DFh6sc49.d.ts +0 -26
package/dist/index.js
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
var axios = require('axios');
|
|
4
4
|
var reactRedux = require('react-redux');
|
|
5
5
|
var toolkit = require('@reduxjs/toolkit');
|
|
6
|
+
var react = require('react');
|
|
6
7
|
var reactQuery = require('@tanstack/react-query');
|
|
7
|
-
var React = require('react');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
|
|
12
12
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
13
|
|
|
15
14
|
// src/config/axios-client.ts
|
|
16
15
|
|
|
@@ -1002,6 +1001,123 @@ function getEnv() {
|
|
|
1002
1001
|
return exports.env;
|
|
1003
1002
|
}
|
|
1004
1003
|
|
|
1004
|
+
// src/models/base-model/index.ts
|
|
1005
|
+
var BaseModel = class {
|
|
1006
|
+
name;
|
|
1007
|
+
view;
|
|
1008
|
+
actContext;
|
|
1009
|
+
fields;
|
|
1010
|
+
constructor(init) {
|
|
1011
|
+
this.name = init.name;
|
|
1012
|
+
this.view = init.view;
|
|
1013
|
+
this.actContext = init.actContext;
|
|
1014
|
+
this.fields = init.fields;
|
|
1015
|
+
}
|
|
1016
|
+
getSpecificationByFields({
|
|
1017
|
+
fields = [],
|
|
1018
|
+
specification = {},
|
|
1019
|
+
modelsData,
|
|
1020
|
+
model,
|
|
1021
|
+
modelRoot
|
|
1022
|
+
}) {
|
|
1023
|
+
if (Array.isArray(fields)) {
|
|
1024
|
+
let spec = { ...specification };
|
|
1025
|
+
fields.forEach((field) => {
|
|
1026
|
+
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
1027
|
+
if (modelsData?.[model]?.[field?.name]) {
|
|
1028
|
+
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
1029
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
1030
|
+
const modelRelation = modelsData?.[relation];
|
|
1031
|
+
if (modelRelation) {
|
|
1032
|
+
spec[field?.name] = {
|
|
1033
|
+
fields: {}
|
|
1034
|
+
};
|
|
1035
|
+
if (modelRoot && modelRoot === relation) {
|
|
1036
|
+
spec[field?.name].fields = { id: {} };
|
|
1037
|
+
} else {
|
|
1038
|
+
spec[field?.name].fields = this.getSpecificationByFields({
|
|
1039
|
+
fields: Object.values(modelRelation),
|
|
1040
|
+
specification: {},
|
|
1041
|
+
modelsData,
|
|
1042
|
+
model: relation,
|
|
1043
|
+
modelRoot: model
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
} else {
|
|
1047
|
+
spec[field?.name] = {
|
|
1048
|
+
fields: {
|
|
1049
|
+
id: {},
|
|
1050
|
+
display_name: {}
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
1055
|
+
spec[field?.name] = {
|
|
1056
|
+
fields: {
|
|
1057
|
+
id: {},
|
|
1058
|
+
display_name: {},
|
|
1059
|
+
...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
1060
|
+
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
1061
|
+
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
} else {
|
|
1065
|
+
spec[field?.name] = {};
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
1069
|
+
const specGroup = this.getSpecificationByFields({
|
|
1070
|
+
fields: field?.fields,
|
|
1071
|
+
specification: spec,
|
|
1072
|
+
modelsData,
|
|
1073
|
+
model
|
|
1074
|
+
});
|
|
1075
|
+
spec = { ...spec, ...specGroup };
|
|
1076
|
+
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
1077
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
1078
|
+
const specTreee = this.getSpecificationByFields({
|
|
1079
|
+
fields: field?.fields,
|
|
1080
|
+
specification: {},
|
|
1081
|
+
modelsData,
|
|
1082
|
+
model: relation,
|
|
1083
|
+
modelRoot: model
|
|
1084
|
+
});
|
|
1085
|
+
spec = {
|
|
1086
|
+
...spec,
|
|
1087
|
+
[field?.name]: {
|
|
1088
|
+
fields: { ...spec?.[field?.name]?.fields, ...specTreee }
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
return spec;
|
|
1094
|
+
} else {
|
|
1095
|
+
console.warn("fields is not array");
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
getTreeProps() {
|
|
1099
|
+
const props = this.view?.views?.list || {};
|
|
1100
|
+
return props;
|
|
1101
|
+
}
|
|
1102
|
+
getTreeFields() {
|
|
1103
|
+
const fields = this.view?.views?.list?.fields || [];
|
|
1104
|
+
return fields;
|
|
1105
|
+
}
|
|
1106
|
+
getSpecification() {
|
|
1107
|
+
const specInit = {};
|
|
1108
|
+
const modelData = this.view?.models || {};
|
|
1109
|
+
const specification = this.getSpecificationByFields({
|
|
1110
|
+
fields: this.fields,
|
|
1111
|
+
specification: specInit,
|
|
1112
|
+
modelsData: modelData,
|
|
1113
|
+
model: this.name,
|
|
1114
|
+
modelRoot: ""
|
|
1115
|
+
});
|
|
1116
|
+
return specification;
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
var base_model_default = BaseModel;
|
|
1120
|
+
|
|
1005
1121
|
// src/utils/domain/py_tokenizer.ts
|
|
1006
1122
|
var TokenizerError = class extends Error {
|
|
1007
1123
|
};
|
|
@@ -4399,702 +4515,6 @@ var ViewService = {
|
|
|
4399
4515
|
};
|
|
4400
4516
|
var view_service_default = ViewService;
|
|
4401
4517
|
|
|
4402
|
-
// src/hooks/auth/use-forgot-password.ts
|
|
4403
|
-
var useForgotPassword = () => {
|
|
4404
|
-
return reactQuery.useMutation({
|
|
4405
|
-
mutationFn: (email) => {
|
|
4406
|
-
return auth_service_default.forgotPassword(email);
|
|
4407
|
-
}
|
|
4408
|
-
});
|
|
4409
|
-
};
|
|
4410
|
-
var use_forgot_password_default = useForgotPassword;
|
|
4411
|
-
var useGetProvider = () => {
|
|
4412
|
-
return reactQuery.useMutation({
|
|
4413
|
-
mutationFn: (data) => {
|
|
4414
|
-
return auth_service_default.getProviders(data?.db);
|
|
4415
|
-
}
|
|
4416
|
-
});
|
|
4417
|
-
};
|
|
4418
|
-
var use_get_provider_default = useGetProvider;
|
|
4419
|
-
var useIsValidToken = () => {
|
|
4420
|
-
return reactQuery.useMutation({
|
|
4421
|
-
mutationFn: (token) => {
|
|
4422
|
-
return auth_service_default.isValidToken(token);
|
|
4423
|
-
}
|
|
4424
|
-
});
|
|
4425
|
-
};
|
|
4426
|
-
var use_isvalid_token_default = useIsValidToken;
|
|
4427
|
-
var useLoginCredential = () => {
|
|
4428
|
-
return reactQuery.useMutation({
|
|
4429
|
-
mutationFn: (data) => {
|
|
4430
|
-
return auth_service_default.login(data);
|
|
4431
|
-
}
|
|
4432
|
-
});
|
|
4433
|
-
};
|
|
4434
|
-
var use_login_credential_default = useLoginCredential;
|
|
4435
|
-
var useLoginSocial = () => {
|
|
4436
|
-
return reactQuery.useMutation({
|
|
4437
|
-
mutationFn: (data) => {
|
|
4438
|
-
return auth_service_default.loginSocial(data);
|
|
4439
|
-
}
|
|
4440
|
-
});
|
|
4441
|
-
};
|
|
4442
|
-
var use_login_socical_default = useLoginSocial;
|
|
4443
|
-
var useResetPassword = () => {
|
|
4444
|
-
return reactQuery.useMutation({
|
|
4445
|
-
mutationFn: (request) => {
|
|
4446
|
-
return auth_service_default.resetPassword(request.data, request.token);
|
|
4447
|
-
}
|
|
4448
|
-
});
|
|
4449
|
-
};
|
|
4450
|
-
var use_reset_password_default = useResetPassword;
|
|
4451
|
-
var useUpdatePassword = () => {
|
|
4452
|
-
return reactQuery.useMutation({
|
|
4453
|
-
mutationFn: (request) => {
|
|
4454
|
-
return auth_service_default.updatePassword(request.data, request.token);
|
|
4455
|
-
}
|
|
4456
|
-
});
|
|
4457
|
-
};
|
|
4458
|
-
var use_update_password_default = useUpdatePassword;
|
|
4459
|
-
var useField = (props) => {
|
|
4460
|
-
const [invisible, setInvisible] = React__default.default.useState(true);
|
|
4461
|
-
const [required, setRequired] = React__default.default.useState(false);
|
|
4462
|
-
const [readonly, setReadOnly] = React__default.default.useState(false);
|
|
4463
|
-
const {
|
|
4464
|
-
invisible: inv,
|
|
4465
|
-
required: req,
|
|
4466
|
-
readonly: rea,
|
|
4467
|
-
onchangeData,
|
|
4468
|
-
rootField,
|
|
4469
|
-
index,
|
|
4470
|
-
name
|
|
4471
|
-
} = props;
|
|
4472
|
-
const nameField = rootField ? `${rootField?.name}.${index}.${name}` : null;
|
|
4473
|
-
React.useEffect(() => {
|
|
4474
|
-
if (onchangeData && Object.keys(onchangeData).length > 0) {
|
|
4475
|
-
setRequired(
|
|
4476
|
-
typeof req === "object" ? matchDomains(onchangeData, req) : checkDomain(onchangeData, req)
|
|
4477
|
-
);
|
|
4478
|
-
setInvisible(matchDomains(onchangeData, inv));
|
|
4479
|
-
setReadOnly(
|
|
4480
|
-
typeof req === "object" ? matchDomains(onchangeData, rea) : checkDomain(onchangeData, rea)
|
|
4481
|
-
);
|
|
4482
|
-
}
|
|
4483
|
-
}, [onchangeData]);
|
|
4484
|
-
return {
|
|
4485
|
-
invisible,
|
|
4486
|
-
required,
|
|
4487
|
-
readonly,
|
|
4488
|
-
nameField
|
|
4489
|
-
};
|
|
4490
|
-
};
|
|
4491
|
-
var use_field_default = useField;
|
|
4492
|
-
var useGetCompanyInfo = () => {
|
|
4493
|
-
return reactQuery.useMutation({
|
|
4494
|
-
mutationFn: (id) => company_service_default.getInfoCompany(id)
|
|
4495
|
-
});
|
|
4496
|
-
};
|
|
4497
|
-
var use_get_company_info_default = useGetCompanyInfo;
|
|
4498
|
-
var useGetCurrentCompany = () => {
|
|
4499
|
-
return reactQuery.useMutation({
|
|
4500
|
-
mutationFn: () => company_service_default.getCurrentCompany()
|
|
4501
|
-
});
|
|
4502
|
-
};
|
|
4503
|
-
var use_get_current_company_default = useGetCurrentCompany;
|
|
4504
|
-
var useChangeStatus = () => {
|
|
4505
|
-
return reactQuery.useMutation({
|
|
4506
|
-
mutationFn: ({ data }) => {
|
|
4507
|
-
return form_service_default.changeStatus({
|
|
4508
|
-
data
|
|
4509
|
-
});
|
|
4510
|
-
}
|
|
4511
|
-
});
|
|
4512
|
-
};
|
|
4513
|
-
var use_change_status_default = useChangeStatus;
|
|
4514
|
-
var useDeleteComment = () => {
|
|
4515
|
-
return reactQuery.useMutation({
|
|
4516
|
-
mutationFn: ({ data }) => form_service_default.deleteComment({
|
|
4517
|
-
data
|
|
4518
|
-
})
|
|
4519
|
-
});
|
|
4520
|
-
};
|
|
4521
|
-
var use_delete_comment_default = useDeleteComment;
|
|
4522
|
-
var useGetComment = ({ data, queryKey }) => {
|
|
4523
|
-
return reactQuery.useQuery({
|
|
4524
|
-
queryKey,
|
|
4525
|
-
queryFn: () => form_service_default.getComment({ data }).then((res) => {
|
|
4526
|
-
if (res) {
|
|
4527
|
-
return res;
|
|
4528
|
-
}
|
|
4529
|
-
}),
|
|
4530
|
-
enabled: !!data.thread_id && !isNaN(data.thread_id),
|
|
4531
|
-
refetchOnWindowFocus: false
|
|
4532
|
-
});
|
|
4533
|
-
};
|
|
4534
|
-
var use_get_comment_default = useGetComment;
|
|
4535
|
-
var useGetFormView = ({
|
|
4536
|
-
data,
|
|
4537
|
-
queryKey,
|
|
4538
|
-
enabled
|
|
4539
|
-
}) => {
|
|
4540
|
-
return reactQuery.useQuery({
|
|
4541
|
-
queryKey,
|
|
4542
|
-
queryFn: () => form_service_default.getFormView({ data }).then((res) => {
|
|
4543
|
-
if (res) {
|
|
4544
|
-
return res;
|
|
4545
|
-
}
|
|
4546
|
-
}),
|
|
4547
|
-
enabled,
|
|
4548
|
-
refetchOnWindowFocus: false
|
|
4549
|
-
});
|
|
4550
|
-
};
|
|
4551
|
-
var use_get_form_view_default = useGetFormView;
|
|
4552
|
-
var useGetImage = ({
|
|
4553
|
-
data,
|
|
4554
|
-
queryKey,
|
|
4555
|
-
src
|
|
4556
|
-
}) => {
|
|
4557
|
-
return reactQuery.useQuery({
|
|
4558
|
-
queryKey,
|
|
4559
|
-
queryFn: () => form_service_default.getImage({ data }).then((res) => {
|
|
4560
|
-
if (res) {
|
|
4561
|
-
return res;
|
|
4562
|
-
}
|
|
4563
|
-
}),
|
|
4564
|
-
enabled: !src && !isBase64File(src),
|
|
4565
|
-
refetchOnWindowFocus: false
|
|
4566
|
-
});
|
|
4567
|
-
};
|
|
4568
|
-
var use_get_image_default = useGetImage;
|
|
4569
|
-
var useSendComment = () => {
|
|
4570
|
-
return reactQuery.useMutation({
|
|
4571
|
-
mutationFn: ({ data }) => form_service_default.sentComment({
|
|
4572
|
-
data
|
|
4573
|
-
})
|
|
4574
|
-
});
|
|
4575
|
-
};
|
|
4576
|
-
var use_send_comment_default = useSendComment;
|
|
4577
|
-
var useUploadImage = () => {
|
|
4578
|
-
return reactQuery.useMutation({
|
|
4579
|
-
mutationFn: ({ data }) => form_service_default.uploadImage({
|
|
4580
|
-
data
|
|
4581
|
-
})
|
|
4582
|
-
});
|
|
4583
|
-
};
|
|
4584
|
-
var use_upload_image_default = useUploadImage;
|
|
4585
|
-
var useExportExcel = () => {
|
|
4586
|
-
return reactQuery.useMutation({
|
|
4587
|
-
mutationFn: ({
|
|
4588
|
-
model,
|
|
4589
|
-
domain,
|
|
4590
|
-
ids,
|
|
4591
|
-
fields,
|
|
4592
|
-
type,
|
|
4593
|
-
importCompat,
|
|
4594
|
-
context,
|
|
4595
|
-
groupby
|
|
4596
|
-
}) => excel_service_default.exportExcel({
|
|
4597
|
-
model,
|
|
4598
|
-
domain,
|
|
4599
|
-
ids,
|
|
4600
|
-
fields,
|
|
4601
|
-
type,
|
|
4602
|
-
importCompat,
|
|
4603
|
-
context,
|
|
4604
|
-
groupby
|
|
4605
|
-
})
|
|
4606
|
-
});
|
|
4607
|
-
};
|
|
4608
|
-
var use_export_excel_default = useExportExcel;
|
|
4609
|
-
var useGetFieldExport = () => {
|
|
4610
|
-
return reactQuery.useMutation({
|
|
4611
|
-
mutationFn: ({
|
|
4612
|
-
ids,
|
|
4613
|
-
model,
|
|
4614
|
-
isShow,
|
|
4615
|
-
parentField,
|
|
4616
|
-
fieldType,
|
|
4617
|
-
parentName,
|
|
4618
|
-
prefix,
|
|
4619
|
-
name,
|
|
4620
|
-
context,
|
|
4621
|
-
importCompat
|
|
4622
|
-
}) => excel_service_default.getFieldExport({
|
|
4623
|
-
ids,
|
|
4624
|
-
model,
|
|
4625
|
-
isShow,
|
|
4626
|
-
parentField,
|
|
4627
|
-
fieldType,
|
|
4628
|
-
parentName,
|
|
4629
|
-
prefix,
|
|
4630
|
-
name,
|
|
4631
|
-
context,
|
|
4632
|
-
importCompat
|
|
4633
|
-
})
|
|
4634
|
-
});
|
|
4635
|
-
};
|
|
4636
|
-
var use_get_field_export_default = useGetFieldExport;
|
|
4637
|
-
var useGetFileExcel = ({
|
|
4638
|
-
model,
|
|
4639
|
-
context
|
|
4640
|
-
}) => {
|
|
4641
|
-
return reactQuery.useQuery({
|
|
4642
|
-
queryKey: [],
|
|
4643
|
-
queryFn: () => excel_service_default.getFileExcel({
|
|
4644
|
-
model,
|
|
4645
|
-
context
|
|
4646
|
-
}).then((res) => {
|
|
4647
|
-
if (res) {
|
|
4648
|
-
return res;
|
|
4649
|
-
}
|
|
4650
|
-
return [];
|
|
4651
|
-
}),
|
|
4652
|
-
refetchOnWindowFocus: false
|
|
4653
|
-
});
|
|
4654
|
-
};
|
|
4655
|
-
var use_get_file_excel_default = useGetFileExcel;
|
|
4656
|
-
var useParsePreview = () => {
|
|
4657
|
-
return reactQuery.useMutation({
|
|
4658
|
-
mutationFn: ({
|
|
4659
|
-
id,
|
|
4660
|
-
selectedSheet,
|
|
4661
|
-
isHeader,
|
|
4662
|
-
context
|
|
4663
|
-
}) => excel_service_default.parsePreview({
|
|
4664
|
-
id,
|
|
4665
|
-
selectedSheet,
|
|
4666
|
-
isHeader,
|
|
4667
|
-
context
|
|
4668
|
-
})
|
|
4669
|
-
});
|
|
4670
|
-
};
|
|
4671
|
-
var use_parse_preview_default = useParsePreview;
|
|
4672
|
-
var useUploadFile = () => {
|
|
4673
|
-
return reactQuery.useMutation({
|
|
4674
|
-
mutationFn: ({ formData }) => excel_service_default.uploadFile({
|
|
4675
|
-
formData
|
|
4676
|
-
})
|
|
4677
|
-
});
|
|
4678
|
-
};
|
|
4679
|
-
var use_upload_file_default = useUploadFile;
|
|
4680
|
-
var useUploadIdFile = () => {
|
|
4681
|
-
return reactQuery.useMutation({
|
|
4682
|
-
mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
|
|
4683
|
-
formData
|
|
4684
|
-
})
|
|
4685
|
-
});
|
|
4686
|
-
};
|
|
4687
|
-
var use_upload_id_file_default = useUploadIdFile;
|
|
4688
|
-
var useExecuteImport = () => {
|
|
4689
|
-
return reactQuery.useMutation({
|
|
4690
|
-
mutationFn: ({
|
|
4691
|
-
fields,
|
|
4692
|
-
columns,
|
|
4693
|
-
idFile,
|
|
4694
|
-
options,
|
|
4695
|
-
dryrun,
|
|
4696
|
-
context
|
|
4697
|
-
}) => excel_service_default.executeImport({
|
|
4698
|
-
fields,
|
|
4699
|
-
columns,
|
|
4700
|
-
idFile,
|
|
4701
|
-
options,
|
|
4702
|
-
dryrun,
|
|
4703
|
-
context
|
|
4704
|
-
})
|
|
4705
|
-
});
|
|
4706
|
-
};
|
|
4707
|
-
var uss_execute_import_default = useExecuteImport;
|
|
4708
|
-
var useDelete = () => {
|
|
4709
|
-
return reactQuery.useMutation({
|
|
4710
|
-
mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
|
|
4711
|
-
});
|
|
4712
|
-
};
|
|
4713
|
-
var use_delete_default = useDelete;
|
|
4714
|
-
var useGetAll = ({ data, queryKey, viewResponse }) => {
|
|
4715
|
-
return reactQuery.useQuery({
|
|
4716
|
-
queryKey,
|
|
4717
|
-
queryFn: () => model_service_default.getAll({ data }).then((res) => {
|
|
4718
|
-
if (res) {
|
|
4719
|
-
return res;
|
|
4720
|
-
}
|
|
4721
|
-
}),
|
|
4722
|
-
enabled: !!data.specification && !!data.model && !!data.domain && !!viewResponse,
|
|
4723
|
-
refetchOnWindowFocus: false
|
|
4724
|
-
// placeholderData: keepPreviousData,
|
|
4725
|
-
});
|
|
4726
|
-
};
|
|
4727
|
-
var use_get_all_default = useGetAll;
|
|
4728
|
-
var useGetDetail = () => {
|
|
4729
|
-
return reactQuery.useMutation({
|
|
4730
|
-
mutationFn: ({
|
|
4731
|
-
model,
|
|
4732
|
-
ids,
|
|
4733
|
-
specification,
|
|
4734
|
-
context
|
|
4735
|
-
}) => model_service_default.getDetail({
|
|
4736
|
-
model,
|
|
4737
|
-
ids,
|
|
4738
|
-
specification,
|
|
4739
|
-
context
|
|
4740
|
-
})
|
|
4741
|
-
});
|
|
4742
|
-
};
|
|
4743
|
-
var use_get_detail_default = useGetDetail;
|
|
4744
|
-
var useGetFieldOnChange = ({ model }) => {
|
|
4745
|
-
return reactQuery.useQuery({
|
|
4746
|
-
queryKey: [`field-onchange-${model}`, model],
|
|
4747
|
-
queryFn: () => model_service_default.getListFieldsOnchange({
|
|
4748
|
-
model
|
|
4749
|
-
}).then((res) => {
|
|
4750
|
-
if (res) {
|
|
4751
|
-
return res;
|
|
4752
|
-
}
|
|
4753
|
-
}),
|
|
4754
|
-
refetchOnWindowFocus: false,
|
|
4755
|
-
staleTime: Infinity
|
|
4756
|
-
});
|
|
4757
|
-
};
|
|
4758
|
-
var use_get_field_onchange_default = useGetFieldOnChange;
|
|
4759
|
-
|
|
4760
|
-
// src/models/base-model/index.ts
|
|
4761
|
-
var BaseModel = class {
|
|
4762
|
-
name;
|
|
4763
|
-
view;
|
|
4764
|
-
actContext;
|
|
4765
|
-
fields;
|
|
4766
|
-
constructor(init) {
|
|
4767
|
-
this.name = init.name;
|
|
4768
|
-
this.view = init.view;
|
|
4769
|
-
this.actContext = init.actContext;
|
|
4770
|
-
this.fields = init.fields;
|
|
4771
|
-
}
|
|
4772
|
-
getSpecificationByFields({
|
|
4773
|
-
fields = [],
|
|
4774
|
-
specification = {},
|
|
4775
|
-
modelsData,
|
|
4776
|
-
model,
|
|
4777
|
-
modelRoot
|
|
4778
|
-
}) {
|
|
4779
|
-
if (Array.isArray(fields)) {
|
|
4780
|
-
let spec = { ...specification };
|
|
4781
|
-
fields.forEach((field) => {
|
|
4782
|
-
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
4783
|
-
if (modelsData?.[model]?.[field?.name]) {
|
|
4784
|
-
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
4785
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
4786
|
-
const modelRelation = modelsData?.[relation];
|
|
4787
|
-
if (modelRelation) {
|
|
4788
|
-
spec[field?.name] = {
|
|
4789
|
-
fields: {}
|
|
4790
|
-
};
|
|
4791
|
-
if (modelRoot && modelRoot === relation) {
|
|
4792
|
-
spec[field?.name].fields = { id: {} };
|
|
4793
|
-
} else {
|
|
4794
|
-
spec[field?.name].fields = this.getSpecificationByFields({
|
|
4795
|
-
fields: Object.values(modelRelation),
|
|
4796
|
-
specification: {},
|
|
4797
|
-
modelsData,
|
|
4798
|
-
model: relation,
|
|
4799
|
-
modelRoot: model
|
|
4800
|
-
});
|
|
4801
|
-
}
|
|
4802
|
-
} else {
|
|
4803
|
-
spec[field?.name] = {
|
|
4804
|
-
fields: {
|
|
4805
|
-
id: {},
|
|
4806
|
-
display_name: {}
|
|
4807
|
-
}
|
|
4808
|
-
};
|
|
4809
|
-
}
|
|
4810
|
-
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
4811
|
-
spec[field?.name] = {
|
|
4812
|
-
fields: {
|
|
4813
|
-
id: {},
|
|
4814
|
-
display_name: {},
|
|
4815
|
-
...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
4816
|
-
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
4817
|
-
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
4818
|
-
}
|
|
4819
|
-
};
|
|
4820
|
-
} else {
|
|
4821
|
-
spec[field?.name] = {};
|
|
4822
|
-
}
|
|
4823
|
-
}
|
|
4824
|
-
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
4825
|
-
const specGroup = this.getSpecificationByFields({
|
|
4826
|
-
fields: field?.fields,
|
|
4827
|
-
specification: spec,
|
|
4828
|
-
modelsData,
|
|
4829
|
-
model
|
|
4830
|
-
});
|
|
4831
|
-
spec = { ...spec, ...specGroup };
|
|
4832
|
-
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
4833
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
4834
|
-
const specTreee = this.getSpecificationByFields({
|
|
4835
|
-
fields: field?.fields,
|
|
4836
|
-
specification: {},
|
|
4837
|
-
modelsData,
|
|
4838
|
-
model: relation,
|
|
4839
|
-
modelRoot: model
|
|
4840
|
-
});
|
|
4841
|
-
spec = {
|
|
4842
|
-
...spec,
|
|
4843
|
-
[field?.name]: {
|
|
4844
|
-
fields: { ...spec?.[field?.name]?.fields, ...specTreee }
|
|
4845
|
-
}
|
|
4846
|
-
};
|
|
4847
|
-
}
|
|
4848
|
-
});
|
|
4849
|
-
return spec;
|
|
4850
|
-
} else {
|
|
4851
|
-
console.warn("fields is not array");
|
|
4852
|
-
}
|
|
4853
|
-
}
|
|
4854
|
-
getTreeProps() {
|
|
4855
|
-
const props = this.view?.views?.list || {};
|
|
4856
|
-
return props;
|
|
4857
|
-
}
|
|
4858
|
-
getTreeFields() {
|
|
4859
|
-
const fields = this.view?.views?.list?.fields || [];
|
|
4860
|
-
return fields;
|
|
4861
|
-
}
|
|
4862
|
-
getSpecification() {
|
|
4863
|
-
const specInit = {};
|
|
4864
|
-
const modelData = this.view?.models || {};
|
|
4865
|
-
const specification = this.getSpecificationByFields({
|
|
4866
|
-
fields: this.fields,
|
|
4867
|
-
specification: specInit,
|
|
4868
|
-
modelsData: modelData,
|
|
4869
|
-
model: this.name,
|
|
4870
|
-
modelRoot: ""
|
|
4871
|
-
});
|
|
4872
|
-
return specification;
|
|
4873
|
-
}
|
|
4874
|
-
};
|
|
4875
|
-
var base_model_default = BaseModel;
|
|
4876
|
-
|
|
4877
|
-
// src/hooks/model/use-model.ts
|
|
4878
|
-
var useModel = () => {
|
|
4879
|
-
const initModel = (modelData) => {
|
|
4880
|
-
switch (modelData?.name) {
|
|
4881
|
-
default:
|
|
4882
|
-
return new base_model_default(modelData);
|
|
4883
|
-
}
|
|
4884
|
-
};
|
|
4885
|
-
return {
|
|
4886
|
-
initModel
|
|
4887
|
-
};
|
|
4888
|
-
};
|
|
4889
|
-
var use_model_default = useModel;
|
|
4890
|
-
|
|
4891
|
-
// src/hooks/model/use-odoo-data-transform.ts
|
|
4892
|
-
var useOdooDataTransform = () => {
|
|
4893
|
-
return {
|
|
4894
|
-
toDataJS: model_service_default.toDataJS,
|
|
4895
|
-
parseORM: model_service_default.parseORMOdoo
|
|
4896
|
-
};
|
|
4897
|
-
};
|
|
4898
|
-
var use_odoo_data_transform_default = useOdooDataTransform;
|
|
4899
|
-
var useOnChangeForm = () => {
|
|
4900
|
-
return reactQuery.useMutation({
|
|
4901
|
-
mutationFn: ({
|
|
4902
|
-
ids,
|
|
4903
|
-
model,
|
|
4904
|
-
specification,
|
|
4905
|
-
context,
|
|
4906
|
-
object,
|
|
4907
|
-
fieldChange
|
|
4908
|
-
}) => model_service_default.onChange({
|
|
4909
|
-
ids,
|
|
4910
|
-
model,
|
|
4911
|
-
specification,
|
|
4912
|
-
context,
|
|
4913
|
-
object,
|
|
4914
|
-
fieldChange
|
|
4915
|
-
})
|
|
4916
|
-
});
|
|
4917
|
-
};
|
|
4918
|
-
var use_onchange_form_default = useOnChangeForm;
|
|
4919
|
-
var useSave = () => {
|
|
4920
|
-
return reactQuery.useMutation({
|
|
4921
|
-
mutationFn: ({
|
|
4922
|
-
ids,
|
|
4923
|
-
model,
|
|
4924
|
-
data,
|
|
4925
|
-
specification,
|
|
4926
|
-
context
|
|
4927
|
-
}) => model_service_default.save({ ids, model, data, specification, context })
|
|
4928
|
-
});
|
|
4929
|
-
};
|
|
4930
|
-
var use_save_default = useSave;
|
|
4931
|
-
var useGetProfile = () => {
|
|
4932
|
-
return reactQuery.useMutation({
|
|
4933
|
-
mutationFn: () => user_service_default.getProfile()
|
|
4934
|
-
});
|
|
4935
|
-
};
|
|
4936
|
-
var use_get_profile_default = useGetProfile;
|
|
4937
|
-
var useGetUser = () => {
|
|
4938
|
-
return reactQuery.useMutation({
|
|
4939
|
-
mutationFn: ({ id, context }) => user_service_default.getUser({
|
|
4940
|
-
id,
|
|
4941
|
-
context
|
|
4942
|
-
})
|
|
4943
|
-
});
|
|
4944
|
-
};
|
|
4945
|
-
var use_get_user_default = useGetUser;
|
|
4946
|
-
var useSwitchLocale = () => {
|
|
4947
|
-
return reactQuery.useMutation({
|
|
4948
|
-
mutationFn: ({ data }) => {
|
|
4949
|
-
return user_service_default.switchUserLocale({
|
|
4950
|
-
id: data.id,
|
|
4951
|
-
values: data.values
|
|
4952
|
-
});
|
|
4953
|
-
}
|
|
4954
|
-
});
|
|
4955
|
-
};
|
|
4956
|
-
var use_switch_locale_default = useSwitchLocale;
|
|
4957
|
-
var useButton = () => {
|
|
4958
|
-
return reactQuery.useMutation({
|
|
4959
|
-
mutationFn: ({
|
|
4960
|
-
model,
|
|
4961
|
-
ids,
|
|
4962
|
-
context,
|
|
4963
|
-
method
|
|
4964
|
-
}) => action_service_default.callButton({
|
|
4965
|
-
model,
|
|
4966
|
-
ids,
|
|
4967
|
-
context,
|
|
4968
|
-
method
|
|
4969
|
-
}),
|
|
4970
|
-
onSuccess: (response) => {
|
|
4971
|
-
return response;
|
|
4972
|
-
}
|
|
4973
|
-
});
|
|
4974
|
-
};
|
|
4975
|
-
var use_button_default = useButton;
|
|
4976
|
-
var useDuplicateRecord = () => {
|
|
4977
|
-
return reactQuery.useMutation({
|
|
4978
|
-
mutationFn: ({
|
|
4979
|
-
id,
|
|
4980
|
-
model,
|
|
4981
|
-
context
|
|
4982
|
-
}) => action_service_default.duplicateRecord({
|
|
4983
|
-
id,
|
|
4984
|
-
model,
|
|
4985
|
-
context
|
|
4986
|
-
})
|
|
4987
|
-
});
|
|
4988
|
-
};
|
|
4989
|
-
var use_duplicate_record_default = useDuplicateRecord;
|
|
4990
|
-
var useGetListData = (listDataProps, queryKey, enabled) => {
|
|
4991
|
-
return reactQuery.useQuery({
|
|
4992
|
-
queryKey,
|
|
4993
|
-
queryFn: () => model_service_default.getAll({ data: listDataProps }).then((res) => {
|
|
4994
|
-
if (res) {
|
|
4995
|
-
return res;
|
|
4996
|
-
}
|
|
4997
|
-
return [];
|
|
4998
|
-
}),
|
|
4999
|
-
enabled,
|
|
5000
|
-
refetchOnWindowFocus: false,
|
|
5001
|
-
staleTime: 0
|
|
5002
|
-
});
|
|
5003
|
-
};
|
|
5004
|
-
var use_get_list_data_default = useGetListData;
|
|
5005
|
-
var useGetMenu = ({ context, enabled, queryKey }) => {
|
|
5006
|
-
return reactQuery.useQuery({
|
|
5007
|
-
queryKey,
|
|
5008
|
-
queryFn: async () => {
|
|
5009
|
-
const res = await view_service_default.getMenu(context);
|
|
5010
|
-
if (res?.records && Array.isArray(res.records) && res.records.length > 0) {
|
|
5011
|
-
return res.records;
|
|
5012
|
-
}
|
|
5013
|
-
return [];
|
|
5014
|
-
},
|
|
5015
|
-
refetchOnWindowFocus: false,
|
|
5016
|
-
staleTime: Infinity,
|
|
5017
|
-
enabled
|
|
5018
|
-
});
|
|
5019
|
-
};
|
|
5020
|
-
var use_get_menu_default = useGetMenu;
|
|
5021
|
-
var useGetSelection = ({
|
|
5022
|
-
data,
|
|
5023
|
-
queryKey,
|
|
5024
|
-
enabled
|
|
5025
|
-
}) => {
|
|
5026
|
-
return reactQuery.useQuery({
|
|
5027
|
-
queryKey,
|
|
5028
|
-
queryFn: () => view_service_default.getSelectionItem({ data }),
|
|
5029
|
-
enabled,
|
|
5030
|
-
refetchOnWindowFocus: false
|
|
5031
|
-
});
|
|
5032
|
-
};
|
|
5033
|
-
var use_get_selection_default = useGetSelection;
|
|
5034
|
-
var useGetView = (viewParams, actData) => {
|
|
5035
|
-
return reactQuery.useQuery({
|
|
5036
|
-
queryKey: ["get_view_by_action" /* GET_VIEW_BY_ACTION */, viewParams],
|
|
5037
|
-
queryFn: () => view_service_default.getView(viewParams),
|
|
5038
|
-
enabled: !!actData,
|
|
5039
|
-
refetchOnWindowFocus: false,
|
|
5040
|
-
staleTime: Infinity
|
|
5041
|
-
});
|
|
5042
|
-
};
|
|
5043
|
-
var use_get_view_default = useGetView;
|
|
5044
|
-
var useLoadAction = ({
|
|
5045
|
-
idAction,
|
|
5046
|
-
context
|
|
5047
|
-
}) => {
|
|
5048
|
-
return reactQuery.useQuery({
|
|
5049
|
-
queryKey: ["load_action", idAction],
|
|
5050
|
-
queryFn: () => action_service_default.loadAction({
|
|
5051
|
-
idAction,
|
|
5052
|
-
context
|
|
5053
|
-
}),
|
|
5054
|
-
enabled: false,
|
|
5055
|
-
staleTime: Infinity,
|
|
5056
|
-
gcTime: Infinity
|
|
5057
|
-
});
|
|
5058
|
-
};
|
|
5059
|
-
var use_load_action_default = useLoadAction;
|
|
5060
|
-
var usePrint = () => {
|
|
5061
|
-
return reactQuery.useMutation({
|
|
5062
|
-
mutationFn: ({ id, report, db }) => action_service_default.print({
|
|
5063
|
-
id,
|
|
5064
|
-
report,
|
|
5065
|
-
db
|
|
5066
|
-
})
|
|
5067
|
-
});
|
|
5068
|
-
};
|
|
5069
|
-
var use_print_default = usePrint;
|
|
5070
|
-
var useRemoveRow = () => {
|
|
5071
|
-
return reactQuery.useMutation({
|
|
5072
|
-
mutationFn: ({
|
|
5073
|
-
model,
|
|
5074
|
-
ids,
|
|
5075
|
-
context
|
|
5076
|
-
}) => action_service_default.removeRows({
|
|
5077
|
-
model,
|
|
5078
|
-
ids,
|
|
5079
|
-
context
|
|
5080
|
-
})
|
|
5081
|
-
});
|
|
5082
|
-
};
|
|
5083
|
-
var use_remove_row_default = useRemoveRow;
|
|
5084
|
-
var useRunAction = ({ idAction, context }) => {
|
|
5085
|
-
return reactQuery.useQuery({
|
|
5086
|
-
queryKey: ["run_action", idAction],
|
|
5087
|
-
queryFn: () => action_service_default.runAction({
|
|
5088
|
-
idAction,
|
|
5089
|
-
context
|
|
5090
|
-
}),
|
|
5091
|
-
enabled: false,
|
|
5092
|
-
staleTime: Infinity,
|
|
5093
|
-
gcTime: Infinity
|
|
5094
|
-
});
|
|
5095
|
-
};
|
|
5096
|
-
var use_run_action_default = useRunAction;
|
|
5097
|
-
|
|
5098
4518
|
// src/models/company-model/index.ts
|
|
5099
4519
|
var CompanyModel = class extends base_model_default {
|
|
5100
4520
|
constructor(init) {
|
|
@@ -5120,7 +4540,7 @@ var UserModel = class extends base_model_default {
|
|
|
5120
4540
|
};
|
|
5121
4541
|
var user_model_default = UserModel;
|
|
5122
4542
|
var ReactQueryProvider = ({ children }) => {
|
|
5123
|
-
const [queryClient] =
|
|
4543
|
+
const [queryClient] = react.useState(
|
|
5124
4544
|
() => new reactQuery.QueryClient({
|
|
5125
4545
|
defaultOptions: {
|
|
5126
4546
|
queries: {
|
|
@@ -5142,8 +4562,8 @@ var MainProvider = ({ children }) => {
|
|
|
5142
4562
|
};
|
|
5143
4563
|
var VersionGate = ({ children }) => {
|
|
5144
4564
|
const queryClient = reactQuery.useQueryClient();
|
|
5145
|
-
const [ready, setReady] =
|
|
5146
|
-
|
|
4565
|
+
const [ready, setReady] = react.useState(false);
|
|
4566
|
+
react.useEffect(() => {
|
|
5147
4567
|
const clearVersion = () => {
|
|
5148
4568
|
queryClient.clear();
|
|
5149
4569
|
localStorage.removeItem("__api_version__");
|
|
@@ -5279,49 +4699,4 @@ exports.toQueryString = toQueryString;
|
|
|
5279
4699
|
exports.updateSearchMap = updateSearchMap;
|
|
5280
4700
|
exports.useAppDispatch = useAppDispatch;
|
|
5281
4701
|
exports.useAppSelector = useAppSelector;
|
|
5282
|
-
exports.useButton = use_button_default;
|
|
5283
|
-
exports.useChangeStatus = use_change_status_default;
|
|
5284
|
-
exports.useDelete = use_delete_default;
|
|
5285
|
-
exports.useDeleteComment = use_delete_comment_default;
|
|
5286
|
-
exports.useDuplicateRecord = use_duplicate_record_default;
|
|
5287
|
-
exports.useExecuteImport = uss_execute_import_default;
|
|
5288
|
-
exports.useExportExcel = use_export_excel_default;
|
|
5289
|
-
exports.useField = use_field_default;
|
|
5290
|
-
exports.useForgotPassword = use_forgot_password_default;
|
|
5291
|
-
exports.useGetAll = use_get_all_default;
|
|
5292
|
-
exports.useGetComment = use_get_comment_default;
|
|
5293
|
-
exports.useGetCompanyInfo = use_get_company_info_default;
|
|
5294
|
-
exports.useGetCurrentCompany = use_get_current_company_default;
|
|
5295
|
-
exports.useGetDetail = use_get_detail_default;
|
|
5296
|
-
exports.useGetFieldExport = use_get_field_export_default;
|
|
5297
|
-
exports.useGetFieldOnChange = use_get_field_onchange_default;
|
|
5298
|
-
exports.useGetFileExcel = use_get_file_excel_default;
|
|
5299
|
-
exports.useGetFormView = use_get_form_view_default;
|
|
5300
|
-
exports.useGetImage = use_get_image_default;
|
|
5301
|
-
exports.useGetListData = use_get_list_data_default;
|
|
5302
|
-
exports.useGetMenu = use_get_menu_default;
|
|
5303
|
-
exports.useGetProfile = use_get_profile_default;
|
|
5304
|
-
exports.useGetProvider = use_get_provider_default;
|
|
5305
|
-
exports.useGetSelection = use_get_selection_default;
|
|
5306
|
-
exports.useGetUser = use_get_user_default;
|
|
5307
|
-
exports.useGetView = use_get_view_default;
|
|
5308
|
-
exports.useIsValidToken = use_isvalid_token_default;
|
|
5309
|
-
exports.useLoadAction = use_load_action_default;
|
|
5310
|
-
exports.useLoginCredential = use_login_credential_default;
|
|
5311
|
-
exports.useLoginSocial = use_login_socical_default;
|
|
5312
|
-
exports.useModel = use_model_default;
|
|
5313
|
-
exports.useOdooDataTransform = use_odoo_data_transform_default;
|
|
5314
|
-
exports.useOnChangeForm = use_onchange_form_default;
|
|
5315
|
-
exports.useParsePreview = use_parse_preview_default;
|
|
5316
|
-
exports.usePrint = use_print_default;
|
|
5317
|
-
exports.useRemoveRow = use_remove_row_default;
|
|
5318
|
-
exports.useResetPassword = use_reset_password_default;
|
|
5319
|
-
exports.useRunAction = use_run_action_default;
|
|
5320
|
-
exports.useSave = use_save_default;
|
|
5321
|
-
exports.useSendComment = use_send_comment_default;
|
|
5322
|
-
exports.useSwitchLocale = use_switch_locale_default;
|
|
5323
4702
|
exports.useTabModel = useTabModel;
|
|
5324
|
-
exports.useUpdatePassword = use_update_password_default;
|
|
5325
|
-
exports.useUploadFile = use_upload_file_default;
|
|
5326
|
-
exports.useUploadIdFile = use_upload_id_file_default;
|
|
5327
|
-
exports.useUploadImage = use_upload_image_default;
|