@fctc/widget-logic 2.4.3 → 2.4.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 +559 -346
- package/dist/hooks.d.ts +559 -346
- package/dist/hooks.js +604 -480
- package/dist/hooks.mjs +615 -498
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +706 -612
- package/dist/index.mjs +799 -647
- package/dist/utils.d.mts +1 -9
- package/dist/utils.d.ts +1 -9
- package/dist/utils.js +0 -12
- package/dist/utils.mjs +0 -10
- package/dist/widget.d.mts +6 -6
- package/dist/widget.d.ts +6 -6
- package/dist/widget.js +168 -713
- package/dist/widget.mjs +258 -745
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ var require_moment = __commonJS({
|
|
|
37
37
|
"use strict";
|
|
38
38
|
(function(global, factory) {
|
|
39
39
|
typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.moment = factory();
|
|
40
|
-
})(exports2, function() {
|
|
40
|
+
})(exports2, (function() {
|
|
41
41
|
"use strict";
|
|
42
42
|
var hookCallback;
|
|
43
43
|
function hooks() {
|
|
@@ -55,7 +55,7 @@ var require_moment = __commonJS({
|
|
|
55
55
|
function hasOwnProp(a, b) {
|
|
56
56
|
return Object.prototype.hasOwnProperty.call(a, b);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function isObjectEmpty4(obj) {
|
|
59
59
|
if (Object.getOwnPropertyNames) {
|
|
60
60
|
return Object.getOwnPropertyNames(obj).length === 0;
|
|
61
61
|
} else {
|
|
@@ -2194,7 +2194,7 @@ var require_moment = __commonJS({
|
|
|
2194
2194
|
strict = locale2;
|
|
2195
2195
|
locale2 = void 0;
|
|
2196
2196
|
}
|
|
2197
|
-
if (isObject(input) &&
|
|
2197
|
+
if (isObject(input) && isObjectEmpty4(input) || isArray(input) && input.length === 0) {
|
|
2198
2198
|
input = void 0;
|
|
2199
2199
|
}
|
|
2200
2200
|
c._isAMomentObject = true;
|
|
@@ -2613,7 +2613,7 @@ var require_moment = __commonJS({
|
|
|
2613
2613
|
return isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === void 0;
|
|
2614
2614
|
}
|
|
2615
2615
|
function isMomentInputObject(input) {
|
|
2616
|
-
var objectTest = isObject(input) && !
|
|
2616
|
+
var objectTest = isObject(input) && !isObjectEmpty4(input), propertyTest = false, properties = [
|
|
2617
2617
|
"years",
|
|
2618
2618
|
"year",
|
|
2619
2619
|
"y",
|
|
@@ -2655,7 +2655,7 @@ var require_moment = __commonJS({
|
|
|
2655
2655
|
return arrayTest && dataTypeTest;
|
|
2656
2656
|
}
|
|
2657
2657
|
function isCalendarSpec(input) {
|
|
2658
|
-
var objectTest = isObject(input) && !
|
|
2658
|
+
var objectTest = isObject(input) && !isObjectEmpty4(input), propertyTest = false, properties = [
|
|
2659
2659
|
"sameDay",
|
|
2660
2660
|
"nextDay",
|
|
2661
2661
|
"lastDay",
|
|
@@ -4028,15 +4028,13 @@ var require_moment = __commonJS({
|
|
|
4028
4028
|
// <input type="month" />
|
|
4029
4029
|
};
|
|
4030
4030
|
return hooks;
|
|
4031
|
-
});
|
|
4031
|
+
}));
|
|
4032
4032
|
}
|
|
4033
4033
|
});
|
|
4034
4034
|
|
|
4035
4035
|
// src/index.ts
|
|
4036
4036
|
var index_exports = {};
|
|
4037
4037
|
__export(index_exports, {
|
|
4038
|
-
API_APP_URL: () => API_APP_URL,
|
|
4039
|
-
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4040
4038
|
AppProvider: () => AppProvider,
|
|
4041
4039
|
CheckIcon: () => CheckIcon,
|
|
4042
4040
|
ChevronBottomIcon: () => ChevronBottomIcon,
|
|
@@ -4072,137 +4070,207 @@ __export(index_exports, {
|
|
|
4072
4070
|
tableGroupController: () => tableGroupController,
|
|
4073
4071
|
tableHeadController: () => tableHeadController,
|
|
4074
4072
|
useAppProvider: () => useAppProvider,
|
|
4075
|
-
|
|
4073
|
+
useButton: () => import_hooks2.useButton,
|
|
4076
4074
|
useCallAction: () => useCallAction,
|
|
4075
|
+
useChangeStatus: () => import_hooks2.useChangeStatus,
|
|
4077
4076
|
useClickOutside: () => useClickOutside,
|
|
4077
|
+
useCompany: () => useCompany,
|
|
4078
4078
|
useConfig: () => useConfig,
|
|
4079
4079
|
useDebounce: () => useDebounce,
|
|
4080
|
+
useDelete: () => import_hooks2.useDelete,
|
|
4081
|
+
useDeleteComment: () => import_hooks2.useDeleteComment,
|
|
4080
4082
|
useDetail: () => useDetail,
|
|
4083
|
+
useDuplicateRecord: () => import_hooks2.useDuplicateRecord,
|
|
4084
|
+
useExecuteImport: () => import_hooks2.useExecuteImport,
|
|
4085
|
+
useExportExcel: () => import_hooks2.useExportExcel,
|
|
4086
|
+
useForgotPassword: () => import_hooks2.useForgotPassword,
|
|
4087
|
+
useForgotPasswordSSO: () => import_hooks2.useForgotPasswordSSO,
|
|
4088
|
+
useGet2FAMethods: () => import_hooks2.useGet2FAMethods,
|
|
4089
|
+
useGetAccessByCode: () => import_hooks2.useGetAccessByCode,
|
|
4090
|
+
useGetAction: () => useGetAction,
|
|
4091
|
+
useGetActionDetail: () => import_hooks2.useGetActionDetail,
|
|
4092
|
+
useGetAll: () => import_hooks2.useGetAll,
|
|
4093
|
+
useGetCalendar: () => import_hooks2.useGetCalendar,
|
|
4094
|
+
useGetComment: () => import_hooks2.useGetComment,
|
|
4095
|
+
useGetCompanyInfo: () => import_hooks2.useGetCompanyInfo,
|
|
4096
|
+
useGetConversionRate: () => import_hooks2.useGetConversionRate,
|
|
4097
|
+
useGetCurrency: () => import_hooks2.useGetCurrency,
|
|
4098
|
+
useGetCurrentCompany: () => import_hooks2.useGetCurrentCompany,
|
|
4099
|
+
useGetDetail: () => import_hooks2.useGetDetail,
|
|
4100
|
+
useGetFieldExport: () => import_hooks2.useGetFieldExport,
|
|
4101
|
+
useGetFieldOnChange: () => import_hooks2.useGetFieldOnChange,
|
|
4102
|
+
useGetFileExcel: () => import_hooks2.useGetFileExcel,
|
|
4103
|
+
useGetFormView: () => import_hooks2.useGetFormView,
|
|
4104
|
+
useGetGroups: () => import_hooks2.useGetGroups,
|
|
4105
|
+
useGetImage: () => import_hooks2.useGetImage,
|
|
4106
|
+
useGetListCompany: () => import_hooks2.useGetListCompany,
|
|
4107
|
+
useGetListData: () => import_hooks2.useGetListData,
|
|
4108
|
+
useGetListMyBankAccount: () => import_hooks2.useGetListMyBankAccount,
|
|
4109
|
+
useGetMenu: () => import_hooks2.useGetMenu,
|
|
4110
|
+
useGetPrintReport: () => import_hooks2.useGetPrintReport,
|
|
4111
|
+
useGetProGressBar: () => import_hooks2.useGetProGressBar,
|
|
4112
|
+
useGetProfile: () => import_hooks2.useGetProfile,
|
|
4113
|
+
useGetProvider: () => import_hooks2.useGetProvider,
|
|
4114
|
+
useGetResequence: () => import_hooks2.useGetResequence,
|
|
4081
4115
|
useGetRowIds: () => useGetRowIds,
|
|
4116
|
+
useGetSelection: () => import_hooks2.useGetSelection,
|
|
4117
|
+
useGetSpecification: () => useGetSpecification,
|
|
4118
|
+
useGetUser: () => import_hooks2.useGetUser,
|
|
4119
|
+
useGetView: () => import_hooks2.useGetView,
|
|
4120
|
+
useGrantAccess: () => import_hooks2.useGrantAccess,
|
|
4121
|
+
useIsValidToken: () => import_hooks2.useIsValidToken,
|
|
4082
4122
|
useListData: () => useListData,
|
|
4123
|
+
useLoadAction: () => import_hooks2.useLoadAction,
|
|
4124
|
+
useLoadMessage: () => import_hooks2.useLoadMessage,
|
|
4125
|
+
useLoginCredential: () => import_hooks2.useLoginCredential,
|
|
4126
|
+
useLoginSocial: () => import_hooks2.useLoginSocial,
|
|
4127
|
+
useLogout: () => import_hooks2.useLogout,
|
|
4083
4128
|
useMenu: () => useMenu,
|
|
4084
|
-
|
|
4129
|
+
useModel: () => import_hooks2.useModel,
|
|
4130
|
+
useOdooDataTransform: () => import_hooks2.useOdooDataTransform,
|
|
4131
|
+
useOnChangeForm: () => import_hooks2.useOnChangeForm,
|
|
4132
|
+
useParsePreview: () => import_hooks2.useParsePreview,
|
|
4133
|
+
usePrint: () => import_hooks2.usePrint,
|
|
4085
4134
|
useProfile: () => useProfile,
|
|
4135
|
+
useRemoveRow: () => import_hooks2.useRemoveRow,
|
|
4136
|
+
useRemoveTotpSetup: () => import_hooks2.useRemoveTotpSetup,
|
|
4137
|
+
useRequestSetupTotp: () => import_hooks2.useRequestSetupTotp,
|
|
4138
|
+
useResetPassword: () => import_hooks2.useResetPassword,
|
|
4139
|
+
useResetPasswordSSO: () => import_hooks2.useResetPasswordSSO,
|
|
4140
|
+
useRunAction: () => import_hooks2.useRunAction,
|
|
4141
|
+
useSave: () => import_hooks2.useSave,
|
|
4142
|
+
useSendComment: () => import_hooks2.useSendComment,
|
|
4143
|
+
useSettingsWebRead2fa: () => import_hooks2.useSettingsWebRead2fa,
|
|
4144
|
+
useSignInSSO: () => import_hooks2.useSignInSSO,
|
|
4086
4145
|
useStorageState: () => useStorageState,
|
|
4146
|
+
useSwitchLocale: () => import_hooks2.useSwitchLocale,
|
|
4147
|
+
useUpdatePassword: () => import_hooks2.useUpdatePassword,
|
|
4148
|
+
useUploadFile: () => import_hooks2.useUploadFile,
|
|
4149
|
+
useUploadFileExcel: () => import_hooks2.useUploadFileExcel,
|
|
4150
|
+
useUploadIdFile: () => import_hooks2.useUploadIdFile,
|
|
4151
|
+
useUploadImage: () => import_hooks2.useUploadImage,
|
|
4087
4152
|
useUser: () => useUser,
|
|
4153
|
+
useValidateActionToken: () => import_hooks2.useValidateActionToken,
|
|
4154
|
+
useVerify2FA: () => import_hooks2.useVerify2FA,
|
|
4155
|
+
useVerifyTotp: () => import_hooks2.useVerifyTotp,
|
|
4088
4156
|
useViewV2: () => useViewV2
|
|
4089
4157
|
});
|
|
4090
4158
|
module.exports = __toCommonJS(index_exports);
|
|
4091
4159
|
|
|
4092
4160
|
// src/hooks.ts
|
|
4093
|
-
var
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
useConfig: () => useConfig,
|
|
4101
|
-
useDebounce: () => useDebounce,
|
|
4102
|
-
useDetail: () => useDetail,
|
|
4103
|
-
useGetRowIds: () => useGetRowIds,
|
|
4104
|
-
useListData: () => useListData,
|
|
4105
|
-
useMenu: () => useMenu,
|
|
4106
|
-
useMenuItem: () => useMenuItem,
|
|
4107
|
-
useProfile: () => useProfile,
|
|
4108
|
-
useUser: () => useUser,
|
|
4109
|
-
useViewV2: () => useViewV2
|
|
4110
|
-
});
|
|
4161
|
+
var import_hooks2 = require("@fctc/interface-logic/hooks");
|
|
4162
|
+
|
|
4163
|
+
// src/hooks/core/use-app-provider.tsx
|
|
4164
|
+
var import_react8 = require("react");
|
|
4165
|
+
|
|
4166
|
+
// src/hooks/core/use-menu.ts
|
|
4167
|
+
var import_react2 = require("react");
|
|
4111
4168
|
|
|
4112
4169
|
// src/hooks/core/use-call-action.ts
|
|
4113
4170
|
var import_react = require("react");
|
|
4114
|
-
|
|
4115
|
-
|
|
4171
|
+
|
|
4172
|
+
// src/provider.ts
|
|
4173
|
+
var provider_exports = {};
|
|
4174
|
+
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
4175
|
+
|
|
4176
|
+
// src/hooks/core/use-call-action.ts
|
|
4116
4177
|
var useCallAction = () => {
|
|
4117
|
-
const
|
|
4118
|
-
const
|
|
4119
|
-
const
|
|
4120
|
-
const
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4178
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
4179
|
+
const { useLoadAction: useLoadAction2, useRunAction: useRunAction2 } = (0, provider_exports.useService)();
|
|
4180
|
+
const queryLoadAction = useLoadAction2();
|
|
4181
|
+
const queryRunAction = useRunAction2();
|
|
4182
|
+
const [actionData, setActionData] = (0, import_react.useState)(
|
|
4183
|
+
void 0
|
|
4184
|
+
);
|
|
4185
|
+
const callAction = (0, import_react.useCallback)(
|
|
4186
|
+
async ({
|
|
4187
|
+
aid
|
|
4188
|
+
}) => {
|
|
4189
|
+
try {
|
|
4190
|
+
const loadRes = await queryLoadAction.mutateAsync({
|
|
4191
|
+
idAction: aid,
|
|
4192
|
+
context: env.context
|
|
4193
|
+
});
|
|
4194
|
+
if (loadRes?.result?.type === "ir.actions.server") {
|
|
4195
|
+
const runRes = await queryRunAction.mutateAsync({
|
|
4196
|
+
idAction: aid,
|
|
4197
|
+
context: env.context
|
|
4198
|
+
});
|
|
4199
|
+
setActionData(runRes?.result);
|
|
4200
|
+
return runRes?.result;
|
|
4201
|
+
} else {
|
|
4202
|
+
setActionData(loadRes?.result);
|
|
4203
|
+
return loadRes?.result;
|
|
4204
|
+
}
|
|
4205
|
+
} catch (err) {
|
|
4206
|
+
console.error("callAction error:", err);
|
|
4207
|
+
return void 0;
|
|
4208
|
+
}
|
|
4209
|
+
},
|
|
4210
|
+
[env?.context?.lang]
|
|
4211
|
+
);
|
|
4212
|
+
return [actionData, callAction];
|
|
4141
4213
|
};
|
|
4142
4214
|
|
|
4143
|
-
// src/hooks/core/use-
|
|
4144
|
-
var
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
const
|
|
4149
|
-
const
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
env.setupEnv({
|
|
4177
|
-
baseUrl: envConfig.baseUrl,
|
|
4178
|
-
port: 3e3,
|
|
4179
|
-
config: {
|
|
4180
|
-
grantType: envConfig.config.grantType,
|
|
4181
|
-
clientId: envConfig.config.clientId,
|
|
4182
|
-
clientSecret: envConfig.config.clientSecret
|
|
4183
|
-
},
|
|
4184
|
-
db: "preschool",
|
|
4185
|
-
localStorageUtils: localStorageUtils(),
|
|
4186
|
-
sessionStorageUtils: sessionStorageUtils()
|
|
4215
|
+
// src/hooks/core/use-menu.ts
|
|
4216
|
+
var useMenu = ({
|
|
4217
|
+
context,
|
|
4218
|
+
specification
|
|
4219
|
+
}) => {
|
|
4220
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
4221
|
+
const { useGetMenu: useGetMenu2 } = (0, provider_exports.useService)();
|
|
4222
|
+
const [action, callAction] = useCallAction();
|
|
4223
|
+
const menuData = useGetMenu2(context, specification, !!context);
|
|
4224
|
+
const [menuId, setMenuId] = (0, import_react2.useState)(void 0);
|
|
4225
|
+
const configedIconData = (0, import_react2.useMemo)(() => {
|
|
4226
|
+
const data = menuData.data;
|
|
4227
|
+
return data?.map((item) => {
|
|
4228
|
+
return {
|
|
4229
|
+
...item,
|
|
4230
|
+
child_id: item?.child_id?.map((child) => {
|
|
4231
|
+
return {
|
|
4232
|
+
...child,
|
|
4233
|
+
url_icon: env?.envFile?.VITE_APP_DOMAIN + "/" + child.url_icon
|
|
4234
|
+
};
|
|
4235
|
+
}) ?? [],
|
|
4236
|
+
url_icon: env?.envFile?.VITE_APP_DOMAIN + "/" + item.url_icon
|
|
4237
|
+
};
|
|
4238
|
+
});
|
|
4239
|
+
}, [menuData.data, env?.envFile?.VITE_APP_DOMAIN]);
|
|
4240
|
+
const handleChangeMenu = async ({ menu }) => {
|
|
4241
|
+
const aidMenu = menu?.action?.id?.id;
|
|
4242
|
+
if (menu) {
|
|
4243
|
+
setMenuId(menu.id?.toString() ?? "");
|
|
4244
|
+
}
|
|
4245
|
+
if (aidMenu) {
|
|
4246
|
+
const actionResponse = await callAction({
|
|
4247
|
+
aid: Number(aidMenu)
|
|
4187
4248
|
});
|
|
4188
|
-
|
|
4189
|
-
} catch (error) {
|
|
4190
|
-
console.error("Error loading env or config:", error);
|
|
4249
|
+
return actionResponse;
|
|
4191
4250
|
}
|
|
4192
|
-
}
|
|
4193
|
-
return {
|
|
4251
|
+
};
|
|
4252
|
+
return {
|
|
4253
|
+
...menuData,
|
|
4254
|
+
data: configedIconData,
|
|
4255
|
+
action: { handleChangeMenu },
|
|
4256
|
+
state: { menuId, action },
|
|
4257
|
+
context,
|
|
4258
|
+
isLoading: menuData.isLoading,
|
|
4259
|
+
isError: menuData.isError,
|
|
4260
|
+
error: menuData.error,
|
|
4261
|
+
refetch: menuData.refetch
|
|
4262
|
+
};
|
|
4194
4263
|
};
|
|
4195
4264
|
|
|
4196
4265
|
// src/hooks/core/use-detail.ts
|
|
4197
|
-
var import_store2 = require("@fctc/interface-logic/store");
|
|
4198
4266
|
var import_react_query = require("@tanstack/react-query");
|
|
4199
4267
|
var import_react3 = require("react");
|
|
4200
|
-
var
|
|
4201
|
-
|
|
4202
|
-
const
|
|
4203
|
-
const fetchGetDetail = (
|
|
4268
|
+
var useDetail = (sub) => {
|
|
4269
|
+
const { setUserInfo, env } = (0, provider_exports.useEnv)();
|
|
4270
|
+
const { useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
|
|
4271
|
+
const fetchGetDetail = useGetDetail2();
|
|
4204
4272
|
const userDetailQuery = (0, import_react_query.useQuery)({
|
|
4205
|
-
queryKey: ["userDetailQuery", sub
|
|
4273
|
+
queryKey: ["userDetailQuery", sub],
|
|
4206
4274
|
queryFn: () => {
|
|
4207
4275
|
return fetchGetDetail.mutateAsync({
|
|
4208
4276
|
model: "res.users",
|
|
@@ -4210,21 +4278,41 @@ var useDetail = (accessToken, sub) => {
|
|
|
4210
4278
|
specification: { image_256: {} }
|
|
4211
4279
|
});
|
|
4212
4280
|
},
|
|
4213
|
-
enabled: !!sub
|
|
4281
|
+
enabled: !!sub
|
|
4214
4282
|
});
|
|
4215
4283
|
(0, import_react3.useEffect)(() => {
|
|
4216
4284
|
if (userDetailQuery.data) {
|
|
4217
4285
|
const userPicture = userDetailQuery.data;
|
|
4218
|
-
|
|
4219
|
-
(0, import_store2.setProfile)({ ...userPicture, image: userPicture?.[0]?.image_256 })
|
|
4220
|
-
);
|
|
4286
|
+
setUserInfo({ ...env?.user, image: userPicture?.[0]?.image_256 });
|
|
4221
4287
|
}
|
|
4222
|
-
}, [userDetailQuery.
|
|
4223
|
-
return userDetailQuery;
|
|
4288
|
+
}, [userDetailQuery.isFetched]);
|
|
4289
|
+
return { ...userDetailQuery };
|
|
4224
4290
|
};
|
|
4225
4291
|
|
|
4226
|
-
// src/hooks/core/use-
|
|
4292
|
+
// src/hooks/core/use-profile.ts
|
|
4293
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
4227
4294
|
var import_react5 = require("react");
|
|
4295
|
+
var import_react_i18next = require("react-i18next");
|
|
4296
|
+
|
|
4297
|
+
// src/utils.ts
|
|
4298
|
+
var utils_exports = {};
|
|
4299
|
+
__export(utils_exports, {
|
|
4300
|
+
STORAGES: () => STORAGES,
|
|
4301
|
+
combineContexts: () => combineContexts,
|
|
4302
|
+
convertFieldsToArray: () => convertFieldsToArray,
|
|
4303
|
+
countSum: () => countSum,
|
|
4304
|
+
getDateRange: () => getDateRange,
|
|
4305
|
+
languages: () => languages,
|
|
4306
|
+
mergeButtons: () => mergeButtons,
|
|
4307
|
+
setStorageItemAsync: () => setStorageItemAsync,
|
|
4308
|
+
useStorageState: () => useStorageState
|
|
4309
|
+
});
|
|
4310
|
+
|
|
4311
|
+
// src/utils/constants.ts
|
|
4312
|
+
var languages = [
|
|
4313
|
+
{ id: "vi_VN", name: "VIE" },
|
|
4314
|
+
{ id: "en_US", name: "ENG" }
|
|
4315
|
+
];
|
|
4228
4316
|
|
|
4229
4317
|
// src/utils/function.ts
|
|
4230
4318
|
var import_react4 = require("react");
|
|
@@ -4384,180 +4472,31 @@ function useStorageState(key) {
|
|
|
4384
4472
|
return [state, setValue];
|
|
4385
4473
|
}
|
|
4386
4474
|
|
|
4387
|
-
// src/
|
|
4388
|
-
|
|
4389
|
-
var import_store3 = require("@fctc/interface-logic/store");
|
|
4390
|
-
var import_utils = require("@fctc/interface-logic/utils");
|
|
4391
|
-
var useListData = ({
|
|
4392
|
-
action,
|
|
4393
|
-
context,
|
|
4394
|
-
viewResponse
|
|
4395
|
-
}) => {
|
|
4396
|
-
const { groupByDomain } = (0, import_store3.useAppSelector)(import_store3.selectSearch);
|
|
4397
|
-
const initModel = (0, import_hooks3.useModel)();
|
|
4398
|
-
const [type, setType] = (0, import_react5.useState)("list");
|
|
4399
|
-
const [mode, setMode] = (0, import_react5.useState)("month");
|
|
4400
|
-
const [currentDate, setCurrentDate] = (0, import_react5.useState)(/* @__PURE__ */ new Date());
|
|
4401
|
-
const { pageLimit, page, order } = (0, import_store3.useAppSelector)(import_store3.selectList);
|
|
4402
|
-
const listDataProps = (0, import_react5.useMemo)(() => {
|
|
4403
|
-
const actData = action?.result;
|
|
4404
|
-
if (!viewResponse || !actData || !context) {
|
|
4405
|
-
return null;
|
|
4406
|
-
}
|
|
4407
|
-
const specification = initModel.initModel({
|
|
4408
|
-
name: String(actData.res_model),
|
|
4409
|
-
view: viewResponse || {},
|
|
4410
|
-
actContext: context,
|
|
4411
|
-
fields: type === "kanban" ? viewResponse?.views?.kanban?.fields : type === "calendar" ? viewResponse?.views?.calendar?.fields : viewResponse?.views?.list?.fields
|
|
4412
|
-
}).getSpecification();
|
|
4413
|
-
const domain = type === "calendar" ? getDateRange(currentDate, mode) : actData?.domain ? Array.isArray(actData?.domain) ? [...actData?.domain] : (0, import_utils.evalJSONDomain)(actData?.domain, context) : [];
|
|
4414
|
-
const limit = type === "calendar" ? 2500 : pageLimit;
|
|
4415
|
-
const offset = page * pageLimit;
|
|
4416
|
-
const fields = type === "calendar" ? convertFieldsToArray(viewResponse?.views?.calendar?.fields) || [] : typeof groupByDomain === "object" ? groupByDomain?.fields : void 0;
|
|
4417
|
-
const groupby = typeof groupByDomain === "object" ? [groupByDomain?.contexts?.[0]?.group_by] : [];
|
|
4418
|
-
const sort = order ? order : viewResponse?.views?.list?.default_order ? (0, import_utils.formatSortingString)(viewResponse?.views?.list?.default_order) : "";
|
|
4419
|
-
return {
|
|
4420
|
-
model: actData.res_model,
|
|
4421
|
-
specification,
|
|
4422
|
-
domain,
|
|
4423
|
-
limit,
|
|
4424
|
-
offset,
|
|
4425
|
-
fields,
|
|
4426
|
-
groupby,
|
|
4427
|
-
context,
|
|
4428
|
-
sort,
|
|
4429
|
-
type
|
|
4430
|
-
};
|
|
4431
|
-
}, [
|
|
4432
|
-
action?.result,
|
|
4433
|
-
context,
|
|
4434
|
-
currentDate,
|
|
4435
|
-
groupByDomain,
|
|
4436
|
-
initModel,
|
|
4437
|
-
mode,
|
|
4438
|
-
order,
|
|
4439
|
-
page,
|
|
4440
|
-
pageLimit,
|
|
4441
|
-
type,
|
|
4442
|
-
viewResponse
|
|
4443
|
-
]);
|
|
4444
|
-
const list = (0, import_hooks3.useGetListData)(
|
|
4445
|
-
listDataProps,
|
|
4446
|
-
[listDataProps],
|
|
4447
|
-
!!listDataProps
|
|
4448
|
-
);
|
|
4449
|
-
return {
|
|
4450
|
-
...list,
|
|
4451
|
-
state: {
|
|
4452
|
-
type,
|
|
4453
|
-
setType,
|
|
4454
|
-
mode,
|
|
4455
|
-
setMode,
|
|
4456
|
-
currentDate,
|
|
4457
|
-
setCurrentDate
|
|
4458
|
-
}
|
|
4459
|
-
};
|
|
4460
|
-
};
|
|
4461
|
-
|
|
4462
|
-
// src/hooks/core/use-menu.ts
|
|
4463
|
-
var import_react6 = require("react");
|
|
4464
|
-
|
|
4465
|
-
// src/utils/constants.ts
|
|
4466
|
-
var languages = [
|
|
4467
|
-
{ id: "vi_VN", name: "VIE" },
|
|
4468
|
-
{ id: "en_US", name: "ENG" }
|
|
4469
|
-
];
|
|
4470
|
-
var API_PRESCHOOL_URL = {
|
|
4471
|
-
baseURL: "https://preschool.vitrust.app"
|
|
4472
|
-
};
|
|
4473
|
-
var API_APP_URL = {
|
|
4474
|
-
baseUrl: "https://api.vitrust.app",
|
|
4475
|
-
c2: "https://api.vitrust.app/c2",
|
|
4476
|
-
apiV2: "https://api.vitrust.app/c2/api/v2"
|
|
4477
|
-
};
|
|
4478
|
-
|
|
4479
|
-
// src/hooks/core/use-menu.ts
|
|
4480
|
-
var import_hooks4 = require("@fctc/interface-logic/hooks");
|
|
4481
|
-
var useMenu = ({ context }) => {
|
|
4482
|
-
const menuData = (0, import_hooks4.useGetMenu)(context, !!context);
|
|
4483
|
-
const [menuid, setMenuId] = (0, import_react6.useState)(void 0);
|
|
4484
|
-
const [action, setAction] = useCallAction();
|
|
4485
|
-
const configedIconData = (0, import_react6.useMemo)(() => {
|
|
4486
|
-
const data = menuData.data;
|
|
4487
|
-
return data?.map((item) => {
|
|
4488
|
-
return {
|
|
4489
|
-
...item,
|
|
4490
|
-
child_id: item?.child_id?.map((child) => {
|
|
4491
|
-
return {
|
|
4492
|
-
...child,
|
|
4493
|
-
url_icon: API_APP_URL.c2 + "/" + child.url_icon
|
|
4494
|
-
};
|
|
4495
|
-
}) ?? [],
|
|
4496
|
-
url_icon: API_APP_URL.c2 + "/" + item.url_icon
|
|
4497
|
-
};
|
|
4498
|
-
});
|
|
4499
|
-
}, [menuData.data]);
|
|
4500
|
-
const handleChangeMenu = async ({
|
|
4501
|
-
menu,
|
|
4502
|
-
subMenu
|
|
4503
|
-
}) => {
|
|
4504
|
-
const aid = subMenu?.action?.id?.id;
|
|
4505
|
-
const actionType = subMenu?.action?.type;
|
|
4506
|
-
await setAction({
|
|
4507
|
-
aid: Number(aid),
|
|
4508
|
-
actionType
|
|
4509
|
-
});
|
|
4510
|
-
if (menu) {
|
|
4511
|
-
setMenuId(menu.id?.toString() ?? "");
|
|
4512
|
-
}
|
|
4513
|
-
};
|
|
4514
|
-
(0, import_react6.useEffect)(() => {
|
|
4515
|
-
const firstRecord = configedIconData?.[0];
|
|
4516
|
-
const firstChild = firstRecord?.child_id?.[0];
|
|
4517
|
-
if (firstChild && firstRecord) {
|
|
4518
|
-
handleChangeMenu({ menu: firstRecord, subMenu: firstChild });
|
|
4519
|
-
}
|
|
4520
|
-
}, [configedIconData]);
|
|
4521
|
-
return {
|
|
4522
|
-
...menuData,
|
|
4523
|
-
data: configedIconData,
|
|
4524
|
-
action: { handleChangeMenu },
|
|
4525
|
-
state: { menuid, action },
|
|
4526
|
-
context
|
|
4527
|
-
};
|
|
4528
|
-
};
|
|
4475
|
+
// src/utils.ts
|
|
4476
|
+
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4529
4477
|
|
|
4530
4478
|
// src/hooks/core/use-profile.ts
|
|
4531
|
-
var
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
var import_hooks5 = require("@fctc/interface-logic/hooks");
|
|
4536
|
-
var import_store4 = require("@fctc/interface-logic/store");
|
|
4537
|
-
var useProfile = (accessToken) => {
|
|
4538
|
-
const getProfile = (0, import_hooks5.useGetProfile)();
|
|
4539
|
-
const dispatch = (0, import_store4.useAppDispatch)();
|
|
4479
|
+
var useProfile = () => {
|
|
4480
|
+
const { setUid, setLang, setUserInfo, env } = (0, provider_exports.useEnv)();
|
|
4481
|
+
const { useGetProfile: useGetProfile2 } = (0, provider_exports.useService)();
|
|
4482
|
+
const getProfile = useGetProfile2();
|
|
4540
4483
|
const { i18n: i18n2 } = (0, import_react_i18next.useTranslation)();
|
|
4541
|
-
const fetchUserProfile = async () => {
|
|
4542
|
-
return await getProfile.mutateAsync();
|
|
4543
|
-
};
|
|
4544
4484
|
const userInfoQuery = (0, import_react_query2.useQuery)({
|
|
4545
|
-
queryKey: ["userInfo"
|
|
4546
|
-
queryFn:
|
|
4547
|
-
enabled:
|
|
4485
|
+
queryKey: ["userInfo"],
|
|
4486
|
+
queryFn: () => getProfile.mutateAsync(),
|
|
4487
|
+
enabled: (0, utils_exports.isObjectEmpty)(env?.user)
|
|
4548
4488
|
});
|
|
4549
|
-
(0,
|
|
4489
|
+
(0, import_react5.useEffect)(() => {
|
|
4550
4490
|
if (userInfoQuery.data) {
|
|
4551
4491
|
const userInfo = userInfoQuery.data;
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
dispatch((0, import_store4.setDataUser)(userInfo));
|
|
4492
|
+
setUid(userInfo?.sub);
|
|
4493
|
+
setUserInfo(userInfo);
|
|
4555
4494
|
const userLocale = languages.find((lang) => lang?.id === userInfo?.locale);
|
|
4556
|
-
|
|
4495
|
+
setLang(userLocale?.id);
|
|
4557
4496
|
i18n2.changeLanguage(userLocale?.id.split("_")[0]);
|
|
4558
4497
|
}
|
|
4559
|
-
}, [
|
|
4560
|
-
const context = (0,
|
|
4498
|
+
}, [userInfoQuery.isFetched]);
|
|
4499
|
+
const context = (0, import_react5.useMemo)(() => {
|
|
4561
4500
|
if (userInfoQuery.data?.sub && userInfoQuery.data?.locale) {
|
|
4562
4501
|
return {
|
|
4563
4502
|
uid: Number(userInfoQuery.data.sub),
|
|
@@ -4567,44 +4506,42 @@ var useProfile = (accessToken) => {
|
|
|
4567
4506
|
};
|
|
4568
4507
|
}
|
|
4569
4508
|
return void 0;
|
|
4570
|
-
}, [userInfoQuery.
|
|
4509
|
+
}, [userInfoQuery.isFetched]);
|
|
4510
|
+
if (userInfoQuery.isLoading || !userInfoQuery.data) {
|
|
4511
|
+
return null;
|
|
4512
|
+
}
|
|
4571
4513
|
return { ...userInfoQuery, context };
|
|
4572
4514
|
};
|
|
4573
4515
|
|
|
4574
4516
|
// src/hooks/core/use-user.ts
|
|
4575
|
-
var useUser = (
|
|
4576
|
-
const userProfile = useProfile(
|
|
4577
|
-
const userDetail = useDetail(
|
|
4578
|
-
return { userProfile, userDetail, context: userProfile
|
|
4517
|
+
var useUser = () => {
|
|
4518
|
+
const userProfile = useProfile();
|
|
4519
|
+
const userDetail = useDetail(userProfile?.data?.sub);
|
|
4520
|
+
return { userProfile, userDetail, context: userProfile?.context };
|
|
4579
4521
|
};
|
|
4580
4522
|
|
|
4581
4523
|
// src/hooks/core/use-view-v2.ts
|
|
4582
|
-
var
|
|
4583
|
-
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
4524
|
+
var import_react6 = require("react");
|
|
4584
4525
|
var useViewV2 = ({
|
|
4585
4526
|
action,
|
|
4586
|
-
context
|
|
4527
|
+
context,
|
|
4528
|
+
aid,
|
|
4529
|
+
views,
|
|
4530
|
+
model
|
|
4587
4531
|
}) => {
|
|
4588
|
-
const
|
|
4589
|
-
|
|
4532
|
+
const { useGetView: useGetView2 } = (0, provider_exports.useService)();
|
|
4533
|
+
const viewParams = (0, import_react6.useMemo)(() => {
|
|
4534
|
+
if (!action) {
|
|
4590
4535
|
return void 0;
|
|
4591
4536
|
}
|
|
4592
|
-
const actionResult = action?.result;
|
|
4593
4537
|
return {
|
|
4594
|
-
model
|
|
4595
|
-
views
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
) : [],
|
|
4599
|
-
[
|
|
4600
|
-
Array.isArray(actionResult?.search_view_id) ? actionResult?.search_view_id[0] : actionResult?.search_view_id,
|
|
4601
|
-
"search"
|
|
4602
|
-
]
|
|
4603
|
-
],
|
|
4604
|
-
context
|
|
4538
|
+
model,
|
|
4539
|
+
views,
|
|
4540
|
+
context,
|
|
4541
|
+
id: isNaN(Number(aid)) ? action?.id : aid
|
|
4605
4542
|
};
|
|
4606
|
-
}, [action, context]);
|
|
4607
|
-
const view = (
|
|
4543
|
+
}, [action, context, aid]);
|
|
4544
|
+
const view = useGetView2(
|
|
4608
4545
|
viewParams || {},
|
|
4609
4546
|
!!viewParams
|
|
4610
4547
|
);
|
|
@@ -4614,149 +4551,117 @@ var useViewV2 = ({
|
|
|
4614
4551
|
};
|
|
4615
4552
|
};
|
|
4616
4553
|
|
|
4617
|
-
// src/hooks/core/use-auth.ts
|
|
4618
|
-
var import_hooks7 = require("@fctc/interface-logic/hooks");
|
|
4619
|
-
var import_store5 = require("@fctc/interface-logic/store");
|
|
4620
|
-
var useAuth = () => {
|
|
4621
|
-
const [[isLoading, accessToken], setAccessToken] = useStorageState("TOKEN");
|
|
4622
|
-
const loginMutate = (0, import_hooks7.useLoginCredential)();
|
|
4623
|
-
const dispatch = (0, import_store5.useAppDispatch)();
|
|
4624
|
-
const signIn = async (email, password) => {
|
|
4625
|
-
try {
|
|
4626
|
-
loginMutate.mutate(
|
|
4627
|
-
{
|
|
4628
|
-
email,
|
|
4629
|
-
password,
|
|
4630
|
-
path: "/authentication/oauth2/token"
|
|
4631
|
-
},
|
|
4632
|
-
{
|
|
4633
|
-
onSuccess: (res) => {
|
|
4634
|
-
},
|
|
4635
|
-
onError: (err) => {
|
|
4636
|
-
}
|
|
4637
|
-
}
|
|
4638
|
-
);
|
|
4639
|
-
} catch (error) {
|
|
4640
|
-
throw new Error("Login failed");
|
|
4641
|
-
}
|
|
4642
|
-
};
|
|
4643
|
-
const signOut = async () => {
|
|
4644
|
-
dispatch((0, import_store5.setMenuList)([]));
|
|
4645
|
-
dispatch((0, import_store5.setDataUser)({}));
|
|
4646
|
-
dispatch((0, import_store5.setProfile)({}));
|
|
4647
|
-
setAccessToken(null);
|
|
4648
|
-
};
|
|
4649
|
-
return {
|
|
4650
|
-
signIn,
|
|
4651
|
-
signOut,
|
|
4652
|
-
accessToken,
|
|
4653
|
-
isLoading
|
|
4654
|
-
};
|
|
4655
|
-
};
|
|
4656
|
-
|
|
4657
|
-
// src/hooks/core/use-app-provider.tsx
|
|
4658
|
-
var import_react10 = require("react");
|
|
4659
|
-
|
|
4660
4554
|
// src/hooks/core/use-company.ts
|
|
4661
4555
|
var import_react_query3 = require("@tanstack/react-query");
|
|
4662
|
-
var
|
|
4663
|
-
var
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
const getCurrentCompany = (
|
|
4556
|
+
var import_react7 = require("react");
|
|
4557
|
+
var useCompany = () => {
|
|
4558
|
+
const { setAllowCompanies, setCompanies, setDefaultCompany, env } = (0, provider_exports.useEnv)();
|
|
4559
|
+
const { useGetCurrentCompany: useGetCurrentCompany2, useGetCompanyInfo: useGetCompanyInfo2 } = (0, provider_exports.useService)();
|
|
4560
|
+
const getCurrentCompany = useGetCurrentCompany2();
|
|
4667
4561
|
const fetchCurrentCompany = async () => {
|
|
4668
4562
|
return await getCurrentCompany.mutateAsync();
|
|
4669
4563
|
};
|
|
4670
4564
|
const currentCompany = (0, import_react_query3.useQuery)({
|
|
4671
|
-
queryKey: ["currentCompany"
|
|
4565
|
+
queryKey: ["currentCompany"],
|
|
4672
4566
|
queryFn: fetchCurrentCompany,
|
|
4673
|
-
enabled: !!
|
|
4567
|
+
enabled: !!env?.defaultCompany
|
|
4674
4568
|
});
|
|
4675
|
-
const current_company_id = (0,
|
|
4569
|
+
const current_company_id = (0, import_react7.useMemo)(() => {
|
|
4676
4570
|
return currentCompany.data?.current_company_id;
|
|
4677
4571
|
}, [currentCompany.data]);
|
|
4678
|
-
(0,
|
|
4572
|
+
(0, import_react7.useEffect)(() => {
|
|
4679
4573
|
if (current_company_id) {
|
|
4680
4574
|
const companyIDs = [current_company_id];
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
env.setCompanies(companyIDs);
|
|
4575
|
+
setAllowCompanies([...companyIDs]);
|
|
4576
|
+
setCompanies(companyIDs);
|
|
4684
4577
|
}
|
|
4685
4578
|
}, [current_company_id]);
|
|
4686
|
-
const getCompanyInfo = (
|
|
4579
|
+
const getCompanyInfo = useGetCompanyInfo2();
|
|
4687
4580
|
const companyInfo = (0, import_react_query3.useQuery)({
|
|
4688
|
-
queryKey: ["companyInfoQuery", current_company_id
|
|
4581
|
+
queryKey: ["companyInfoQuery", current_company_id],
|
|
4689
4582
|
queryFn: () => getCompanyInfo.mutateAsync(Number(current_company_id)),
|
|
4690
|
-
enabled: !!current_company_id
|
|
4583
|
+
enabled: !!current_company_id
|
|
4691
4584
|
});
|
|
4692
|
-
(0,
|
|
4585
|
+
(0, import_react7.useEffect)(() => {
|
|
4693
4586
|
if (companyInfo.data) {
|
|
4694
4587
|
const companyInfoData = companyInfo.data;
|
|
4695
4588
|
if (companyInfoData?.length) {
|
|
4696
|
-
|
|
4697
|
-
env.setDefaultCompany(companyInfoData[0]);
|
|
4589
|
+
setDefaultCompany(companyInfoData[0]);
|
|
4698
4590
|
}
|
|
4699
4591
|
}
|
|
4700
4592
|
}, [companyInfo.data]);
|
|
4593
|
+
if (!companyInfo?.data || !currentCompany?.data) return;
|
|
4701
4594
|
return {
|
|
4702
|
-
currentCompany,
|
|
4703
|
-
companyInfo,
|
|
4595
|
+
currentCompany: { ...currentCompany },
|
|
4596
|
+
companyInfo: { ...companyInfo },
|
|
4704
4597
|
context: { allowed_company_ids: [current_company_id] }
|
|
4705
4598
|
};
|
|
4706
4599
|
};
|
|
4707
|
-
var use_company_default = useCompany;
|
|
4708
4600
|
|
|
4709
4601
|
// src/hooks/core/use-app-provider.tsx
|
|
4710
|
-
var import_utils2 = require("@fctc/interface-logic/utils");
|
|
4711
4602
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4712
4603
|
var AppProviderInitialValue = {
|
|
4713
|
-
config: {},
|
|
4714
4604
|
user: {},
|
|
4715
|
-
auth: {},
|
|
4716
4605
|
company: {},
|
|
4717
4606
|
action: {},
|
|
4718
4607
|
menu: {},
|
|
4719
|
-
view: {}
|
|
4720
|
-
list: {}
|
|
4608
|
+
view: {}
|
|
4721
4609
|
};
|
|
4722
|
-
var ReactContext = (0,
|
|
4723
|
-
var AppProvider = ({
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
const
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
const
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4610
|
+
var ReactContext = (0, import_react8.createContext)(AppProviderInitialValue);
|
|
4611
|
+
var AppProvider = ({
|
|
4612
|
+
children,
|
|
4613
|
+
menuSpecification,
|
|
4614
|
+
aid
|
|
4615
|
+
}) => {
|
|
4616
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
4617
|
+
const user = useUser();
|
|
4618
|
+
const company = useCompany();
|
|
4619
|
+
const menuContext = (0, import_react8.useMemo)(() => {
|
|
4620
|
+
return combineContexts([
|
|
4621
|
+
{
|
|
4622
|
+
...user?.context,
|
|
4623
|
+
...!(0, utils_exports.isObjectEmpty)(env?.user) && company?.context?.allowed_company_ids ? { lang: env?.context?.lang } : {}
|
|
4624
|
+
},
|
|
4625
|
+
company?.context
|
|
4626
|
+
]);
|
|
4627
|
+
}, [user?.context, company?.context]);
|
|
4628
|
+
const menu = useMenu({
|
|
4629
|
+
context: {
|
|
4630
|
+
...menuContext
|
|
4631
|
+
},
|
|
4632
|
+
specification: menuSpecification
|
|
4633
|
+
});
|
|
4634
|
+
const action = (0, import_react8.useMemo)(() => {
|
|
4635
|
+
return menu?.state?.action;
|
|
4636
|
+
}, [menu?.state?.action, env?.context?.lang]);
|
|
4637
|
+
const viewContext = (0, import_react8.useMemo)(() => {
|
|
4736
4638
|
return combineContexts([
|
|
4737
4639
|
menuContext,
|
|
4738
|
-
{ ...(0,
|
|
4640
|
+
{ ...(0, utils_exports.evalJSONContext)(action?.context) }
|
|
4739
4641
|
]);
|
|
4740
|
-
}, [menuContext, action?.
|
|
4642
|
+
}, [menuContext, action?.context, env?.context?.lang]);
|
|
4741
4643
|
const view = useViewV2({
|
|
4742
4644
|
action,
|
|
4743
|
-
context: viewContext
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4645
|
+
context: viewContext,
|
|
4646
|
+
aid,
|
|
4647
|
+
views: [
|
|
4648
|
+
...Array.isArray(action?.views) ? action?.views.map(
|
|
4649
|
+
(view2) => view2[1] === "list" ? [view2[0], "list"] : view2
|
|
4650
|
+
) : [],
|
|
4651
|
+
[
|
|
4652
|
+
Array.isArray(action?.search_view_id) ? action?.search_view_id[0] : action?.search_view_id,
|
|
4653
|
+
"search"
|
|
4654
|
+
]
|
|
4655
|
+
],
|
|
4656
|
+
model: String(action?.res_model)
|
|
4749
4657
|
});
|
|
4750
4658
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4751
4659
|
ReactContext.Provider,
|
|
4752
4660
|
{
|
|
4753
4661
|
value: {
|
|
4754
|
-
config,
|
|
4755
|
-
auth,
|
|
4756
4662
|
user,
|
|
4757
4663
|
company,
|
|
4758
4664
|
menu,
|
|
4759
|
-
list,
|
|
4760
4665
|
action,
|
|
4761
4666
|
view
|
|
4762
4667
|
},
|
|
@@ -4765,74 +4670,164 @@ var AppProvider = ({ children }) => {
|
|
|
4765
4670
|
);
|
|
4766
4671
|
};
|
|
4767
4672
|
var useAppProvider = () => {
|
|
4768
|
-
const context = (0,
|
|
4673
|
+
const context = (0, import_react8.useContext)(ReactContext);
|
|
4769
4674
|
if (!context) {
|
|
4770
4675
|
return AppProviderInitialValue;
|
|
4771
4676
|
}
|
|
4772
4677
|
return context;
|
|
4773
4678
|
};
|
|
4774
4679
|
|
|
4775
|
-
// src/hooks/core/use-
|
|
4776
|
-
var
|
|
4777
|
-
var
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
})
|
|
4795
|
-
|
|
4680
|
+
// src/hooks/core/use-config.ts
|
|
4681
|
+
var import_react9 = require("react");
|
|
4682
|
+
var useConfig = ({
|
|
4683
|
+
envConfig,
|
|
4684
|
+
config,
|
|
4685
|
+
localStorageUtils,
|
|
4686
|
+
sessionStorageUtils
|
|
4687
|
+
}) => {
|
|
4688
|
+
const { setupEnv, setEnvFile } = (0, provider_exports.useEnv)();
|
|
4689
|
+
(0, import_react9.useEffect)(() => {
|
|
4690
|
+
try {
|
|
4691
|
+
setupEnv({
|
|
4692
|
+
baseUrl: envConfig.baseUrl,
|
|
4693
|
+
config: envConfig.config,
|
|
4694
|
+
default_service: "",
|
|
4695
|
+
localStorageUtils: localStorageUtils && localStorageUtils(),
|
|
4696
|
+
sessionStorageUtils: localStorageUtils && sessionStorageUtils()
|
|
4697
|
+
});
|
|
4698
|
+
setEnvFile(config);
|
|
4699
|
+
} catch (error) {
|
|
4700
|
+
console.error("Error loading env or config:", error);
|
|
4701
|
+
}
|
|
4702
|
+
}, [envConfig, config]);
|
|
4703
|
+
return { envConfig, config };
|
|
4704
|
+
};
|
|
4796
4705
|
|
|
4797
|
-
// src/hooks/core/use-
|
|
4798
|
-
var
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
const
|
|
4803
|
-
const
|
|
4804
|
-
const
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
model,
|
|
4808
|
-
context,
|
|
4809
|
-
enabled: true,
|
|
4810
|
-
queryKey: [`action-${aid}`]
|
|
4811
|
-
}).data;
|
|
4812
|
-
const [path, setPath] = (0, import_react11.useState)("");
|
|
4813
|
-
const handleClick = () => {
|
|
4814
|
-
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4815
|
-
return;
|
|
4706
|
+
// src/hooks/core/use-get-action.ts
|
|
4707
|
+
var useGetAction = ({
|
|
4708
|
+
aid,
|
|
4709
|
+
context
|
|
4710
|
+
}) => {
|
|
4711
|
+
const { useLoadAction: useLoadAction2, useRunAction: useRunAction2 } = (0, provider_exports.useService)();
|
|
4712
|
+
const queryLoadAction = useLoadAction2();
|
|
4713
|
+
const queryRunAction = useRunAction2();
|
|
4714
|
+
const handleActionResult = (data) => {
|
|
4715
|
+
if (data && data.result && data.result.views && Array.isArray(data.result.views) && data.result.views.length > 0) {
|
|
4816
4716
|
}
|
|
4817
|
-
|
|
4818
|
-
|
|
4717
|
+
};
|
|
4718
|
+
const onLoadAction = () => {
|
|
4719
|
+
queryLoadAction.mutate(
|
|
4720
|
+
{
|
|
4721
|
+
idAction: aid,
|
|
4722
|
+
context
|
|
4723
|
+
},
|
|
4724
|
+
{
|
|
4725
|
+
onSuccess: (data) => {
|
|
4726
|
+
if (data?.result?.type === "ir.actions.act_window") {
|
|
4727
|
+
handleActionResult(data);
|
|
4728
|
+
} else if (data?.result?.type === "ir.actions.server") {
|
|
4729
|
+
queryRunAction.mutate(
|
|
4730
|
+
{
|
|
4731
|
+
idAction: aid,
|
|
4732
|
+
context
|
|
4733
|
+
},
|
|
4734
|
+
{
|
|
4735
|
+
onSuccess: handleActionResult
|
|
4736
|
+
}
|
|
4737
|
+
);
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
}
|
|
4819
4741
|
);
|
|
4820
|
-
const viewType = hasListView ? "list" : "form";
|
|
4821
|
-
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4822
|
-
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4823
|
-
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4824
|
-
viewType,
|
|
4825
|
-
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4826
|
-
aid: menu?.action?.id?.id,
|
|
4827
|
-
model: queryActionDetail.res_model
|
|
4828
|
-
});
|
|
4829
|
-
setPath(path2);
|
|
4830
4742
|
};
|
|
4831
|
-
return {
|
|
4743
|
+
return {
|
|
4744
|
+
onLoadAction
|
|
4745
|
+
};
|
|
4832
4746
|
};
|
|
4833
4747
|
|
|
4834
|
-
// src/hooks/core/use-get-
|
|
4748
|
+
// src/hooks/core/use-get-specification.ts
|
|
4749
|
+
var import_react10 = require("react");
|
|
4750
|
+
var useGetSpecification = ({
|
|
4751
|
+
model,
|
|
4752
|
+
viewData,
|
|
4753
|
+
fields
|
|
4754
|
+
}) => {
|
|
4755
|
+
const baseModel = (0, import_react10.useMemo)(
|
|
4756
|
+
() => ({
|
|
4757
|
+
name: String(model),
|
|
4758
|
+
view: viewData || {},
|
|
4759
|
+
fields
|
|
4760
|
+
}),
|
|
4761
|
+
[model, viewData]
|
|
4762
|
+
);
|
|
4763
|
+
const initModel = (0, import_hooks2.useModel)();
|
|
4764
|
+
const modelInstance = (0, import_react10.useMemo)(() => {
|
|
4765
|
+
if (viewData) {
|
|
4766
|
+
return initModel.initModel(baseModel);
|
|
4767
|
+
}
|
|
4768
|
+
return null;
|
|
4769
|
+
}, [baseModel, viewData]);
|
|
4770
|
+
const specification = (0, import_react10.useMemo)(() => {
|
|
4771
|
+
if (modelInstance) {
|
|
4772
|
+
return modelInstance.getSpecification();
|
|
4773
|
+
}
|
|
4774
|
+
return null;
|
|
4775
|
+
}, [modelInstance]);
|
|
4776
|
+
return { specification };
|
|
4777
|
+
};
|
|
4778
|
+
|
|
4779
|
+
// src/hooks/core/use-list-data.ts
|
|
4780
|
+
var import_react14 = require("react");
|
|
4781
|
+
var import_utils4 = require("@fctc/interface-logic/utils");
|
|
4782
|
+
|
|
4783
|
+
// src/hooks/utils/use-click-outside.ts
|
|
4784
|
+
var import_react11 = require("react");
|
|
4785
|
+
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
4786
|
+
var useClickOutside = ({
|
|
4787
|
+
handler,
|
|
4788
|
+
events = DEFAULT_EVENTS,
|
|
4789
|
+
nodes = [],
|
|
4790
|
+
refs
|
|
4791
|
+
}) => {
|
|
4792
|
+
const ref = (0, import_react11.useRef)(null);
|
|
4793
|
+
(0, import_react11.useEffect)(() => {
|
|
4794
|
+
const listener = (event) => {
|
|
4795
|
+
const { target } = event;
|
|
4796
|
+
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
4797
|
+
return;
|
|
4798
|
+
}
|
|
4799
|
+
if (!(target instanceof HTMLElement)) return;
|
|
4800
|
+
const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
|
|
4801
|
+
const shouldTrigger = nodes.length > 0 ? nodes.every((node) => node && !event.composedPath().includes(node)) : ref.current && !ref.current.contains(target);
|
|
4802
|
+
if (shouldTrigger && !shouldIgnore) {
|
|
4803
|
+
handler(event);
|
|
4804
|
+
}
|
|
4805
|
+
};
|
|
4806
|
+
events.forEach((event) => document.addEventListener(event, listener));
|
|
4807
|
+
return () => {
|
|
4808
|
+
events.forEach((event) => document.removeEventListener(event, listener));
|
|
4809
|
+
};
|
|
4810
|
+
}, [handler, nodes, events]);
|
|
4811
|
+
return ref;
|
|
4812
|
+
};
|
|
4813
|
+
|
|
4814
|
+
// src/hooks/utils/use-debounce.ts
|
|
4835
4815
|
var import_react12 = require("react");
|
|
4816
|
+
function useDebounce(value, delay) {
|
|
4817
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react12.useState)(value);
|
|
4818
|
+
(0, import_react12.useEffect)(() => {
|
|
4819
|
+
const handler = setTimeout(() => {
|
|
4820
|
+
setDebouncedValue(value);
|
|
4821
|
+
}, delay);
|
|
4822
|
+
return () => {
|
|
4823
|
+
clearTimeout(handler);
|
|
4824
|
+
};
|
|
4825
|
+
}, [value, delay]);
|
|
4826
|
+
return [debouncedValue];
|
|
4827
|
+
}
|
|
4828
|
+
|
|
4829
|
+
// src/hooks/utils/use-get-rowids.ts
|
|
4830
|
+
var import_react13 = require("react");
|
|
4836
4831
|
var useGetRowIds = (tableRef) => {
|
|
4837
4832
|
function isElementVisible(el) {
|
|
4838
4833
|
const style = window.getComputedStyle(el);
|
|
@@ -4849,9 +4844,9 @@ var useGetRowIds = (tableRef) => {
|
|
|
4849
4844
|
}
|
|
4850
4845
|
return true;
|
|
4851
4846
|
}
|
|
4852
|
-
const [rowIds, setRowIds] = (0,
|
|
4853
|
-
const lastRowIdsRef = (0,
|
|
4854
|
-
const updateVisibleRowIds = (0,
|
|
4847
|
+
const [rowIds, setRowIds] = (0, import_react13.useState)([]);
|
|
4848
|
+
const lastRowIdsRef = (0, import_react13.useRef)([]);
|
|
4849
|
+
const updateVisibleRowIds = (0, import_react13.useCallback)(() => {
|
|
4855
4850
|
const table = tableRef.current;
|
|
4856
4851
|
if (!table) return;
|
|
4857
4852
|
const rows = table.querySelectorAll("tr[data-row-id]");
|
|
@@ -4869,7 +4864,7 @@ var useGetRowIds = (tableRef) => {
|
|
|
4869
4864
|
setRowIds(uniqueIds);
|
|
4870
4865
|
}
|
|
4871
4866
|
}, [tableRef]);
|
|
4872
|
-
(0,
|
|
4867
|
+
(0, import_react13.useEffect)(() => {
|
|
4873
4868
|
const table = tableRef.current;
|
|
4874
4869
|
if (!table) return;
|
|
4875
4870
|
const mutationObserver = new MutationObserver(() => {
|
|
@@ -4897,58 +4892,95 @@ var useGetRowIds = (tableRef) => {
|
|
|
4897
4892
|
return { rowIds, refresh: updateVisibleRowIds };
|
|
4898
4893
|
};
|
|
4899
4894
|
|
|
4900
|
-
// src/hooks/
|
|
4901
|
-
var
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
nodes = [],
|
|
4907
|
-
refs
|
|
4895
|
+
// src/hooks/core/use-list-data.ts
|
|
4896
|
+
var useListData = ({
|
|
4897
|
+
action,
|
|
4898
|
+
context,
|
|
4899
|
+
viewData,
|
|
4900
|
+
model
|
|
4908
4901
|
}) => {
|
|
4909
|
-
const
|
|
4910
|
-
(0,
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4902
|
+
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
4903
|
+
const [page, setPage] = (0, import_react14.useState)(0);
|
|
4904
|
+
const [pageLimit, setPageLimit] = (0, import_react14.useState)(10);
|
|
4905
|
+
const [groupByList, setGroupByList] = (0, import_react14.useState)(null);
|
|
4906
|
+
const [domain, setDomain] = (0, import_react14.useState)(null);
|
|
4907
|
+
const [order, setOrder] = (0, import_react14.useState)("");
|
|
4908
|
+
const [mode, setMode] = (0, import_react14.useState)("month");
|
|
4909
|
+
const [type, setType] = (0, import_react14.useState)("list");
|
|
4910
|
+
const [currentDate, setCurrentDate] = (0, import_react14.useState)(/* @__PURE__ */ new Date());
|
|
4911
|
+
const [selectedRowKeys, setSelectedRowKeys2] = (0, import_react14.useState)([]);
|
|
4912
|
+
const [debouncedPage] = useDebounce(page, 500);
|
|
4913
|
+
const [debouncedDomain] = useDebounce(domain, 500);
|
|
4914
|
+
const { specification } = useGetSpecification({
|
|
4915
|
+
model,
|
|
4916
|
+
viewData,
|
|
4917
|
+
fields: viewData?.views?.list?.fields
|
|
4918
|
+
});
|
|
4919
|
+
const listDataProps = (0, import_react14.useMemo)(() => {
|
|
4920
|
+
if (!viewData || !action || !context) {
|
|
4921
|
+
return null;
|
|
4922
|
+
}
|
|
4923
|
+
const domainParse = type === "calendar" ? getDateRange(currentDate, mode) : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, import_utils4.evalJSONDomain)(action?.domain, context) : [];
|
|
4924
|
+
const limit = type === "calendar" ? 2500 : pageLimit;
|
|
4925
|
+
const offset = debouncedPage * pageLimit;
|
|
4926
|
+
const fields = type === "calendar" ? convertFieldsToArray(viewData?.views?.calendar?.fields) || [] : typeof groupByList === "object" ? groupByList?.fields : void 0;
|
|
4927
|
+
const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
|
|
4928
|
+
const sort = order ? order : viewData?.views?.list?.default_order ? (0, import_utils4.formatSortingString)(viewData?.views?.list?.default_order) : "";
|
|
4929
|
+
return {
|
|
4930
|
+
model: action.res_model,
|
|
4931
|
+
specification,
|
|
4932
|
+
domain: domainParse,
|
|
4933
|
+
limit,
|
|
4934
|
+
offset,
|
|
4935
|
+
fields,
|
|
4936
|
+
groupby,
|
|
4937
|
+
context,
|
|
4938
|
+
sort,
|
|
4939
|
+
type
|
|
4926
4940
|
};
|
|
4927
|
-
}, [
|
|
4928
|
-
|
|
4941
|
+
}, [
|
|
4942
|
+
action,
|
|
4943
|
+
context,
|
|
4944
|
+
currentDate,
|
|
4945
|
+
groupByList,
|
|
4946
|
+
mode,
|
|
4947
|
+
order,
|
|
4948
|
+
debouncedPage,
|
|
4949
|
+
pageLimit,
|
|
4950
|
+
type,
|
|
4951
|
+
debouncedDomain
|
|
4952
|
+
]);
|
|
4953
|
+
const list = useGetListData2(
|
|
4954
|
+
listDataProps,
|
|
4955
|
+
[listDataProps],
|
|
4956
|
+
!!listDataProps && !!specification && !(0, import_utils4.isObjectEmpty)(specification)
|
|
4957
|
+
);
|
|
4958
|
+
return {
|
|
4959
|
+
...list,
|
|
4960
|
+
state: {
|
|
4961
|
+
specification,
|
|
4962
|
+
type,
|
|
4963
|
+
page,
|
|
4964
|
+
mode,
|
|
4965
|
+
order,
|
|
4966
|
+
domain: listDataProps?.domain,
|
|
4967
|
+
pageLimit,
|
|
4968
|
+
groupByList,
|
|
4969
|
+
currentDate,
|
|
4970
|
+
selectedRowKeys,
|
|
4971
|
+
setType,
|
|
4972
|
+
setMode,
|
|
4973
|
+
setPage,
|
|
4974
|
+
setOrder,
|
|
4975
|
+
setDomain,
|
|
4976
|
+
setPageLimit,
|
|
4977
|
+
setGroupByList,
|
|
4978
|
+
setCurrentDate,
|
|
4979
|
+
setSelectedRowKeys: setSelectedRowKeys2
|
|
4980
|
+
}
|
|
4981
|
+
};
|
|
4929
4982
|
};
|
|
4930
4983
|
|
|
4931
|
-
// src/hooks/utils/use-debounce.ts
|
|
4932
|
-
var import_react14 = require("react");
|
|
4933
|
-
function useDebounce(value, delay) {
|
|
4934
|
-
const [debouncedValue, setDebouncedValue] = (0, import_react14.useState)(value);
|
|
4935
|
-
(0, import_react14.useEffect)(() => {
|
|
4936
|
-
const handler = setTimeout(() => {
|
|
4937
|
-
setDebouncedValue(value);
|
|
4938
|
-
}, delay);
|
|
4939
|
-
return () => {
|
|
4940
|
-
clearTimeout(handler);
|
|
4941
|
-
};
|
|
4942
|
-
}, [value, delay]);
|
|
4943
|
-
return [debouncedValue];
|
|
4944
|
-
}
|
|
4945
|
-
|
|
4946
|
-
// src/hooks.ts
|
|
4947
|
-
__reExport(hooks_exports, require("@fctc/interface-logic/hooks"));
|
|
4948
|
-
|
|
4949
|
-
// src/index.ts
|
|
4950
|
-
__reExport(index_exports, hooks_exports, module.exports);
|
|
4951
|
-
|
|
4952
4984
|
// src/config.ts
|
|
4953
4985
|
var config_exports = {};
|
|
4954
4986
|
__reExport(config_exports, require("@fctc/interface-logic/configs"));
|
|
@@ -5188,11 +5220,11 @@ var ChevronBottomIcon = ({
|
|
|
5188
5220
|
|
|
5189
5221
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
5190
5222
|
var import_react15 = require("react");
|
|
5191
|
-
var
|
|
5192
|
-
var
|
|
5223
|
+
var import_environment = require("@fctc/interface-logic/environment");
|
|
5224
|
+
var import_hooks4 = require("@fctc/interface-logic/hooks");
|
|
5193
5225
|
var statusDropdownController = (props) => {
|
|
5194
5226
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
5195
|
-
const env = (0,
|
|
5227
|
+
const env = (0, import_environment.getEnv)();
|
|
5196
5228
|
const colors = {
|
|
5197
5229
|
normal: "bg-[#e9ecef]",
|
|
5198
5230
|
done: "bg-primary",
|
|
@@ -5211,7 +5243,7 @@ var statusDropdownController = (props) => {
|
|
|
5211
5243
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5212
5244
|
};
|
|
5213
5245
|
}, []);
|
|
5214
|
-
const { mutate: onSave } = (0,
|
|
5246
|
+
const { mutate: onSave } = (0, import_hooks4.useSave)();
|
|
5215
5247
|
const handleClick = async (status) => {
|
|
5216
5248
|
setIsOpen(!isOpen);
|
|
5217
5249
|
onSave(
|
|
@@ -5247,10 +5279,6 @@ var import_react16 = require("react");
|
|
|
5247
5279
|
var store_exports = {};
|
|
5248
5280
|
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
5249
5281
|
|
|
5250
|
-
// src/provider.ts
|
|
5251
|
-
var provider_exports = {};
|
|
5252
|
-
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
5253
|
-
|
|
5254
5282
|
// src/widget/basic/many2one-field/controller.ts
|
|
5255
5283
|
var many2oneFieldController = (props) => {
|
|
5256
5284
|
const {
|
|
@@ -5283,7 +5311,7 @@ var many2oneFieldController = (props) => {
|
|
|
5283
5311
|
...fieldContext,
|
|
5284
5312
|
...env?.context
|
|
5285
5313
|
};
|
|
5286
|
-
const { useGetSelection:
|
|
5314
|
+
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
5287
5315
|
const data = {
|
|
5288
5316
|
model: relation,
|
|
5289
5317
|
domain: domainObject,
|
|
@@ -5299,7 +5327,7 @@ var many2oneFieldController = (props) => {
|
|
|
5299
5327
|
data: dataOfSelection,
|
|
5300
5328
|
refetch,
|
|
5301
5329
|
isFetching
|
|
5302
|
-
} =
|
|
5330
|
+
} = useGetSelection3({
|
|
5303
5331
|
data,
|
|
5304
5332
|
queryKey,
|
|
5305
5333
|
enabled: false
|
|
@@ -5425,20 +5453,20 @@ var many2oneFieldController = (props) => {
|
|
|
5425
5453
|
};
|
|
5426
5454
|
|
|
5427
5455
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5428
|
-
var
|
|
5429
|
-
var
|
|
5430
|
-
var
|
|
5456
|
+
var import_environment2 = require("@fctc/interface-logic/environment");
|
|
5457
|
+
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
5458
|
+
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5431
5459
|
var many2oneButtonController = (props) => {
|
|
5432
5460
|
const { domain, methods, relation } = props;
|
|
5433
5461
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5434
|
-
const env = (0,
|
|
5435
|
-
const domainObject = (0,
|
|
5462
|
+
const env = (0, import_environment2.getEnv)();
|
|
5463
|
+
const domainObject = (0, import_utils7.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5436
5464
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5437
|
-
const { data: dataOfSelection } = (0,
|
|
5465
|
+
const { data: dataOfSelection } = (0, import_hooks6.useGetSelection)({
|
|
5438
5466
|
data: {
|
|
5439
5467
|
model: relation ?? "",
|
|
5440
5468
|
domain: domainObject,
|
|
5441
|
-
context: { ...env.context, ...(0,
|
|
5469
|
+
context: { ...env.context, ...(0, import_utils7.evalJSONContext)(actionData?.context) }
|
|
5442
5470
|
},
|
|
5443
5471
|
queryKey: [`data_${relation}`, domainObject]
|
|
5444
5472
|
});
|
|
@@ -5453,7 +5481,7 @@ var many2oneButtonController = (props) => {
|
|
|
5453
5481
|
|
|
5454
5482
|
// src/widget/basic/many2many-field/controller.ts
|
|
5455
5483
|
var import_react17 = require("react");
|
|
5456
|
-
var
|
|
5484
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5457
5485
|
var many2manyFieldController = (props) => {
|
|
5458
5486
|
const {
|
|
5459
5487
|
relation,
|
|
@@ -5461,13 +5489,13 @@ var many2manyFieldController = (props) => {
|
|
|
5461
5489
|
context,
|
|
5462
5490
|
options,
|
|
5463
5491
|
tab,
|
|
5464
|
-
setSelectedRowKeys:
|
|
5492
|
+
setSelectedRowKeys: setSelectedRowKeys2,
|
|
5465
5493
|
groupByDomain,
|
|
5466
5494
|
enabled: enabledCallAPI,
|
|
5467
5495
|
actionData
|
|
5468
5496
|
} = props;
|
|
5469
5497
|
const { env } = (0, provider_exports.useEnv)();
|
|
5470
|
-
const { useGetView: useGetView2, useGetListData: useGetListData2, useGetFormView } = (0, provider_exports.useService)();
|
|
5498
|
+
const { useGetView: useGetView2, useGetListData: useGetListData2, useGetFormView: useGetFormView2 } = (0, provider_exports.useService)();
|
|
5471
5499
|
const [order, setOrder] = (0, import_react17.useState)();
|
|
5472
5500
|
const [page, setPage] = (0, import_react17.useState)(0);
|
|
5473
5501
|
const [domainMany2Many, setDomainMany2Many] = (0, import_react17.useState)(null);
|
|
@@ -5497,7 +5525,7 @@ var many2manyFieldController = (props) => {
|
|
|
5497
5525
|
}),
|
|
5498
5526
|
[relation, viewResponse]
|
|
5499
5527
|
);
|
|
5500
|
-
const initModel = (0,
|
|
5528
|
+
const initModel = (0, import_hooks2.useModel)();
|
|
5501
5529
|
const modelInstance = (0, import_react17.useMemo)(() => {
|
|
5502
5530
|
if (viewResponse) {
|
|
5503
5531
|
return initModel.initModel(baseModel);
|
|
@@ -5511,10 +5539,10 @@ var many2manyFieldController = (props) => {
|
|
|
5511
5539
|
return null;
|
|
5512
5540
|
}, [modelInstance]);
|
|
5513
5541
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5514
|
-
const optionsObject = tab?.options ? (0,
|
|
5542
|
+
const optionsObject = tab?.options ? (0, import_utils8.evalJSONContext)(tab?.options) : (options ? (0, import_utils8.evalJSONContext)(options) : {}) || {};
|
|
5515
5543
|
const fetchData = async () => {
|
|
5516
5544
|
try {
|
|
5517
|
-
const domainParse = typeof domain === "string" ? (0,
|
|
5545
|
+
const domainParse = typeof domain === "string" ? (0, import_utils8.evalJSONDomain)(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5518
5546
|
setDomainMany2Many(domainParse);
|
|
5519
5547
|
setPage(0);
|
|
5520
5548
|
} catch (err) {
|
|
@@ -5538,7 +5566,7 @@ var many2manyFieldController = (props) => {
|
|
|
5538
5566
|
context: contextObject,
|
|
5539
5567
|
fields: groupByDomain?.fields,
|
|
5540
5568
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5541
|
-
sort: order ? order : default_order ? (0,
|
|
5569
|
+
sort: order ? order : default_order ? (0, import_utils8.formatSortingString)(default_order) : ""
|
|
5542
5570
|
};
|
|
5543
5571
|
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5544
5572
|
const {
|
|
@@ -5553,7 +5581,7 @@ var many2manyFieldController = (props) => {
|
|
|
5553
5581
|
}
|
|
5554
5582
|
return () => {
|
|
5555
5583
|
setPage(0);
|
|
5556
|
-
|
|
5584
|
+
setSelectedRowKeys2([]);
|
|
5557
5585
|
setDomainMany2Many(null);
|
|
5558
5586
|
};
|
|
5559
5587
|
}, [viewResponse]);
|
|
@@ -5601,8 +5629,8 @@ var many2manyFieldController = (props) => {
|
|
|
5601
5629
|
|
|
5602
5630
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5603
5631
|
var import_react18 = require("react");
|
|
5604
|
-
var
|
|
5605
|
-
var
|
|
5632
|
+
var import_constants2 = require("@fctc/interface-logic/constants");
|
|
5633
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5606
5634
|
var many2manyTagsController = (props) => {
|
|
5607
5635
|
const {
|
|
5608
5636
|
relation,
|
|
@@ -5614,10 +5642,10 @@ var many2manyTagsController = (props) => {
|
|
|
5614
5642
|
} = props;
|
|
5615
5643
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5616
5644
|
const { env } = (0, provider_exports.useEnv)();
|
|
5617
|
-
const { useGetSelection:
|
|
5618
|
-
const addtionalFields = optionsFields ? (0,
|
|
5645
|
+
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
5646
|
+
const addtionalFields = optionsFields ? (0, import_utils9.evalJSONContext)(optionsFields) : null;
|
|
5619
5647
|
const domainObject = (0, import_react18.useMemo)(
|
|
5620
|
-
() => (0,
|
|
5648
|
+
() => (0, import_utils9.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5621
5649
|
[domain, formValues]
|
|
5622
5650
|
);
|
|
5623
5651
|
const data = {
|
|
@@ -5627,13 +5655,13 @@ var many2manyTagsController = (props) => {
|
|
|
5627
5655
|
id: {},
|
|
5628
5656
|
name: {},
|
|
5629
5657
|
display_name: {},
|
|
5630
|
-
...widget &&
|
|
5631
|
-
...widget &&
|
|
5658
|
+
...widget && import_constants2.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
5659
|
+
...widget && import_constants2.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
5632
5660
|
},
|
|
5633
5661
|
enabled: true,
|
|
5634
5662
|
context: env.context
|
|
5635
5663
|
};
|
|
5636
|
-
const { data: dataOfSelection } =
|
|
5664
|
+
const { data: dataOfSelection } = useGetSelection3({
|
|
5637
5665
|
data,
|
|
5638
5666
|
queryKey: [`data_${relation}`, domainObject]
|
|
5639
5667
|
});
|
|
@@ -5659,7 +5687,7 @@ var many2manyTagsController = (props) => {
|
|
|
5659
5687
|
|
|
5660
5688
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5661
5689
|
var import_react19 = require("react");
|
|
5662
|
-
var
|
|
5690
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
5663
5691
|
var durationController = (props) => {
|
|
5664
5692
|
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5665
5693
|
const specification = {
|
|
@@ -5667,7 +5695,7 @@ var durationController = (props) => {
|
|
|
5667
5695
|
name: "",
|
|
5668
5696
|
fold: ""
|
|
5669
5697
|
};
|
|
5670
|
-
const { useGetListData: useGetListData2, useChangeStatus } = (0, provider_exports.useService)();
|
|
5698
|
+
const { useGetListData: useGetListData2, useChangeStatus: useChangeStatus2 } = (0, provider_exports.useService)();
|
|
5671
5699
|
const { env } = (0, provider_exports.useEnv)();
|
|
5672
5700
|
const [disabled, setDisabled] = (0, import_react19.useState)(false);
|
|
5673
5701
|
const [modelStatus, setModalStatus] = (0, import_react19.useState)(false);
|
|
@@ -5675,7 +5703,7 @@ var durationController = (props) => {
|
|
|
5675
5703
|
const listDataProps = {
|
|
5676
5704
|
model: relation,
|
|
5677
5705
|
specification,
|
|
5678
|
-
domain: (0,
|
|
5706
|
+
domain: (0, import_utils10.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5679
5707
|
limit: 10,
|
|
5680
5708
|
offset: 0,
|
|
5681
5709
|
fields: "",
|
|
@@ -5690,7 +5718,7 @@ var durationController = (props) => {
|
|
|
5690
5718
|
queryKey,
|
|
5691
5719
|
enabled
|
|
5692
5720
|
);
|
|
5693
|
-
const { mutate: fetchChangeStatus } =
|
|
5721
|
+
const { mutate: fetchChangeStatus } = useChangeStatus2();
|
|
5694
5722
|
const handleClick = async (stage_id) => {
|
|
5695
5723
|
setDisabled(true);
|
|
5696
5724
|
if (stage_id) {
|
|
@@ -5725,13 +5753,13 @@ var durationController = (props) => {
|
|
|
5725
5753
|
};
|
|
5726
5754
|
|
|
5727
5755
|
// src/widget/basic/priority-field/controller.ts
|
|
5728
|
-
var
|
|
5756
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
5729
5757
|
var priorityFieldController = (props) => {
|
|
5730
5758
|
const { name, model, index, actionData, context, onChange, specification } = props;
|
|
5731
|
-
const _context = { ...(0,
|
|
5759
|
+
const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) };
|
|
5732
5760
|
const contextObject = { ...context, ..._context };
|
|
5733
|
-
const { useSave:
|
|
5734
|
-
const { mutateAsync: fetchSave } =
|
|
5761
|
+
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
5762
|
+
const { mutateAsync: fetchSave } = useSave3();
|
|
5735
5763
|
const savePriorities = async ({
|
|
5736
5764
|
value,
|
|
5737
5765
|
resetPriority
|
|
@@ -6696,12 +6724,12 @@ var dateFieldController = (props) => {
|
|
|
6696
6724
|
|
|
6697
6725
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6698
6726
|
var import_react21 = require("react");
|
|
6699
|
-
var
|
|
6727
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
6700
6728
|
var copyLinkButtonController = (props) => {
|
|
6701
6729
|
const { value, defaultValue } = props;
|
|
6702
6730
|
const [isCopied, setIsCopied] = (0, import_react21.useState)(false);
|
|
6703
6731
|
const handleCopyToClipboard = async (value2) => {
|
|
6704
|
-
await (0,
|
|
6732
|
+
await (0, import_utils12.copyTextToClipboard)(value2);
|
|
6705
6733
|
setIsCopied(true);
|
|
6706
6734
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
6707
6735
|
};
|
|
@@ -6714,15 +6742,15 @@ var copyLinkButtonController = (props) => {
|
|
|
6714
6742
|
};
|
|
6715
6743
|
|
|
6716
6744
|
// src/widget/basic/color-field/color-controller.ts
|
|
6717
|
-
var
|
|
6745
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6718
6746
|
var colorFieldController = (props) => {
|
|
6719
6747
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6720
6748
|
const { env } = (0, provider_exports.useEnv)();
|
|
6721
|
-
const { useSave:
|
|
6722
|
-
const _context = { ...(0,
|
|
6749
|
+
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
6750
|
+
const _context = { ...(0, import_utils13.evalJSONContext)(actionData?.context) || {} };
|
|
6723
6751
|
const contextObject = { ...env.context, ..._context };
|
|
6724
6752
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6725
|
-
const { mutate: onSave } =
|
|
6753
|
+
const { mutate: onSave } = useSave3();
|
|
6726
6754
|
const savePickColor = async (colorObject) => {
|
|
6727
6755
|
const { id } = colorObject;
|
|
6728
6756
|
if (value === id) return;
|
|
@@ -6748,7 +6776,7 @@ var colorFieldController = (props) => {
|
|
|
6748
6776
|
|
|
6749
6777
|
// src/widget/basic/binary-field/controller.ts
|
|
6750
6778
|
var import_react22 = require("react");
|
|
6751
|
-
var
|
|
6779
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6752
6780
|
var binaryFieldController = (props) => {
|
|
6753
6781
|
const { name, methods, readonly = false, value } = props;
|
|
6754
6782
|
const inputId = (0, import_react22.useId)();
|
|
@@ -6805,11 +6833,11 @@ var binaryFieldController = (props) => {
|
|
|
6805
6833
|
};
|
|
6806
6834
|
const checkIsImageLink = (url) => {
|
|
6807
6835
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6808
|
-
return imageExtensions.test(url) || (0,
|
|
6836
|
+
return imageExtensions.test(url) || (0, import_utils14.isBase64Image)(url) || isBlobUrl(url);
|
|
6809
6837
|
};
|
|
6810
6838
|
const getImageBase64WithMimeType = (base64) => {
|
|
6811
6839
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6812
|
-
if ((0,
|
|
6840
|
+
if ((0, import_utils14.isBase64Image)(base64)) return base64;
|
|
6813
6841
|
let mimeType = null;
|
|
6814
6842
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6815
6843
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6845,11 +6873,16 @@ var binaryFieldController = (props) => {
|
|
|
6845
6873
|
};
|
|
6846
6874
|
|
|
6847
6875
|
// src/widget/advance/table/table-head/controller.ts
|
|
6848
|
-
var import_store7 = require("@fctc/interface-logic/store");
|
|
6849
6876
|
var import_react23 = require("react");
|
|
6850
6877
|
var tableHeadController = (props) => {
|
|
6851
|
-
const {
|
|
6852
|
-
|
|
6878
|
+
const {
|
|
6879
|
+
typeTable,
|
|
6880
|
+
rows,
|
|
6881
|
+
tableRef,
|
|
6882
|
+
groupByList,
|
|
6883
|
+
selectedRowKeys,
|
|
6884
|
+
setSelectedRowKeys: setSelectedRowKeys2
|
|
6885
|
+
} = props;
|
|
6853
6886
|
const { rowIds: recordIds } = useGetRowIds(tableRef);
|
|
6854
6887
|
const selectedRowKeysRef = (0, import_react23.useRef)(recordIds);
|
|
6855
6888
|
const isGroupTable = typeTable === "group";
|
|
@@ -6875,27 +6908,27 @@ var tableHeadController = (props) => {
|
|
|
6875
6908
|
const handleCheckBoxAll = (event) => {
|
|
6876
6909
|
if (event?.target?.checked && typeTable === "list") {
|
|
6877
6910
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6878
|
-
|
|
6911
|
+
setSelectedRowKeys2(allRowKeys);
|
|
6879
6912
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6880
6913
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6881
6914
|
const ids = Array.from(rowsIDs)?.map(
|
|
6882
6915
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6883
6916
|
);
|
|
6884
6917
|
if (ids?.length > 0) {
|
|
6885
|
-
|
|
6918
|
+
setSelectedRowKeys2(ids);
|
|
6886
6919
|
} else {
|
|
6887
6920
|
const sum = countSum(
|
|
6888
6921
|
rows,
|
|
6889
6922
|
typeof groupByList === "object" ? groupByList?.contexts?.[0]?.group_by : void 0
|
|
6890
6923
|
);
|
|
6891
6924
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6892
|
-
|
|
6925
|
+
setSelectedRowKeys2(keys);
|
|
6893
6926
|
}
|
|
6894
6927
|
if (selectedRowKeysRef) {
|
|
6895
6928
|
selectedRowKeysRef.current = [];
|
|
6896
6929
|
}
|
|
6897
6930
|
} else {
|
|
6898
|
-
|
|
6931
|
+
setSelectedRowKeys2([]);
|
|
6899
6932
|
}
|
|
6900
6933
|
};
|
|
6901
6934
|
return {
|
|
@@ -6907,7 +6940,7 @@ var tableHeadController = (props) => {
|
|
|
6907
6940
|
|
|
6908
6941
|
// src/widget/advance/table/table-view/controller.ts
|
|
6909
6942
|
var import_react24 = require("react");
|
|
6910
|
-
var
|
|
6943
|
+
var import_utils16 = require("@fctc/interface-logic/utils");
|
|
6911
6944
|
var tableController = ({ data }) => {
|
|
6912
6945
|
const [rows, setRows] = (0, import_react24.useState)(null);
|
|
6913
6946
|
const [columns, setColumns] = (0, import_react24.useState)(null);
|
|
@@ -6945,7 +6978,7 @@ var tableController = ({ data }) => {
|
|
|
6945
6978
|
let cols = [];
|
|
6946
6979
|
try {
|
|
6947
6980
|
cols = mergeFields?.filter((item) => {
|
|
6948
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
6981
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils16.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils16.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
6949
6982
|
})?.map((field) => {
|
|
6950
6983
|
return {
|
|
6951
6984
|
name: field?.name,
|
|
@@ -6977,11 +7010,13 @@ var tableController = ({ data }) => {
|
|
|
6977
7010
|
setColumns(tempColumn);
|
|
6978
7011
|
};
|
|
6979
7012
|
(0, import_react24.useEffect)(() => {
|
|
6980
|
-
|
|
6981
|
-
setColumns(null);
|
|
6982
|
-
return () => {
|
|
6983
|
-
setRows(null);
|
|
7013
|
+
if (data?.fields != null) {
|
|
6984
7014
|
setColumns(null);
|
|
7015
|
+
}
|
|
7016
|
+
return () => {
|
|
7017
|
+
if (data?.fields != null) {
|
|
7018
|
+
setColumns(null);
|
|
7019
|
+
}
|
|
6985
7020
|
};
|
|
6986
7021
|
}, [data?.fields]);
|
|
6987
7022
|
return {
|
|
@@ -6994,7 +7029,7 @@ var tableController = ({ data }) => {
|
|
|
6994
7029
|
|
|
6995
7030
|
// src/widget/advance/table/table-group/controller.ts
|
|
6996
7031
|
var import_react25 = require("react");
|
|
6997
|
-
var
|
|
7032
|
+
var import_store2 = require("@fctc/interface-logic/store");
|
|
6998
7033
|
var tableGroupController = (props) => {
|
|
6999
7034
|
const { env } = (0, provider_exports.useEnv)();
|
|
7000
7035
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
@@ -7008,10 +7043,10 @@ var tableGroupController = (props) => {
|
|
|
7008
7043
|
context,
|
|
7009
7044
|
checkedAll,
|
|
7010
7045
|
groupByList,
|
|
7011
|
-
setSelectedRowKeys:
|
|
7046
|
+
setSelectedRowKeys: setSelectedRowKeys2
|
|
7012
7047
|
} = props;
|
|
7013
7048
|
const [pageGroup, setPageGroup] = (0, import_react25.useState)(0);
|
|
7014
|
-
const { selectedRowKeys } = (0,
|
|
7049
|
+
const { selectedRowKeys } = (0, import_store2.useAppSelector)(import_store2.selectList);
|
|
7015
7050
|
const [isShowGroup, setIsShowGroup] = (0, import_react25.useState)(false);
|
|
7016
7051
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react25.useState)({
|
|
7017
7052
|
fromStart: 1,
|
|
@@ -7090,15 +7125,15 @@ var tableGroupController = (props) => {
|
|
|
7090
7125
|
const filteredIds = selectedRowKeys.filter(
|
|
7091
7126
|
(id) => !ids.includes(id)
|
|
7092
7127
|
);
|
|
7093
|
-
|
|
7128
|
+
setSelectedRowKeys2(filteredIds);
|
|
7094
7129
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull) {
|
|
7095
7130
|
const clonedKeys = [...selectedRowKeys];
|
|
7096
|
-
|
|
7097
|
-
setTimeout(() =>
|
|
7131
|
+
setSelectedRowKeys2([...clonedKeys, -1]);
|
|
7132
|
+
setTimeout(() => setSelectedRowKeys2(clonedKeys), 500);
|
|
7098
7133
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7099
7134
|
console.log("abc");
|
|
7100
7135
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7101
|
-
|
|
7136
|
+
setSelectedRowKeys2(filteredKeys);
|
|
7102
7137
|
}
|
|
7103
7138
|
toggleShowGroup();
|
|
7104
7139
|
};
|
|
@@ -7107,8 +7142,8 @@ var tableGroupController = (props) => {
|
|
|
7107
7142
|
return;
|
|
7108
7143
|
}
|
|
7109
7144
|
const clonedKeys = [...selectedRowKeys];
|
|
7110
|
-
|
|
7111
|
-
setTimeout(() =>
|
|
7145
|
+
setSelectedRowKeys2([...clonedKeys, -1]);
|
|
7146
|
+
setTimeout(() => setSelectedRowKeys2(clonedKeys), 500);
|
|
7112
7147
|
}, [isDataGroupFetched]);
|
|
7113
7148
|
return {
|
|
7114
7149
|
onExpandChildGroup,
|
|
@@ -7127,8 +7162,8 @@ var tableGroupController = (props) => {
|
|
|
7127
7162
|
};
|
|
7128
7163
|
|
|
7129
7164
|
// src/widget/advance/search/controller.ts
|
|
7130
|
-
var
|
|
7131
|
-
var
|
|
7165
|
+
var import_constants3 = require("@fctc/interface-logic/constants");
|
|
7166
|
+
var import_utils18 = require("@fctc/interface-logic/utils");
|
|
7132
7167
|
var import_moment2 = __toESM(require_moment());
|
|
7133
7168
|
var import_react26 = require("react");
|
|
7134
7169
|
var searchController = ({
|
|
@@ -7145,9 +7180,9 @@ var searchController = ({
|
|
|
7145
7180
|
const [selectedTags, setSelectedTags] = (0, import_react26.useState)(null);
|
|
7146
7181
|
const [searchString, setSearchString] = (0, import_react26.useState)("");
|
|
7147
7182
|
const [searchMap, setSearchMap] = (0, import_react26.useState)({});
|
|
7148
|
-
const actionContext = typeof context === "string" ? (0,
|
|
7183
|
+
const actionContext = typeof context === "string" ? (0, import_utils18.evalJSONContext)(context) : context;
|
|
7149
7184
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7150
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0,
|
|
7185
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils18.evalJSONDomain)(domain, contextSearch) : [];
|
|
7151
7186
|
const clearSearch = () => {
|
|
7152
7187
|
setFilterBy([]);
|
|
7153
7188
|
setGroupBy([]);
|
|
@@ -7162,7 +7197,7 @@ var searchController = ({
|
|
|
7162
7197
|
const dataModel = viewData?.models?.[model];
|
|
7163
7198
|
const searchViews = viewData?.views?.search;
|
|
7164
7199
|
const searchByItems = searchViews?.search_by?.filter(
|
|
7165
|
-
(item) => !
|
|
7200
|
+
(item) => !import_utils18.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
7166
7201
|
)?.map(
|
|
7167
7202
|
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
7168
7203
|
dataIndex: index,
|
|
@@ -7175,10 +7210,10 @@ var searchController = ({
|
|
|
7175
7210
|
})
|
|
7176
7211
|
);
|
|
7177
7212
|
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
7178
|
-
return !
|
|
7213
|
+
return !import_utils18.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
7179
7214
|
})?.map((item) => ({ ...item, active: false }));
|
|
7180
7215
|
const groupByItems = searchViews?.group_by.filter(
|
|
7181
|
-
(item) => !
|
|
7216
|
+
(item) => !import_utils18.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
7182
7217
|
).map((item) => ({
|
|
7183
7218
|
...item,
|
|
7184
7219
|
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
@@ -7232,7 +7267,7 @@ var searchController = ({
|
|
|
7232
7267
|
if (domainAction) {
|
|
7233
7268
|
const domain2 = [];
|
|
7234
7269
|
if (domainAction?.length > 0) {
|
|
7235
|
-
if (Object.keys(searchMap).some((key) => !key.includes(
|
|
7270
|
+
if (Object.keys(searchMap).some((key) => !key.includes(import_constants3.SearchType.GROUP))) {
|
|
7236
7271
|
domain2.push("&");
|
|
7237
7272
|
}
|
|
7238
7273
|
domainAction.forEach((domainItem) => {
|
|
@@ -7240,7 +7275,7 @@ var searchController = ({
|
|
|
7240
7275
|
});
|
|
7241
7276
|
}
|
|
7242
7277
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7243
|
-
if (!key?.includes(
|
|
7278
|
+
if (!key?.includes(import_constants3.SearchType.GROUP)) {
|
|
7244
7279
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7245
7280
|
domain2.push("&");
|
|
7246
7281
|
}
|
|
@@ -7255,14 +7290,14 @@ var searchController = ({
|
|
|
7255
7290
|
}
|
|
7256
7291
|
let valueDomainItem = value?.value;
|
|
7257
7292
|
if (value?.modelType === "date") {
|
|
7258
|
-
valueDomainItem = (0,
|
|
7293
|
+
valueDomainItem = (0, import_utils18.validateAndParseDate)(value?.value);
|
|
7259
7294
|
} else if (value?.modelType === "datetime") {
|
|
7260
7295
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
7261
|
-
const parsedDate = (0,
|
|
7296
|
+
const parsedDate = (0, import_utils18.validateAndParseDate)(value?.value, true);
|
|
7262
7297
|
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
7263
7298
|
valueDomainItem = hasTime ? (0, import_moment2.default)(parsedDate).format("YYYY-MM-DD HH:mm:ss") : (0, import_moment2.default)(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
7264
7299
|
} else {
|
|
7265
|
-
valueDomainItem = (0,
|
|
7300
|
+
valueDomainItem = (0, import_utils18.validateAndParseDate)(value?.value, true);
|
|
7266
7301
|
}
|
|
7267
7302
|
}
|
|
7268
7303
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
@@ -7287,11 +7322,11 @@ var searchController = ({
|
|
|
7287
7322
|
modelType,
|
|
7288
7323
|
dataIndex
|
|
7289
7324
|
} = objValues[0];
|
|
7290
|
-
if (!key?.includes(
|
|
7325
|
+
if (!key?.includes(import_constants3.SearchType.GROUP)) {
|
|
7291
7326
|
const values = objValues?.map((objValue) => objValue.value);
|
|
7292
7327
|
return {
|
|
7293
7328
|
title,
|
|
7294
|
-
name: type ===
|
|
7329
|
+
name: type === import_constants3.SearchType.SEARCH ? `${import_constants3.SearchType.SEARCH}_${String(dataIndex)}` : groupIndex ?? name,
|
|
7295
7330
|
values,
|
|
7296
7331
|
type,
|
|
7297
7332
|
widget,
|
|
@@ -7340,32 +7375,23 @@ var searchController = ({
|
|
|
7340
7375
|
setTagSearch(searchMap);
|
|
7341
7376
|
}, [searchMap]);
|
|
7342
7377
|
const handleAddTagSearch = (tag) => {
|
|
7343
|
-
const {
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
type,
|
|
7348
|
-
title,
|
|
7349
|
-
context: context2,
|
|
7350
|
-
active,
|
|
7351
|
-
dataIndex
|
|
7352
|
-
} = tag;
|
|
7353
|
-
const domainFormat = new import_utils15.domainHelper.Domain(domain2);
|
|
7354
|
-
if (type === import_constants5.SearchType.FILTER) {
|
|
7355
|
-
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7378
|
+
const { domain: domain2, groupIndex, value, type, context: context2, dataIndex } = tag;
|
|
7379
|
+
const domainFormat = new import_utils18.domainHelper.Domain(domain2);
|
|
7380
|
+
if (type === import_constants3.SearchType.FILTER) {
|
|
7381
|
+
addSearchItems(`${import_constants3.SearchType.FILTER}_${groupIndex}`, {
|
|
7356
7382
|
...tag,
|
|
7357
7383
|
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7358
7384
|
});
|
|
7359
|
-
} else if (type ===
|
|
7360
|
-
addSearchItems(`${
|
|
7385
|
+
} else if (type === import_constants3.SearchType.SEARCH) {
|
|
7386
|
+
addSearchItems(`${import_constants3.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7361
7387
|
...tag,
|
|
7362
7388
|
domain: domain2 ? domainFormat.toList({
|
|
7363
7389
|
...context2,
|
|
7364
7390
|
self: value
|
|
7365
7391
|
}) : null
|
|
7366
7392
|
});
|
|
7367
|
-
} else if (type ===
|
|
7368
|
-
addSearchItems(`${
|
|
7393
|
+
} else if (type === import_constants3.SearchType.GROUP) {
|
|
7394
|
+
addSearchItems(`${import_constants3.SearchType.GROUP}`, {
|
|
7369
7395
|
...tag,
|
|
7370
7396
|
domain: domain2 ? domainFormat.toList({
|
|
7371
7397
|
context: context2,
|
|
@@ -7427,8 +7453,6 @@ __reExport(types_exports, require("@fctc/interface-logic/types"));
|
|
|
7427
7453
|
__reExport(index_exports, types_exports, module.exports);
|
|
7428
7454
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7429
7455
|
0 && (module.exports = {
|
|
7430
|
-
API_APP_URL,
|
|
7431
|
-
API_PRESCHOOL_URL,
|
|
7432
7456
|
AppProvider,
|
|
7433
7457
|
CheckIcon,
|
|
7434
7458
|
ChevronBottomIcon,
|
|
@@ -7464,19 +7488,89 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
7464
7488
|
tableGroupController,
|
|
7465
7489
|
tableHeadController,
|
|
7466
7490
|
useAppProvider,
|
|
7467
|
-
|
|
7491
|
+
useButton,
|
|
7468
7492
|
useCallAction,
|
|
7493
|
+
useChangeStatus,
|
|
7469
7494
|
useClickOutside,
|
|
7495
|
+
useCompany,
|
|
7470
7496
|
useConfig,
|
|
7471
7497
|
useDebounce,
|
|
7498
|
+
useDelete,
|
|
7499
|
+
useDeleteComment,
|
|
7472
7500
|
useDetail,
|
|
7501
|
+
useDuplicateRecord,
|
|
7502
|
+
useExecuteImport,
|
|
7503
|
+
useExportExcel,
|
|
7504
|
+
useForgotPassword,
|
|
7505
|
+
useForgotPasswordSSO,
|
|
7506
|
+
useGet2FAMethods,
|
|
7507
|
+
useGetAccessByCode,
|
|
7508
|
+
useGetAction,
|
|
7509
|
+
useGetActionDetail,
|
|
7510
|
+
useGetAll,
|
|
7511
|
+
useGetCalendar,
|
|
7512
|
+
useGetComment,
|
|
7513
|
+
useGetCompanyInfo,
|
|
7514
|
+
useGetConversionRate,
|
|
7515
|
+
useGetCurrency,
|
|
7516
|
+
useGetCurrentCompany,
|
|
7517
|
+
useGetDetail,
|
|
7518
|
+
useGetFieldExport,
|
|
7519
|
+
useGetFieldOnChange,
|
|
7520
|
+
useGetFileExcel,
|
|
7521
|
+
useGetFormView,
|
|
7522
|
+
useGetGroups,
|
|
7523
|
+
useGetImage,
|
|
7524
|
+
useGetListCompany,
|
|
7525
|
+
useGetListData,
|
|
7526
|
+
useGetListMyBankAccount,
|
|
7527
|
+
useGetMenu,
|
|
7528
|
+
useGetPrintReport,
|
|
7529
|
+
useGetProGressBar,
|
|
7530
|
+
useGetProfile,
|
|
7531
|
+
useGetProvider,
|
|
7532
|
+
useGetResequence,
|
|
7473
7533
|
useGetRowIds,
|
|
7534
|
+
useGetSelection,
|
|
7535
|
+
useGetSpecification,
|
|
7536
|
+
useGetUser,
|
|
7537
|
+
useGetView,
|
|
7538
|
+
useGrantAccess,
|
|
7539
|
+
useIsValidToken,
|
|
7474
7540
|
useListData,
|
|
7541
|
+
useLoadAction,
|
|
7542
|
+
useLoadMessage,
|
|
7543
|
+
useLoginCredential,
|
|
7544
|
+
useLoginSocial,
|
|
7545
|
+
useLogout,
|
|
7475
7546
|
useMenu,
|
|
7476
|
-
|
|
7547
|
+
useModel,
|
|
7548
|
+
useOdooDataTransform,
|
|
7549
|
+
useOnChangeForm,
|
|
7550
|
+
useParsePreview,
|
|
7551
|
+
usePrint,
|
|
7477
7552
|
useProfile,
|
|
7553
|
+
useRemoveRow,
|
|
7554
|
+
useRemoveTotpSetup,
|
|
7555
|
+
useRequestSetupTotp,
|
|
7556
|
+
useResetPassword,
|
|
7557
|
+
useResetPasswordSSO,
|
|
7558
|
+
useRunAction,
|
|
7559
|
+
useSave,
|
|
7560
|
+
useSendComment,
|
|
7561
|
+
useSettingsWebRead2fa,
|
|
7562
|
+
useSignInSSO,
|
|
7478
7563
|
useStorageState,
|
|
7564
|
+
useSwitchLocale,
|
|
7565
|
+
useUpdatePassword,
|
|
7566
|
+
useUploadFile,
|
|
7567
|
+
useUploadFileExcel,
|
|
7568
|
+
useUploadIdFile,
|
|
7569
|
+
useUploadImage,
|
|
7479
7570
|
useUser,
|
|
7571
|
+
useValidateActionToken,
|
|
7572
|
+
useVerify2FA,
|
|
7573
|
+
useVerifyTotp,
|
|
7480
7574
|
useViewV2
|
|
7481
7575
|
});
|
|
7482
7576
|
/*! Bundled license information:
|