@fctc/widget-logic 2.0.9 → 2.1.0
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 +12 -1
- package/dist/hooks.d.ts +12 -1
- package/dist/hooks.js +179 -6
- package/dist/hooks.mjs +179 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +204 -246
- package/dist/index.mjs +157 -199
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/widget.d.mts +3 -29
- package/dist/widget.d.ts +3 -29
- package/dist/widget.js +194 -238
- package/dist/widget.mjs +151 -194
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4068,7 +4068,6 @@ __export(index_exports, {
|
|
|
4068
4068
|
searchController: () => searchController,
|
|
4069
4069
|
setStorageItemAsync: () => setStorageItemAsync,
|
|
4070
4070
|
statusDropdownController: () => statusDropdownController,
|
|
4071
|
-
tableBodyController: () => tableBodyController,
|
|
4072
4071
|
tableController: () => tableController,
|
|
4073
4072
|
tableGroupController: () => tableGroupController,
|
|
4074
4073
|
tableHeadController: () => tableHeadController,
|
|
@@ -4082,6 +4081,7 @@ __export(index_exports, {
|
|
|
4082
4081
|
useGetRowIds: () => useGetRowIds,
|
|
4083
4082
|
useListData: () => useListData,
|
|
4084
4083
|
useMenu: () => useMenu,
|
|
4084
|
+
useMenuItem: () => useMenuItem,
|
|
4085
4085
|
useProfile: () => useProfile,
|
|
4086
4086
|
useSelectionState: () => useSelectionState,
|
|
4087
4087
|
useStorageState: () => useStorageState,
|
|
@@ -4103,6 +4103,7 @@ __export(hooks_exports, {
|
|
|
4103
4103
|
useDetail: () => useDetail,
|
|
4104
4104
|
useListData: () => useListData,
|
|
4105
4105
|
useMenu: () => useMenu,
|
|
4106
|
+
useMenuItem: () => useMenuItem,
|
|
4106
4107
|
useProfile: () => useProfile,
|
|
4107
4108
|
useUser: () => useUser,
|
|
4108
4109
|
useViewV2: () => useViewV2
|
|
@@ -4862,8 +4863,69 @@ var useAppProvider = () => {
|
|
|
4862
4863
|
return context;
|
|
4863
4864
|
};
|
|
4864
4865
|
|
|
4865
|
-
// src/hooks/
|
|
4866
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4867
|
+
var import_environment5 = require("@fctc/interface-logic/environment");
|
|
4868
|
+
var import_hooks9 = require("@fctc/interface-logic/hooks");
|
|
4866
4869
|
var import_react11 = require("react");
|
|
4870
|
+
|
|
4871
|
+
// src/utils.ts
|
|
4872
|
+
var utils_exports = {};
|
|
4873
|
+
__export(utils_exports, {
|
|
4874
|
+
API_APP_URL: () => API_APP_URL,
|
|
4875
|
+
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4876
|
+
STORAGES: () => STORAGES,
|
|
4877
|
+
combineContexts: () => combineContexts,
|
|
4878
|
+
convertFieldsToArray: () => convertFieldsToArray,
|
|
4879
|
+
countSum: () => countSum,
|
|
4880
|
+
getDateRange: () => getDateRange,
|
|
4881
|
+
languages: () => languages,
|
|
4882
|
+
mergeButtons: () => mergeButtons,
|
|
4883
|
+
setStorageItemAsync: () => setStorageItemAsync,
|
|
4884
|
+
useGetRowIds: () => useGetRowIds,
|
|
4885
|
+
useSelectionState: () => useSelectionState,
|
|
4886
|
+
useStorageState: () => useStorageState
|
|
4887
|
+
});
|
|
4888
|
+
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4889
|
+
|
|
4890
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4891
|
+
var useMenuItem = (props) => {
|
|
4892
|
+
const { menu, activeMenuId } = props;
|
|
4893
|
+
const model = menu?.action?.res_model;
|
|
4894
|
+
const aid = menu?.action?.id?.id;
|
|
4895
|
+
const id = menu?.id;
|
|
4896
|
+
const context = (0, import_environment5.getEnv)().context;
|
|
4897
|
+
const queryActionDetail = (0, import_hooks9.useGetActionDetail)({
|
|
4898
|
+
aid,
|
|
4899
|
+
id,
|
|
4900
|
+
model,
|
|
4901
|
+
context,
|
|
4902
|
+
enabled: true,
|
|
4903
|
+
queryKey: [`action-${aid}`]
|
|
4904
|
+
}).data;
|
|
4905
|
+
const [path, setPath] = (0, import_react11.useState)("");
|
|
4906
|
+
const handleClick = () => {
|
|
4907
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4908
|
+
return;
|
|
4909
|
+
}
|
|
4910
|
+
const hasListView = queryActionDetail.views.some(
|
|
4911
|
+
([id2, type]) => type === "list"
|
|
4912
|
+
);
|
|
4913
|
+
const viewType = hasListView ? "list" : "form";
|
|
4914
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4915
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4916
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4917
|
+
viewType,
|
|
4918
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4919
|
+
aid: menu?.action?.id?.id,
|
|
4920
|
+
model: queryActionDetail.res_model
|
|
4921
|
+
});
|
|
4922
|
+
setPath(path2);
|
|
4923
|
+
};
|
|
4924
|
+
return { handleClick, path, queryActionDetail };
|
|
4925
|
+
};
|
|
4926
|
+
|
|
4927
|
+
// src/hooks/utils/use-click-outside.ts
|
|
4928
|
+
var import_react12 = require("react");
|
|
4867
4929
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
4868
4930
|
var useClickOutside = ({
|
|
4869
4931
|
handler,
|
|
@@ -4871,8 +4933,8 @@ var useClickOutside = ({
|
|
|
4871
4933
|
nodes = [],
|
|
4872
4934
|
refs
|
|
4873
4935
|
}) => {
|
|
4874
|
-
const ref = (0,
|
|
4875
|
-
(0,
|
|
4936
|
+
const ref = (0, import_react12.useRef)(null);
|
|
4937
|
+
(0, import_react12.useEffect)(() => {
|
|
4876
4938
|
const listener = (event) => {
|
|
4877
4939
|
const { target } = event;
|
|
4878
4940
|
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
@@ -4894,10 +4956,10 @@ var useClickOutside = ({
|
|
|
4894
4956
|
};
|
|
4895
4957
|
|
|
4896
4958
|
// src/hooks/utils/use-debounce.ts
|
|
4897
|
-
var
|
|
4959
|
+
var import_react13 = require("react");
|
|
4898
4960
|
function useDebounce(value, delay) {
|
|
4899
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
4900
|
-
(0,
|
|
4961
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react13.useState)(value);
|
|
4962
|
+
(0, import_react13.useEffect)(() => {
|
|
4901
4963
|
const handler = setTimeout(() => {
|
|
4902
4964
|
setDebouncedValue(value);
|
|
4903
4965
|
}, delay);
|
|
@@ -5152,20 +5214,20 @@ var ChevronBottomIcon = ({
|
|
|
5152
5214
|
};
|
|
5153
5215
|
|
|
5154
5216
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
5155
|
-
var
|
|
5156
|
-
var
|
|
5157
|
-
var
|
|
5217
|
+
var import_react14 = require("react");
|
|
5218
|
+
var import_environment6 = require("@fctc/interface-logic/environment");
|
|
5219
|
+
var import_hooks11 = require("@fctc/interface-logic/hooks");
|
|
5158
5220
|
var statusDropdownController = (props) => {
|
|
5159
5221
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
5160
|
-
const env = (0,
|
|
5222
|
+
const env = (0, import_environment6.getEnv)();
|
|
5161
5223
|
const colors = {
|
|
5162
5224
|
normal: "bg-[#e9ecef]",
|
|
5163
5225
|
done: "bg-primary",
|
|
5164
5226
|
blocked: "bg-red-500"
|
|
5165
5227
|
};
|
|
5166
|
-
const [isOpen, setIsOpen] = (0,
|
|
5167
|
-
const buttonRef = (0,
|
|
5168
|
-
(0,
|
|
5228
|
+
const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
|
|
5229
|
+
const buttonRef = (0, import_react14.useRef)(null);
|
|
5230
|
+
(0, import_react14.useEffect)(() => {
|
|
5169
5231
|
const handleClickOutside = (event) => {
|
|
5170
5232
|
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
5171
5233
|
setIsOpen(false);
|
|
@@ -5176,7 +5238,7 @@ var statusDropdownController = (props) => {
|
|
|
5176
5238
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5177
5239
|
};
|
|
5178
5240
|
}, []);
|
|
5179
|
-
const { mutate: onSave } = (0,
|
|
5241
|
+
const { mutate: onSave } = (0, import_hooks11.useSave)();
|
|
5180
5242
|
const handleClick = async (status) => {
|
|
5181
5243
|
setIsOpen(!isOpen);
|
|
5182
5244
|
onSave(
|
|
@@ -5206,26 +5268,7 @@ var statusDropdownController = (props) => {
|
|
|
5206
5268
|
};
|
|
5207
5269
|
|
|
5208
5270
|
// src/widget/basic/many2one-field/controller.ts
|
|
5209
|
-
var
|
|
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"));
|
|
5271
|
+
var import_react15 = require("react");
|
|
5229
5272
|
|
|
5230
5273
|
// src/provider.ts
|
|
5231
5274
|
var provider_exports = {};
|
|
@@ -5247,13 +5290,13 @@ var many2oneFieldController = (props) => {
|
|
|
5247
5290
|
showDetail
|
|
5248
5291
|
} = props;
|
|
5249
5292
|
const { env } = (0, provider_exports.useEnv)();
|
|
5250
|
-
const [options, setOptions] = (0,
|
|
5251
|
-
const [inputValue, setInputValue] = (0,
|
|
5293
|
+
const [options, setOptions] = (0, import_react15.useState)([]);
|
|
5294
|
+
const [inputValue, setInputValue] = (0, import_react15.useState)("");
|
|
5252
5295
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
5253
|
-
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0,
|
|
5254
|
-
const [tempSelectedOption, setTempSelectedOption] = (0,
|
|
5255
|
-
const [domainModal, setDomainModal] = (0,
|
|
5256
|
-
const [domainObject, setDomainObject] = (0,
|
|
5296
|
+
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react15.useState)(false);
|
|
5297
|
+
const [tempSelectedOption, setTempSelectedOption] = (0, import_react15.useState)(null);
|
|
5298
|
+
const [domainModal, setDomainModal] = (0, import_react15.useState)(null);
|
|
5299
|
+
const [domainObject, setDomainObject] = (0, import_react15.useState)(null);
|
|
5257
5300
|
const actionData = sessionStorageUtils.getActionData();
|
|
5258
5301
|
const { menuList } = (0, store_exports.useAppSelector)(store_exports.selectNavbar);
|
|
5259
5302
|
const initValue = methods?.getValues(name);
|
|
@@ -5263,7 +5306,7 @@ var many2oneFieldController = (props) => {
|
|
|
5263
5306
|
...fieldContext,
|
|
5264
5307
|
...env?.context
|
|
5265
5308
|
};
|
|
5266
|
-
const { useGetSelection:
|
|
5309
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5267
5310
|
const data = {
|
|
5268
5311
|
model: relation,
|
|
5269
5312
|
domain: domainObject,
|
|
@@ -5279,23 +5322,23 @@ var many2oneFieldController = (props) => {
|
|
|
5279
5322
|
data: dataOfSelection,
|
|
5280
5323
|
refetch,
|
|
5281
5324
|
isFetching
|
|
5282
|
-
} =
|
|
5325
|
+
} = useGetSelection2({
|
|
5283
5326
|
data,
|
|
5284
5327
|
queryKey,
|
|
5285
5328
|
enabled: false
|
|
5286
5329
|
});
|
|
5287
|
-
const selectOptions = (0,
|
|
5330
|
+
const selectOptions = (0, import_react15.useMemo)(() => {
|
|
5288
5331
|
return dataOfSelection?.records?.map((val) => ({
|
|
5289
5332
|
value: val?.id,
|
|
5290
5333
|
label: val?.display_name || val?.name
|
|
5291
5334
|
})) || [];
|
|
5292
5335
|
}, [dataOfSelection]);
|
|
5293
|
-
(0,
|
|
5336
|
+
(0, import_react15.useEffect)(() => {
|
|
5294
5337
|
setOptions(selectOptions);
|
|
5295
5338
|
setDomainModal(domainObject);
|
|
5296
5339
|
if (relation === "student.subject") (0, store_exports.setListSubject)(selectOptions);
|
|
5297
5340
|
}, [selectOptions]);
|
|
5298
|
-
(0,
|
|
5341
|
+
(0, import_react15.useEffect)(() => {
|
|
5299
5342
|
setDomainObject(
|
|
5300
5343
|
(0, utils_exports.evalJSONDomain)(
|
|
5301
5344
|
domain,
|
|
@@ -5303,7 +5346,7 @@ var many2oneFieldController = (props) => {
|
|
|
5303
5346
|
)
|
|
5304
5347
|
);
|
|
5305
5348
|
}, [domain, formValues]);
|
|
5306
|
-
(0,
|
|
5349
|
+
(0, import_react15.useEffect)(() => {
|
|
5307
5350
|
if (!propValue && tempSelectedOption) {
|
|
5308
5351
|
methods.setValue(name, null);
|
|
5309
5352
|
setTempSelectedOption(null);
|
|
@@ -5314,10 +5357,10 @@ var many2oneFieldController = (props) => {
|
|
|
5314
5357
|
});
|
|
5315
5358
|
}
|
|
5316
5359
|
}, [propValue]);
|
|
5317
|
-
const fetchMoreOptions = (0,
|
|
5360
|
+
const fetchMoreOptions = (0, import_react15.useCallback)(() => {
|
|
5318
5361
|
refetch();
|
|
5319
5362
|
}, [refetch]);
|
|
5320
|
-
(0,
|
|
5363
|
+
(0, import_react15.useEffect)(() => {
|
|
5321
5364
|
if (debouncedInputValue) {
|
|
5322
5365
|
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
5323
5366
|
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
@@ -5332,7 +5375,7 @@ var many2oneFieldController = (props) => {
|
|
|
5332
5375
|
}, 50);
|
|
5333
5376
|
}
|
|
5334
5377
|
}, [debouncedInputValue]);
|
|
5335
|
-
const handleChooseRecord = (0,
|
|
5378
|
+
const handleChooseRecord = (0, import_react15.useCallback)(
|
|
5336
5379
|
(idRecord) => {
|
|
5337
5380
|
const newOption = options.find(
|
|
5338
5381
|
(option) => option.value === idRecord
|
|
@@ -5357,8 +5400,8 @@ var many2oneFieldController = (props) => {
|
|
|
5357
5400
|
},
|
|
5358
5401
|
[options, methods, name, onChange]
|
|
5359
5402
|
);
|
|
5360
|
-
const handleClose = (0,
|
|
5361
|
-
const handleSelectChange = (0,
|
|
5403
|
+
const handleClose = (0, import_react15.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
5404
|
+
const handleSelectChange = (0, import_react15.useCallback)(
|
|
5362
5405
|
(selectedOption) => {
|
|
5363
5406
|
if (!selectedOption) {
|
|
5364
5407
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5405,20 +5448,20 @@ var many2oneFieldController = (props) => {
|
|
|
5405
5448
|
};
|
|
5406
5449
|
|
|
5407
5450
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5408
|
-
var
|
|
5409
|
-
var
|
|
5410
|
-
var
|
|
5451
|
+
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
5452
|
+
var import_hooks13 = require("@fctc/interface-logic/hooks");
|
|
5453
|
+
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
5411
5454
|
var many2oneButtonController = (props) => {
|
|
5412
5455
|
const { domain, methods, relation } = props;
|
|
5413
5456
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5414
|
-
const env = (0,
|
|
5415
|
-
const domainObject = (0,
|
|
5457
|
+
const env = (0, import_environment7.getEnv)();
|
|
5458
|
+
const domainObject = (0, import_utils6.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5416
5459
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5417
|
-
const { data: dataOfSelection } = (0,
|
|
5460
|
+
const { data: dataOfSelection } = (0, import_hooks13.useGetSelection)({
|
|
5418
5461
|
data: {
|
|
5419
5462
|
model: relation ?? "",
|
|
5420
5463
|
domain: domainObject,
|
|
5421
|
-
context: { ...env.context, ...(0,
|
|
5464
|
+
context: { ...env.context, ...(0, import_utils6.evalJSONContext)(actionData?.context) }
|
|
5422
5465
|
},
|
|
5423
5466
|
queryKey: [`data_${relation}`, domainObject]
|
|
5424
5467
|
});
|
|
@@ -5432,8 +5475,8 @@ var many2oneButtonController = (props) => {
|
|
|
5432
5475
|
};
|
|
5433
5476
|
|
|
5434
5477
|
// src/widget/basic/many2many-field/controller.ts
|
|
5435
|
-
var
|
|
5436
|
-
var
|
|
5478
|
+
var import_react16 = require("react");
|
|
5479
|
+
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5437
5480
|
var many2manyFieldController = (props) => {
|
|
5438
5481
|
const {
|
|
5439
5482
|
relation,
|
|
@@ -5441,16 +5484,16 @@ var many2manyFieldController = (props) => {
|
|
|
5441
5484
|
context,
|
|
5442
5485
|
options,
|
|
5443
5486
|
tab,
|
|
5444
|
-
setSelectedRowKeys:
|
|
5487
|
+
setSelectedRowKeys: setSelectedRowKeys3,
|
|
5445
5488
|
groupByDomain,
|
|
5446
5489
|
enabled: enabledCallAPI,
|
|
5447
5490
|
actionData
|
|
5448
5491
|
} = props;
|
|
5449
5492
|
const { env } = (0, provider_exports.useEnv)();
|
|
5450
5493
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5451
|
-
const [order, setOrder] = (0,
|
|
5452
|
-
const [page, setPage] = (0,
|
|
5453
|
-
const [domainMany2Many, setDomainMany2Many] = (0,
|
|
5494
|
+
const [order, setOrder] = (0, import_react16.useState)();
|
|
5495
|
+
const [page, setPage] = (0, import_react16.useState)(0);
|
|
5496
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react16.useState)(null);
|
|
5454
5497
|
const [debouncedPage] = useDebounce(page, 500);
|
|
5455
5498
|
const contextObject = {
|
|
5456
5499
|
...env.context,
|
|
@@ -5465,7 +5508,7 @@ var many2manyFieldController = (props) => {
|
|
|
5465
5508
|
context: contextObject
|
|
5466
5509
|
};
|
|
5467
5510
|
const { data: viewResponse } = useGetView2(viewParams, enabledCallAPI);
|
|
5468
|
-
const baseModel = (0,
|
|
5511
|
+
const baseModel = (0, import_react16.useMemo)(
|
|
5469
5512
|
() => ({
|
|
5470
5513
|
name: String(relation),
|
|
5471
5514
|
view: viewResponse || {},
|
|
@@ -5478,23 +5521,23 @@ var many2manyFieldController = (props) => {
|
|
|
5478
5521
|
[relation, viewResponse]
|
|
5479
5522
|
);
|
|
5480
5523
|
const initModel = (0, hooks_exports.useModel)();
|
|
5481
|
-
const modelInstance = (0,
|
|
5524
|
+
const modelInstance = (0, import_react16.useMemo)(() => {
|
|
5482
5525
|
if (viewResponse) {
|
|
5483
5526
|
return initModel.initModel(baseModel);
|
|
5484
5527
|
}
|
|
5485
5528
|
return null;
|
|
5486
5529
|
}, [baseModel, viewResponse]);
|
|
5487
|
-
const specification = (0,
|
|
5530
|
+
const specification = (0, import_react16.useMemo)(() => {
|
|
5488
5531
|
if (modelInstance) {
|
|
5489
5532
|
return modelInstance.getSpecification();
|
|
5490
5533
|
}
|
|
5491
5534
|
return null;
|
|
5492
5535
|
}, [modelInstance]);
|
|
5493
5536
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5494
|
-
const optionsObject = tab?.options ? (0,
|
|
5537
|
+
const optionsObject = tab?.options ? (0, import_utils7.evalJSONContext)(tab?.options) : (options ? (0, import_utils7.evalJSONContext)(options) : {}) || {};
|
|
5495
5538
|
const fetchData = async () => {
|
|
5496
5539
|
try {
|
|
5497
|
-
const domainParse = typeof domain === "string" ? (0,
|
|
5540
|
+
const domainParse = typeof domain === "string" ? (0, import_utils7.evalJSONDomain)(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5498
5541
|
setDomainMany2Many(domainParse);
|
|
5499
5542
|
setPage(0);
|
|
5500
5543
|
} catch (err) {
|
|
@@ -5518,7 +5561,7 @@ var many2manyFieldController = (props) => {
|
|
|
5518
5561
|
context: contextObject,
|
|
5519
5562
|
fields: groupByDomain?.fields,
|
|
5520
5563
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5521
|
-
sort: order ? order : default_order ? (0,
|
|
5564
|
+
sort: order ? order : default_order ? (0, import_utils7.formatSortingString)(default_order) : ""
|
|
5522
5565
|
};
|
|
5523
5566
|
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5524
5567
|
const {
|
|
@@ -5527,13 +5570,13 @@ var many2manyFieldController = (props) => {
|
|
|
5527
5570
|
isFetched,
|
|
5528
5571
|
isPlaceholderData
|
|
5529
5572
|
} = useGetListData3(data, queryKey, enabled);
|
|
5530
|
-
(0,
|
|
5573
|
+
(0, import_react16.useEffect)(() => {
|
|
5531
5574
|
if (viewResponse) {
|
|
5532
5575
|
fetchData();
|
|
5533
5576
|
}
|
|
5534
5577
|
return () => {
|
|
5535
5578
|
setPage(0);
|
|
5536
|
-
|
|
5579
|
+
setSelectedRowKeys3([]);
|
|
5537
5580
|
setDomainMany2Many(null);
|
|
5538
5581
|
};
|
|
5539
5582
|
}, [viewResponse]);
|
|
@@ -5580,11 +5623,9 @@ var many2manyFieldController = (props) => {
|
|
|
5580
5623
|
};
|
|
5581
5624
|
|
|
5582
5625
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5583
|
-
var
|
|
5626
|
+
var import_react17 = require("react");
|
|
5584
5627
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5585
|
-
var
|
|
5586
|
-
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5587
|
-
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5628
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5588
5629
|
var many2manyTagsController = (props) => {
|
|
5589
5630
|
const {
|
|
5590
5631
|
relation,
|
|
@@ -5595,10 +5636,11 @@ var many2manyTagsController = (props) => {
|
|
|
5595
5636
|
placeholderNoOption
|
|
5596
5637
|
} = props;
|
|
5597
5638
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5598
|
-
const env = (0,
|
|
5599
|
-
const
|
|
5600
|
-
const
|
|
5601
|
-
|
|
5639
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5640
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5641
|
+
const addtionalFields = optionsFields ? (0, import_utils8.evalJSONContext)(optionsFields) : null;
|
|
5642
|
+
const domainObject = (0, import_react17.useMemo)(
|
|
5643
|
+
() => (0, import_utils8.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5602
5644
|
[domain, formValues]
|
|
5603
5645
|
);
|
|
5604
5646
|
const data = {
|
|
@@ -5614,7 +5656,7 @@ var many2manyTagsController = (props) => {
|
|
|
5614
5656
|
enabled: true,
|
|
5615
5657
|
context: env.context
|
|
5616
5658
|
};
|
|
5617
|
-
const { data: dataOfSelection } = (
|
|
5659
|
+
const { data: dataOfSelection } = useGetSelection2({
|
|
5618
5660
|
data,
|
|
5619
5661
|
queryKey: [`data_${relation}`, domainObject]
|
|
5620
5662
|
});
|
|
@@ -5634,16 +5676,15 @@ var many2manyTagsController = (props) => {
|
|
|
5634
5676
|
options,
|
|
5635
5677
|
customNoOptionsMessage,
|
|
5636
5678
|
tranfer,
|
|
5637
|
-
dataOfSelection,
|
|
5638
5679
|
isUser
|
|
5639
5680
|
};
|
|
5640
5681
|
};
|
|
5641
5682
|
|
|
5642
5683
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5643
|
-
var
|
|
5644
|
-
var
|
|
5684
|
+
var import_react18 = require("react");
|
|
5685
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5645
5686
|
var durationController = (props) => {
|
|
5646
|
-
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5687
|
+
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5647
5688
|
const specification = {
|
|
5648
5689
|
id: 0,
|
|
5649
5690
|
name: "",
|
|
@@ -5651,13 +5692,13 @@ var durationController = (props) => {
|
|
|
5651
5692
|
};
|
|
5652
5693
|
const { useGetListData: useGetListData3, useChangeStatus } = (0, provider_exports.useService)();
|
|
5653
5694
|
const { env } = (0, provider_exports.useEnv)();
|
|
5654
|
-
const [disabled, setDisabled] = (0,
|
|
5655
|
-
const [modelStatus, setModalStatus] = (0,
|
|
5695
|
+
const [disabled, setDisabled] = (0, import_react18.useState)(false);
|
|
5696
|
+
const [modelStatus, setModalStatus] = (0, import_react18.useState)(false);
|
|
5656
5697
|
const queryKey = [`data-status-duration`, specification];
|
|
5657
5698
|
const listDataProps = {
|
|
5658
5699
|
model: relation,
|
|
5659
5700
|
specification,
|
|
5660
|
-
domain: (0,
|
|
5701
|
+
domain: (0, import_utils9.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5661
5702
|
limit: 10,
|
|
5662
5703
|
offset: 0,
|
|
5663
5704
|
fields: "",
|
|
@@ -5667,7 +5708,11 @@ var durationController = (props) => {
|
|
|
5667
5708
|
},
|
|
5668
5709
|
sort: ""
|
|
5669
5710
|
};
|
|
5670
|
-
const { data: dataResponse } = useGetListData3(
|
|
5711
|
+
const { data: dataResponse } = useGetListData3(
|
|
5712
|
+
listDataProps,
|
|
5713
|
+
queryKey,
|
|
5714
|
+
enabled
|
|
5715
|
+
);
|
|
5671
5716
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5672
5717
|
const handleClick = async (stage_id) => {
|
|
5673
5718
|
setDisabled(true);
|
|
@@ -5703,41 +5748,28 @@ var durationController = (props) => {
|
|
|
5703
5748
|
};
|
|
5704
5749
|
|
|
5705
5750
|
// src/widget/basic/priority-field/controller.ts
|
|
5706
|
-
var
|
|
5707
|
-
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5751
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
5708
5752
|
var priorityFieldController = (props) => {
|
|
5709
|
-
const {
|
|
5710
|
-
|
|
5711
|
-
isForm,
|
|
5712
|
-
name,
|
|
5713
|
-
methods,
|
|
5714
|
-
onChange,
|
|
5715
|
-
model,
|
|
5716
|
-
selection,
|
|
5717
|
-
id,
|
|
5718
|
-
actionData,
|
|
5719
|
-
viewData,
|
|
5720
|
-
context
|
|
5721
|
-
} = props;
|
|
5722
|
-
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5753
|
+
const { name, model, id, actionData, context, onChange, specification } = props;
|
|
5754
|
+
const _context = { ...(0, import_utils10.evalJSONContext)(actionData?.context) };
|
|
5723
5755
|
const contextObject = { ...context, ..._context };
|
|
5724
|
-
const
|
|
5725
|
-
const
|
|
5726
|
-
const { mutateAsync: fetchSave } = (0, import_hooks15.useSave)();
|
|
5756
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
5757
|
+
const { mutateAsync: fetchSave } = useSave2();
|
|
5727
5758
|
const savePriorities = async ({
|
|
5728
|
-
value
|
|
5759
|
+
value,
|
|
5729
5760
|
resetPriority
|
|
5730
5761
|
}) => {
|
|
5731
|
-
const priorityValue =
|
|
5762
|
+
const priorityValue = value <= 0 ? 0 : value - 1;
|
|
5732
5763
|
try {
|
|
5733
5764
|
fetchSave({
|
|
5734
5765
|
ids: id ? [id] : [],
|
|
5735
|
-
data: { [name
|
|
5736
|
-
model: model
|
|
5737
|
-
context: contextObject
|
|
5766
|
+
data: { [String(name)]: String(priorityValue) },
|
|
5767
|
+
model: String(model),
|
|
5768
|
+
context: contextObject,
|
|
5769
|
+
specification
|
|
5738
5770
|
});
|
|
5739
5771
|
if (typeof onChange === "function") {
|
|
5740
|
-
onChange(name
|
|
5772
|
+
onChange(String(name), String(priorityValue));
|
|
5741
5773
|
}
|
|
5742
5774
|
} catch (error) {
|
|
5743
5775
|
if (resetPriority) {
|
|
@@ -5746,22 +5778,15 @@ var priorityFieldController = (props) => {
|
|
|
5746
5778
|
}
|
|
5747
5779
|
};
|
|
5748
5780
|
return {
|
|
5749
|
-
|
|
5750
|
-
isForm,
|
|
5751
|
-
methods,
|
|
5752
|
-
defaultPriority,
|
|
5753
|
-
savePriorities,
|
|
5754
|
-
label,
|
|
5755
|
-
id,
|
|
5756
|
-
onChange
|
|
5781
|
+
savePriorities
|
|
5757
5782
|
};
|
|
5758
5783
|
};
|
|
5759
5784
|
|
|
5760
5785
|
// src/widget/basic/download-file-field/controller.ts
|
|
5761
|
-
var
|
|
5786
|
+
var import_react19 = require("react");
|
|
5762
5787
|
var downloadFileController = () => {
|
|
5763
|
-
const inputId = (0,
|
|
5764
|
-
const [file, setFile] = (0,
|
|
5788
|
+
const inputId = (0, import_react19.useId)();
|
|
5789
|
+
const [file, setFile] = (0, import_react19.useState)(null);
|
|
5765
5790
|
const handleFileChange = (e) => {
|
|
5766
5791
|
setFile(e.target.files[0]);
|
|
5767
5792
|
};
|
|
@@ -6693,13 +6718,13 @@ var dateFieldController = (props) => {
|
|
|
6693
6718
|
};
|
|
6694
6719
|
|
|
6695
6720
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6696
|
-
var
|
|
6697
|
-
var
|
|
6721
|
+
var import_react20 = require("react");
|
|
6722
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
6698
6723
|
var copyLinkButtonController = (props) => {
|
|
6699
6724
|
const { value, defaultValue } = props;
|
|
6700
|
-
const [isCopied, setIsCopied] = (0,
|
|
6725
|
+
const [isCopied, setIsCopied] = (0, import_react20.useState)(false);
|
|
6701
6726
|
const handleCopyToClipboard = async (value2) => {
|
|
6702
|
-
await (0,
|
|
6727
|
+
await (0, import_utils11.copyTextToClipboard)(value2);
|
|
6703
6728
|
setIsCopied(true);
|
|
6704
6729
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
6705
6730
|
};
|
|
@@ -6712,15 +6737,15 @@ var copyLinkButtonController = (props) => {
|
|
|
6712
6737
|
};
|
|
6713
6738
|
|
|
6714
6739
|
// src/widget/basic/color-field/color-controller.ts
|
|
6715
|
-
var
|
|
6740
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
6716
6741
|
var colorFieldController = (props) => {
|
|
6717
6742
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6718
6743
|
const { env } = (0, provider_exports.useEnv)();
|
|
6719
|
-
const { useSave:
|
|
6720
|
-
const _context = { ...(0,
|
|
6744
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
6745
|
+
const _context = { ...(0, import_utils12.evalJSONContext)(actionData?.context) || {} };
|
|
6721
6746
|
const contextObject = { ...env.context, ..._context };
|
|
6722
6747
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6723
|
-
const { mutate: onSave } =
|
|
6748
|
+
const { mutate: onSave } = useSave2();
|
|
6724
6749
|
const savePickColor = async (colorObject) => {
|
|
6725
6750
|
const { id } = colorObject;
|
|
6726
6751
|
if (value === id) return;
|
|
@@ -6745,16 +6770,16 @@ var colorFieldController = (props) => {
|
|
|
6745
6770
|
};
|
|
6746
6771
|
|
|
6747
6772
|
// src/widget/basic/binary-field/controller.ts
|
|
6748
|
-
var
|
|
6749
|
-
var
|
|
6773
|
+
var import_react21 = require("react");
|
|
6774
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6750
6775
|
var binaryFieldController = (props) => {
|
|
6751
6776
|
const { name, methods, readonly = false, value } = props;
|
|
6752
|
-
const inputId = (0,
|
|
6753
|
-
const [selectedImage, setSelectedImage] = (0,
|
|
6754
|
-
const [initialImage, setInitialImage] = (0,
|
|
6755
|
-
const [isInsideTable, setIsInsideTable] = (0,
|
|
6777
|
+
const inputId = (0, import_react21.useId)();
|
|
6778
|
+
const [selectedImage, setSelectedImage] = (0, import_react21.useState)(null);
|
|
6779
|
+
const [initialImage, setInitialImage] = (0, import_react21.useState)(value || null);
|
|
6780
|
+
const [isInsideTable, setIsInsideTable] = (0, import_react21.useState)(false);
|
|
6756
6781
|
const { setValue } = methods;
|
|
6757
|
-
const binaryRef = (0,
|
|
6782
|
+
const binaryRef = (0, import_react21.useRef)(null);
|
|
6758
6783
|
const convertUrlToBase64 = async (url) => {
|
|
6759
6784
|
try {
|
|
6760
6785
|
const response = await fetch(url);
|
|
@@ -6803,11 +6828,11 @@ var binaryFieldController = (props) => {
|
|
|
6803
6828
|
};
|
|
6804
6829
|
const checkIsImageLink = (url) => {
|
|
6805
6830
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6806
|
-
return imageExtensions.test(url) || (0,
|
|
6831
|
+
return imageExtensions.test(url) || (0, import_utils13.isBase64Image)(url) || isBlobUrl(url);
|
|
6807
6832
|
};
|
|
6808
6833
|
const getImageBase64WithMimeType = (base64) => {
|
|
6809
6834
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6810
|
-
if ((0,
|
|
6835
|
+
if ((0, import_utils13.isBase64Image)(base64)) return base64;
|
|
6811
6836
|
let mimeType = null;
|
|
6812
6837
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6813
6838
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6816,14 +6841,14 @@ var binaryFieldController = (props) => {
|
|
|
6816
6841
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
6817
6842
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
6818
6843
|
};
|
|
6819
|
-
(0,
|
|
6844
|
+
(0, import_react21.useEffect)(() => {
|
|
6820
6845
|
return () => {
|
|
6821
6846
|
if (selectedImage) {
|
|
6822
6847
|
URL.revokeObjectURL(selectedImage);
|
|
6823
6848
|
}
|
|
6824
6849
|
};
|
|
6825
6850
|
}, [selectedImage]);
|
|
6826
|
-
(0,
|
|
6851
|
+
(0, import_react21.useEffect)(() => {
|
|
6827
6852
|
if (binaryRef.current) {
|
|
6828
6853
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
6829
6854
|
setIsInsideTable(isInsideTable2);
|
|
@@ -6842,103 +6867,36 @@ var binaryFieldController = (props) => {
|
|
|
6842
6867
|
};
|
|
6843
6868
|
};
|
|
6844
6869
|
|
|
6845
|
-
// src/widget/advance/table/table-body/controller.ts
|
|
6846
|
-
var import_store8 = require("@fctc/interface-logic/store");
|
|
6847
|
-
var import_react21 = require("react");
|
|
6848
|
-
var tableBodyController = (props) => {
|
|
6849
|
-
const {
|
|
6850
|
-
checkedAll,
|
|
6851
|
-
checkboxRef,
|
|
6852
|
-
setIsAutoSelect,
|
|
6853
|
-
selectedRowKeys,
|
|
6854
|
-
row,
|
|
6855
|
-
isAutoSelect,
|
|
6856
|
-
selectedRowKeysRef,
|
|
6857
|
-
onClickRow
|
|
6858
|
-
} = props;
|
|
6859
|
-
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
6860
|
-
const checked = (0, import_react21.useMemo)(() => {
|
|
6861
|
-
if (!row?.id) return false;
|
|
6862
|
-
if (selectedRowKeys?.includes(row.id)) {
|
|
6863
|
-
return true;
|
|
6864
|
-
}
|
|
6865
|
-
return checkedAll;
|
|
6866
|
-
}, [row?.id, selectedRowKeys, checkedAll]);
|
|
6867
|
-
const handleCheckBoxSingle = (event) => {
|
|
6868
|
-
event.stopPropagation();
|
|
6869
|
-
if (checkedAll) {
|
|
6870
|
-
checkboxRef.current = "uncheck";
|
|
6871
|
-
setIsAutoSelect(true);
|
|
6872
|
-
return;
|
|
6873
|
-
}
|
|
6874
|
-
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6875
|
-
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6876
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6877
|
-
};
|
|
6878
|
-
const handleClickRow = (col, row2) => {
|
|
6879
|
-
onClickRow(col, row2);
|
|
6880
|
-
};
|
|
6881
|
-
(0, import_react21.useEffect)(() => {
|
|
6882
|
-
if (!row?.id) return;
|
|
6883
|
-
if (isAutoSelect) {
|
|
6884
|
-
if (checkboxRef?.current === "uncheck") {
|
|
6885
|
-
const filtered = selectedRowKeysRef.current.filter(
|
|
6886
|
-
(id) => id !== row.id
|
|
6887
|
-
);
|
|
6888
|
-
selectedRowKeysRef.current = filtered;
|
|
6889
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(filtered));
|
|
6890
|
-
} else {
|
|
6891
|
-
const unique = Array.from(
|
|
6892
|
-
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6893
|
-
);
|
|
6894
|
-
selectedRowKeysRef.current = unique;
|
|
6895
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(unique));
|
|
6896
|
-
}
|
|
6897
|
-
}
|
|
6898
|
-
}, [isAutoSelect]);
|
|
6899
|
-
(0, import_react21.useEffect)(() => {
|
|
6900
|
-
if (!checkedAll) {
|
|
6901
|
-
checkboxRef.current = "enabled";
|
|
6902
|
-
false;
|
|
6903
|
-
}
|
|
6904
|
-
}, [checkedAll]);
|
|
6905
|
-
return {
|
|
6906
|
-
handleCheckBoxSingle,
|
|
6907
|
-
checked,
|
|
6908
|
-
handleClickRow
|
|
6909
|
-
};
|
|
6910
|
-
};
|
|
6911
|
-
|
|
6912
6870
|
// src/widget/advance/table/table-head/controller.ts
|
|
6913
|
-
var
|
|
6871
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
6914
6872
|
var tableHeadController = (props) => {
|
|
6915
6873
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6916
|
-
const appDispatch = (0,
|
|
6917
|
-
const { groupByDomain } = (0,
|
|
6874
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
6875
|
+
const { groupByDomain } = (0, import_store8.useAppSelector)(import_store8.selectSearch);
|
|
6918
6876
|
const handleCheckBoxAll = (event) => {
|
|
6919
6877
|
if (event?.target?.checked && typeTable === "list") {
|
|
6920
6878
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6921
|
-
appDispatch((0,
|
|
6879
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(allRowKeys));
|
|
6922
6880
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6923
6881
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6924
6882
|
const ids = Array.from(rowsIDs)?.map(
|
|
6925
6883
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6926
6884
|
);
|
|
6927
6885
|
if (ids?.length > 0) {
|
|
6928
|
-
appDispatch((0,
|
|
6886
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(ids));
|
|
6929
6887
|
} else {
|
|
6930
6888
|
const sum = countSum(
|
|
6931
6889
|
rows,
|
|
6932
6890
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6933
6891
|
);
|
|
6934
6892
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6935
|
-
appDispatch((0,
|
|
6893
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(keys));
|
|
6936
6894
|
}
|
|
6937
6895
|
if (selectedRowKeysRef) {
|
|
6938
6896
|
selectedRowKeysRef.current = [];
|
|
6939
6897
|
}
|
|
6940
6898
|
} else {
|
|
6941
|
-
appDispatch((0,
|
|
6899
|
+
appDispatch((0, import_store8.setSelectedRowKeys)([]));
|
|
6942
6900
|
}
|
|
6943
6901
|
};
|
|
6944
6902
|
return {
|
|
@@ -6948,8 +6906,8 @@ var tableHeadController = (props) => {
|
|
|
6948
6906
|
|
|
6949
6907
|
// src/widget/advance/table/table-view/controller.ts
|
|
6950
6908
|
var import_react22 = require("react");
|
|
6951
|
-
var
|
|
6952
|
-
var
|
|
6909
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6910
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6953
6911
|
var tableController = ({ data }) => {
|
|
6954
6912
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
6955
6913
|
const [columns, setColumns] = (0, import_react22.useState)([]);
|
|
@@ -6987,7 +6945,7 @@ var tableController = ({ data }) => {
|
|
|
6987
6945
|
let cols = [];
|
|
6988
6946
|
try {
|
|
6989
6947
|
cols = mergeFields?.filter((item) => {
|
|
6990
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
6948
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils14.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils14.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
6991
6949
|
})?.map((field) => {
|
|
6992
6950
|
return {
|
|
6993
6951
|
name: field?.name,
|
|
@@ -7027,8 +6985,8 @@ var tableController = ({ data }) => {
|
|
|
7027
6985
|
|
|
7028
6986
|
// src/widget/advance/table/table-group/controller.ts
|
|
7029
6987
|
var import_react23 = require("react");
|
|
7030
|
-
var
|
|
7031
|
-
var
|
|
6988
|
+
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
6989
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
7032
6990
|
|
|
7033
6991
|
// src/environment.ts
|
|
7034
6992
|
var environment_exports = {};
|
|
@@ -7056,10 +7014,10 @@ var tableGroupController = (props) => {
|
|
|
7056
7014
|
selectedRowKeysRef
|
|
7057
7015
|
} = props;
|
|
7058
7016
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
7059
|
-
const { groupByDomain, selectedTags } = (0,
|
|
7060
|
-
const { selectedRowKeys } = (0,
|
|
7061
|
-
const appDispatch = (0,
|
|
7062
|
-
const { toDataJS } = (0,
|
|
7017
|
+
const { groupByDomain, selectedTags } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
7018
|
+
const { selectedRowKeys } = (0, import_store10.useAppSelector)(import_store10.selectList);
|
|
7019
|
+
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
7020
|
+
const { toDataJS } = (0, import_hooks15.useOdooDataTransform)();
|
|
7063
7021
|
const initVal = toDataJS(row, viewData, model);
|
|
7064
7022
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7065
7023
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -7106,7 +7064,7 @@ var tableGroupController = (props) => {
|
|
|
7106
7064
|
isPlaceholderData,
|
|
7107
7065
|
isLoading,
|
|
7108
7066
|
isFetching
|
|
7109
|
-
} = (0,
|
|
7067
|
+
} = (0, import_hooks15.useGetListData)(listDataProps, queryKey, enabled);
|
|
7110
7068
|
const {
|
|
7111
7069
|
columns: columnsGroup,
|
|
7112
7070
|
rows: rowsGroup,
|
|
@@ -7144,14 +7102,14 @@ var tableGroupController = (props) => {
|
|
|
7144
7102
|
const filteredIds = selectedRowKeys.filter(
|
|
7145
7103
|
(id) => !ids.includes(id)
|
|
7146
7104
|
);
|
|
7147
|
-
appDispatch((0,
|
|
7105
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(filteredIds));
|
|
7148
7106
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7149
7107
|
const clonedKeys = [...selectedRowKeys];
|
|
7150
|
-
appDispatch((0,
|
|
7151
|
-
setTimeout(() => appDispatch((0,
|
|
7108
|
+
appDispatch((0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
7109
|
+
setTimeout(() => appDispatch((0, import_store10.setSelectedRowKeys)(clonedKeys)), 500);
|
|
7152
7110
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7153
7111
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7154
|
-
appDispatch((0,
|
|
7112
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(filteredKeys));
|
|
7155
7113
|
}
|
|
7156
7114
|
toggleShowGroup();
|
|
7157
7115
|
};
|
|
@@ -7160,8 +7118,8 @@ var tableGroupController = (props) => {
|
|
|
7160
7118
|
return;
|
|
7161
7119
|
}
|
|
7162
7120
|
const clonedKeys = [...selectedRowKeys];
|
|
7163
|
-
(0,
|
|
7164
|
-
setTimeout(() => (0,
|
|
7121
|
+
(0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
7122
|
+
setTimeout(() => (0, import_store10.setSelectedRowKeys)(clonedKeys), 500);
|
|
7165
7123
|
}, [isQueryFetched]);
|
|
7166
7124
|
return {
|
|
7167
7125
|
handleExpandChildGroup,
|
|
@@ -7196,7 +7154,7 @@ var tableGroupController = (props) => {
|
|
|
7196
7154
|
|
|
7197
7155
|
// src/widget/advance/search/controller.ts
|
|
7198
7156
|
var import_constants5 = require("@fctc/interface-logic/constants");
|
|
7199
|
-
var
|
|
7157
|
+
var import_utils15 = require("@fctc/interface-logic/utils");
|
|
7200
7158
|
var import_moment2 = __toESM(require_moment());
|
|
7201
7159
|
var import_react24 = require("react");
|
|
7202
7160
|
var searchController = ({
|
|
@@ -7213,9 +7171,9 @@ var searchController = ({
|
|
|
7213
7171
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7214
7172
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7215
7173
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
7216
|
-
const actionContext = typeof context === "string" ? (0,
|
|
7174
|
+
const actionContext = typeof context === "string" ? (0, import_utils15.evalJSONContext)(context) : context;
|
|
7217
7175
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7218
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0,
|
|
7176
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils15.evalJSONDomain)(domain, contextSearch) : [];
|
|
7219
7177
|
const clearSearch = () => {
|
|
7220
7178
|
setFilterBy([]);
|
|
7221
7179
|
setGroupBy([]);
|
|
@@ -7230,7 +7188,7 @@ var searchController = ({
|
|
|
7230
7188
|
const dataModel = viewData?.models?.[model];
|
|
7231
7189
|
const searchViews = viewData?.views?.search;
|
|
7232
7190
|
const searchByItems = searchViews?.search_by?.filter(
|
|
7233
|
-
(item) => !
|
|
7191
|
+
(item) => !import_utils15.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
7234
7192
|
)?.map(
|
|
7235
7193
|
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
7236
7194
|
dataIndex: index,
|
|
@@ -7243,10 +7201,10 @@ var searchController = ({
|
|
|
7243
7201
|
})
|
|
7244
7202
|
);
|
|
7245
7203
|
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
7246
|
-
return !
|
|
7204
|
+
return !import_utils15.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
7247
7205
|
})?.map((item) => ({ ...item, active: false }));
|
|
7248
7206
|
const groupByItems = searchViews?.group_by.filter(
|
|
7249
|
-
(item) => !
|
|
7207
|
+
(item) => !import_utils15.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
7250
7208
|
).map((item) => ({
|
|
7251
7209
|
...item,
|
|
7252
7210
|
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
@@ -7323,14 +7281,14 @@ var searchController = ({
|
|
|
7323
7281
|
}
|
|
7324
7282
|
let valueDomainItem = value?.value;
|
|
7325
7283
|
if (value?.modelType === "date") {
|
|
7326
|
-
valueDomainItem = (0,
|
|
7284
|
+
valueDomainItem = (0, import_utils15.validateAndParseDate)(value?.value);
|
|
7327
7285
|
} else if (value?.modelType === "datetime") {
|
|
7328
7286
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
7329
|
-
const parsedDate = (0,
|
|
7287
|
+
const parsedDate = (0, import_utils15.validateAndParseDate)(value?.value, true);
|
|
7330
7288
|
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
7331
7289
|
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");
|
|
7332
7290
|
} else {
|
|
7333
|
-
valueDomainItem = (0,
|
|
7291
|
+
valueDomainItem = (0, import_utils15.validateAndParseDate)(value?.value, true);
|
|
7334
7292
|
}
|
|
7335
7293
|
}
|
|
7336
7294
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
@@ -7418,7 +7376,7 @@ var searchController = ({
|
|
|
7418
7376
|
active,
|
|
7419
7377
|
dataIndex
|
|
7420
7378
|
} = tag;
|
|
7421
|
-
const domainFormat = new
|
|
7379
|
+
const domainFormat = new import_utils15.domainHelper.Domain(domain2);
|
|
7422
7380
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7423
7381
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7424
7382
|
...tag,
|
|
@@ -7522,7 +7480,6 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
7522
7480
|
searchController,
|
|
7523
7481
|
setStorageItemAsync,
|
|
7524
7482
|
statusDropdownController,
|
|
7525
|
-
tableBodyController,
|
|
7526
7483
|
tableController,
|
|
7527
7484
|
tableGroupController,
|
|
7528
7485
|
tableHeadController,
|
|
@@ -7536,6 +7493,7 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
7536
7493
|
useGetRowIds,
|
|
7537
7494
|
useListData,
|
|
7538
7495
|
useMenu,
|
|
7496
|
+
useMenuItem,
|
|
7539
7497
|
useProfile,
|
|
7540
7498
|
useSelectionState,
|
|
7541
7499
|
useStorageState,
|