@fctc/widget-logic 1.9.7 → 1.9.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/index.js +115 -75
- package/dist/index.mjs +104 -59
- package/dist/types.d.mts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/widget.d.mts +9 -11
- package/dist/widget.d.ts +9 -11
- package/dist/widget.js +115 -75
- package/dist/widget.mjs +104 -59
- package/package.json +1 -1
package/dist/widget.mjs
CHANGED
|
@@ -4978,7 +4978,6 @@ var many2oneFieldController = (props) => {
|
|
|
4978
4978
|
options: fieldOptions,
|
|
4979
4979
|
showDetail
|
|
4980
4980
|
} = props;
|
|
4981
|
-
const { env } = (0, provider_exports.useEnv)();
|
|
4982
4981
|
const [options, setOptions] = useState7([]);
|
|
4983
4982
|
const [inputValue, setInputValue] = useState7("");
|
|
4984
4983
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
@@ -4988,14 +4987,15 @@ var many2oneFieldController = (props) => {
|
|
|
4988
4987
|
const [domainObject, setDomainObject] = useState7(null);
|
|
4989
4988
|
const actionData = sessionStorageUtils.getActionData();
|
|
4990
4989
|
const { menuList } = (0, store_exports.useAppSelector)(store_exports.selectNavbar);
|
|
4990
|
+
const { context } = (0, store_exports.useAppSelector)(store_exports.selectEnv);
|
|
4991
4991
|
const initValue = methods?.getValues(name);
|
|
4992
4992
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
4993
4993
|
const contextObject = {
|
|
4994
4994
|
...(0, utils_exports.evalJSONContext)(actionData?.context) || {},
|
|
4995
4995
|
...fieldContext,
|
|
4996
|
-
...
|
|
4996
|
+
...context
|
|
4997
4997
|
};
|
|
4998
|
-
const { useGetSelection:
|
|
4998
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
4999
4999
|
const data = {
|
|
5000
5000
|
model: relation,
|
|
5001
5001
|
domain: domainObject,
|
|
@@ -5011,7 +5011,7 @@ var many2oneFieldController = (props) => {
|
|
|
5011
5011
|
data: dataOfSelection,
|
|
5012
5012
|
refetch,
|
|
5013
5013
|
isFetching
|
|
5014
|
-
} =
|
|
5014
|
+
} = useGetSelection2({
|
|
5015
5015
|
data,
|
|
5016
5016
|
queryKey,
|
|
5017
5017
|
enabled: false
|
|
@@ -5165,9 +5165,15 @@ var many2oneButtonController = (props) => {
|
|
|
5165
5165
|
|
|
5166
5166
|
// src/widget/basic/many2many-field/controller.ts
|
|
5167
5167
|
import { useEffect as useEffect11, useMemo as useMemo10, useState as useState8 } from "react";
|
|
5168
|
+
import {
|
|
5169
|
+
useAppDispatch as useAppDispatch5,
|
|
5170
|
+
setFirstDomain,
|
|
5171
|
+
setViewDataStore,
|
|
5172
|
+
setPage,
|
|
5173
|
+
setGroupByDomain
|
|
5174
|
+
} from "@fctc/interface-logic/store";
|
|
5168
5175
|
import {
|
|
5169
5176
|
evalJSONContext as evalJSONContext4,
|
|
5170
|
-
evalJSONDomain as evalJSONDomain4,
|
|
5171
5177
|
formatSortingString as formatSortingString2
|
|
5172
5178
|
} from "@fctc/interface-logic/utils";
|
|
5173
5179
|
var many2manyFieldController = (props) => {
|
|
@@ -5175,43 +5181,45 @@ var many2manyFieldController = (props) => {
|
|
|
5175
5181
|
relation,
|
|
5176
5182
|
domain,
|
|
5177
5183
|
context,
|
|
5178
|
-
options,
|
|
5179
5184
|
tab,
|
|
5185
|
+
model,
|
|
5186
|
+
aid,
|
|
5180
5187
|
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5188
|
+
fields,
|
|
5189
|
+
setFields,
|
|
5181
5190
|
groupByDomain,
|
|
5182
|
-
|
|
5191
|
+
page,
|
|
5192
|
+
options,
|
|
5193
|
+
sessionStorageUtils
|
|
5183
5194
|
} = props;
|
|
5184
|
-
const
|
|
5185
|
-
const
|
|
5195
|
+
const appDispatch = useAppDispatch5();
|
|
5196
|
+
const actionData = sessionStorageUtils.getActionData();
|
|
5197
|
+
const [debouncedPage] = useDebounce(page, 500);
|
|
5186
5198
|
const [order, setOrder] = useState8();
|
|
5187
5199
|
const [isLoadedData, setIsLoadedData] = useState8(false);
|
|
5188
|
-
const [
|
|
5189
|
-
const
|
|
5190
|
-
const
|
|
5191
|
-
const contextObject = {
|
|
5192
|
-
...env.context,
|
|
5193
|
-
...context || {}
|
|
5194
|
-
};
|
|
5200
|
+
const [domainMany2Many, setDomainMany2Many] = useState8(domain);
|
|
5201
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5202
|
+
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5195
5203
|
const viewParams = {
|
|
5196
5204
|
model: relation,
|
|
5197
5205
|
views: [
|
|
5198
5206
|
[false, "list"],
|
|
5199
5207
|
[false, "search"]
|
|
5200
5208
|
],
|
|
5201
|
-
context
|
|
5209
|
+
context
|
|
5202
5210
|
};
|
|
5203
|
-
const { data: viewResponse } = useGetView2(viewParams,
|
|
5211
|
+
const { data: viewResponse } = useGetView2(viewParams, actionData);
|
|
5204
5212
|
const baseModel = useMemo10(
|
|
5205
5213
|
() => ({
|
|
5206
5214
|
name: String(relation),
|
|
5207
5215
|
view: viewResponse || {},
|
|
5208
|
-
actContext:
|
|
5216
|
+
actContext: context,
|
|
5209
5217
|
fields: [
|
|
5210
5218
|
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5211
5219
|
...tab?.fields ? tab.fields : []
|
|
5212
5220
|
]
|
|
5213
5221
|
}),
|
|
5214
|
-
[
|
|
5222
|
+
[model, viewResponse]
|
|
5215
5223
|
);
|
|
5216
5224
|
const initModel = (0, hooks_exports.useModel)();
|
|
5217
5225
|
const modelInstance = useMemo10(() => {
|
|
@@ -5230,15 +5238,26 @@ var many2manyFieldController = (props) => {
|
|
|
5230
5238
|
const optionsObject = tab?.options ? evalJSONContext4(tab?.options) : (options ? evalJSONContext4(options) : {}) || {};
|
|
5231
5239
|
const fetchData = async () => {
|
|
5232
5240
|
try {
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5241
|
+
setDomainMany2Many(domain);
|
|
5242
|
+
appDispatch(setFirstDomain(domain));
|
|
5243
|
+
appDispatch(setViewDataStore(viewResponse));
|
|
5244
|
+
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
5245
|
+
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
5246
|
+
...field
|
|
5247
|
+
}));
|
|
5248
|
+
if (!fields?.[`${aid}_${relation}_popupmany2many`] && modalData) {
|
|
5249
|
+
setFields({
|
|
5250
|
+
...fields,
|
|
5251
|
+
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
5252
|
+
});
|
|
5253
|
+
}
|
|
5254
|
+
appDispatch(setPage(0));
|
|
5236
5255
|
} catch (err) {
|
|
5237
5256
|
console.log(err);
|
|
5238
5257
|
}
|
|
5239
5258
|
};
|
|
5240
5259
|
const queryKey = [
|
|
5241
|
-
`view-${relation}`,
|
|
5260
|
+
`view-${relation}-${aid}`,
|
|
5242
5261
|
specification,
|
|
5243
5262
|
domainMany2Many,
|
|
5244
5263
|
debouncedPage,
|
|
@@ -5251,16 +5270,16 @@ var many2manyFieldController = (props) => {
|
|
|
5251
5270
|
domain: domainMany2Many,
|
|
5252
5271
|
offset: debouncedPage * 10,
|
|
5253
5272
|
limit: 10,
|
|
5254
|
-
context
|
|
5273
|
+
context,
|
|
5255
5274
|
fields: groupByDomain?.fields,
|
|
5256
5275
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5257
5276
|
sort: order ? order : default_order ? formatSortingString2(default_order) : ""
|
|
5258
5277
|
};
|
|
5259
|
-
const enabled =
|
|
5278
|
+
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5260
5279
|
const {
|
|
5261
5280
|
data: dataResponse,
|
|
5262
|
-
isLoading,
|
|
5263
|
-
isFetched,
|
|
5281
|
+
isLoading: isDataLoading,
|
|
5282
|
+
isFetched: isDataResponseFetched,
|
|
5264
5283
|
isPlaceholderData
|
|
5265
5284
|
} = useGetListData3(data, queryKey, enabled);
|
|
5266
5285
|
useEffect11(() => {
|
|
@@ -5268,52 +5287,74 @@ var many2manyFieldController = (props) => {
|
|
|
5268
5287
|
fetchData();
|
|
5269
5288
|
}
|
|
5270
5289
|
return () => {
|
|
5271
|
-
|
|
5290
|
+
appDispatch(setGroupByDomain(null));
|
|
5291
|
+
setFields((prevFields) => ({
|
|
5292
|
+
...prevFields,
|
|
5293
|
+
[`${aid}_${relation}_popupmany2many`]: null
|
|
5294
|
+
}));
|
|
5295
|
+
appDispatch(setPage(0));
|
|
5272
5296
|
setSelectedRowKeys4([]);
|
|
5273
5297
|
setDomainMany2Many(null);
|
|
5274
5298
|
setIsLoadedData(false);
|
|
5275
5299
|
};
|
|
5276
5300
|
}, [viewResponse]);
|
|
5277
|
-
const { rows, columns, typeTable
|
|
5301
|
+
const { rows, columns, typeTable } = tableController({
|
|
5278
5302
|
data: {
|
|
5279
|
-
fields: viewResponse?.views?.list?.fields,
|
|
5303
|
+
fields: fields?.[`${aid}_${relation}_popupmany2many`] || viewResponse?.views?.list?.fields,
|
|
5280
5304
|
records: dataResponse?.records ?? dataResponse?.groups,
|
|
5281
5305
|
dataModel: viewResponse?.models?.[String(relation)],
|
|
5282
|
-
context:
|
|
5306
|
+
context: { ...env.context, ...context },
|
|
5283
5307
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
5284
5308
|
}
|
|
5285
5309
|
});
|
|
5310
|
+
const dataFormView = {
|
|
5311
|
+
id: null,
|
|
5312
|
+
model: relation,
|
|
5313
|
+
context
|
|
5314
|
+
};
|
|
5315
|
+
const {
|
|
5316
|
+
refetch,
|
|
5317
|
+
data: dataFormViewResponse,
|
|
5318
|
+
isSuccess
|
|
5319
|
+
} = useGetFormView({
|
|
5320
|
+
data: dataFormView,
|
|
5321
|
+
queryKey: [`form-view-action-${relation}`],
|
|
5322
|
+
enabled: false
|
|
5323
|
+
});
|
|
5324
|
+
useEffect11(() => {
|
|
5325
|
+
if (isSuccess && dataFormViewResponse) {
|
|
5326
|
+
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5327
|
+
window.location.href = `/form/menu?model=${relation}`;
|
|
5328
|
+
}
|
|
5329
|
+
}, [isSuccess]);
|
|
5286
5330
|
useEffect11(() => {
|
|
5287
5331
|
if (domainMany2Many && !isLoadedData) {
|
|
5288
5332
|
setIsLoadedData(true);
|
|
5289
5333
|
}
|
|
5290
5334
|
}, [domainMany2Many]);
|
|
5291
5335
|
const handleCreateNewOnPage = async () => {
|
|
5336
|
+
try {
|
|
5337
|
+
refetch();
|
|
5338
|
+
} catch (error) {
|
|
5339
|
+
console.log(error);
|
|
5340
|
+
}
|
|
5292
5341
|
};
|
|
5293
5342
|
return {
|
|
5294
5343
|
handleCreateNewOnPage,
|
|
5295
5344
|
optionsObject,
|
|
5296
|
-
totalRows: dataResponse?.length ?? 0,
|
|
5297
5345
|
rows,
|
|
5298
5346
|
columns,
|
|
5299
|
-
onToggleColumnOptional,
|
|
5300
5347
|
typeTable,
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
isPlaceholderData
|
|
5304
|
-
setPage,
|
|
5305
|
-
page,
|
|
5306
|
-
domain: domainMany2Many,
|
|
5307
|
-
setDomain: setDomainMany2Many
|
|
5348
|
+
isDataLoading,
|
|
5349
|
+
isDataResponseFetched,
|
|
5350
|
+
isPlaceholderData
|
|
5308
5351
|
};
|
|
5309
5352
|
};
|
|
5310
5353
|
|
|
5311
5354
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5312
5355
|
import { useMemo as useMemo11 } from "react";
|
|
5313
5356
|
import { WIDGETAVATAR, WIDGETCOLOR } from "@fctc/interface-logic/constants";
|
|
5314
|
-
import {
|
|
5315
|
-
import { useGetSelection as useGetSelection2 } from "@fctc/interface-logic/hooks";
|
|
5316
|
-
import { evalJSONContext as evalJSONContext5, evalJSONDomain as evalJSONDomain5 } from "@fctc/interface-logic/utils";
|
|
5357
|
+
import { evalJSONContext as evalJSONContext5, evalJSONDomain as evalJSONDomain4 } from "@fctc/interface-logic/utils";
|
|
5317
5358
|
var many2manyTagsController = (props) => {
|
|
5318
5359
|
const {
|
|
5319
5360
|
relation,
|
|
@@ -5324,10 +5365,11 @@ var many2manyTagsController = (props) => {
|
|
|
5324
5365
|
placeholderNoOption
|
|
5325
5366
|
} = props;
|
|
5326
5367
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5327
|
-
const env =
|
|
5368
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5369
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5328
5370
|
const addtionalFields = optionsFields ? evalJSONContext5(optionsFields) : null;
|
|
5329
5371
|
const domainObject = useMemo11(
|
|
5330
|
-
() =>
|
|
5372
|
+
() => evalJSONDomain4(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5331
5373
|
[domain, formValues]
|
|
5332
5374
|
);
|
|
5333
5375
|
const data = {
|
|
@@ -5363,16 +5405,15 @@ var many2manyTagsController = (props) => {
|
|
|
5363
5405
|
options,
|
|
5364
5406
|
customNoOptionsMessage,
|
|
5365
5407
|
tranfer,
|
|
5366
|
-
dataOfSelection,
|
|
5367
5408
|
isUser
|
|
5368
5409
|
};
|
|
5369
5410
|
};
|
|
5370
5411
|
|
|
5371
5412
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5372
5413
|
import { useState as useState9 } from "react";
|
|
5373
|
-
import { evalJSONDomain as
|
|
5414
|
+
import { evalJSONDomain as evalJSONDomain5 } from "@fctc/interface-logic/utils";
|
|
5374
5415
|
var durationController = (props) => {
|
|
5375
|
-
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5416
|
+
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5376
5417
|
const specification = {
|
|
5377
5418
|
id: 0,
|
|
5378
5419
|
name: "",
|
|
@@ -5386,7 +5427,7 @@ var durationController = (props) => {
|
|
|
5386
5427
|
const listDataProps = {
|
|
5387
5428
|
model: relation,
|
|
5388
5429
|
specification,
|
|
5389
|
-
domain:
|
|
5430
|
+
domain: evalJSONDomain5(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5390
5431
|
limit: 10,
|
|
5391
5432
|
offset: 0,
|
|
5392
5433
|
fields: "",
|
|
@@ -5396,7 +5437,11 @@ var durationController = (props) => {
|
|
|
5396
5437
|
},
|
|
5397
5438
|
sort: ""
|
|
5398
5439
|
};
|
|
5399
|
-
const { data: dataResponse } = useGetListData3(
|
|
5440
|
+
const { data: dataResponse } = useGetListData3(
|
|
5441
|
+
listDataProps,
|
|
5442
|
+
queryKey,
|
|
5443
|
+
enabled
|
|
5444
|
+
);
|
|
5400
5445
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5401
5446
|
const handleClick = async (stage_id) => {
|
|
5402
5447
|
setDisabled(true);
|
|
@@ -6572,7 +6617,7 @@ var binaryFieldController = (props) => {
|
|
|
6572
6617
|
};
|
|
6573
6618
|
|
|
6574
6619
|
// src/widget/advance/table/table-body/controller.ts
|
|
6575
|
-
import { useAppDispatch as
|
|
6620
|
+
import { useAppDispatch as useAppDispatch6, setSelectedRowKeys } from "@fctc/interface-logic/store";
|
|
6576
6621
|
import { useEffect as useEffect13, useMemo as useMemo12 } from "react";
|
|
6577
6622
|
var tableBodyController = (props) => {
|
|
6578
6623
|
const {
|
|
@@ -6585,7 +6630,7 @@ var tableBodyController = (props) => {
|
|
|
6585
6630
|
selectedRowKeysRef,
|
|
6586
6631
|
onClickRow
|
|
6587
6632
|
} = props;
|
|
6588
|
-
const appDispatch =
|
|
6633
|
+
const appDispatch = useAppDispatch6();
|
|
6589
6634
|
const checked = useMemo12(() => {
|
|
6590
6635
|
if (!row?.id) return false;
|
|
6591
6636
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6640,14 +6685,14 @@ var tableBodyController = (props) => {
|
|
|
6640
6685
|
|
|
6641
6686
|
// src/widget/advance/table/table-head/controller.ts
|
|
6642
6687
|
import {
|
|
6643
|
-
useAppDispatch as
|
|
6688
|
+
useAppDispatch as useAppDispatch7,
|
|
6644
6689
|
useAppSelector as useAppSelector4,
|
|
6645
6690
|
selectSearch as selectSearch3,
|
|
6646
6691
|
setSelectedRowKeys as setSelectedRowKeys2
|
|
6647
6692
|
} from "@fctc/interface-logic/store";
|
|
6648
6693
|
var tableHeadController = (props) => {
|
|
6649
6694
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6650
|
-
const appDispatch =
|
|
6695
|
+
const appDispatch = useAppDispatch7();
|
|
6651
6696
|
const { groupByDomain } = useAppSelector4(selectSearch3);
|
|
6652
6697
|
const handleCheckBoxAll = (event) => {
|
|
6653
6698
|
if (event?.target?.checked && typeTable === "list") {
|
|
@@ -6773,7 +6818,7 @@ import {
|
|
|
6773
6818
|
useAppSelector as useAppSelector6,
|
|
6774
6819
|
selectSearch as selectSearch5,
|
|
6775
6820
|
selectList as selectList4,
|
|
6776
|
-
useAppDispatch as
|
|
6821
|
+
useAppDispatch as useAppDispatch8,
|
|
6777
6822
|
setSelectedRowKeys as setSelectedRowKeys3
|
|
6778
6823
|
} from "@fctc/interface-logic/store";
|
|
6779
6824
|
|
|
@@ -6806,7 +6851,7 @@ var tableGroupController = (props) => {
|
|
|
6806
6851
|
const [pageGroup, setPageGroup] = useState14(0);
|
|
6807
6852
|
const { groupByDomain, selectedTags } = useAppSelector6(selectSearch5);
|
|
6808
6853
|
const { selectedRowKeys } = useAppSelector6(selectList4);
|
|
6809
|
-
const appDispatch =
|
|
6854
|
+
const appDispatch = useAppDispatch8();
|
|
6810
6855
|
const { toDataJS } = useOdooDataTransform();
|
|
6811
6856
|
const initVal = toDataJS(row, viewData, model);
|
|
6812
6857
|
const [isShowGroup, setIsShowGroup] = useState14(false);
|
|
@@ -6947,7 +6992,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
6947
6992
|
import { SearchType } from "@fctc/interface-logic/constants";
|
|
6948
6993
|
import {
|
|
6949
6994
|
domainHelper as domainHelper2,
|
|
6950
|
-
evalJSONDomain as
|
|
6995
|
+
evalJSONDomain as evalJSONDomain6,
|
|
6951
6996
|
validateAndParseDate
|
|
6952
6997
|
} from "@fctc/interface-logic/utils";
|
|
6953
6998
|
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
@@ -6964,7 +7009,7 @@ var searchController = ({
|
|
|
6964
7009
|
const [groupBy, setGroupBy] = useState15(null);
|
|
6965
7010
|
const [selectedTags, setSelectedTags] = useState15(null);
|
|
6966
7011
|
const [searchString, setSearchString] = useState15("");
|
|
6967
|
-
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] :
|
|
7012
|
+
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : evalJSONDomain6(actionData?.domain, contextSearch) : [];
|
|
6968
7013
|
const aid = actionData?.id;
|
|
6969
7014
|
const model = actionData?.res_model;
|
|
6970
7015
|
const clearSearch = () => {
|