@fctc/widget-logic 2.4.2 → 2.4.5
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 +691 -602
- package/dist/index.mjs +781 -634
- 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.js +153 -703
- package/dist/widget.mjs +239 -731
- package/package.json +2 -2
package/dist/widget.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,7 +4028,7 @@ var require_moment = __commonJS({
|
|
|
4028
4028
|
// <input type="month" />
|
|
4029
4029
|
};
|
|
4030
4030
|
return hooks;
|
|
4031
|
-
});
|
|
4031
|
+
}));
|
|
4032
4032
|
}
|
|
4033
4033
|
});
|
|
4034
4034
|
|
|
@@ -4113,141 +4113,49 @@ var statusDropdownController = (props) => {
|
|
|
4113
4113
|
var import_react16 = require("react");
|
|
4114
4114
|
|
|
4115
4115
|
// src/hooks.ts
|
|
4116
|
-
var
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
useConfig: () => useConfig,
|
|
4124
|
-
useDebounce: () => useDebounce,
|
|
4125
|
-
useDetail: () => useDetail,
|
|
4126
|
-
useGetRowIds: () => useGetRowIds,
|
|
4127
|
-
useListData: () => useListData,
|
|
4128
|
-
useMenu: () => useMenu,
|
|
4129
|
-
useMenuItem: () => useMenuItem,
|
|
4130
|
-
useProfile: () => useProfile,
|
|
4131
|
-
useUser: () => useUser,
|
|
4132
|
-
useViewV2: () => useViewV2
|
|
4133
|
-
});
|
|
4116
|
+
var import_hooks3 = require("@fctc/interface-logic/hooks");
|
|
4117
|
+
|
|
4118
|
+
// src/hooks/core/use-app-provider.tsx
|
|
4119
|
+
var import_react9 = require("react");
|
|
4120
|
+
|
|
4121
|
+
// src/hooks/core/use-menu.ts
|
|
4122
|
+
var import_react3 = require("react");
|
|
4134
4123
|
|
|
4135
4124
|
// src/hooks/core/use-call-action.ts
|
|
4136
4125
|
var import_react2 = require("react");
|
|
4137
|
-
var import_environment2 = require("@fctc/interface-logic/environment");
|
|
4138
|
-
var import_hooks2 = require("@fctc/interface-logic/hooks");
|
|
4139
|
-
var useCallAction = () => {
|
|
4140
|
-
const queryLoadAction = (0, import_hooks2.useLoadAction)();
|
|
4141
|
-
const queryRunAction = (0, import_hooks2.useRunAction)();
|
|
4142
|
-
const [data, setData] = (0, import_react2.useState)(void 0);
|
|
4143
|
-
const callAction = async ({
|
|
4144
|
-
aid,
|
|
4145
|
-
actionType = "ir.actions.act_window"
|
|
4146
|
-
}) => {
|
|
4147
|
-
const context = (0, import_environment2.getEnv)().context;
|
|
4148
|
-
let res = void 0;
|
|
4149
|
-
if (actionType === "ir.actions.act_window") {
|
|
4150
|
-
res = await queryLoadAction.mutateAsync({
|
|
4151
|
-
idAction: aid,
|
|
4152
|
-
context
|
|
4153
|
-
});
|
|
4154
|
-
} else if (actionType === "ir.actions.server") {
|
|
4155
|
-
res = await queryRunAction.mutateAsync({
|
|
4156
|
-
idAction: aid,
|
|
4157
|
-
context
|
|
4158
|
-
});
|
|
4159
|
-
}
|
|
4160
|
-
setData(res);
|
|
4161
|
-
return res;
|
|
4162
|
-
};
|
|
4163
|
-
return [data, callAction];
|
|
4164
|
-
};
|
|
4165
4126
|
|
|
4166
|
-
// src/
|
|
4167
|
-
var
|
|
4168
|
-
|
|
4169
|
-
var import_store = require("@fctc/interface-logic/store");
|
|
4170
|
-
var useConfig = ({ localStorageUtils, sessionStorageUtils }) => {
|
|
4171
|
-
const dispatch = (0, import_store.useAppDispatch)();
|
|
4172
|
-
const envConfig = (0, import_react3.useMemo)(() => {
|
|
4173
|
-
return {
|
|
4174
|
-
mode: "development",
|
|
4175
|
-
baseUrl: "https://api.vitrust.app/c2/api/v2",
|
|
4176
|
-
config: {
|
|
4177
|
-
grantType: "password",
|
|
4178
|
-
clientId: "C52foVQSMpnNOcAP2CBIIkupOSfxUarF8nlOPfXM",
|
|
4179
|
-
clientSecret: "rColINr4a9QBFQPqQB8YU1XfBjqzwerDMJGBxsFK"
|
|
4180
|
-
}
|
|
4181
|
-
};
|
|
4182
|
-
}, []);
|
|
4183
|
-
const config = (0, import_react3.useMemo)(() => {
|
|
4184
|
-
return {
|
|
4185
|
-
VITE_SIDEBAR_TYPE: "grid/sidebar",
|
|
4186
|
-
VITE_APP_DOMAIN: "https://api.vitrust.app/c2/",
|
|
4187
|
-
VITE_IS_EDU: true,
|
|
4188
|
-
VITE_LOGO_WHITE_LOGIN: "https://static.vitrust.app/vitrust/3a/3a1301f614dea6ee19ebf99b68f57e3fd46011d2.png",
|
|
4189
|
-
VITE_LOGO_BLACK_LOGIN: "https://static.vitrust.app/vitrust/32/3223918780da7a439f916faac9abf0bfe98dfa07.png",
|
|
4190
|
-
VITE_BACKGROUND_SIDEBAR: "linear-gradient(178deg, rgb(1, 106, 13) -0.89%, rgb(4, 179, 66) 99.46%",
|
|
4191
|
-
VITE_BANNER: "https://static.vitrust.app/vitrust/5d/5d20cab0627182b4ed5cba4ee42c58b98b663e5b.svg",
|
|
4192
|
-
VITE_BG_BUTTON: "#008F3C",
|
|
4193
|
-
VITE_BACKGROUND_PAGE: "#F9FAFB"
|
|
4194
|
-
};
|
|
4195
|
-
}, []);
|
|
4196
|
-
(0, import_react3.useEffect)(() => {
|
|
4197
|
-
try {
|
|
4198
|
-
const env = (0, import_environment3.getEnv)();
|
|
4199
|
-
env.setupEnv({
|
|
4200
|
-
baseUrl: envConfig.baseUrl,
|
|
4201
|
-
port: 3e3,
|
|
4202
|
-
config: {
|
|
4203
|
-
grantType: envConfig.config.grantType,
|
|
4204
|
-
clientId: envConfig.config.clientId,
|
|
4205
|
-
clientSecret: envConfig.config.clientSecret
|
|
4206
|
-
},
|
|
4207
|
-
db: "preschool",
|
|
4208
|
-
localStorageUtils: localStorageUtils(),
|
|
4209
|
-
sessionStorageUtils: sessionStorageUtils()
|
|
4210
|
-
});
|
|
4211
|
-
dispatch((0, import_store.setEnvFile)(config));
|
|
4212
|
-
} catch (error) {
|
|
4213
|
-
console.error("Error loading env or config:", error);
|
|
4214
|
-
}
|
|
4215
|
-
}, [dispatch, envConfig, config]);
|
|
4216
|
-
return { envConfig, config };
|
|
4217
|
-
};
|
|
4127
|
+
// src/provider.ts
|
|
4128
|
+
var provider_exports = {};
|
|
4129
|
+
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
4218
4130
|
|
|
4219
4131
|
// src/hooks/core/use-detail.ts
|
|
4220
|
-
var import_store2 = require("@fctc/interface-logic/store");
|
|
4221
4132
|
var import_react_query = require("@tanstack/react-query");
|
|
4222
4133
|
var import_react4 = require("react");
|
|
4223
|
-
var import_hooks3 = require("@fctc/interface-logic/hooks");
|
|
4224
|
-
var useDetail = (accessToken, sub) => {
|
|
4225
|
-
const dispatch = (0, import_store2.useAppDispatch)();
|
|
4226
|
-
const fetchGetDetail = (0, import_hooks3.useGetDetail)();
|
|
4227
|
-
const userDetailQuery = (0, import_react_query.useQuery)({
|
|
4228
|
-
queryKey: ["userDetailQuery", sub && accessToken],
|
|
4229
|
-
queryFn: () => {
|
|
4230
|
-
return fetchGetDetail.mutateAsync({
|
|
4231
|
-
model: "res.users",
|
|
4232
|
-
ids: [sub],
|
|
4233
|
-
specification: { image_256: {} }
|
|
4234
|
-
});
|
|
4235
|
-
},
|
|
4236
|
-
enabled: !!sub && !!accessToken
|
|
4237
|
-
});
|
|
4238
|
-
(0, import_react4.useEffect)(() => {
|
|
4239
|
-
if (userDetailQuery.data) {
|
|
4240
|
-
const userPicture = userDetailQuery.data;
|
|
4241
|
-
dispatch(
|
|
4242
|
-
(0, import_store2.setProfile)({ ...userPicture, image: userPicture?.[0]?.image_256 })
|
|
4243
|
-
);
|
|
4244
|
-
}
|
|
4245
|
-
}, [userDetailQuery.data, dispatch]);
|
|
4246
|
-
return userDetailQuery;
|
|
4247
|
-
};
|
|
4248
4134
|
|
|
4249
|
-
// src/hooks/core/use-
|
|
4135
|
+
// src/hooks/core/use-profile.ts
|
|
4136
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
4250
4137
|
var import_react6 = require("react");
|
|
4138
|
+
var import_react_i18next = require("react-i18next");
|
|
4139
|
+
|
|
4140
|
+
// src/utils.ts
|
|
4141
|
+
var utils_exports = {};
|
|
4142
|
+
__export(utils_exports, {
|
|
4143
|
+
STORAGES: () => STORAGES,
|
|
4144
|
+
combineContexts: () => combineContexts,
|
|
4145
|
+
convertFieldsToArray: () => convertFieldsToArray,
|
|
4146
|
+
countSum: () => countSum,
|
|
4147
|
+
getDateRange: () => getDateRange,
|
|
4148
|
+
languages: () => languages,
|
|
4149
|
+
mergeButtons: () => mergeButtons,
|
|
4150
|
+
setStorageItemAsync: () => setStorageItemAsync,
|
|
4151
|
+
useStorageState: () => useStorageState
|
|
4152
|
+
});
|
|
4153
|
+
|
|
4154
|
+
// src/utils/constants.ts
|
|
4155
|
+
var languages = [
|
|
4156
|
+
{ id: "vi_VN", name: "VIE" },
|
|
4157
|
+
{ id: "en_US", name: "ENG" }
|
|
4158
|
+
];
|
|
4251
4159
|
|
|
4252
4160
|
// src/utils/function.ts
|
|
4253
4161
|
var import_react5 = require("react");
|
|
@@ -4407,455 +4315,57 @@ function useStorageState(key) {
|
|
|
4407
4315
|
return [state, setValue];
|
|
4408
4316
|
}
|
|
4409
4317
|
|
|
4410
|
-
// src/
|
|
4411
|
-
|
|
4412
|
-
var import_store3 = require("@fctc/interface-logic/store");
|
|
4413
|
-
var import_utils = require("@fctc/interface-logic/utils");
|
|
4414
|
-
var useListData = ({
|
|
4415
|
-
action,
|
|
4416
|
-
context,
|
|
4417
|
-
viewResponse
|
|
4418
|
-
}) => {
|
|
4419
|
-
const { groupByDomain } = (0, import_store3.useAppSelector)(import_store3.selectSearch);
|
|
4420
|
-
const initModel = (0, import_hooks4.useModel)();
|
|
4421
|
-
const [type, setType] = (0, import_react6.useState)("list");
|
|
4422
|
-
const [mode, setMode] = (0, import_react6.useState)("month");
|
|
4423
|
-
const [currentDate, setCurrentDate] = (0, import_react6.useState)(/* @__PURE__ */ new Date());
|
|
4424
|
-
const { pageLimit, page, order } = (0, import_store3.useAppSelector)(import_store3.selectList);
|
|
4425
|
-
const listDataProps = (0, import_react6.useMemo)(() => {
|
|
4426
|
-
const actData = action?.result;
|
|
4427
|
-
if (!viewResponse || !actData || !context) {
|
|
4428
|
-
return null;
|
|
4429
|
-
}
|
|
4430
|
-
const specification = initModel.initModel({
|
|
4431
|
-
name: String(actData.res_model),
|
|
4432
|
-
view: viewResponse || {},
|
|
4433
|
-
actContext: context,
|
|
4434
|
-
fields: type === "kanban" ? viewResponse?.views?.kanban?.fields : type === "calendar" ? viewResponse?.views?.calendar?.fields : viewResponse?.views?.list?.fields
|
|
4435
|
-
}).getSpecification();
|
|
4436
|
-
const domain = type === "calendar" ? getDateRange(currentDate, mode) : actData?.domain ? Array.isArray(actData?.domain) ? [...actData?.domain] : (0, import_utils.evalJSONDomain)(actData?.domain, context) : [];
|
|
4437
|
-
const limit = type === "calendar" ? 2500 : pageLimit;
|
|
4438
|
-
const offset = page * pageLimit;
|
|
4439
|
-
const fields = type === "calendar" ? convertFieldsToArray(viewResponse?.views?.calendar?.fields) || [] : typeof groupByDomain === "object" ? groupByDomain?.fields : void 0;
|
|
4440
|
-
const groupby = typeof groupByDomain === "object" ? [groupByDomain?.contexts?.[0]?.group_by] : [];
|
|
4441
|
-
const sort = order ? order : viewResponse?.views?.list?.default_order ? (0, import_utils.formatSortingString)(viewResponse?.views?.list?.default_order) : "";
|
|
4442
|
-
return {
|
|
4443
|
-
model: actData.res_model,
|
|
4444
|
-
specification,
|
|
4445
|
-
domain,
|
|
4446
|
-
limit,
|
|
4447
|
-
offset,
|
|
4448
|
-
fields,
|
|
4449
|
-
groupby,
|
|
4450
|
-
context,
|
|
4451
|
-
sort,
|
|
4452
|
-
type
|
|
4453
|
-
};
|
|
4454
|
-
}, [
|
|
4455
|
-
action?.result,
|
|
4456
|
-
context,
|
|
4457
|
-
currentDate,
|
|
4458
|
-
groupByDomain,
|
|
4459
|
-
initModel,
|
|
4460
|
-
mode,
|
|
4461
|
-
order,
|
|
4462
|
-
page,
|
|
4463
|
-
pageLimit,
|
|
4464
|
-
type,
|
|
4465
|
-
viewResponse
|
|
4466
|
-
]);
|
|
4467
|
-
const list = (0, import_hooks4.useGetListData)(
|
|
4468
|
-
listDataProps,
|
|
4469
|
-
[listDataProps],
|
|
4470
|
-
!!listDataProps
|
|
4471
|
-
);
|
|
4472
|
-
return {
|
|
4473
|
-
...list,
|
|
4474
|
-
state: {
|
|
4475
|
-
type,
|
|
4476
|
-
setType,
|
|
4477
|
-
mode,
|
|
4478
|
-
setMode,
|
|
4479
|
-
currentDate,
|
|
4480
|
-
setCurrentDate
|
|
4481
|
-
}
|
|
4482
|
-
};
|
|
4483
|
-
};
|
|
4484
|
-
|
|
4485
|
-
// src/hooks/core/use-menu.ts
|
|
4486
|
-
var import_react7 = require("react");
|
|
4487
|
-
|
|
4488
|
-
// src/utils/constants.ts
|
|
4489
|
-
var languages = [
|
|
4490
|
-
{ id: "vi_VN", name: "VIE" },
|
|
4491
|
-
{ id: "en_US", name: "ENG" }
|
|
4492
|
-
];
|
|
4493
|
-
var API_PRESCHOOL_URL = {
|
|
4494
|
-
baseURL: "https://preschool.vitrust.app"
|
|
4495
|
-
};
|
|
4496
|
-
var API_APP_URL = {
|
|
4497
|
-
baseUrl: "https://api.vitrust.app",
|
|
4498
|
-
c2: "https://api.vitrust.app/c2",
|
|
4499
|
-
apiV2: "https://api.vitrust.app/c2/api/v2"
|
|
4500
|
-
};
|
|
4501
|
-
|
|
4502
|
-
// src/hooks/core/use-menu.ts
|
|
4503
|
-
var import_hooks5 = require("@fctc/interface-logic/hooks");
|
|
4504
|
-
var useMenu = ({ context }) => {
|
|
4505
|
-
const menuData = (0, import_hooks5.useGetMenu)(context, !!context);
|
|
4506
|
-
const [menuid, setMenuId] = (0, import_react7.useState)(void 0);
|
|
4507
|
-
const [action, setAction] = useCallAction();
|
|
4508
|
-
const configedIconData = (0, import_react7.useMemo)(() => {
|
|
4509
|
-
const data = menuData.data;
|
|
4510
|
-
return data?.map((item) => {
|
|
4511
|
-
return {
|
|
4512
|
-
...item,
|
|
4513
|
-
child_id: item?.child_id?.map((child) => {
|
|
4514
|
-
return {
|
|
4515
|
-
...child,
|
|
4516
|
-
url_icon: API_APP_URL.c2 + "/" + child.url_icon
|
|
4517
|
-
};
|
|
4518
|
-
}) ?? [],
|
|
4519
|
-
url_icon: API_APP_URL.c2 + "/" + item.url_icon
|
|
4520
|
-
};
|
|
4521
|
-
});
|
|
4522
|
-
}, [menuData.data]);
|
|
4523
|
-
const handleChangeMenu = async ({
|
|
4524
|
-
menu,
|
|
4525
|
-
subMenu
|
|
4526
|
-
}) => {
|
|
4527
|
-
const aid = subMenu?.action?.id?.id;
|
|
4528
|
-
const actionType = subMenu?.action?.type;
|
|
4529
|
-
await setAction({
|
|
4530
|
-
aid: Number(aid),
|
|
4531
|
-
actionType
|
|
4532
|
-
});
|
|
4533
|
-
if (menu) {
|
|
4534
|
-
setMenuId(menu.id?.toString() ?? "");
|
|
4535
|
-
}
|
|
4536
|
-
};
|
|
4537
|
-
(0, import_react7.useEffect)(() => {
|
|
4538
|
-
const firstRecord = configedIconData?.[0];
|
|
4539
|
-
const firstChild = firstRecord?.child_id?.[0];
|
|
4540
|
-
if (firstChild && firstRecord) {
|
|
4541
|
-
handleChangeMenu({ menu: firstRecord, subMenu: firstChild });
|
|
4542
|
-
}
|
|
4543
|
-
}, [configedIconData]);
|
|
4544
|
-
return {
|
|
4545
|
-
...menuData,
|
|
4546
|
-
data: configedIconData,
|
|
4547
|
-
action: { handleChangeMenu },
|
|
4548
|
-
state: { menuid, action },
|
|
4549
|
-
context
|
|
4550
|
-
};
|
|
4551
|
-
};
|
|
4552
|
-
|
|
4553
|
-
// src/hooks/core/use-profile.ts
|
|
4554
|
-
var import_react_query2 = require("@tanstack/react-query");
|
|
4555
|
-
var import_react8 = require("react");
|
|
4556
|
-
var import_react_i18next = require("react-i18next");
|
|
4557
|
-
var import_environment4 = require("@fctc/interface-logic/environment");
|
|
4558
|
-
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
4559
|
-
var import_store4 = require("@fctc/interface-logic/store");
|
|
4560
|
-
var useProfile = (accessToken) => {
|
|
4561
|
-
const getProfile = (0, import_hooks6.useGetProfile)();
|
|
4562
|
-
const dispatch = (0, import_store4.useAppDispatch)();
|
|
4563
|
-
const { i18n: i18n2 } = (0, import_react_i18next.useTranslation)();
|
|
4564
|
-
const fetchUserProfile = async () => {
|
|
4565
|
-
return await getProfile.mutateAsync();
|
|
4566
|
-
};
|
|
4567
|
-
const userInfoQuery = (0, import_react_query2.useQuery)({
|
|
4568
|
-
queryKey: ["userInfo", accessToken],
|
|
4569
|
-
queryFn: fetchUserProfile,
|
|
4570
|
-
enabled: !!accessToken
|
|
4571
|
-
});
|
|
4572
|
-
(0, import_react8.useEffect)(() => {
|
|
4573
|
-
if (userInfoQuery.data) {
|
|
4574
|
-
const userInfo = userInfoQuery.data;
|
|
4575
|
-
const env = (0, import_environment4.getEnv)();
|
|
4576
|
-
env.setUid(userInfo?.sub);
|
|
4577
|
-
dispatch((0, import_store4.setDataUser)(userInfo));
|
|
4578
|
-
const userLocale = languages.find((lang) => lang?.id === userInfo?.locale);
|
|
4579
|
-
env.setLang(userLocale?.id);
|
|
4580
|
-
i18n2.changeLanguage(userLocale?.id.split("_")[0]);
|
|
4581
|
-
}
|
|
4582
|
-
}, [dispatch, userInfoQuery.data]);
|
|
4583
|
-
const context = (0, import_react8.useMemo)(() => {
|
|
4584
|
-
if (userInfoQuery.data?.sub && userInfoQuery.data?.locale) {
|
|
4585
|
-
return {
|
|
4586
|
-
uid: Number(userInfoQuery.data.sub),
|
|
4587
|
-
allowed_company_ids: [],
|
|
4588
|
-
lang: String(userInfoQuery.data.locale),
|
|
4589
|
-
tz: "Asia/Saigon"
|
|
4590
|
-
};
|
|
4591
|
-
}
|
|
4592
|
-
return void 0;
|
|
4593
|
-
}, [userInfoQuery.data]);
|
|
4594
|
-
return { ...userInfoQuery, context };
|
|
4595
|
-
};
|
|
4596
|
-
|
|
4597
|
-
// src/hooks/core/use-user.ts
|
|
4598
|
-
var useUser = (accessToken) => {
|
|
4599
|
-
const userProfile = useProfile(accessToken);
|
|
4600
|
-
const userDetail = useDetail(accessToken, userProfile.data?.sub);
|
|
4601
|
-
return { userProfile, userDetail, context: userProfile.context };
|
|
4602
|
-
};
|
|
4318
|
+
// src/utils.ts
|
|
4319
|
+
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4603
4320
|
|
|
4604
4321
|
// src/hooks/core/use-view-v2.ts
|
|
4605
|
-
var
|
|
4606
|
-
var import_hooks7 = require("@fctc/interface-logic/hooks");
|
|
4607
|
-
var useViewV2 = ({
|
|
4608
|
-
action,
|
|
4609
|
-
context
|
|
4610
|
-
}) => {
|
|
4611
|
-
const viewParams = (0, import_react9.useMemo)(() => {
|
|
4612
|
-
if (!action?.result) {
|
|
4613
|
-
return void 0;
|
|
4614
|
-
}
|
|
4615
|
-
const actionResult = action?.result;
|
|
4616
|
-
return {
|
|
4617
|
-
model: String(actionResult?.res_model),
|
|
4618
|
-
views: [
|
|
4619
|
-
...Array.isArray(actionResult?.views) ? actionResult?.views.map(
|
|
4620
|
-
(view2) => view2[1] === "list" ? [view2[0], "list"] : view2
|
|
4621
|
-
) : [],
|
|
4622
|
-
[
|
|
4623
|
-
Array.isArray(actionResult?.search_view_id) ? actionResult?.search_view_id[0] : actionResult?.search_view_id,
|
|
4624
|
-
"search"
|
|
4625
|
-
]
|
|
4626
|
-
],
|
|
4627
|
-
context
|
|
4628
|
-
};
|
|
4629
|
-
}, [action, context]);
|
|
4630
|
-
const view = (0, import_hooks7.useGetView)(
|
|
4631
|
-
viewParams || {},
|
|
4632
|
-
!!viewParams
|
|
4633
|
-
);
|
|
4634
|
-
return {
|
|
4635
|
-
...view,
|
|
4636
|
-
context
|
|
4637
|
-
};
|
|
4638
|
-
};
|
|
4639
|
-
|
|
4640
|
-
// src/hooks/core/use-auth.ts
|
|
4641
|
-
var import_hooks8 = require("@fctc/interface-logic/hooks");
|
|
4642
|
-
var import_store5 = require("@fctc/interface-logic/store");
|
|
4643
|
-
var useAuth = () => {
|
|
4644
|
-
const [[isLoading, accessToken], setAccessToken] = useStorageState("TOKEN");
|
|
4645
|
-
const loginMutate = (0, import_hooks8.useLoginCredential)();
|
|
4646
|
-
const dispatch = (0, import_store5.useAppDispatch)();
|
|
4647
|
-
const signIn = async (email, password) => {
|
|
4648
|
-
try {
|
|
4649
|
-
loginMutate.mutate(
|
|
4650
|
-
{
|
|
4651
|
-
email,
|
|
4652
|
-
password,
|
|
4653
|
-
path: "/authentication/oauth2/token"
|
|
4654
|
-
},
|
|
4655
|
-
{
|
|
4656
|
-
onSuccess: (res) => {
|
|
4657
|
-
},
|
|
4658
|
-
onError: (err) => {
|
|
4659
|
-
}
|
|
4660
|
-
}
|
|
4661
|
-
);
|
|
4662
|
-
} catch (error) {
|
|
4663
|
-
throw new Error("Login failed");
|
|
4664
|
-
}
|
|
4665
|
-
};
|
|
4666
|
-
const signOut = async () => {
|
|
4667
|
-
dispatch((0, import_store5.setMenuList)([]));
|
|
4668
|
-
dispatch((0, import_store5.setDataUser)({}));
|
|
4669
|
-
dispatch((0, import_store5.setProfile)({}));
|
|
4670
|
-
setAccessToken(null);
|
|
4671
|
-
};
|
|
4672
|
-
return {
|
|
4673
|
-
signIn,
|
|
4674
|
-
signOut,
|
|
4675
|
-
accessToken,
|
|
4676
|
-
isLoading
|
|
4677
|
-
};
|
|
4678
|
-
};
|
|
4679
|
-
|
|
4680
|
-
// src/hooks/core/use-app-provider.tsx
|
|
4681
|
-
var import_react11 = require("react");
|
|
4322
|
+
var import_react7 = require("react");
|
|
4682
4323
|
|
|
4683
4324
|
// src/hooks/core/use-company.ts
|
|
4684
4325
|
var import_react_query3 = require("@tanstack/react-query");
|
|
4685
|
-
var
|
|
4686
|
-
var import_environment5 = require("@fctc/interface-logic/environment");
|
|
4687
|
-
var import_hooks9 = require("@fctc/interface-logic/hooks");
|
|
4688
|
-
var useCompany = (accessToken) => {
|
|
4689
|
-
const getCurrentCompany = (0, import_hooks9.useGetCurrentCompany)();
|
|
4690
|
-
const fetchCurrentCompany = async () => {
|
|
4691
|
-
return await getCurrentCompany.mutateAsync();
|
|
4692
|
-
};
|
|
4693
|
-
const currentCompany = (0, import_react_query3.useQuery)({
|
|
4694
|
-
queryKey: ["currentCompany", accessToken],
|
|
4695
|
-
queryFn: fetchCurrentCompany,
|
|
4696
|
-
enabled: !!accessToken
|
|
4697
|
-
});
|
|
4698
|
-
const current_company_id = (0, import_react10.useMemo)(() => {
|
|
4699
|
-
return currentCompany.data?.current_company_id;
|
|
4700
|
-
}, [currentCompany.data]);
|
|
4701
|
-
(0, import_react10.useEffect)(() => {
|
|
4702
|
-
if (current_company_id) {
|
|
4703
|
-
const companyIDs = [current_company_id];
|
|
4704
|
-
const env = (0, import_environment5.getEnv)();
|
|
4705
|
-
env.setAllowCompanies([...companyIDs]);
|
|
4706
|
-
env.setCompanies(companyIDs);
|
|
4707
|
-
}
|
|
4708
|
-
}, [current_company_id]);
|
|
4709
|
-
const getCompanyInfo = (0, import_hooks9.useGetCompanyInfo)();
|
|
4710
|
-
const companyInfo = (0, import_react_query3.useQuery)({
|
|
4711
|
-
queryKey: ["companyInfoQuery", current_company_id, accessToken],
|
|
4712
|
-
queryFn: () => getCompanyInfo.mutateAsync(Number(current_company_id)),
|
|
4713
|
-
enabled: !!current_company_id && !!accessToken
|
|
4714
|
-
});
|
|
4715
|
-
(0, import_react10.useEffect)(() => {
|
|
4716
|
-
if (companyInfo.data) {
|
|
4717
|
-
const companyInfoData = companyInfo.data;
|
|
4718
|
-
if (companyInfoData?.length) {
|
|
4719
|
-
const env = (0, import_environment5.getEnv)();
|
|
4720
|
-
env.setDefaultCompany(companyInfoData[0]);
|
|
4721
|
-
}
|
|
4722
|
-
}
|
|
4723
|
-
}, [companyInfo.data]);
|
|
4724
|
-
return {
|
|
4725
|
-
currentCompany,
|
|
4726
|
-
companyInfo,
|
|
4727
|
-
context: { allowed_company_ids: [current_company_id] }
|
|
4728
|
-
};
|
|
4729
|
-
};
|
|
4730
|
-
var use_company_default = useCompany;
|
|
4326
|
+
var import_react8 = require("react");
|
|
4731
4327
|
|
|
4732
4328
|
// src/hooks/core/use-app-provider.tsx
|
|
4733
|
-
var import_utils2 = require("@fctc/interface-logic/utils");
|
|
4734
4329
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4735
4330
|
var AppProviderInitialValue = {
|
|
4736
|
-
config: {},
|
|
4737
4331
|
user: {},
|
|
4738
|
-
auth: {},
|
|
4739
4332
|
company: {},
|
|
4740
4333
|
action: {},
|
|
4741
4334
|
menu: {},
|
|
4742
|
-
view: {}
|
|
4743
|
-
list: {}
|
|
4744
|
-
};
|
|
4745
|
-
var ReactContext = (0, import_react11.createContext)(AppProviderInitialValue);
|
|
4746
|
-
var AppProvider = ({ children }) => {
|
|
4747
|
-
const config = useConfig({});
|
|
4748
|
-
const auth = useAuth();
|
|
4749
|
-
const user = useUser(auth.accessToken);
|
|
4750
|
-
const company = use_company_default(auth.accessToken);
|
|
4751
|
-
const menuContext = (0, import_react11.useMemo)(() => {
|
|
4752
|
-
return combineContexts([user.context, company.context]);
|
|
4753
|
-
}, [user.context, company.context]);
|
|
4754
|
-
const menu = useMenu({ context: menuContext });
|
|
4755
|
-
const action = (0, import_react11.useMemo)(() => {
|
|
4756
|
-
return menu.state.action;
|
|
4757
|
-
}, [menu.state.action]);
|
|
4758
|
-
const viewContext = (0, import_react11.useMemo)(() => {
|
|
4759
|
-
return combineContexts([
|
|
4760
|
-
menuContext,
|
|
4761
|
-
{ ...(0, import_utils2.evalJSONContext)(action?.result?.context) }
|
|
4762
|
-
]);
|
|
4763
|
-
}, [menuContext, action?.result?.context]);
|
|
4764
|
-
const view = useViewV2({
|
|
4765
|
-
action,
|
|
4766
|
-
context: viewContext
|
|
4767
|
-
});
|
|
4768
|
-
const list = useListData({
|
|
4769
|
-
action,
|
|
4770
|
-
viewResponse: view.data,
|
|
4771
|
-
context: viewContext
|
|
4772
|
-
});
|
|
4773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4774
|
-
ReactContext.Provider,
|
|
4775
|
-
{
|
|
4776
|
-
value: {
|
|
4777
|
-
config,
|
|
4778
|
-
auth,
|
|
4779
|
-
user,
|
|
4780
|
-
company,
|
|
4781
|
-
menu,
|
|
4782
|
-
list,
|
|
4783
|
-
action,
|
|
4784
|
-
view
|
|
4785
|
-
},
|
|
4786
|
-
children
|
|
4787
|
-
}
|
|
4788
|
-
);
|
|
4789
|
-
};
|
|
4790
|
-
var useAppProvider = () => {
|
|
4791
|
-
const context = (0, import_react11.useContext)(ReactContext);
|
|
4792
|
-
if (!context) {
|
|
4793
|
-
return AppProviderInitialValue;
|
|
4794
|
-
}
|
|
4795
|
-
return context;
|
|
4335
|
+
view: {}
|
|
4796
4336
|
};
|
|
4337
|
+
var ReactContext = (0, import_react9.createContext)(AppProviderInitialValue);
|
|
4797
4338
|
|
|
4798
|
-
// src/hooks/core/use-
|
|
4799
|
-
var
|
|
4800
|
-
var import_hooks10 = require("@fctc/interface-logic/hooks");
|
|
4801
|
-
var import_react12 = require("react");
|
|
4339
|
+
// src/hooks/core/use-config.ts
|
|
4340
|
+
var import_react10 = require("react");
|
|
4802
4341
|
|
|
4803
|
-
// src/
|
|
4804
|
-
var
|
|
4805
|
-
__export(utils_exports, {
|
|
4806
|
-
API_APP_URL: () => API_APP_URL,
|
|
4807
|
-
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4808
|
-
STORAGES: () => STORAGES,
|
|
4809
|
-
combineContexts: () => combineContexts,
|
|
4810
|
-
convertFieldsToArray: () => convertFieldsToArray,
|
|
4811
|
-
countSum: () => countSum,
|
|
4812
|
-
getDateRange: () => getDateRange,
|
|
4813
|
-
languages: () => languages,
|
|
4814
|
-
mergeButtons: () => mergeButtons,
|
|
4815
|
-
setStorageItemAsync: () => setStorageItemAsync,
|
|
4816
|
-
useStorageState: () => useStorageState
|
|
4817
|
-
});
|
|
4818
|
-
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4342
|
+
// src/hooks/core/use-get-specification.ts
|
|
4343
|
+
var import_react11 = require("react");
|
|
4819
4344
|
|
|
4820
|
-
// src/hooks/core/use-
|
|
4821
|
-
var
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
const context = (0, import_environment6.getEnv)().context;
|
|
4827
|
-
const queryActionDetail = (0, import_hooks10.useGetActionDetail)({
|
|
4828
|
-
aid,
|
|
4829
|
-
id,
|
|
4830
|
-
model,
|
|
4831
|
-
context,
|
|
4832
|
-
enabled: true,
|
|
4833
|
-
queryKey: [`action-${aid}`]
|
|
4834
|
-
}).data;
|
|
4835
|
-
const [path, setPath] = (0, import_react12.useState)("");
|
|
4836
|
-
const handleClick = () => {
|
|
4837
|
-
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4838
|
-
return;
|
|
4839
|
-
}
|
|
4840
|
-
const hasListView = queryActionDetail.views.some(
|
|
4841
|
-
([id2, type]) => type === "list"
|
|
4842
|
-
);
|
|
4843
|
-
const viewType = hasListView ? "list" : "form";
|
|
4844
|
-
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4845
|
-
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4846
|
-
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4847
|
-
viewType,
|
|
4848
|
-
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4849
|
-
aid: menu?.action?.id?.id,
|
|
4850
|
-
model: queryActionDetail.res_model
|
|
4851
|
-
});
|
|
4852
|
-
setPath(path2);
|
|
4853
|
-
};
|
|
4854
|
-
return { handleClick, path, queryActionDetail };
|
|
4855
|
-
};
|
|
4345
|
+
// src/hooks/core/use-list-data.ts
|
|
4346
|
+
var import_react15 = require("react");
|
|
4347
|
+
var import_utils4 = require("@fctc/interface-logic/utils");
|
|
4348
|
+
|
|
4349
|
+
// src/hooks/utils/use-click-outside.ts
|
|
4350
|
+
var import_react12 = require("react");
|
|
4856
4351
|
|
|
4857
|
-
// src/hooks/
|
|
4352
|
+
// src/hooks/utils/use-debounce.ts
|
|
4858
4353
|
var import_react13 = require("react");
|
|
4354
|
+
function useDebounce(value, delay) {
|
|
4355
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react13.useState)(value);
|
|
4356
|
+
(0, import_react13.useEffect)(() => {
|
|
4357
|
+
const handler = setTimeout(() => {
|
|
4358
|
+
setDebouncedValue(value);
|
|
4359
|
+
}, delay);
|
|
4360
|
+
return () => {
|
|
4361
|
+
clearTimeout(handler);
|
|
4362
|
+
};
|
|
4363
|
+
}, [value, delay]);
|
|
4364
|
+
return [debouncedValue];
|
|
4365
|
+
}
|
|
4366
|
+
|
|
4367
|
+
// src/hooks/utils/use-get-rowids.ts
|
|
4368
|
+
var import_react14 = require("react");
|
|
4859
4369
|
var useGetRowIds = (tableRef) => {
|
|
4860
4370
|
function isElementVisible(el) {
|
|
4861
4371
|
const style = window.getComputedStyle(el);
|
|
@@ -4872,9 +4382,9 @@ var useGetRowIds = (tableRef) => {
|
|
|
4872
4382
|
}
|
|
4873
4383
|
return true;
|
|
4874
4384
|
}
|
|
4875
|
-
const [rowIds, setRowIds] = (0,
|
|
4876
|
-
const lastRowIdsRef = (0,
|
|
4877
|
-
const updateVisibleRowIds = (0,
|
|
4385
|
+
const [rowIds, setRowIds] = (0, import_react14.useState)([]);
|
|
4386
|
+
const lastRowIdsRef = (0, import_react14.useRef)([]);
|
|
4387
|
+
const updateVisibleRowIds = (0, import_react14.useCallback)(() => {
|
|
4878
4388
|
const table = tableRef.current;
|
|
4879
4389
|
if (!table) return;
|
|
4880
4390
|
const rows = table.querySelectorAll("tr[data-row-id]");
|
|
@@ -4892,7 +4402,7 @@ var useGetRowIds = (tableRef) => {
|
|
|
4892
4402
|
setRowIds(uniqueIds);
|
|
4893
4403
|
}
|
|
4894
4404
|
}, [tableRef]);
|
|
4895
|
-
(0,
|
|
4405
|
+
(0, import_react14.useEffect)(() => {
|
|
4896
4406
|
const table = tableRef.current;
|
|
4897
4407
|
if (!table) return;
|
|
4898
4408
|
const mutationObserver = new MutationObserver(() => {
|
|
@@ -4920,63 +4430,10 @@ var useGetRowIds = (tableRef) => {
|
|
|
4920
4430
|
return { rowIds, refresh: updateVisibleRowIds };
|
|
4921
4431
|
};
|
|
4922
4432
|
|
|
4923
|
-
// src/hooks/utils/use-click-outside.ts
|
|
4924
|
-
var import_react14 = require("react");
|
|
4925
|
-
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
4926
|
-
var useClickOutside = ({
|
|
4927
|
-
handler,
|
|
4928
|
-
events = DEFAULT_EVENTS,
|
|
4929
|
-
nodes = [],
|
|
4930
|
-
refs
|
|
4931
|
-
}) => {
|
|
4932
|
-
const ref = (0, import_react14.useRef)(null);
|
|
4933
|
-
(0, import_react14.useEffect)(() => {
|
|
4934
|
-
const listener = (event) => {
|
|
4935
|
-
const { target } = event;
|
|
4936
|
-
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
4937
|
-
return;
|
|
4938
|
-
}
|
|
4939
|
-
if (!(target instanceof HTMLElement)) return;
|
|
4940
|
-
const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
|
|
4941
|
-
const shouldTrigger = nodes.length > 0 ? nodes.every((node) => node && !event.composedPath().includes(node)) : ref.current && !ref.current.contains(target);
|
|
4942
|
-
if (shouldTrigger && !shouldIgnore) {
|
|
4943
|
-
handler(event);
|
|
4944
|
-
}
|
|
4945
|
-
};
|
|
4946
|
-
events.forEach((event) => document.addEventListener(event, listener));
|
|
4947
|
-
return () => {
|
|
4948
|
-
events.forEach((event) => document.removeEventListener(event, listener));
|
|
4949
|
-
};
|
|
4950
|
-
}, [handler, nodes, events]);
|
|
4951
|
-
return ref;
|
|
4952
|
-
};
|
|
4953
|
-
|
|
4954
|
-
// src/hooks/utils/use-debounce.ts
|
|
4955
|
-
var import_react15 = require("react");
|
|
4956
|
-
function useDebounce(value, delay) {
|
|
4957
|
-
const [debouncedValue, setDebouncedValue] = (0, import_react15.useState)(value);
|
|
4958
|
-
(0, import_react15.useEffect)(() => {
|
|
4959
|
-
const handler = setTimeout(() => {
|
|
4960
|
-
setDebouncedValue(value);
|
|
4961
|
-
}, delay);
|
|
4962
|
-
return () => {
|
|
4963
|
-
clearTimeout(handler);
|
|
4964
|
-
};
|
|
4965
|
-
}, [value, delay]);
|
|
4966
|
-
return [debouncedValue];
|
|
4967
|
-
}
|
|
4968
|
-
|
|
4969
|
-
// src/hooks.ts
|
|
4970
|
-
__reExport(hooks_exports, require("@fctc/interface-logic/hooks"));
|
|
4971
|
-
|
|
4972
4433
|
// src/store.ts
|
|
4973
4434
|
var store_exports = {};
|
|
4974
4435
|
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
4975
4436
|
|
|
4976
|
-
// src/provider.ts
|
|
4977
|
-
var provider_exports = {};
|
|
4978
|
-
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
4979
|
-
|
|
4980
4437
|
// src/widget/basic/many2one-field/controller.ts
|
|
4981
4438
|
var many2oneFieldController = (props) => {
|
|
4982
4439
|
const {
|
|
@@ -5009,7 +4466,7 @@ var many2oneFieldController = (props) => {
|
|
|
5009
4466
|
...fieldContext,
|
|
5010
4467
|
...env?.context
|
|
5011
4468
|
};
|
|
5012
|
-
const { useGetSelection:
|
|
4469
|
+
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
5013
4470
|
const data = {
|
|
5014
4471
|
model: relation,
|
|
5015
4472
|
domain: domainObject,
|
|
@@ -5025,7 +4482,7 @@ var many2oneFieldController = (props) => {
|
|
|
5025
4482
|
data: dataOfSelection,
|
|
5026
4483
|
refetch,
|
|
5027
4484
|
isFetching
|
|
5028
|
-
} =
|
|
4485
|
+
} = useGetSelection3({
|
|
5029
4486
|
data,
|
|
5030
4487
|
queryKey,
|
|
5031
4488
|
enabled: false
|
|
@@ -5151,20 +4608,20 @@ var many2oneFieldController = (props) => {
|
|
|
5151
4608
|
};
|
|
5152
4609
|
|
|
5153
4610
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5154
|
-
var
|
|
5155
|
-
var
|
|
5156
|
-
var
|
|
4611
|
+
var import_environment2 = require("@fctc/interface-logic/environment");
|
|
4612
|
+
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
4613
|
+
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5157
4614
|
var many2oneButtonController = (props) => {
|
|
5158
4615
|
const { domain, methods, relation } = props;
|
|
5159
4616
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5160
|
-
const env = (0,
|
|
5161
|
-
const domainObject = (0,
|
|
4617
|
+
const env = (0, import_environment2.getEnv)();
|
|
4618
|
+
const domainObject = (0, import_utils7.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5162
4619
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5163
|
-
const { data: dataOfSelection } = (0,
|
|
4620
|
+
const { data: dataOfSelection } = (0, import_hooks6.useGetSelection)({
|
|
5164
4621
|
data: {
|
|
5165
4622
|
model: relation ?? "",
|
|
5166
4623
|
domain: domainObject,
|
|
5167
|
-
context: { ...env.context, ...(0,
|
|
4624
|
+
context: { ...env.context, ...(0, import_utils7.evalJSONContext)(actionData?.context) }
|
|
5168
4625
|
},
|
|
5169
4626
|
queryKey: [`data_${relation}`, domainObject]
|
|
5170
4627
|
});
|
|
@@ -5179,7 +4636,7 @@ var many2oneButtonController = (props) => {
|
|
|
5179
4636
|
|
|
5180
4637
|
// src/widget/basic/many2many-field/controller.ts
|
|
5181
4638
|
var import_react17 = require("react");
|
|
5182
|
-
var
|
|
4639
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5183
4640
|
var many2manyFieldController = (props) => {
|
|
5184
4641
|
const {
|
|
5185
4642
|
relation,
|
|
@@ -5193,7 +4650,7 @@ var many2manyFieldController = (props) => {
|
|
|
5193
4650
|
actionData
|
|
5194
4651
|
} = props;
|
|
5195
4652
|
const { env } = (0, provider_exports.useEnv)();
|
|
5196
|
-
const { useGetView: useGetView2, useGetListData: useGetListData2, useGetFormView } = (0, provider_exports.useService)();
|
|
4653
|
+
const { useGetView: useGetView2, useGetListData: useGetListData2, useGetFormView: useGetFormView2 } = (0, provider_exports.useService)();
|
|
5197
4654
|
const [order, setOrder] = (0, import_react17.useState)();
|
|
5198
4655
|
const [page, setPage] = (0, import_react17.useState)(0);
|
|
5199
4656
|
const [domainMany2Many, setDomainMany2Many] = (0, import_react17.useState)(null);
|
|
@@ -5223,7 +4680,7 @@ var many2manyFieldController = (props) => {
|
|
|
5223
4680
|
}),
|
|
5224
4681
|
[relation, viewResponse]
|
|
5225
4682
|
);
|
|
5226
|
-
const initModel = (0,
|
|
4683
|
+
const initModel = (0, import_hooks3.useModel)();
|
|
5227
4684
|
const modelInstance = (0, import_react17.useMemo)(() => {
|
|
5228
4685
|
if (viewResponse) {
|
|
5229
4686
|
return initModel.initModel(baseModel);
|
|
@@ -5237,10 +4694,10 @@ var many2manyFieldController = (props) => {
|
|
|
5237
4694
|
return null;
|
|
5238
4695
|
}, [modelInstance]);
|
|
5239
4696
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5240
|
-
const optionsObject = tab?.options ? (0,
|
|
4697
|
+
const optionsObject = tab?.options ? (0, import_utils8.evalJSONContext)(tab?.options) : (options ? (0, import_utils8.evalJSONContext)(options) : {}) || {};
|
|
5241
4698
|
const fetchData = async () => {
|
|
5242
4699
|
try {
|
|
5243
|
-
const domainParse = typeof domain === "string" ? (0,
|
|
4700
|
+
const domainParse = typeof domain === "string" ? (0, import_utils8.evalJSONDomain)(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5244
4701
|
setDomainMany2Many(domainParse);
|
|
5245
4702
|
setPage(0);
|
|
5246
4703
|
} catch (err) {
|
|
@@ -5264,7 +4721,7 @@ var many2manyFieldController = (props) => {
|
|
|
5264
4721
|
context: contextObject,
|
|
5265
4722
|
fields: groupByDomain?.fields,
|
|
5266
4723
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5267
|
-
sort: order ? order : default_order ? (0,
|
|
4724
|
+
sort: order ? order : default_order ? (0, import_utils8.formatSortingString)(default_order) : ""
|
|
5268
4725
|
};
|
|
5269
4726
|
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5270
4727
|
const {
|
|
@@ -5327,8 +4784,8 @@ var many2manyFieldController = (props) => {
|
|
|
5327
4784
|
|
|
5328
4785
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5329
4786
|
var import_react18 = require("react");
|
|
5330
|
-
var
|
|
5331
|
-
var
|
|
4787
|
+
var import_constants2 = require("@fctc/interface-logic/constants");
|
|
4788
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5332
4789
|
var many2manyTagsController = (props) => {
|
|
5333
4790
|
const {
|
|
5334
4791
|
relation,
|
|
@@ -5340,10 +4797,10 @@ var many2manyTagsController = (props) => {
|
|
|
5340
4797
|
} = props;
|
|
5341
4798
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5342
4799
|
const { env } = (0, provider_exports.useEnv)();
|
|
5343
|
-
const { useGetSelection:
|
|
5344
|
-
const addtionalFields = optionsFields ? (0,
|
|
4800
|
+
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
4801
|
+
const addtionalFields = optionsFields ? (0, import_utils9.evalJSONContext)(optionsFields) : null;
|
|
5345
4802
|
const domainObject = (0, import_react18.useMemo)(
|
|
5346
|
-
() => (0,
|
|
4803
|
+
() => (0, import_utils9.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5347
4804
|
[domain, formValues]
|
|
5348
4805
|
);
|
|
5349
4806
|
const data = {
|
|
@@ -5353,13 +4810,13 @@ var many2manyTagsController = (props) => {
|
|
|
5353
4810
|
id: {},
|
|
5354
4811
|
name: {},
|
|
5355
4812
|
display_name: {},
|
|
5356
|
-
...widget &&
|
|
5357
|
-
...widget &&
|
|
4813
|
+
...widget && import_constants2.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
4814
|
+
...widget && import_constants2.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
5358
4815
|
},
|
|
5359
4816
|
enabled: true,
|
|
5360
4817
|
context: env.context
|
|
5361
4818
|
};
|
|
5362
|
-
const { data: dataOfSelection } =
|
|
4819
|
+
const { data: dataOfSelection } = useGetSelection3({
|
|
5363
4820
|
data,
|
|
5364
4821
|
queryKey: [`data_${relation}`, domainObject]
|
|
5365
4822
|
});
|
|
@@ -5385,7 +4842,7 @@ var many2manyTagsController = (props) => {
|
|
|
5385
4842
|
|
|
5386
4843
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5387
4844
|
var import_react19 = require("react");
|
|
5388
|
-
var
|
|
4845
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
5389
4846
|
var durationController = (props) => {
|
|
5390
4847
|
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5391
4848
|
const specification = {
|
|
@@ -5393,7 +4850,7 @@ var durationController = (props) => {
|
|
|
5393
4850
|
name: "",
|
|
5394
4851
|
fold: ""
|
|
5395
4852
|
};
|
|
5396
|
-
const { useGetListData: useGetListData2, useChangeStatus } = (0, provider_exports.useService)();
|
|
4853
|
+
const { useGetListData: useGetListData2, useChangeStatus: useChangeStatus2 } = (0, provider_exports.useService)();
|
|
5397
4854
|
const { env } = (0, provider_exports.useEnv)();
|
|
5398
4855
|
const [disabled, setDisabled] = (0, import_react19.useState)(false);
|
|
5399
4856
|
const [modelStatus, setModalStatus] = (0, import_react19.useState)(false);
|
|
@@ -5401,7 +4858,7 @@ var durationController = (props) => {
|
|
|
5401
4858
|
const listDataProps = {
|
|
5402
4859
|
model: relation,
|
|
5403
4860
|
specification,
|
|
5404
|
-
domain: (0,
|
|
4861
|
+
domain: (0, import_utils10.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5405
4862
|
limit: 10,
|
|
5406
4863
|
offset: 0,
|
|
5407
4864
|
fields: "",
|
|
@@ -5416,7 +4873,7 @@ var durationController = (props) => {
|
|
|
5416
4873
|
queryKey,
|
|
5417
4874
|
enabled
|
|
5418
4875
|
);
|
|
5419
|
-
const { mutate: fetchChangeStatus } =
|
|
4876
|
+
const { mutate: fetchChangeStatus } = useChangeStatus2();
|
|
5420
4877
|
const handleClick = async (stage_id) => {
|
|
5421
4878
|
setDisabled(true);
|
|
5422
4879
|
if (stage_id) {
|
|
@@ -5451,13 +4908,13 @@ var durationController = (props) => {
|
|
|
5451
4908
|
};
|
|
5452
4909
|
|
|
5453
4910
|
// src/widget/basic/priority-field/controller.ts
|
|
5454
|
-
var
|
|
4911
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
5455
4912
|
var priorityFieldController = (props) => {
|
|
5456
4913
|
const { name, model, index, actionData, context, onChange, specification } = props;
|
|
5457
|
-
const _context = { ...(0,
|
|
4914
|
+
const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) };
|
|
5458
4915
|
const contextObject = { ...context, ..._context };
|
|
5459
|
-
const { useSave:
|
|
5460
|
-
const { mutateAsync: fetchSave } =
|
|
4916
|
+
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
4917
|
+
const { mutateAsync: fetchSave } = useSave3();
|
|
5461
4918
|
const savePriorities = async ({
|
|
5462
4919
|
value,
|
|
5463
4920
|
resetPriority
|
|
@@ -6422,12 +5879,12 @@ var dateFieldController = (props) => {
|
|
|
6422
5879
|
|
|
6423
5880
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6424
5881
|
var import_react21 = require("react");
|
|
6425
|
-
var
|
|
5882
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
6426
5883
|
var copyLinkButtonController = (props) => {
|
|
6427
5884
|
const { value, defaultValue } = props;
|
|
6428
5885
|
const [isCopied, setIsCopied] = (0, import_react21.useState)(false);
|
|
6429
5886
|
const handleCopyToClipboard = async (value2) => {
|
|
6430
|
-
await (0,
|
|
5887
|
+
await (0, import_utils12.copyTextToClipboard)(value2);
|
|
6431
5888
|
setIsCopied(true);
|
|
6432
5889
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
6433
5890
|
};
|
|
@@ -6440,15 +5897,15 @@ var copyLinkButtonController = (props) => {
|
|
|
6440
5897
|
};
|
|
6441
5898
|
|
|
6442
5899
|
// src/widget/basic/color-field/color-controller.ts
|
|
6443
|
-
var
|
|
5900
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6444
5901
|
var colorFieldController = (props) => {
|
|
6445
5902
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6446
5903
|
const { env } = (0, provider_exports.useEnv)();
|
|
6447
|
-
const { useSave:
|
|
6448
|
-
const _context = { ...(0,
|
|
5904
|
+
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
5905
|
+
const _context = { ...(0, import_utils13.evalJSONContext)(actionData?.context) || {} };
|
|
6449
5906
|
const contextObject = { ...env.context, ..._context };
|
|
6450
5907
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6451
|
-
const { mutate: onSave } =
|
|
5908
|
+
const { mutate: onSave } = useSave3();
|
|
6452
5909
|
const savePickColor = async (colorObject) => {
|
|
6453
5910
|
const { id } = colorObject;
|
|
6454
5911
|
if (value === id) return;
|
|
@@ -6474,7 +5931,7 @@ var colorFieldController = (props) => {
|
|
|
6474
5931
|
|
|
6475
5932
|
// src/widget/basic/binary-field/controller.ts
|
|
6476
5933
|
var import_react22 = require("react");
|
|
6477
|
-
var
|
|
5934
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6478
5935
|
var binaryFieldController = (props) => {
|
|
6479
5936
|
const { name, methods, readonly = false, value } = props;
|
|
6480
5937
|
const inputId = (0, import_react22.useId)();
|
|
@@ -6531,11 +5988,11 @@ var binaryFieldController = (props) => {
|
|
|
6531
5988
|
};
|
|
6532
5989
|
const checkIsImageLink = (url) => {
|
|
6533
5990
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6534
|
-
return imageExtensions.test(url) || (0,
|
|
5991
|
+
return imageExtensions.test(url) || (0, import_utils14.isBase64Image)(url) || isBlobUrl(url);
|
|
6535
5992
|
};
|
|
6536
5993
|
const getImageBase64WithMimeType = (base64) => {
|
|
6537
5994
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6538
|
-
if ((0,
|
|
5995
|
+
if ((0, import_utils14.isBase64Image)(base64)) return base64;
|
|
6539
5996
|
let mimeType = null;
|
|
6540
5997
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6541
5998
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6571,11 +6028,11 @@ var binaryFieldController = (props) => {
|
|
|
6571
6028
|
};
|
|
6572
6029
|
|
|
6573
6030
|
// src/widget/advance/table/table-head/controller.ts
|
|
6574
|
-
var
|
|
6031
|
+
var import_store2 = require("@fctc/interface-logic/store");
|
|
6575
6032
|
var import_react23 = require("react");
|
|
6576
6033
|
var tableHeadController = (props) => {
|
|
6577
6034
|
const { typeTable, rows, tableRef, groupByList, selectedRowKeys } = props;
|
|
6578
|
-
const appDispatch = (0,
|
|
6035
|
+
const appDispatch = (0, import_store2.useAppDispatch)();
|
|
6579
6036
|
const { rowIds: recordIds } = useGetRowIds(tableRef);
|
|
6580
6037
|
const selectedRowKeysRef = (0, import_react23.useRef)(recordIds);
|
|
6581
6038
|
const isGroupTable = typeTable === "group";
|
|
@@ -6601,27 +6058,27 @@ var tableHeadController = (props) => {
|
|
|
6601
6058
|
const handleCheckBoxAll = (event) => {
|
|
6602
6059
|
if (event?.target?.checked && typeTable === "list") {
|
|
6603
6060
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6604
|
-
appDispatch((0,
|
|
6061
|
+
appDispatch((0, import_store2.setSelectedRowKeys)(allRowKeys));
|
|
6605
6062
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6606
6063
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6607
6064
|
const ids = Array.from(rowsIDs)?.map(
|
|
6608
6065
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6609
6066
|
);
|
|
6610
6067
|
if (ids?.length > 0) {
|
|
6611
|
-
appDispatch((0,
|
|
6068
|
+
appDispatch((0, import_store2.setSelectedRowKeys)(ids));
|
|
6612
6069
|
} else {
|
|
6613
6070
|
const sum = countSum(
|
|
6614
6071
|
rows,
|
|
6615
6072
|
typeof groupByList === "object" ? groupByList?.contexts?.[0]?.group_by : void 0
|
|
6616
6073
|
);
|
|
6617
6074
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6618
|
-
appDispatch((0,
|
|
6075
|
+
appDispatch((0, import_store2.setSelectedRowKeys)(keys));
|
|
6619
6076
|
}
|
|
6620
6077
|
if (selectedRowKeysRef) {
|
|
6621
6078
|
selectedRowKeysRef.current = [];
|
|
6622
6079
|
}
|
|
6623
6080
|
} else {
|
|
6624
|
-
appDispatch((0,
|
|
6081
|
+
appDispatch((0, import_store2.setSelectedRowKeys)([]));
|
|
6625
6082
|
}
|
|
6626
6083
|
};
|
|
6627
6084
|
return {
|
|
@@ -6633,7 +6090,7 @@ var tableHeadController = (props) => {
|
|
|
6633
6090
|
|
|
6634
6091
|
// src/widget/advance/table/table-view/controller.ts
|
|
6635
6092
|
var import_react24 = require("react");
|
|
6636
|
-
var
|
|
6093
|
+
var import_utils15 = require("@fctc/interface-logic/utils");
|
|
6637
6094
|
var tableController = ({ data }) => {
|
|
6638
6095
|
const [rows, setRows] = (0, import_react24.useState)(null);
|
|
6639
6096
|
const [columns, setColumns] = (0, import_react24.useState)(null);
|
|
@@ -6671,7 +6128,7 @@ var tableController = ({ data }) => {
|
|
|
6671
6128
|
let cols = [];
|
|
6672
6129
|
try {
|
|
6673
6130
|
cols = mergeFields?.filter((item) => {
|
|
6674
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
6131
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils15.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils15.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
6675
6132
|
})?.map((field) => {
|
|
6676
6133
|
return {
|
|
6677
6134
|
name: field?.name,
|
|
@@ -6703,11 +6160,13 @@ var tableController = ({ data }) => {
|
|
|
6703
6160
|
setColumns(tempColumn);
|
|
6704
6161
|
};
|
|
6705
6162
|
(0, import_react24.useEffect)(() => {
|
|
6706
|
-
|
|
6707
|
-
setColumns(null);
|
|
6708
|
-
return () => {
|
|
6709
|
-
setRows(null);
|
|
6163
|
+
if (data?.fields != null) {
|
|
6710
6164
|
setColumns(null);
|
|
6165
|
+
}
|
|
6166
|
+
return () => {
|
|
6167
|
+
if (data?.fields != null) {
|
|
6168
|
+
setColumns(null);
|
|
6169
|
+
}
|
|
6711
6170
|
};
|
|
6712
6171
|
}, [data?.fields]);
|
|
6713
6172
|
return {
|
|
@@ -6720,7 +6179,7 @@ var tableController = ({ data }) => {
|
|
|
6720
6179
|
|
|
6721
6180
|
// src/widget/advance/table/table-group/controller.ts
|
|
6722
6181
|
var import_react25 = require("react");
|
|
6723
|
-
var
|
|
6182
|
+
var import_store3 = require("@fctc/interface-logic/store");
|
|
6724
6183
|
var tableGroupController = (props) => {
|
|
6725
6184
|
const { env } = (0, provider_exports.useEnv)();
|
|
6726
6185
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
@@ -6737,7 +6196,7 @@ var tableGroupController = (props) => {
|
|
|
6737
6196
|
setSelectedRowKeys: setSelectedRowKeys3
|
|
6738
6197
|
} = props;
|
|
6739
6198
|
const [pageGroup, setPageGroup] = (0, import_react25.useState)(0);
|
|
6740
|
-
const { selectedRowKeys } = (0,
|
|
6199
|
+
const { selectedRowKeys } = (0, import_store3.useAppSelector)(import_store3.selectList);
|
|
6741
6200
|
const [isShowGroup, setIsShowGroup] = (0, import_react25.useState)(false);
|
|
6742
6201
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react25.useState)({
|
|
6743
6202
|
fromStart: 1,
|
|
@@ -6853,8 +6312,8 @@ var tableGroupController = (props) => {
|
|
|
6853
6312
|
};
|
|
6854
6313
|
|
|
6855
6314
|
// src/widget/advance/search/controller.ts
|
|
6856
|
-
var
|
|
6857
|
-
var
|
|
6315
|
+
var import_constants3 = require("@fctc/interface-logic/constants");
|
|
6316
|
+
var import_utils17 = require("@fctc/interface-logic/utils");
|
|
6858
6317
|
var import_moment2 = __toESM(require_moment());
|
|
6859
6318
|
var import_react26 = require("react");
|
|
6860
6319
|
var searchController = ({
|
|
@@ -6871,9 +6330,9 @@ var searchController = ({
|
|
|
6871
6330
|
const [selectedTags, setSelectedTags] = (0, import_react26.useState)(null);
|
|
6872
6331
|
const [searchString, setSearchString] = (0, import_react26.useState)("");
|
|
6873
6332
|
const [searchMap, setSearchMap] = (0, import_react26.useState)({});
|
|
6874
|
-
const actionContext = typeof context === "string" ? (0,
|
|
6333
|
+
const actionContext = typeof context === "string" ? (0, import_utils17.evalJSONContext)(context) : context;
|
|
6875
6334
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6876
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0,
|
|
6335
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils17.evalJSONDomain)(domain, contextSearch) : [];
|
|
6877
6336
|
const clearSearch = () => {
|
|
6878
6337
|
setFilterBy([]);
|
|
6879
6338
|
setGroupBy([]);
|
|
@@ -6888,7 +6347,7 @@ var searchController = ({
|
|
|
6888
6347
|
const dataModel = viewData?.models?.[model];
|
|
6889
6348
|
const searchViews = viewData?.views?.search;
|
|
6890
6349
|
const searchByItems = searchViews?.search_by?.filter(
|
|
6891
|
-
(item) => !
|
|
6350
|
+
(item) => !import_utils17.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
6892
6351
|
)?.map(
|
|
6893
6352
|
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
6894
6353
|
dataIndex: index,
|
|
@@ -6901,10 +6360,10 @@ var searchController = ({
|
|
|
6901
6360
|
})
|
|
6902
6361
|
);
|
|
6903
6362
|
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
6904
|
-
return !
|
|
6363
|
+
return !import_utils17.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
6905
6364
|
})?.map((item) => ({ ...item, active: false }));
|
|
6906
6365
|
const groupByItems = searchViews?.group_by.filter(
|
|
6907
|
-
(item) => !
|
|
6366
|
+
(item) => !import_utils17.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
6908
6367
|
).map((item) => ({
|
|
6909
6368
|
...item,
|
|
6910
6369
|
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
@@ -6958,7 +6417,7 @@ var searchController = ({
|
|
|
6958
6417
|
if (domainAction) {
|
|
6959
6418
|
const domain2 = [];
|
|
6960
6419
|
if (domainAction?.length > 0) {
|
|
6961
|
-
if (Object.keys(searchMap).some((key) => !key.includes(
|
|
6420
|
+
if (Object.keys(searchMap).some((key) => !key.includes(import_constants3.SearchType.GROUP))) {
|
|
6962
6421
|
domain2.push("&");
|
|
6963
6422
|
}
|
|
6964
6423
|
domainAction.forEach((domainItem) => {
|
|
@@ -6966,7 +6425,7 @@ var searchController = ({
|
|
|
6966
6425
|
});
|
|
6967
6426
|
}
|
|
6968
6427
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
6969
|
-
if (!key?.includes(
|
|
6428
|
+
if (!key?.includes(import_constants3.SearchType.GROUP)) {
|
|
6970
6429
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
6971
6430
|
domain2.push("&");
|
|
6972
6431
|
}
|
|
@@ -6981,14 +6440,14 @@ var searchController = ({
|
|
|
6981
6440
|
}
|
|
6982
6441
|
let valueDomainItem = value?.value;
|
|
6983
6442
|
if (value?.modelType === "date") {
|
|
6984
|
-
valueDomainItem = (0,
|
|
6443
|
+
valueDomainItem = (0, import_utils17.validateAndParseDate)(value?.value);
|
|
6985
6444
|
} else if (value?.modelType === "datetime") {
|
|
6986
6445
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
6987
|
-
const parsedDate = (0,
|
|
6446
|
+
const parsedDate = (0, import_utils17.validateAndParseDate)(value?.value, true);
|
|
6988
6447
|
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
6989
6448
|
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");
|
|
6990
6449
|
} else {
|
|
6991
|
-
valueDomainItem = (0,
|
|
6450
|
+
valueDomainItem = (0, import_utils17.validateAndParseDate)(value?.value, true);
|
|
6992
6451
|
}
|
|
6993
6452
|
}
|
|
6994
6453
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
@@ -7013,11 +6472,11 @@ var searchController = ({
|
|
|
7013
6472
|
modelType,
|
|
7014
6473
|
dataIndex
|
|
7015
6474
|
} = objValues[0];
|
|
7016
|
-
if (!key?.includes(
|
|
6475
|
+
if (!key?.includes(import_constants3.SearchType.GROUP)) {
|
|
7017
6476
|
const values = objValues?.map((objValue) => objValue.value);
|
|
7018
6477
|
return {
|
|
7019
6478
|
title,
|
|
7020
|
-
name: type ===
|
|
6479
|
+
name: type === import_constants3.SearchType.SEARCH ? `${import_constants3.SearchType.SEARCH}_${String(dataIndex)}` : groupIndex ?? name,
|
|
7021
6480
|
values,
|
|
7022
6481
|
type,
|
|
7023
6482
|
widget,
|
|
@@ -7066,32 +6525,23 @@ var searchController = ({
|
|
|
7066
6525
|
setTagSearch(searchMap);
|
|
7067
6526
|
}, [searchMap]);
|
|
7068
6527
|
const handleAddTagSearch = (tag) => {
|
|
7069
|
-
const {
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
type,
|
|
7074
|
-
title,
|
|
7075
|
-
context: context2,
|
|
7076
|
-
active,
|
|
7077
|
-
dataIndex
|
|
7078
|
-
} = tag;
|
|
7079
|
-
const domainFormat = new import_utils15.domainHelper.Domain(domain2);
|
|
7080
|
-
if (type === import_constants5.SearchType.FILTER) {
|
|
7081
|
-
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
6528
|
+
const { domain: domain2, groupIndex, value, type, context: context2, dataIndex } = tag;
|
|
6529
|
+
const domainFormat = new import_utils17.domainHelper.Domain(domain2);
|
|
6530
|
+
if (type === import_constants3.SearchType.FILTER) {
|
|
6531
|
+
addSearchItems(`${import_constants3.SearchType.FILTER}_${groupIndex}`, {
|
|
7082
6532
|
...tag,
|
|
7083
6533
|
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7084
6534
|
});
|
|
7085
|
-
} else if (type ===
|
|
7086
|
-
addSearchItems(`${
|
|
6535
|
+
} else if (type === import_constants3.SearchType.SEARCH) {
|
|
6536
|
+
addSearchItems(`${import_constants3.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7087
6537
|
...tag,
|
|
7088
6538
|
domain: domain2 ? domainFormat.toList({
|
|
7089
6539
|
...context2,
|
|
7090
6540
|
self: value
|
|
7091
6541
|
}) : null
|
|
7092
6542
|
});
|
|
7093
|
-
} else if (type ===
|
|
7094
|
-
addSearchItems(`${
|
|
6543
|
+
} else if (type === import_constants3.SearchType.GROUP) {
|
|
6544
|
+
addSearchItems(`${import_constants3.SearchType.GROUP}`, {
|
|
7095
6545
|
...tag,
|
|
7096
6546
|
domain: domain2 ? domainFormat.toList({
|
|
7097
6547
|
context: context2,
|