@fctc/widget-logic 2.0.4 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks.d.mts +1 -12
- package/dist/hooks.d.ts +1 -12
- package/dist/hooks.js +6 -179
- package/dist/hooks.mjs +2 -179
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +161 -226
- package/dist/index.mjs +95 -155
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/widget.d.mts +2 -13
- package/dist/widget.d.ts +2 -13
- package/dist/widget.js +153 -216
- package/dist/widget.mjs +91 -149
- package/package.json +96 -96
package/dist/index.js
CHANGED
|
@@ -4082,7 +4082,6 @@ __export(index_exports, {
|
|
|
4082
4082
|
useGetRowIds: () => useGetRowIds,
|
|
4083
4083
|
useListData: () => useListData,
|
|
4084
4084
|
useMenu: () => useMenu,
|
|
4085
|
-
useMenuItem: () => useMenuItem,
|
|
4086
4085
|
useProfile: () => useProfile,
|
|
4087
4086
|
useSelectionState: () => useSelectionState,
|
|
4088
4087
|
useStorageState: () => useStorageState,
|
|
@@ -4104,7 +4103,6 @@ __export(hooks_exports, {
|
|
|
4104
4103
|
useDetail: () => useDetail,
|
|
4105
4104
|
useListData: () => useListData,
|
|
4106
4105
|
useMenu: () => useMenu,
|
|
4107
|
-
useMenuItem: () => useMenuItem,
|
|
4108
4106
|
useProfile: () => useProfile,
|
|
4109
4107
|
useUser: () => useUser,
|
|
4110
4108
|
useViewV2: () => useViewV2
|
|
@@ -4864,69 +4862,8 @@ var useAppProvider = () => {
|
|
|
4864
4862
|
return context;
|
|
4865
4863
|
};
|
|
4866
4864
|
|
|
4867
|
-
// src/hooks/core/use-menu-item.tsx
|
|
4868
|
-
var import_environment5 = require("@fctc/interface-logic/environment");
|
|
4869
|
-
var import_hooks9 = require("@fctc/interface-logic/hooks");
|
|
4870
|
-
var import_react11 = require("react");
|
|
4871
|
-
|
|
4872
|
-
// src/utils.ts
|
|
4873
|
-
var utils_exports = {};
|
|
4874
|
-
__export(utils_exports, {
|
|
4875
|
-
API_APP_URL: () => API_APP_URL,
|
|
4876
|
-
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4877
|
-
STORAGES: () => STORAGES,
|
|
4878
|
-
combineContexts: () => combineContexts,
|
|
4879
|
-
convertFieldsToArray: () => convertFieldsToArray,
|
|
4880
|
-
countSum: () => countSum,
|
|
4881
|
-
getDateRange: () => getDateRange,
|
|
4882
|
-
languages: () => languages,
|
|
4883
|
-
mergeButtons: () => mergeButtons,
|
|
4884
|
-
setStorageItemAsync: () => setStorageItemAsync,
|
|
4885
|
-
useGetRowIds: () => useGetRowIds,
|
|
4886
|
-
useSelectionState: () => useSelectionState,
|
|
4887
|
-
useStorageState: () => useStorageState
|
|
4888
|
-
});
|
|
4889
|
-
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4890
|
-
|
|
4891
|
-
// src/hooks/core/use-menu-item.tsx
|
|
4892
|
-
var useMenuItem = (props) => {
|
|
4893
|
-
const { menu, activeMenuId } = props;
|
|
4894
|
-
const model = menu?.action?.res_model;
|
|
4895
|
-
const aid = menu?.action?.id?.id;
|
|
4896
|
-
const id = menu?.id;
|
|
4897
|
-
const context = (0, import_environment5.getEnv)().context;
|
|
4898
|
-
const queryActionDetail = (0, import_hooks9.useGetActionDetail)({
|
|
4899
|
-
aid,
|
|
4900
|
-
id,
|
|
4901
|
-
model,
|
|
4902
|
-
context,
|
|
4903
|
-
enabled: true,
|
|
4904
|
-
queryKey: [`action-${aid}`]
|
|
4905
|
-
}).data;
|
|
4906
|
-
const [path, setPath] = (0, import_react11.useState)("");
|
|
4907
|
-
const handleClick = () => {
|
|
4908
|
-
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4909
|
-
return;
|
|
4910
|
-
}
|
|
4911
|
-
const hasListView = queryActionDetail.views.some(
|
|
4912
|
-
([id2, type]) => type === "list"
|
|
4913
|
-
);
|
|
4914
|
-
const viewType = hasListView ? "list" : "form";
|
|
4915
|
-
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4916
|
-
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4917
|
-
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4918
|
-
viewType,
|
|
4919
|
-
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4920
|
-
aid: menu?.action?.id?.id,
|
|
4921
|
-
model: queryActionDetail.res_model
|
|
4922
|
-
});
|
|
4923
|
-
setPath(path2);
|
|
4924
|
-
};
|
|
4925
|
-
return { handleClick, path, queryActionDetail };
|
|
4926
|
-
};
|
|
4927
|
-
|
|
4928
4865
|
// src/hooks/utils/use-click-outside.ts
|
|
4929
|
-
var
|
|
4866
|
+
var import_react11 = require("react");
|
|
4930
4867
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
4931
4868
|
var useClickOutside = ({
|
|
4932
4869
|
handler,
|
|
@@ -4934,8 +4871,8 @@ var useClickOutside = ({
|
|
|
4934
4871
|
nodes = [],
|
|
4935
4872
|
refs
|
|
4936
4873
|
}) => {
|
|
4937
|
-
const ref = (0,
|
|
4938
|
-
(0,
|
|
4874
|
+
const ref = (0, import_react11.useRef)(null);
|
|
4875
|
+
(0, import_react11.useEffect)(() => {
|
|
4939
4876
|
const listener = (event) => {
|
|
4940
4877
|
const { target } = event;
|
|
4941
4878
|
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
@@ -4957,10 +4894,10 @@ var useClickOutside = ({
|
|
|
4957
4894
|
};
|
|
4958
4895
|
|
|
4959
4896
|
// src/hooks/utils/use-debounce.ts
|
|
4960
|
-
var
|
|
4897
|
+
var import_react12 = require("react");
|
|
4961
4898
|
function useDebounce(value, delay) {
|
|
4962
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
4963
|
-
(0,
|
|
4899
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react12.useState)(value);
|
|
4900
|
+
(0, import_react12.useEffect)(() => {
|
|
4964
4901
|
const handler = setTimeout(() => {
|
|
4965
4902
|
setDebouncedValue(value);
|
|
4966
4903
|
}, delay);
|
|
@@ -5215,20 +5152,20 @@ var ChevronBottomIcon = ({
|
|
|
5215
5152
|
};
|
|
5216
5153
|
|
|
5217
5154
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
5218
|
-
var
|
|
5219
|
-
var
|
|
5220
|
-
var
|
|
5155
|
+
var import_react13 = require("react");
|
|
5156
|
+
var import_environment5 = require("@fctc/interface-logic/environment");
|
|
5157
|
+
var import_hooks10 = require("@fctc/interface-logic/hooks");
|
|
5221
5158
|
var statusDropdownController = (props) => {
|
|
5222
5159
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
5223
|
-
const env = (0,
|
|
5160
|
+
const env = (0, import_environment5.getEnv)();
|
|
5224
5161
|
const colors = {
|
|
5225
5162
|
normal: "bg-[#e9ecef]",
|
|
5226
5163
|
done: "bg-primary",
|
|
5227
5164
|
blocked: "bg-red-500"
|
|
5228
5165
|
};
|
|
5229
|
-
const [isOpen, setIsOpen] = (0,
|
|
5230
|
-
const buttonRef = (0,
|
|
5231
|
-
(0,
|
|
5166
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
5167
|
+
const buttonRef = (0, import_react13.useRef)(null);
|
|
5168
|
+
(0, import_react13.useEffect)(() => {
|
|
5232
5169
|
const handleClickOutside = (event) => {
|
|
5233
5170
|
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
5234
5171
|
setIsOpen(false);
|
|
@@ -5239,7 +5176,7 @@ var statusDropdownController = (props) => {
|
|
|
5239
5176
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5240
5177
|
};
|
|
5241
5178
|
}, []);
|
|
5242
|
-
const { mutate: onSave } = (0,
|
|
5179
|
+
const { mutate: onSave } = (0, import_hooks10.useSave)();
|
|
5243
5180
|
const handleClick = async (status) => {
|
|
5244
5181
|
setIsOpen(!isOpen);
|
|
5245
5182
|
onSave(
|
|
@@ -5269,7 +5206,26 @@ var statusDropdownController = (props) => {
|
|
|
5269
5206
|
};
|
|
5270
5207
|
|
|
5271
5208
|
// src/widget/basic/many2one-field/controller.ts
|
|
5272
|
-
var
|
|
5209
|
+
var import_react14 = require("react");
|
|
5210
|
+
|
|
5211
|
+
// src/utils.ts
|
|
5212
|
+
var utils_exports = {};
|
|
5213
|
+
__export(utils_exports, {
|
|
5214
|
+
API_APP_URL: () => API_APP_URL,
|
|
5215
|
+
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
5216
|
+
STORAGES: () => STORAGES,
|
|
5217
|
+
combineContexts: () => combineContexts,
|
|
5218
|
+
convertFieldsToArray: () => convertFieldsToArray,
|
|
5219
|
+
countSum: () => countSum,
|
|
5220
|
+
getDateRange: () => getDateRange,
|
|
5221
|
+
languages: () => languages,
|
|
5222
|
+
mergeButtons: () => mergeButtons,
|
|
5223
|
+
setStorageItemAsync: () => setStorageItemAsync,
|
|
5224
|
+
useGetRowIds: () => useGetRowIds,
|
|
5225
|
+
useSelectionState: () => useSelectionState,
|
|
5226
|
+
useStorageState: () => useStorageState
|
|
5227
|
+
});
|
|
5228
|
+
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
5273
5229
|
|
|
5274
5230
|
// src/provider.ts
|
|
5275
5231
|
var provider_exports = {};
|
|
@@ -5290,13 +5246,13 @@ var many2oneFieldController = (props) => {
|
|
|
5290
5246
|
options: fieldOptions,
|
|
5291
5247
|
showDetail
|
|
5292
5248
|
} = props;
|
|
5293
|
-
const [options, setOptions] = (0,
|
|
5294
|
-
const [inputValue, setInputValue] = (0,
|
|
5249
|
+
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
5250
|
+
const [inputValue, setInputValue] = (0, import_react14.useState)("");
|
|
5295
5251
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
5296
|
-
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0,
|
|
5297
|
-
const [tempSelectedOption, setTempSelectedOption] = (0,
|
|
5298
|
-
const [domainModal, setDomainModal] = (0,
|
|
5299
|
-
const [domainObject, setDomainObject] = (0,
|
|
5252
|
+
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react14.useState)(false);
|
|
5253
|
+
const [tempSelectedOption, setTempSelectedOption] = (0, import_react14.useState)(null);
|
|
5254
|
+
const [domainModal, setDomainModal] = (0, import_react14.useState)(null);
|
|
5255
|
+
const [domainObject, setDomainObject] = (0, import_react14.useState)(null);
|
|
5300
5256
|
const actionData = sessionStorageUtils.getActionData();
|
|
5301
5257
|
const { menuList } = (0, store_exports.useAppSelector)(store_exports.selectNavbar);
|
|
5302
5258
|
const { context } = (0, store_exports.useAppSelector)(store_exports.selectEnv);
|
|
@@ -5307,7 +5263,7 @@ var many2oneFieldController = (props) => {
|
|
|
5307
5263
|
...fieldContext,
|
|
5308
5264
|
...context
|
|
5309
5265
|
};
|
|
5310
|
-
const { useGetSelection:
|
|
5266
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5311
5267
|
const data = {
|
|
5312
5268
|
model: relation,
|
|
5313
5269
|
domain: domainObject,
|
|
@@ -5323,23 +5279,23 @@ var many2oneFieldController = (props) => {
|
|
|
5323
5279
|
data: dataOfSelection,
|
|
5324
5280
|
refetch,
|
|
5325
5281
|
isFetching
|
|
5326
|
-
} =
|
|
5282
|
+
} = useGetSelection2({
|
|
5327
5283
|
data,
|
|
5328
5284
|
queryKey,
|
|
5329
5285
|
enabled: false
|
|
5330
5286
|
});
|
|
5331
|
-
const selectOptions = (0,
|
|
5287
|
+
const selectOptions = (0, import_react14.useMemo)(() => {
|
|
5332
5288
|
return dataOfSelection?.records?.map((val) => ({
|
|
5333
5289
|
value: val?.id,
|
|
5334
5290
|
label: val?.display_name || val?.name
|
|
5335
5291
|
})) || [];
|
|
5336
5292
|
}, [dataOfSelection]);
|
|
5337
|
-
(0,
|
|
5293
|
+
(0, import_react14.useEffect)(() => {
|
|
5338
5294
|
setOptions(selectOptions);
|
|
5339
5295
|
setDomainModal(domainObject);
|
|
5340
5296
|
if (relation === "student.subject") (0, store_exports.setListSubject)(selectOptions);
|
|
5341
5297
|
}, [selectOptions]);
|
|
5342
|
-
(0,
|
|
5298
|
+
(0, import_react14.useEffect)(() => {
|
|
5343
5299
|
setDomainObject(
|
|
5344
5300
|
(0, utils_exports.evalJSONDomain)(
|
|
5345
5301
|
domain,
|
|
@@ -5347,7 +5303,7 @@ var many2oneFieldController = (props) => {
|
|
|
5347
5303
|
)
|
|
5348
5304
|
);
|
|
5349
5305
|
}, [domain, formValues]);
|
|
5350
|
-
(0,
|
|
5306
|
+
(0, import_react14.useEffect)(() => {
|
|
5351
5307
|
if (!propValue && tempSelectedOption) {
|
|
5352
5308
|
methods.setValue(name, null);
|
|
5353
5309
|
setTempSelectedOption(null);
|
|
@@ -5358,10 +5314,10 @@ var many2oneFieldController = (props) => {
|
|
|
5358
5314
|
});
|
|
5359
5315
|
}
|
|
5360
5316
|
}, [propValue]);
|
|
5361
|
-
const fetchMoreOptions = (0,
|
|
5317
|
+
const fetchMoreOptions = (0, import_react14.useCallback)(() => {
|
|
5362
5318
|
refetch();
|
|
5363
5319
|
}, [refetch]);
|
|
5364
|
-
(0,
|
|
5320
|
+
(0, import_react14.useEffect)(() => {
|
|
5365
5321
|
if (debouncedInputValue) {
|
|
5366
5322
|
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
5367
5323
|
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
@@ -5376,7 +5332,7 @@ var many2oneFieldController = (props) => {
|
|
|
5376
5332
|
}, 50);
|
|
5377
5333
|
}
|
|
5378
5334
|
}, [debouncedInputValue]);
|
|
5379
|
-
const handleChooseRecord = (0,
|
|
5335
|
+
const handleChooseRecord = (0, import_react14.useCallback)(
|
|
5380
5336
|
(idRecord) => {
|
|
5381
5337
|
const newOption = options.find(
|
|
5382
5338
|
(option) => option.value === idRecord
|
|
@@ -5401,8 +5357,8 @@ var many2oneFieldController = (props) => {
|
|
|
5401
5357
|
},
|
|
5402
5358
|
[options, methods, name, onChange]
|
|
5403
5359
|
);
|
|
5404
|
-
const handleClose = (0,
|
|
5405
|
-
const handleSelectChange = (0,
|
|
5360
|
+
const handleClose = (0, import_react14.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
5361
|
+
const handleSelectChange = (0, import_react14.useCallback)(
|
|
5406
5362
|
(selectedOption) => {
|
|
5407
5363
|
if (!selectedOption) {
|
|
5408
5364
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5449,20 +5405,20 @@ var many2oneFieldController = (props) => {
|
|
|
5449
5405
|
};
|
|
5450
5406
|
|
|
5451
5407
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5452
|
-
var
|
|
5453
|
-
var
|
|
5454
|
-
var
|
|
5408
|
+
var import_environment6 = require("@fctc/interface-logic/environment");
|
|
5409
|
+
var import_hooks12 = require("@fctc/interface-logic/hooks");
|
|
5410
|
+
var import_utils5 = require("@fctc/interface-logic/utils");
|
|
5455
5411
|
var many2oneButtonController = (props) => {
|
|
5456
5412
|
const { domain, methods, relation } = props;
|
|
5457
5413
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5458
|
-
const env = (0,
|
|
5459
|
-
const domainObject = (0,
|
|
5414
|
+
const env = (0, import_environment6.getEnv)();
|
|
5415
|
+
const domainObject = (0, import_utils5.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5460
5416
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5461
|
-
const { data: dataOfSelection } = (0,
|
|
5417
|
+
const { data: dataOfSelection } = (0, import_hooks12.useGetSelection)({
|
|
5462
5418
|
data: {
|
|
5463
5419
|
model: relation ?? "",
|
|
5464
5420
|
domain: domainObject,
|
|
5465
|
-
context: { ...env.context, ...(0,
|
|
5421
|
+
context: { ...env.context, ...(0, import_utils5.evalJSONContext)(actionData?.context) }
|
|
5466
5422
|
},
|
|
5467
5423
|
queryKey: [`data_${relation}`, domainObject]
|
|
5468
5424
|
});
|
|
@@ -5476,9 +5432,9 @@ var many2oneButtonController = (props) => {
|
|
|
5476
5432
|
};
|
|
5477
5433
|
|
|
5478
5434
|
// src/widget/basic/many2many-field/controller.ts
|
|
5479
|
-
var
|
|
5435
|
+
var import_react15 = require("react");
|
|
5480
5436
|
var import_store8 = require("@fctc/interface-logic/store");
|
|
5481
|
-
var
|
|
5437
|
+
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
5482
5438
|
var many2manyFieldController = (props) => {
|
|
5483
5439
|
const {
|
|
5484
5440
|
relation,
|
|
@@ -5498,9 +5454,9 @@ var many2manyFieldController = (props) => {
|
|
|
5498
5454
|
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
5499
5455
|
const actionData = sessionStorageUtils.getActionData();
|
|
5500
5456
|
const [debouncedPage] = useDebounce(page, 500);
|
|
5501
|
-
const [order, setOrder] = (0,
|
|
5502
|
-
const [isLoadedData, setIsLoadedData] = (0,
|
|
5503
|
-
const [domainMany2Many, setDomainMany2Many] = (0,
|
|
5457
|
+
const [order, setOrder] = (0, import_react15.useState)();
|
|
5458
|
+
const [isLoadedData, setIsLoadedData] = (0, import_react15.useState)(false);
|
|
5459
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(domain);
|
|
5504
5460
|
const { env } = (0, provider_exports.useEnv)();
|
|
5505
5461
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5506
5462
|
const viewParams = {
|
|
@@ -5512,7 +5468,7 @@ var many2manyFieldController = (props) => {
|
|
|
5512
5468
|
context
|
|
5513
5469
|
};
|
|
5514
5470
|
const { data: viewResponse } = useGetView2(viewParams, actionData);
|
|
5515
|
-
const baseModel = (0,
|
|
5471
|
+
const baseModel = (0, import_react15.useMemo)(
|
|
5516
5472
|
() => ({
|
|
5517
5473
|
name: String(relation),
|
|
5518
5474
|
view: viewResponse || {},
|
|
@@ -5525,20 +5481,20 @@ var many2manyFieldController = (props) => {
|
|
|
5525
5481
|
[model, viewResponse]
|
|
5526
5482
|
);
|
|
5527
5483
|
const initModel = (0, hooks_exports.useModel)();
|
|
5528
|
-
const modelInstance = (0,
|
|
5484
|
+
const modelInstance = (0, import_react15.useMemo)(() => {
|
|
5529
5485
|
if (viewResponse) {
|
|
5530
5486
|
return initModel.initModel(baseModel);
|
|
5531
5487
|
}
|
|
5532
5488
|
return null;
|
|
5533
5489
|
}, [baseModel, viewResponse]);
|
|
5534
|
-
const specification = (0,
|
|
5490
|
+
const specification = (0, import_react15.useMemo)(() => {
|
|
5535
5491
|
if (modelInstance) {
|
|
5536
5492
|
return modelInstance.getSpecification();
|
|
5537
5493
|
}
|
|
5538
5494
|
return null;
|
|
5539
5495
|
}, [modelInstance]);
|
|
5540
5496
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5541
|
-
const optionsObject = tab?.options ? (0,
|
|
5497
|
+
const optionsObject = tab?.options ? (0, import_utils6.evalJSONContext)(tab?.options) : (options ? (0, import_utils6.evalJSONContext)(options) : {}) || {};
|
|
5542
5498
|
const fetchData = async () => {
|
|
5543
5499
|
try {
|
|
5544
5500
|
setDomainMany2Many(domain);
|
|
@@ -5576,7 +5532,7 @@ var many2manyFieldController = (props) => {
|
|
|
5576
5532
|
context,
|
|
5577
5533
|
fields: groupByDomain?.fields,
|
|
5578
5534
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5579
|
-
sort: order ? order : default_order ? (0,
|
|
5535
|
+
sort: order ? order : default_order ? (0, import_utils6.formatSortingString)(default_order) : ""
|
|
5580
5536
|
};
|
|
5581
5537
|
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5582
5538
|
const {
|
|
@@ -5585,7 +5541,7 @@ var many2manyFieldController = (props) => {
|
|
|
5585
5541
|
isFetched: isDataResponseFetched,
|
|
5586
5542
|
isPlaceholderData
|
|
5587
5543
|
} = useGetListData3(data, queryKey, enabled);
|
|
5588
|
-
(0,
|
|
5544
|
+
(0, import_react15.useEffect)(() => {
|
|
5589
5545
|
if (viewResponse) {
|
|
5590
5546
|
fetchData();
|
|
5591
5547
|
}
|
|
@@ -5624,13 +5580,13 @@ var many2manyFieldController = (props) => {
|
|
|
5624
5580
|
queryKey: [`form-view-action-${relation}`],
|
|
5625
5581
|
enabled: false
|
|
5626
5582
|
});
|
|
5627
|
-
(0,
|
|
5583
|
+
(0, import_react15.useEffect)(() => {
|
|
5628
5584
|
if (isSuccess && dataFormViewResponse) {
|
|
5629
5585
|
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5630
5586
|
window.location.href = `/form/menu?model=${relation}`;
|
|
5631
5587
|
}
|
|
5632
5588
|
}, [isSuccess]);
|
|
5633
|
-
(0,
|
|
5589
|
+
(0, import_react15.useEffect)(() => {
|
|
5634
5590
|
if (domainMany2Many && !isLoadedData) {
|
|
5635
5591
|
setIsLoadedData(true);
|
|
5636
5592
|
}
|
|
@@ -5655,11 +5611,9 @@ var many2manyFieldController = (props) => {
|
|
|
5655
5611
|
};
|
|
5656
5612
|
|
|
5657
5613
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5658
|
-
var
|
|
5614
|
+
var import_react16 = require("react");
|
|
5659
5615
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5660
|
-
var
|
|
5661
|
-
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
5662
|
-
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5616
|
+
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5663
5617
|
var many2manyTagsController = (props) => {
|
|
5664
5618
|
const {
|
|
5665
5619
|
relation,
|
|
@@ -5670,10 +5624,11 @@ var many2manyTagsController = (props) => {
|
|
|
5670
5624
|
placeholderNoOption
|
|
5671
5625
|
} = props;
|
|
5672
5626
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5673
|
-
const env = (0,
|
|
5674
|
-
const
|
|
5675
|
-
const
|
|
5676
|
-
|
|
5627
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5628
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5629
|
+
const addtionalFields = optionsFields ? (0, import_utils7.evalJSONContext)(optionsFields) : null;
|
|
5630
|
+
const domainObject = (0, import_react16.useMemo)(
|
|
5631
|
+
() => (0, import_utils7.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5677
5632
|
[domain, formValues]
|
|
5678
5633
|
);
|
|
5679
5634
|
const data = {
|
|
@@ -5689,7 +5644,7 @@ var many2manyTagsController = (props) => {
|
|
|
5689
5644
|
enabled: true,
|
|
5690
5645
|
context: env.context
|
|
5691
5646
|
};
|
|
5692
|
-
const { data: dataOfSelection } = (
|
|
5647
|
+
const { data: dataOfSelection } = useGetSelection2({
|
|
5693
5648
|
data,
|
|
5694
5649
|
queryKey: [`data_${relation}`, domainObject]
|
|
5695
5650
|
});
|
|
@@ -5709,16 +5664,15 @@ var many2manyTagsController = (props) => {
|
|
|
5709
5664
|
options,
|
|
5710
5665
|
customNoOptionsMessage,
|
|
5711
5666
|
tranfer,
|
|
5712
|
-
dataOfSelection,
|
|
5713
5667
|
isUser
|
|
5714
5668
|
};
|
|
5715
5669
|
};
|
|
5716
5670
|
|
|
5717
5671
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5718
|
-
var
|
|
5719
|
-
var
|
|
5672
|
+
var import_react17 = require("react");
|
|
5673
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5720
5674
|
var durationController = (props) => {
|
|
5721
|
-
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5675
|
+
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5722
5676
|
const specification = {
|
|
5723
5677
|
id: 0,
|
|
5724
5678
|
name: "",
|
|
@@ -5726,13 +5680,13 @@ var durationController = (props) => {
|
|
|
5726
5680
|
};
|
|
5727
5681
|
const { useGetListData: useGetListData3, useChangeStatus } = (0, provider_exports.useService)();
|
|
5728
5682
|
const { env } = (0, provider_exports.useEnv)();
|
|
5729
|
-
const [disabled, setDisabled] = (0,
|
|
5730
|
-
const [modelStatus, setModalStatus] = (0,
|
|
5683
|
+
const [disabled, setDisabled] = (0, import_react17.useState)(false);
|
|
5684
|
+
const [modelStatus, setModalStatus] = (0, import_react17.useState)(false);
|
|
5731
5685
|
const queryKey = [`data-status-duration`, specification];
|
|
5732
5686
|
const listDataProps = {
|
|
5733
5687
|
model: relation,
|
|
5734
5688
|
specification,
|
|
5735
|
-
domain: (0,
|
|
5689
|
+
domain: (0, import_utils8.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5736
5690
|
limit: 10,
|
|
5737
5691
|
offset: 0,
|
|
5738
5692
|
fields: "",
|
|
@@ -5742,7 +5696,11 @@ var durationController = (props) => {
|
|
|
5742
5696
|
},
|
|
5743
5697
|
sort: ""
|
|
5744
5698
|
};
|
|
5745
|
-
const { data: dataResponse } = useGetListData3(
|
|
5699
|
+
const { data: dataResponse } = useGetListData3(
|
|
5700
|
+
listDataProps,
|
|
5701
|
+
queryKey,
|
|
5702
|
+
enabled
|
|
5703
|
+
);
|
|
5746
5704
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5747
5705
|
const handleClick = async (stage_id) => {
|
|
5748
5706
|
setDisabled(true);
|
|
@@ -5778,32 +5736,18 @@ var durationController = (props) => {
|
|
|
5778
5736
|
};
|
|
5779
5737
|
|
|
5780
5738
|
// src/widget/basic/priority-field/controller.ts
|
|
5781
|
-
var
|
|
5782
|
-
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
5739
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5783
5740
|
var priorityFieldController = (props) => {
|
|
5784
|
-
const {
|
|
5785
|
-
|
|
5786
|
-
isForm,
|
|
5787
|
-
name,
|
|
5788
|
-
methods,
|
|
5789
|
-
onChange,
|
|
5790
|
-
model,
|
|
5791
|
-
selection,
|
|
5792
|
-
id,
|
|
5793
|
-
actionData,
|
|
5794
|
-
viewData,
|
|
5795
|
-
context
|
|
5796
|
-
} = props;
|
|
5797
|
-
const _context = { ...(0, import_utils10.evalJSONContext)(actionData?.context) };
|
|
5741
|
+
const { name, model, id, actionData, context, onChange } = props;
|
|
5742
|
+
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5798
5743
|
const contextObject = { ...context, ..._context };
|
|
5799
|
-
const
|
|
5800
|
-
const
|
|
5801
|
-
const { mutateAsync: fetchSave } = (0, import_hooks16.useSave)();
|
|
5744
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
5745
|
+
const { mutateAsync: fetchSave } = useSave2();
|
|
5802
5746
|
const savePriorities = async ({
|
|
5803
|
-
value
|
|
5747
|
+
value,
|
|
5804
5748
|
resetPriority
|
|
5805
5749
|
}) => {
|
|
5806
|
-
const priorityValue =
|
|
5750
|
+
const priorityValue = value <= 0 ? 0 : value - 1;
|
|
5807
5751
|
try {
|
|
5808
5752
|
fetchSave({
|
|
5809
5753
|
ids: id ? [id] : [],
|
|
@@ -5821,22 +5765,15 @@ var priorityFieldController = (props) => {
|
|
|
5821
5765
|
}
|
|
5822
5766
|
};
|
|
5823
5767
|
return {
|
|
5824
|
-
|
|
5825
|
-
isForm,
|
|
5826
|
-
methods,
|
|
5827
|
-
defaultPriority,
|
|
5828
|
-
savePriorities,
|
|
5829
|
-
label,
|
|
5830
|
-
id,
|
|
5831
|
-
onChange
|
|
5768
|
+
savePriorities
|
|
5832
5769
|
};
|
|
5833
5770
|
};
|
|
5834
5771
|
|
|
5835
5772
|
// src/widget/basic/download-file-field/controller.ts
|
|
5836
|
-
var
|
|
5773
|
+
var import_react18 = require("react");
|
|
5837
5774
|
var downloadFileController = () => {
|
|
5838
|
-
const inputId = (0,
|
|
5839
|
-
const [file, setFile] = (0,
|
|
5775
|
+
const inputId = (0, import_react18.useId)();
|
|
5776
|
+
const [file, setFile] = (0, import_react18.useState)(null);
|
|
5840
5777
|
const handleFileChange = (e) => {
|
|
5841
5778
|
setFile(e.target.files[0]);
|
|
5842
5779
|
};
|
|
@@ -6768,13 +6705,13 @@ var dateFieldController = (props) => {
|
|
|
6768
6705
|
};
|
|
6769
6706
|
|
|
6770
6707
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6771
|
-
var
|
|
6772
|
-
var
|
|
6708
|
+
var import_react19 = require("react");
|
|
6709
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
6773
6710
|
var copyLinkButtonController = (props) => {
|
|
6774
6711
|
const { value, defaultValue } = props;
|
|
6775
|
-
const [isCopied, setIsCopied] = (0,
|
|
6712
|
+
const [isCopied, setIsCopied] = (0, import_react19.useState)(false);
|
|
6776
6713
|
const handleCopyToClipboard = async (value2) => {
|
|
6777
|
-
await (0,
|
|
6714
|
+
await (0, import_utils10.copyTextToClipboard)(value2);
|
|
6778
6715
|
setIsCopied(true);
|
|
6779
6716
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
6780
6717
|
};
|
|
@@ -6787,15 +6724,15 @@ var copyLinkButtonController = (props) => {
|
|
|
6787
6724
|
};
|
|
6788
6725
|
|
|
6789
6726
|
// src/widget/basic/color-field/color-controller.ts
|
|
6790
|
-
var
|
|
6727
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
6791
6728
|
var colorFieldController = (props) => {
|
|
6792
6729
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6793
6730
|
const { env } = (0, provider_exports.useEnv)();
|
|
6794
|
-
const { useSave:
|
|
6795
|
-
const _context = { ...(0,
|
|
6731
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
6732
|
+
const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) || {} };
|
|
6796
6733
|
const contextObject = { ...env.context, ..._context };
|
|
6797
6734
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6798
|
-
const { mutate: onSave } =
|
|
6735
|
+
const { mutate: onSave } = useSave2();
|
|
6799
6736
|
const savePickColor = async (colorObject) => {
|
|
6800
6737
|
const { id } = colorObject;
|
|
6801
6738
|
if (value === id) return;
|
|
@@ -6820,16 +6757,16 @@ var colorFieldController = (props) => {
|
|
|
6820
6757
|
};
|
|
6821
6758
|
|
|
6822
6759
|
// src/widget/basic/binary-field/controller.ts
|
|
6823
|
-
var
|
|
6824
|
-
var
|
|
6760
|
+
var import_react20 = require("react");
|
|
6761
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
6825
6762
|
var binaryFieldController = (props) => {
|
|
6826
6763
|
const { name, methods, readonly = false, value } = props;
|
|
6827
|
-
const inputId = (0,
|
|
6828
|
-
const [selectedImage, setSelectedImage] = (0,
|
|
6829
|
-
const [initialImage, setInitialImage] = (0,
|
|
6830
|
-
const [isInsideTable, setIsInsideTable] = (0,
|
|
6764
|
+
const inputId = (0, import_react20.useId)();
|
|
6765
|
+
const [selectedImage, setSelectedImage] = (0, import_react20.useState)(null);
|
|
6766
|
+
const [initialImage, setInitialImage] = (0, import_react20.useState)(value || null);
|
|
6767
|
+
const [isInsideTable, setIsInsideTable] = (0, import_react20.useState)(false);
|
|
6831
6768
|
const { setValue } = methods;
|
|
6832
|
-
const binaryRef = (0,
|
|
6769
|
+
const binaryRef = (0, import_react20.useRef)(null);
|
|
6833
6770
|
const convertUrlToBase64 = async (url) => {
|
|
6834
6771
|
try {
|
|
6835
6772
|
const response = await fetch(url);
|
|
@@ -6878,11 +6815,11 @@ var binaryFieldController = (props) => {
|
|
|
6878
6815
|
};
|
|
6879
6816
|
const checkIsImageLink = (url) => {
|
|
6880
6817
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6881
|
-
return imageExtensions.test(url) || (0,
|
|
6818
|
+
return imageExtensions.test(url) || (0, import_utils12.isBase64Image)(url) || isBlobUrl(url);
|
|
6882
6819
|
};
|
|
6883
6820
|
const getImageBase64WithMimeType = (base64) => {
|
|
6884
6821
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6885
|
-
if ((0,
|
|
6822
|
+
if ((0, import_utils12.isBase64Image)(base64)) return base64;
|
|
6886
6823
|
let mimeType = null;
|
|
6887
6824
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6888
6825
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6891,14 +6828,14 @@ var binaryFieldController = (props) => {
|
|
|
6891
6828
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
6892
6829
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
6893
6830
|
};
|
|
6894
|
-
(0,
|
|
6831
|
+
(0, import_react20.useEffect)(() => {
|
|
6895
6832
|
return () => {
|
|
6896
6833
|
if (selectedImage) {
|
|
6897
6834
|
URL.revokeObjectURL(selectedImage);
|
|
6898
6835
|
}
|
|
6899
6836
|
};
|
|
6900
6837
|
}, [selectedImage]);
|
|
6901
|
-
(0,
|
|
6838
|
+
(0, import_react20.useEffect)(() => {
|
|
6902
6839
|
if (binaryRef.current) {
|
|
6903
6840
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
6904
6841
|
setIsInsideTable(isInsideTable2);
|
|
@@ -6919,20 +6856,20 @@ var binaryFieldController = (props) => {
|
|
|
6919
6856
|
|
|
6920
6857
|
// src/widget/advance/table/table-body/controller.ts
|
|
6921
6858
|
var import_store9 = require("@fctc/interface-logic/store");
|
|
6922
|
-
var
|
|
6859
|
+
var import_react21 = require("react");
|
|
6923
6860
|
var tableBodyController = (props) => {
|
|
6924
6861
|
const {
|
|
6925
6862
|
checkedAll,
|
|
6926
6863
|
checkboxRef,
|
|
6927
6864
|
setIsAutoSelect,
|
|
6928
|
-
selectedRowKeys,
|
|
6929
6865
|
row,
|
|
6930
6866
|
isAutoSelect,
|
|
6931
6867
|
selectedRowKeysRef,
|
|
6932
6868
|
onClickRow
|
|
6933
6869
|
} = props;
|
|
6934
6870
|
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
6935
|
-
const
|
|
6871
|
+
const { selectedRowKeys } = (0, import_store9.useAppSelector)(import_store9.selectList);
|
|
6872
|
+
const checked = (0, import_react21.useMemo)(() => {
|
|
6936
6873
|
if (!row?.id) return false;
|
|
6937
6874
|
if (selectedRowKeys?.includes(row.id)) {
|
|
6938
6875
|
return true;
|
|
@@ -6947,13 +6884,12 @@ var tableBodyController = (props) => {
|
|
|
6947
6884
|
return;
|
|
6948
6885
|
}
|
|
6949
6886
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6950
|
-
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6951
6887
|
appDispatch((0, import_store9.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6952
6888
|
};
|
|
6953
6889
|
const handleClickRow = (col, row2) => {
|
|
6954
6890
|
onClickRow(col, row2);
|
|
6955
6891
|
};
|
|
6956
|
-
(0,
|
|
6892
|
+
(0, import_react21.useEffect)(() => {
|
|
6957
6893
|
if (!row?.id) return;
|
|
6958
6894
|
if (isAutoSelect) {
|
|
6959
6895
|
if (checkboxRef?.current === "uncheck") {
|
|
@@ -6971,7 +6907,7 @@ var tableBodyController = (props) => {
|
|
|
6971
6907
|
}
|
|
6972
6908
|
}
|
|
6973
6909
|
}, [isAutoSelect]);
|
|
6974
|
-
(0,
|
|
6910
|
+
(0, import_react21.useEffect)(() => {
|
|
6975
6911
|
if (!checkedAll) {
|
|
6976
6912
|
checkboxRef.current = "enabled";
|
|
6977
6913
|
false;
|
|
@@ -7022,12 +6958,12 @@ var tableHeadController = (props) => {
|
|
|
7022
6958
|
};
|
|
7023
6959
|
|
|
7024
6960
|
// src/widget/advance/table/table-view/controller.ts
|
|
7025
|
-
var
|
|
6961
|
+
var import_react22 = require("react");
|
|
7026
6962
|
var import_store11 = require("@fctc/interface-logic/store");
|
|
7027
|
-
var
|
|
6963
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
7028
6964
|
var tableController = ({ data }) => {
|
|
7029
|
-
const [rows, setRows] = (0,
|
|
7030
|
-
const [columns, setColumns] = (0,
|
|
6965
|
+
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
6966
|
+
const [columns, setColumns] = (0, import_react22.useState)([]);
|
|
7031
6967
|
const dataModelFields = data.fields?.map((field) => {
|
|
7032
6968
|
return {
|
|
7033
6969
|
...data.dataModel?.[field?.name],
|
|
@@ -7055,14 +6991,14 @@ var tableController = ({ data }) => {
|
|
|
7055
6991
|
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
7056
6992
|
});
|
|
7057
6993
|
};
|
|
7058
|
-
(0,
|
|
6994
|
+
(0, import_react22.useEffect)(() => {
|
|
7059
6995
|
setRows(transformData(data.records || null));
|
|
7060
6996
|
}, [data.records]);
|
|
7061
6997
|
const handleGetColumns = () => {
|
|
7062
6998
|
let cols = [];
|
|
7063
6999
|
try {
|
|
7064
7000
|
cols = mergeFields?.filter((item) => {
|
|
7065
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
7001
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils13.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils13.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
7066
7002
|
})?.map((field) => {
|
|
7067
7003
|
return {
|
|
7068
7004
|
name: field?.name,
|
|
@@ -7076,7 +7012,7 @@ var tableController = ({ data }) => {
|
|
|
7076
7012
|
}
|
|
7077
7013
|
return cols;
|
|
7078
7014
|
};
|
|
7079
|
-
(0,
|
|
7015
|
+
(0, import_react22.useEffect)(() => {
|
|
7080
7016
|
const columns2 = handleGetColumns();
|
|
7081
7017
|
setColumns(columns2);
|
|
7082
7018
|
}, [data.records]);
|
|
@@ -7101,8 +7037,8 @@ var tableController = ({ data }) => {
|
|
|
7101
7037
|
};
|
|
7102
7038
|
|
|
7103
7039
|
// src/widget/advance/table/table-group/controller.ts
|
|
7104
|
-
var
|
|
7105
|
-
var
|
|
7040
|
+
var import_react23 = require("react");
|
|
7041
|
+
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
7106
7042
|
var import_store12 = require("@fctc/interface-logic/store");
|
|
7107
7043
|
|
|
7108
7044
|
// src/environment.ts
|
|
@@ -7130,18 +7066,18 @@ var tableGroupController = (props) => {
|
|
|
7130
7066
|
setIsAutoSelect,
|
|
7131
7067
|
selectedRowKeysRef
|
|
7132
7068
|
} = props;
|
|
7133
|
-
const [pageGroup, setPageGroup] = (0,
|
|
7069
|
+
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
7134
7070
|
const { groupByDomain, selectedTags } = (0, import_store12.useAppSelector)(import_store12.selectSearch);
|
|
7135
7071
|
const { selectedRowKeys } = (0, import_store12.useAppSelector)(import_store12.selectList);
|
|
7136
7072
|
const appDispatch = (0, import_store12.useAppDispatch)();
|
|
7137
|
-
const { toDataJS } = (0,
|
|
7073
|
+
const { toDataJS } = (0, import_hooks14.useOdooDataTransform)();
|
|
7138
7074
|
const initVal = toDataJS(row, viewData, model);
|
|
7139
|
-
const [isShowGroup, setIsShowGroup] = (0,
|
|
7140
|
-
const [colEmptyGroup, setColEmptyGroup] = (0,
|
|
7075
|
+
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7076
|
+
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
7141
7077
|
fromStart: 1,
|
|
7142
7078
|
fromEnd: 1
|
|
7143
7079
|
});
|
|
7144
|
-
const processedData = (0,
|
|
7080
|
+
const processedData = (0, import_react23.useMemo)(() => {
|
|
7145
7081
|
const calculateColSpanEmpty = () => {
|
|
7146
7082
|
const startIndex = columns.findIndex(
|
|
7147
7083
|
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
@@ -7156,7 +7092,7 @@ var tableGroupController = (props) => {
|
|
|
7156
7092
|
};
|
|
7157
7093
|
return calculateColSpanEmpty();
|
|
7158
7094
|
}, [columns, row]);
|
|
7159
|
-
const shouldFetchData = (0,
|
|
7095
|
+
const shouldFetchData = (0, import_react23.useMemo)(() => {
|
|
7160
7096
|
return !!isShowGroup;
|
|
7161
7097
|
}, [isShowGroup]);
|
|
7162
7098
|
const enabled = shouldFetchData && !!processedData;
|
|
@@ -7181,7 +7117,7 @@ var tableGroupController = (props) => {
|
|
|
7181
7117
|
isPlaceholderData,
|
|
7182
7118
|
isLoading,
|
|
7183
7119
|
isFetching
|
|
7184
|
-
} = (0,
|
|
7120
|
+
} = (0, import_hooks14.useGetListData)(listDataProps, queryKey, enabled);
|
|
7185
7121
|
const {
|
|
7186
7122
|
columns: columnsGroup,
|
|
7187
7123
|
rows: rowsGroup,
|
|
@@ -7196,7 +7132,7 @@ var tableGroupController = (props) => {
|
|
|
7196
7132
|
}
|
|
7197
7133
|
});
|
|
7198
7134
|
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
7199
|
-
(0,
|
|
7135
|
+
(0, import_react23.useEffect)(() => {
|
|
7200
7136
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
7201
7137
|
setIsShowGroup(false);
|
|
7202
7138
|
}
|
|
@@ -7230,7 +7166,7 @@ var tableGroupController = (props) => {
|
|
|
7230
7166
|
}
|
|
7231
7167
|
toggleShowGroup();
|
|
7232
7168
|
};
|
|
7233
|
-
(0,
|
|
7169
|
+
(0, import_react23.useEffect)(() => {
|
|
7234
7170
|
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
7235
7171
|
return;
|
|
7236
7172
|
}
|
|
@@ -7271,9 +7207,9 @@ var tableGroupController = (props) => {
|
|
|
7271
7207
|
|
|
7272
7208
|
// src/widget/advance/search/controller.ts
|
|
7273
7209
|
var import_constants5 = require("@fctc/interface-logic/constants");
|
|
7274
|
-
var
|
|
7210
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
7275
7211
|
var import_moment2 = __toESM(require_moment());
|
|
7276
|
-
var
|
|
7212
|
+
var import_react24 = require("react");
|
|
7277
7213
|
var searchController = ({
|
|
7278
7214
|
viewData,
|
|
7279
7215
|
actionData,
|
|
@@ -7282,12 +7218,12 @@ var searchController = ({
|
|
|
7282
7218
|
setSearchMap,
|
|
7283
7219
|
searchMap
|
|
7284
7220
|
}) => {
|
|
7285
|
-
const [filterBy, setFilterBy] = (0,
|
|
7286
|
-
const [searchBy, setSearchBy] = (0,
|
|
7287
|
-
const [groupBy, setGroupBy] = (0,
|
|
7288
|
-
const [selectedTags, setSelectedTags] = (0,
|
|
7289
|
-
const [searchString, setSearchString] = (0,
|
|
7290
|
-
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0,
|
|
7221
|
+
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
7222
|
+
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
7223
|
+
const [groupBy, setGroupBy] = (0, import_react24.useState)(null);
|
|
7224
|
+
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7225
|
+
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7226
|
+
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils14.evalJSONDomain)(actionData?.domain, contextSearch) : [];
|
|
7291
7227
|
const aid = actionData?.id;
|
|
7292
7228
|
const model = actionData?.res_model;
|
|
7293
7229
|
const clearSearch = () => {
|
|
@@ -7304,7 +7240,7 @@ var searchController = ({
|
|
|
7304
7240
|
const dataModel = viewData?.models?.[model];
|
|
7305
7241
|
const searchViews = viewData?.views?.search;
|
|
7306
7242
|
const searchByItems = searchViews?.search_by?.filter(
|
|
7307
|
-
(item) => !
|
|
7243
|
+
(item) => !import_utils14.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
7308
7244
|
)?.map(
|
|
7309
7245
|
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
7310
7246
|
dataIndex: index,
|
|
@@ -7317,10 +7253,10 @@ var searchController = ({
|
|
|
7317
7253
|
})
|
|
7318
7254
|
);
|
|
7319
7255
|
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
7320
|
-
return !
|
|
7256
|
+
return !import_utils14.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
7321
7257
|
})?.map((item) => ({ ...item, active: false }));
|
|
7322
7258
|
const groupByItems = searchViews?.group_by.filter(
|
|
7323
|
-
(item) => !
|
|
7259
|
+
(item) => !import_utils14.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
7324
7260
|
).map((item) => ({
|
|
7325
7261
|
...item,
|
|
7326
7262
|
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
@@ -7333,7 +7269,7 @@ var searchController = ({
|
|
|
7333
7269
|
}
|
|
7334
7270
|
}
|
|
7335
7271
|
};
|
|
7336
|
-
(0,
|
|
7272
|
+
(0, import_react24.useEffect)(() => {
|
|
7337
7273
|
clearSearch();
|
|
7338
7274
|
fetchData();
|
|
7339
7275
|
}, [aid, model, viewData]);
|
|
@@ -7398,14 +7334,14 @@ var searchController = ({
|
|
|
7398
7334
|
}
|
|
7399
7335
|
let valueDomainItem = value?.value;
|
|
7400
7336
|
if (value?.modelType === "date") {
|
|
7401
|
-
valueDomainItem = (0,
|
|
7337
|
+
valueDomainItem = (0, import_utils14.validateAndParseDate)(value?.value);
|
|
7402
7338
|
} else if (value?.modelType === "datetime") {
|
|
7403
7339
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
7404
|
-
const parsedDate = (0,
|
|
7340
|
+
const parsedDate = (0, import_utils14.validateAndParseDate)(value?.value, true);
|
|
7405
7341
|
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
7406
7342
|
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");
|
|
7407
7343
|
} else {
|
|
7408
|
-
valueDomainItem = (0,
|
|
7344
|
+
valueDomainItem = (0, import_utils14.validateAndParseDate)(value?.value, true);
|
|
7409
7345
|
}
|
|
7410
7346
|
}
|
|
7411
7347
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
@@ -7416,7 +7352,7 @@ var searchController = ({
|
|
|
7416
7352
|
return [...domain];
|
|
7417
7353
|
}
|
|
7418
7354
|
};
|
|
7419
|
-
const setTagSearch = (0,
|
|
7355
|
+
const setTagSearch = (0, import_react24.useCallback)(
|
|
7420
7356
|
(updatedMap) => {
|
|
7421
7357
|
if (!updatedMap) return;
|
|
7422
7358
|
const tagsSearch = Object.entries(updatedMap).map(
|
|
@@ -7479,7 +7415,7 @@ var searchController = ({
|
|
|
7479
7415
|
},
|
|
7480
7416
|
[searchMap]
|
|
7481
7417
|
);
|
|
7482
|
-
(0,
|
|
7418
|
+
(0, import_react24.useEffect)(() => {
|
|
7483
7419
|
setSelectedTags(null);
|
|
7484
7420
|
setTagSearch(searchMap);
|
|
7485
7421
|
}, [searchMap]);
|
|
@@ -7494,7 +7430,7 @@ var searchController = ({
|
|
|
7494
7430
|
active,
|
|
7495
7431
|
dataIndex
|
|
7496
7432
|
} = tag;
|
|
7497
|
-
const domainFormat = new
|
|
7433
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain);
|
|
7498
7434
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7499
7435
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7500
7436
|
...tag,
|
|
@@ -7611,7 +7547,6 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
7611
7547
|
useGetRowIds,
|
|
7612
7548
|
useListData,
|
|
7613
7549
|
useMenu,
|
|
7614
|
-
useMenuItem,
|
|
7615
7550
|
useProfile,
|
|
7616
7551
|
useSelectionState,
|
|
7617
7552
|
useStorageState,
|