@fctc/widget-logic 1.10.1 → 1.10.3
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.js +6 -140
- package/dist/hooks.mjs +2 -141
- package/dist/index.js +254 -258
- package/dist/index.mjs +164 -172
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/widget.d.mts +31 -17
- package/dist/widget.d.ts +31 -17
- package/dist/widget.js +246 -250
- package/dist/widget.mjs +160 -168
- package/package.json +96 -96
package/dist/widget.mjs
CHANGED
|
@@ -4091,7 +4091,7 @@ var statusDropdownController = (props) => {
|
|
|
4091
4091
|
};
|
|
4092
4092
|
|
|
4093
4093
|
// src/widget/basic/many2one-field/controller.ts
|
|
4094
|
-
import { useCallback as useCallback2, useEffect as useEffect10, useMemo as useMemo9, useState as
|
|
4094
|
+
import { useCallback as useCallback2, useEffect as useEffect10, useMemo as useMemo9, useState as useState7 } from "react";
|
|
4095
4095
|
|
|
4096
4096
|
// src/hooks.ts
|
|
4097
4097
|
var hooks_exports = {};
|
|
@@ -4888,31 +4888,6 @@ var useAppProvider = () => {
|
|
|
4888
4888
|
return context;
|
|
4889
4889
|
};
|
|
4890
4890
|
|
|
4891
|
-
// src/hooks/core/use-menu-item.tsx
|
|
4892
|
-
import { getEnv as getEnv6 } from "@fctc/interface-logic/environment";
|
|
4893
|
-
import { useGetActionDetail } from "@fctc/interface-logic/hooks";
|
|
4894
|
-
import { useState as useState6 } from "react";
|
|
4895
|
-
|
|
4896
|
-
// src/utils.ts
|
|
4897
|
-
var utils_exports = {};
|
|
4898
|
-
__export(utils_exports, {
|
|
4899
|
-
API_APP_URL: () => API_APP_URL,
|
|
4900
|
-
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4901
|
-
STORAGES: () => STORAGES,
|
|
4902
|
-
combineContexts: () => combineContexts,
|
|
4903
|
-
convertFieldsToArray: () => convertFieldsToArray,
|
|
4904
|
-
countSum: () => countSum,
|
|
4905
|
-
getDateRange: () => getDateRange,
|
|
4906
|
-
languages: () => languages,
|
|
4907
|
-
mergeButtons: () => mergeButtons,
|
|
4908
|
-
setStorageItemAsync: () => setStorageItemAsync,
|
|
4909
|
-
useGetRowIds: () => useGetRowIds,
|
|
4910
|
-
useSelectionState: () => useSelectionState,
|
|
4911
|
-
useStorageState: () => useStorageState
|
|
4912
|
-
});
|
|
4913
|
-
__reExport(utils_exports, utils_star);
|
|
4914
|
-
import * as utils_star from "@fctc/interface-logic/utils";
|
|
4915
|
-
|
|
4916
4891
|
// src/hooks/utils/use-click-outside.ts
|
|
4917
4892
|
import { useEffect as useEffect8, useRef as useRef3 } from "react";
|
|
4918
4893
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
@@ -4945,9 +4920,9 @@ var useClickOutside = ({
|
|
|
4945
4920
|
};
|
|
4946
4921
|
|
|
4947
4922
|
// src/hooks/utils/use-debounce.ts
|
|
4948
|
-
import { useEffect as useEffect9, useState as
|
|
4923
|
+
import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
4949
4924
|
function useDebounce(value, delay) {
|
|
4950
|
-
const [debouncedValue, setDebouncedValue] =
|
|
4925
|
+
const [debouncedValue, setDebouncedValue] = useState6(value);
|
|
4951
4926
|
useEffect9(() => {
|
|
4952
4927
|
const handler = setTimeout(() => {
|
|
4953
4928
|
setDebouncedValue(value);
|
|
@@ -4963,6 +4938,26 @@ function useDebounce(value, delay) {
|
|
|
4963
4938
|
__reExport(hooks_exports, hooks_star);
|
|
4964
4939
|
import * as hooks_star from "@fctc/interface-logic/hooks";
|
|
4965
4940
|
|
|
4941
|
+
// src/utils.ts
|
|
4942
|
+
var utils_exports = {};
|
|
4943
|
+
__export(utils_exports, {
|
|
4944
|
+
API_APP_URL: () => API_APP_URL,
|
|
4945
|
+
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4946
|
+
STORAGES: () => STORAGES,
|
|
4947
|
+
combineContexts: () => combineContexts,
|
|
4948
|
+
convertFieldsToArray: () => convertFieldsToArray,
|
|
4949
|
+
countSum: () => countSum,
|
|
4950
|
+
getDateRange: () => getDateRange,
|
|
4951
|
+
languages: () => languages,
|
|
4952
|
+
mergeButtons: () => mergeButtons,
|
|
4953
|
+
setStorageItemAsync: () => setStorageItemAsync,
|
|
4954
|
+
useGetRowIds: () => useGetRowIds,
|
|
4955
|
+
useSelectionState: () => useSelectionState,
|
|
4956
|
+
useStorageState: () => useStorageState
|
|
4957
|
+
});
|
|
4958
|
+
__reExport(utils_exports, utils_star2);
|
|
4959
|
+
import * as utils_star2 from "@fctc/interface-logic/utils";
|
|
4960
|
+
|
|
4966
4961
|
// src/provider.ts
|
|
4967
4962
|
var provider_exports = {};
|
|
4968
4963
|
__reExport(provider_exports, provider_star);
|
|
@@ -4983,22 +4978,22 @@ var many2oneFieldController = (props) => {
|
|
|
4983
4978
|
options: fieldOptions,
|
|
4984
4979
|
showDetail
|
|
4985
4980
|
} = props;
|
|
4986
|
-
const
|
|
4987
|
-
const [
|
|
4981
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
4982
|
+
const [options, setOptions] = useState7([]);
|
|
4983
|
+
const [inputValue, setInputValue] = useState7("");
|
|
4988
4984
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
4989
|
-
const [isShowModalMany2Many, setIsShowModalMany2Many] =
|
|
4990
|
-
const [tempSelectedOption, setTempSelectedOption] =
|
|
4991
|
-
const [domainModal, setDomainModal] =
|
|
4992
|
-
const [domainObject, setDomainObject] =
|
|
4985
|
+
const [isShowModalMany2Many, setIsShowModalMany2Many] = useState7(false);
|
|
4986
|
+
const [tempSelectedOption, setTempSelectedOption] = useState7(null);
|
|
4987
|
+
const [domainModal, setDomainModal] = useState7(null);
|
|
4988
|
+
const [domainObject, setDomainObject] = useState7(null);
|
|
4993
4989
|
const actionData = sessionStorageUtils.getActionData();
|
|
4994
4990
|
const { menuList } = (0, store_exports.useAppSelector)(store_exports.selectNavbar);
|
|
4995
|
-
const { context } = (0, store_exports.useAppSelector)(store_exports.selectEnv);
|
|
4996
4991
|
const initValue = methods?.getValues(name);
|
|
4997
4992
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
4998
4993
|
const contextObject = {
|
|
4999
4994
|
...(0, utils_exports.evalJSONContext)(actionData?.context) || {},
|
|
5000
4995
|
...fieldContext,
|
|
5001
|
-
...context
|
|
4996
|
+
...env?.context
|
|
5002
4997
|
};
|
|
5003
4998
|
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
5004
4999
|
const data = {
|
|
@@ -5142,13 +5137,13 @@ var many2oneFieldController = (props) => {
|
|
|
5142
5137
|
};
|
|
5143
5138
|
|
|
5144
5139
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5145
|
-
import { getEnv as
|
|
5140
|
+
import { getEnv as getEnv6 } from "@fctc/interface-logic/environment";
|
|
5146
5141
|
import { useGetSelection } from "@fctc/interface-logic/hooks";
|
|
5147
5142
|
import { evalJSONDomain as evalJSONDomain3, evalJSONContext as evalJSONContext3 } from "@fctc/interface-logic/utils";
|
|
5148
5143
|
var many2oneButtonController = (props) => {
|
|
5149
5144
|
const { domain, methods, relation } = props;
|
|
5150
5145
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5151
|
-
const env =
|
|
5146
|
+
const env = getEnv6();
|
|
5152
5147
|
const domainObject = evalJSONDomain3(domain, methods?.getValues() || {});
|
|
5153
5148
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5154
5149
|
const { data: dataOfSelection } = useGetSelection({
|
|
@@ -5169,16 +5164,10 @@ var many2oneButtonController = (props) => {
|
|
|
5169
5164
|
};
|
|
5170
5165
|
|
|
5171
5166
|
// src/widget/basic/many2many-field/controller.ts
|
|
5172
|
-
import { useEffect as useEffect11, useMemo as useMemo10, useState as
|
|
5173
|
-
import {
|
|
5174
|
-
useAppDispatch as useAppDispatch5,
|
|
5175
|
-
setFirstDomain,
|
|
5176
|
-
setViewDataStore,
|
|
5177
|
-
setPage,
|
|
5178
|
-
setGroupByDomain
|
|
5179
|
-
} from "@fctc/interface-logic/store";
|
|
5167
|
+
import { useEffect as useEffect11, useMemo as useMemo10, useState as useState8 } from "react";
|
|
5180
5168
|
import {
|
|
5181
5169
|
evalJSONContext as evalJSONContext4,
|
|
5170
|
+
evalJSONDomain as evalJSONDomain4,
|
|
5182
5171
|
formatSortingString as formatSortingString2
|
|
5183
5172
|
} from "@fctc/interface-logic/utils";
|
|
5184
5173
|
var many2manyFieldController = (props) => {
|
|
@@ -5186,45 +5175,44 @@ var many2manyFieldController = (props) => {
|
|
|
5186
5175
|
relation,
|
|
5187
5176
|
domain,
|
|
5188
5177
|
context,
|
|
5178
|
+
options,
|
|
5189
5179
|
tab,
|
|
5190
|
-
model,
|
|
5191
|
-
aid,
|
|
5192
5180
|
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5193
|
-
fields,
|
|
5194
|
-
setFields,
|
|
5195
5181
|
groupByDomain,
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
sessionStorageUtils
|
|
5182
|
+
enabled: enabledCallAPI,
|
|
5183
|
+
actionData
|
|
5199
5184
|
} = props;
|
|
5200
|
-
const appDispatch = useAppDispatch5();
|
|
5201
|
-
const actionData = sessionStorageUtils.getActionData();
|
|
5202
|
-
const [debouncedPage] = useDebounce(page, 500);
|
|
5203
|
-
const [order, setOrder] = useState9();
|
|
5204
|
-
const [isLoadedData, setIsLoadedData] = useState9(false);
|
|
5205
|
-
const [domainMany2Many, setDomainMany2Many] = useState9(domain);
|
|
5206
5185
|
const { env } = (0, provider_exports.useEnv)();
|
|
5207
5186
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5187
|
+
const [order, setOrder] = useState8();
|
|
5188
|
+
const [isLoadedData, setIsLoadedData] = useState8(false);
|
|
5189
|
+
const [page, setPage] = useState8(0);
|
|
5190
|
+
const [domainMany2Many, setDomainMany2Many] = useState8(null);
|
|
5191
|
+
const [debouncedPage] = useDebounce(page, 500);
|
|
5192
|
+
const contextObject = {
|
|
5193
|
+
...env.context,
|
|
5194
|
+
...context || {}
|
|
5195
|
+
};
|
|
5208
5196
|
const viewParams = {
|
|
5209
5197
|
model: relation,
|
|
5210
5198
|
views: [
|
|
5211
5199
|
[false, "list"],
|
|
5212
5200
|
[false, "search"]
|
|
5213
5201
|
],
|
|
5214
|
-
context
|
|
5202
|
+
context: contextObject
|
|
5215
5203
|
};
|
|
5216
|
-
const { data: viewResponse } = useGetView2(viewParams,
|
|
5204
|
+
const { data: viewResponse } = useGetView2(viewParams, enabledCallAPI);
|
|
5217
5205
|
const baseModel = useMemo10(
|
|
5218
5206
|
() => ({
|
|
5219
5207
|
name: String(relation),
|
|
5220
5208
|
view: viewResponse || {},
|
|
5221
|
-
actContext:
|
|
5209
|
+
actContext: contextObject,
|
|
5222
5210
|
fields: [
|
|
5223
5211
|
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5224
5212
|
...tab?.fields ? tab.fields : []
|
|
5225
5213
|
]
|
|
5226
5214
|
}),
|
|
5227
|
-
[
|
|
5215
|
+
[relation, viewResponse]
|
|
5228
5216
|
);
|
|
5229
5217
|
const initModel = (0, hooks_exports.useModel)();
|
|
5230
5218
|
const modelInstance = useMemo10(() => {
|
|
@@ -5243,26 +5231,15 @@ var many2manyFieldController = (props) => {
|
|
|
5243
5231
|
const optionsObject = tab?.options ? evalJSONContext4(tab?.options) : (options ? evalJSONContext4(options) : {}) || {};
|
|
5244
5232
|
const fetchData = async () => {
|
|
5245
5233
|
try {
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
5250
|
-
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
5251
|
-
...field
|
|
5252
|
-
}));
|
|
5253
|
-
if (!fields?.[`${aid}_${relation}_popupmany2many`] && modalData) {
|
|
5254
|
-
setFields({
|
|
5255
|
-
...fields,
|
|
5256
|
-
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
5257
|
-
});
|
|
5258
|
-
}
|
|
5259
|
-
appDispatch(setPage(0));
|
|
5234
|
+
const domainParse = typeof domain === "string" ? evalJSONDomain4(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5235
|
+
setDomainMany2Many(domainParse);
|
|
5236
|
+
setPage(0);
|
|
5260
5237
|
} catch (err) {
|
|
5261
5238
|
console.log(err);
|
|
5262
5239
|
}
|
|
5263
5240
|
};
|
|
5264
5241
|
const queryKey = [
|
|
5265
|
-
`view-${relation}
|
|
5242
|
+
`view-${relation}`,
|
|
5266
5243
|
specification,
|
|
5267
5244
|
domainMany2Many,
|
|
5268
5245
|
debouncedPage,
|
|
@@ -5275,16 +5252,16 @@ var many2manyFieldController = (props) => {
|
|
|
5275
5252
|
domain: domainMany2Many,
|
|
5276
5253
|
offset: debouncedPage * 10,
|
|
5277
5254
|
limit: 10,
|
|
5278
|
-
context,
|
|
5255
|
+
context: contextObject,
|
|
5279
5256
|
fields: groupByDomain?.fields,
|
|
5280
5257
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5281
5258
|
sort: order ? order : default_order ? formatSortingString2(default_order) : ""
|
|
5282
5259
|
};
|
|
5283
|
-
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5260
|
+
const enabled = enabledCallAPI && isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5284
5261
|
const {
|
|
5285
5262
|
data: dataResponse,
|
|
5286
|
-
isLoading
|
|
5287
|
-
isFetched
|
|
5263
|
+
isLoading,
|
|
5264
|
+
isFetched,
|
|
5288
5265
|
isPlaceholderData
|
|
5289
5266
|
} = useGetListData3(data, queryKey, enabled);
|
|
5290
5267
|
useEffect11(() => {
|
|
@@ -5292,76 +5269,87 @@ var many2manyFieldController = (props) => {
|
|
|
5292
5269
|
fetchData();
|
|
5293
5270
|
}
|
|
5294
5271
|
return () => {
|
|
5295
|
-
|
|
5296
|
-
setFields((prevFields) => ({
|
|
5297
|
-
...prevFields,
|
|
5298
|
-
[`${aid}_${relation}_popupmany2many`]: null
|
|
5299
|
-
}));
|
|
5300
|
-
appDispatch(setPage(0));
|
|
5272
|
+
setPage(0);
|
|
5301
5273
|
setSelectedRowKeys4([]);
|
|
5302
5274
|
setDomainMany2Many(null);
|
|
5303
5275
|
setIsLoadedData(false);
|
|
5304
5276
|
};
|
|
5305
5277
|
}, [viewResponse]);
|
|
5306
|
-
const { rows, columns, typeTable } = tableController({
|
|
5278
|
+
const { rows, columns, typeTable, onToggleColumnOptional } = tableController({
|
|
5307
5279
|
data: {
|
|
5308
|
-
fields:
|
|
5280
|
+
fields: viewResponse?.views?.list?.fields,
|
|
5309
5281
|
records: dataResponse?.records ?? dataResponse?.groups,
|
|
5310
5282
|
dataModel: viewResponse?.models?.[String(relation)],
|
|
5311
|
-
context:
|
|
5283
|
+
context: contextObject,
|
|
5312
5284
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
5313
5285
|
}
|
|
5314
5286
|
});
|
|
5315
|
-
const dataFormView = {
|
|
5316
|
-
id: null,
|
|
5317
|
-
model: relation,
|
|
5318
|
-
context
|
|
5319
|
-
};
|
|
5320
5287
|
const {
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5288
|
+
removeSearchItems,
|
|
5289
|
+
selectedTags,
|
|
5290
|
+
filterBy,
|
|
5291
|
+
setFilterBy,
|
|
5292
|
+
searchString,
|
|
5293
|
+
onSearchString,
|
|
5294
|
+
handleAddTagSearch,
|
|
5295
|
+
searchBy,
|
|
5296
|
+
groupBy,
|
|
5297
|
+
setGroupBy,
|
|
5298
|
+
domain: domainSearch
|
|
5299
|
+
} = searchController({
|
|
5300
|
+
viewData: viewResponse,
|
|
5301
|
+
actionData,
|
|
5302
|
+
fieldsList: [
|
|
5303
|
+
...columns?.filter(
|
|
5304
|
+
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
5305
|
+
)?.map((col) => ({ ...col.field })) ?? []
|
|
5306
|
+
]
|
|
5328
5307
|
});
|
|
5329
|
-
useEffect11(() => {
|
|
5330
|
-
if (isSuccess && dataFormViewResponse) {
|
|
5331
|
-
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5332
|
-
window.location.href = `/form/menu?model=${relation}`;
|
|
5333
|
-
}
|
|
5334
|
-
}, [isSuccess]);
|
|
5335
5308
|
useEffect11(() => {
|
|
5336
5309
|
if (domainMany2Many && !isLoadedData) {
|
|
5337
5310
|
setIsLoadedData(true);
|
|
5338
5311
|
}
|
|
5339
5312
|
}, [domainMany2Many]);
|
|
5313
|
+
useEffect11(() => {
|
|
5314
|
+
setDomainMany2Many(domainSearch);
|
|
5315
|
+
}, [domainSearch]);
|
|
5340
5316
|
const handleCreateNewOnPage = async () => {
|
|
5341
|
-
try {
|
|
5342
|
-
refetch();
|
|
5343
|
-
} catch (error) {
|
|
5344
|
-
console.log(error);
|
|
5345
|
-
}
|
|
5346
5317
|
};
|
|
5347
5318
|
return {
|
|
5348
5319
|
handleCreateNewOnPage,
|
|
5349
5320
|
optionsObject,
|
|
5321
|
+
totalRows: dataResponse?.length ?? 0,
|
|
5350
5322
|
rows,
|
|
5351
5323
|
columns,
|
|
5324
|
+
onToggleColumnOptional,
|
|
5352
5325
|
typeTable,
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
isPlaceholderData
|
|
5326
|
+
isLoading,
|
|
5327
|
+
isFetched,
|
|
5328
|
+
isPlaceholderData,
|
|
5329
|
+
setPage,
|
|
5330
|
+
page,
|
|
5331
|
+
viewData: viewResponse,
|
|
5332
|
+
domain: domainMany2Many,
|
|
5333
|
+
// search
|
|
5334
|
+
removeSearchItems,
|
|
5335
|
+
selectedTags,
|
|
5336
|
+
filterBy,
|
|
5337
|
+
setFilterBy,
|
|
5338
|
+
searchString,
|
|
5339
|
+
onSearchString,
|
|
5340
|
+
handleAddTagSearch,
|
|
5341
|
+
searchBy,
|
|
5342
|
+
groupBy,
|
|
5343
|
+
setGroupBy
|
|
5356
5344
|
};
|
|
5357
5345
|
};
|
|
5358
5346
|
|
|
5359
5347
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5360
5348
|
import { useMemo as useMemo11 } from "react";
|
|
5361
5349
|
import { WIDGETAVATAR, WIDGETCOLOR } from "@fctc/interface-logic/constants";
|
|
5362
|
-
import { getEnv as
|
|
5350
|
+
import { getEnv as getEnv7 } from "@fctc/interface-logic/environment";
|
|
5363
5351
|
import { useGetSelection as useGetSelection2 } from "@fctc/interface-logic/hooks";
|
|
5364
|
-
import { evalJSONContext as evalJSONContext5, evalJSONDomain as
|
|
5352
|
+
import { evalJSONContext as evalJSONContext5, evalJSONDomain as evalJSONDomain5 } from "@fctc/interface-logic/utils";
|
|
5365
5353
|
var many2manyTagsController = (props) => {
|
|
5366
5354
|
const {
|
|
5367
5355
|
relation,
|
|
@@ -5372,10 +5360,10 @@ var many2manyTagsController = (props) => {
|
|
|
5372
5360
|
placeholderNoOption
|
|
5373
5361
|
} = props;
|
|
5374
5362
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5375
|
-
const env =
|
|
5363
|
+
const env = getEnv7();
|
|
5376
5364
|
const addtionalFields = optionsFields ? evalJSONContext5(optionsFields) : null;
|
|
5377
5365
|
const domainObject = useMemo11(
|
|
5378
|
-
() =>
|
|
5366
|
+
() => evalJSONDomain5(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5379
5367
|
[domain, formValues]
|
|
5380
5368
|
);
|
|
5381
5369
|
const data = {
|
|
@@ -5417,8 +5405,8 @@ var many2manyTagsController = (props) => {
|
|
|
5417
5405
|
};
|
|
5418
5406
|
|
|
5419
5407
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5420
|
-
import { useState as
|
|
5421
|
-
import { evalJSONDomain as
|
|
5408
|
+
import { useState as useState9 } from "react";
|
|
5409
|
+
import { evalJSONDomain as evalJSONDomain6 } from "@fctc/interface-logic/utils";
|
|
5422
5410
|
var durationController = (props) => {
|
|
5423
5411
|
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5424
5412
|
const specification = {
|
|
@@ -5428,13 +5416,13 @@ var durationController = (props) => {
|
|
|
5428
5416
|
};
|
|
5429
5417
|
const { useGetListData: useGetListData3, useChangeStatus } = (0, provider_exports.useService)();
|
|
5430
5418
|
const { env } = (0, provider_exports.useEnv)();
|
|
5431
|
-
const [disabled, setDisabled] =
|
|
5432
|
-
const [modelStatus, setModalStatus] =
|
|
5419
|
+
const [disabled, setDisabled] = useState9(false);
|
|
5420
|
+
const [modelStatus, setModalStatus] = useState9(false);
|
|
5433
5421
|
const queryKey = [`data-status-duration`, specification];
|
|
5434
5422
|
const listDataProps = {
|
|
5435
5423
|
model: relation,
|
|
5436
5424
|
specification,
|
|
5437
|
-
domain:
|
|
5425
|
+
domain: evalJSONDomain6(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5438
5426
|
limit: 10,
|
|
5439
5427
|
offset: 0,
|
|
5440
5428
|
fields: "",
|
|
@@ -5535,10 +5523,10 @@ var priorityFieldController = (props) => {
|
|
|
5535
5523
|
};
|
|
5536
5524
|
|
|
5537
5525
|
// src/widget/basic/download-file-field/controller.ts
|
|
5538
|
-
import { useId, useState as
|
|
5526
|
+
import { useId, useState as useState10 } from "react";
|
|
5539
5527
|
var downloadFileController = () => {
|
|
5540
5528
|
const inputId = useId();
|
|
5541
|
-
const [file, setFile] =
|
|
5529
|
+
const [file, setFile] = useState10(null);
|
|
5542
5530
|
const handleFileChange = (e) => {
|
|
5543
5531
|
setFile(e.target.files[0]);
|
|
5544
5532
|
};
|
|
@@ -6470,11 +6458,11 @@ var dateFieldController = (props) => {
|
|
|
6470
6458
|
};
|
|
6471
6459
|
|
|
6472
6460
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6473
|
-
import { useState as
|
|
6461
|
+
import { useState as useState11 } from "react";
|
|
6474
6462
|
import { copyTextToClipboard } from "@fctc/interface-logic/utils";
|
|
6475
6463
|
var copyLinkButtonController = (props) => {
|
|
6476
6464
|
const { value, defaultValue } = props;
|
|
6477
|
-
const [isCopied, setIsCopied] =
|
|
6465
|
+
const [isCopied, setIsCopied] = useState11(false);
|
|
6478
6466
|
const handleCopyToClipboard = async (value2) => {
|
|
6479
6467
|
await copyTextToClipboard(value2);
|
|
6480
6468
|
setIsCopied(true);
|
|
@@ -6522,14 +6510,14 @@ var colorFieldController = (props) => {
|
|
|
6522
6510
|
};
|
|
6523
6511
|
|
|
6524
6512
|
// src/widget/basic/binary-field/controller.ts
|
|
6525
|
-
import { useEffect as useEffect12, useId as useId2, useRef as useRef4, useState as
|
|
6513
|
+
import { useEffect as useEffect12, useId as useId2, useRef as useRef4, useState as useState12 } from "react";
|
|
6526
6514
|
import { isBase64Image } from "@fctc/interface-logic/utils";
|
|
6527
6515
|
var binaryFieldController = (props) => {
|
|
6528
6516
|
const { name, methods, readonly = false, value } = props;
|
|
6529
6517
|
const inputId = useId2();
|
|
6530
|
-
const [selectedImage, setSelectedImage] =
|
|
6531
|
-
const [initialImage, setInitialImage] =
|
|
6532
|
-
const [isInsideTable, setIsInsideTable] =
|
|
6518
|
+
const [selectedImage, setSelectedImage] = useState12(null);
|
|
6519
|
+
const [initialImage, setInitialImage] = useState12(value || null);
|
|
6520
|
+
const [isInsideTable, setIsInsideTable] = useState12(false);
|
|
6533
6521
|
const { setValue } = methods;
|
|
6534
6522
|
const binaryRef = useRef4(null);
|
|
6535
6523
|
const convertUrlToBase64 = async (url) => {
|
|
@@ -6620,7 +6608,7 @@ var binaryFieldController = (props) => {
|
|
|
6620
6608
|
};
|
|
6621
6609
|
|
|
6622
6610
|
// src/widget/advance/table/table-body/controller.ts
|
|
6623
|
-
import { useAppDispatch as
|
|
6611
|
+
import { useAppDispatch as useAppDispatch5, setSelectedRowKeys } from "@fctc/interface-logic/store";
|
|
6624
6612
|
import { useEffect as useEffect13, useMemo as useMemo12 } from "react";
|
|
6625
6613
|
var tableBodyController = (props) => {
|
|
6626
6614
|
const {
|
|
@@ -6633,7 +6621,7 @@ var tableBodyController = (props) => {
|
|
|
6633
6621
|
selectedRowKeysRef,
|
|
6634
6622
|
onClickRow
|
|
6635
6623
|
} = props;
|
|
6636
|
-
const appDispatch =
|
|
6624
|
+
const appDispatch = useAppDispatch5();
|
|
6637
6625
|
const checked = useMemo12(() => {
|
|
6638
6626
|
if (!row?.id) return false;
|
|
6639
6627
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6688,14 +6676,14 @@ var tableBodyController = (props) => {
|
|
|
6688
6676
|
|
|
6689
6677
|
// src/widget/advance/table/table-head/controller.ts
|
|
6690
6678
|
import {
|
|
6691
|
-
useAppDispatch as
|
|
6679
|
+
useAppDispatch as useAppDispatch6,
|
|
6692
6680
|
useAppSelector as useAppSelector4,
|
|
6693
6681
|
selectSearch as selectSearch3,
|
|
6694
6682
|
setSelectedRowKeys as setSelectedRowKeys2
|
|
6695
6683
|
} from "@fctc/interface-logic/store";
|
|
6696
6684
|
var tableHeadController = (props) => {
|
|
6697
6685
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6698
|
-
const appDispatch =
|
|
6686
|
+
const appDispatch = useAppDispatch6();
|
|
6699
6687
|
const { groupByDomain } = useAppSelector4(selectSearch3);
|
|
6700
6688
|
const handleCheckBoxAll = (event) => {
|
|
6701
6689
|
if (event?.target?.checked && typeTable === "list") {
|
|
@@ -6729,7 +6717,7 @@ var tableHeadController = (props) => {
|
|
|
6729
6717
|
};
|
|
6730
6718
|
|
|
6731
6719
|
// src/widget/advance/table/table-view/controller.ts
|
|
6732
|
-
import { useEffect as useEffect14, useMemo as useMemo13, useRef as useRef5, useState as
|
|
6720
|
+
import { useEffect as useEffect14, useMemo as useMemo13, useRef as useRef5, useState as useState13 } from "react";
|
|
6733
6721
|
import {
|
|
6734
6722
|
useAppSelector as useAppSelector5,
|
|
6735
6723
|
selectSearch as selectSearch4,
|
|
@@ -6737,8 +6725,8 @@ import {
|
|
|
6737
6725
|
} from "@fctc/interface-logic/store";
|
|
6738
6726
|
import { domainHelper } from "@fctc/interface-logic/utils";
|
|
6739
6727
|
var tableController = ({ data }) => {
|
|
6740
|
-
const [rows, setRows] =
|
|
6741
|
-
const [columns, setColumns] =
|
|
6728
|
+
const [rows, setRows] = useState13(data.records || []);
|
|
6729
|
+
const [columns, setColumns] = useState13([]);
|
|
6742
6730
|
const dataModelFields = data.fields?.map((field) => {
|
|
6743
6731
|
return {
|
|
6744
6732
|
...data.dataModel?.[field?.name],
|
|
@@ -6812,7 +6800,7 @@ var tableController = ({ data }) => {
|
|
|
6812
6800
|
};
|
|
6813
6801
|
|
|
6814
6802
|
// src/widget/advance/table/table-group/controller.ts
|
|
6815
|
-
import { useEffect as useEffect15, useMemo as useMemo14, useState as
|
|
6803
|
+
import { useEffect as useEffect15, useMemo as useMemo14, useState as useState14 } from "react";
|
|
6816
6804
|
import {
|
|
6817
6805
|
useOdooDataTransform,
|
|
6818
6806
|
useGetListData as useGetListData2
|
|
@@ -6821,7 +6809,7 @@ import {
|
|
|
6821
6809
|
useAppSelector as useAppSelector6,
|
|
6822
6810
|
selectSearch as selectSearch5,
|
|
6823
6811
|
selectList as selectList4,
|
|
6824
|
-
useAppDispatch as
|
|
6812
|
+
useAppDispatch as useAppDispatch7,
|
|
6825
6813
|
setSelectedRowKeys as setSelectedRowKeys3
|
|
6826
6814
|
} from "@fctc/interface-logic/store";
|
|
6827
6815
|
|
|
@@ -6851,14 +6839,14 @@ var tableGroupController = (props) => {
|
|
|
6851
6839
|
setIsAutoSelect,
|
|
6852
6840
|
selectedRowKeysRef
|
|
6853
6841
|
} = props;
|
|
6854
|
-
const [pageGroup, setPageGroup] =
|
|
6842
|
+
const [pageGroup, setPageGroup] = useState14(0);
|
|
6855
6843
|
const { groupByDomain, selectedTags } = useAppSelector6(selectSearch5);
|
|
6856
6844
|
const { selectedRowKeys } = useAppSelector6(selectList4);
|
|
6857
|
-
const appDispatch =
|
|
6845
|
+
const appDispatch = useAppDispatch7();
|
|
6858
6846
|
const { toDataJS } = useOdooDataTransform();
|
|
6859
6847
|
const initVal = toDataJS(row, viewData, model);
|
|
6860
|
-
const [isShowGroup, setIsShowGroup] =
|
|
6861
|
-
const [colEmptyGroup, setColEmptyGroup] =
|
|
6848
|
+
const [isShowGroup, setIsShowGroup] = useState14(false);
|
|
6849
|
+
const [colEmptyGroup, setColEmptyGroup] = useState14({
|
|
6862
6850
|
fromStart: 1,
|
|
6863
6851
|
fromEnd: 1
|
|
6864
6852
|
});
|
|
@@ -6995,24 +6983,27 @@ var import_moment2 = __toESM(require_moment());
|
|
|
6995
6983
|
import { SearchType } from "@fctc/interface-logic/constants";
|
|
6996
6984
|
import {
|
|
6997
6985
|
domainHelper as domainHelper2,
|
|
6998
|
-
|
|
6986
|
+
evalJSONContext as evalJSONContext8,
|
|
6987
|
+
evalJSONDomain as evalJSONDomain7,
|
|
6999
6988
|
validateAndParseDate
|
|
7000
6989
|
} from "@fctc/interface-logic/utils";
|
|
7001
|
-
import { useCallback as useCallback3, useEffect as useEffect16, useState as
|
|
6990
|
+
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
7002
6991
|
var searchController = ({
|
|
7003
6992
|
viewData,
|
|
7004
6993
|
actionData,
|
|
7005
|
-
fieldsList
|
|
7006
|
-
contextSearch,
|
|
7007
|
-
setSearchMap,
|
|
7008
|
-
searchMap
|
|
6994
|
+
fieldsList
|
|
7009
6995
|
}) => {
|
|
7010
|
-
const
|
|
7011
|
-
const [
|
|
7012
|
-
const [
|
|
7013
|
-
const [
|
|
7014
|
-
const [
|
|
7015
|
-
const
|
|
6996
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
6997
|
+
const [filterBy, setFilterBy] = useState15(null);
|
|
6998
|
+
const [searchBy, setSearchBy] = useState15(null);
|
|
6999
|
+
const [groupBy, setGroupBy] = useState15(null);
|
|
7000
|
+
const [selectedTags, setSelectedTags] = useState15(null);
|
|
7001
|
+
const [searchString, setSearchString] = useState15("");
|
|
7002
|
+
const [searchMap, setSearchMap] = useState15({});
|
|
7003
|
+
const { context } = actionData || {};
|
|
7004
|
+
const actionContext = typeof context === "string" ? evalJSONContext8(context) : context;
|
|
7005
|
+
const contextSearch = { ...env.context, ...actionContext };
|
|
7006
|
+
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : evalJSONDomain7(actionData?.domain, contextSearch) : [];
|
|
7016
7007
|
const aid = actionData?.id;
|
|
7017
7008
|
const model = actionData?.res_model;
|
|
7018
7009
|
const clearSearch = () => {
|
|
@@ -7169,16 +7160,16 @@ var searchController = ({
|
|
|
7169
7160
|
const contexts = [];
|
|
7170
7161
|
let groupValues = [];
|
|
7171
7162
|
objValues?.forEach((objValue) => {
|
|
7172
|
-
const { context, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7163
|
+
const { context: context2, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7173
7164
|
const indexAppend = groupIndex2 != null ? groupIndex2 : viewData?.views?.search?.filters_by?.length ?? 0;
|
|
7174
7165
|
contexts.push(
|
|
7175
|
-
...Array.isArray(
|
|
7166
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({ group_by: item })) : [context2]
|
|
7176
7167
|
);
|
|
7177
7168
|
groupValues[indexAppend] = {
|
|
7178
7169
|
contexts: [
|
|
7179
|
-
...Array.isArray(
|
|
7170
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({
|
|
7180
7171
|
group_by: item
|
|
7181
|
-
})) : [
|
|
7172
|
+
})) : [context2]
|
|
7182
7173
|
],
|
|
7183
7174
|
strings: isDefault ? [value] : [...groupValues[indexAppend]?.strings ?? [], value]
|
|
7184
7175
|
};
|
|
@@ -7215,7 +7206,7 @@ var searchController = ({
|
|
|
7215
7206
|
value,
|
|
7216
7207
|
type,
|
|
7217
7208
|
title,
|
|
7218
|
-
context,
|
|
7209
|
+
context: context2,
|
|
7219
7210
|
active,
|
|
7220
7211
|
dataIndex
|
|
7221
7212
|
} = tag;
|
|
@@ -7223,13 +7214,13 @@ var searchController = ({
|
|
|
7223
7214
|
if (type === SearchType.FILTER) {
|
|
7224
7215
|
addSearchItems(`${SearchType.FILTER}_${groupIndex}`, {
|
|
7225
7216
|
...tag,
|
|
7226
|
-
domain: domain ? domainFormat.toList(
|
|
7217
|
+
domain: domain ? domainFormat.toList(context2) : null
|
|
7227
7218
|
});
|
|
7228
7219
|
} else if (type === SearchType.SEARCH) {
|
|
7229
7220
|
addSearchItems(`${SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7230
7221
|
...tag,
|
|
7231
7222
|
domain: domain ? domainFormat.toList({
|
|
7232
|
-
...
|
|
7223
|
+
...context2,
|
|
7233
7224
|
self: value
|
|
7234
7225
|
}) : null
|
|
7235
7226
|
});
|
|
@@ -7237,7 +7228,7 @@ var searchController = ({
|
|
|
7237
7228
|
addSearchItems(`${SearchType.GROUP}`, {
|
|
7238
7229
|
...tag,
|
|
7239
7230
|
domain: domain ? domainFormat.toList({
|
|
7240
|
-
context,
|
|
7231
|
+
context: context2,
|
|
7241
7232
|
self: value
|
|
7242
7233
|
}) : null
|
|
7243
7234
|
});
|
|
@@ -7257,7 +7248,8 @@ var searchController = ({
|
|
|
7257
7248
|
removeSearchItems,
|
|
7258
7249
|
onSearchString: onChangeSearchInput,
|
|
7259
7250
|
handleAddTagSearch,
|
|
7260
|
-
domain: formatDomain()
|
|
7251
|
+
domain: formatDomain(),
|
|
7252
|
+
context: contextSearch
|
|
7261
7253
|
};
|
|
7262
7254
|
};
|
|
7263
7255
|
export {
|