@fctc/widget-logic 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +159 -149
- package/dist/index.mjs +161 -142
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/widget.d.mts +19 -58
- package/dist/widget.d.ts +19 -58
- package/dist/widget.js +159 -149
- package/dist/widget.mjs +161 -142
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -4972,7 +4972,6 @@ var many2oneFieldController = (props) => {
|
|
|
4972
4972
|
options: fieldOptions,
|
|
4973
4973
|
showDetail
|
|
4974
4974
|
} = props;
|
|
4975
|
-
const { env } = (0, provider_exports.useEnv)();
|
|
4976
4975
|
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
4977
4976
|
const [inputValue, setInputValue] = (0, import_react14.useState)("");
|
|
4978
4977
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
@@ -4982,14 +4981,15 @@ var many2oneFieldController = (props) => {
|
|
|
4982
4981
|
const [domainObject, setDomainObject] = (0, import_react14.useState)(null);
|
|
4983
4982
|
const actionData = sessionStorageUtils.getActionData();
|
|
4984
4983
|
const { menuList } = (0, store_exports.useAppSelector)(store_exports.selectNavbar);
|
|
4984
|
+
const { context } = (0, store_exports.useAppSelector)(store_exports.selectEnv);
|
|
4985
4985
|
const initValue = methods?.getValues(name);
|
|
4986
4986
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
4987
4987
|
const contextObject = {
|
|
4988
4988
|
...(0, utils_exports.evalJSONContext)(actionData?.context) || {},
|
|
4989
4989
|
...fieldContext,
|
|
4990
|
-
...
|
|
4990
|
+
...context
|
|
4991
4991
|
};
|
|
4992
|
-
const { useGetSelection:
|
|
4992
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
4993
4993
|
const data = {
|
|
4994
4994
|
model: relation,
|
|
4995
4995
|
domain: domainObject,
|
|
@@ -5005,7 +5005,7 @@ var many2oneFieldController = (props) => {
|
|
|
5005
5005
|
data: dataOfSelection,
|
|
5006
5006
|
refetch,
|
|
5007
5007
|
isFetching
|
|
5008
|
-
} =
|
|
5008
|
+
} = useGetSelection2({
|
|
5009
5009
|
data,
|
|
5010
5010
|
queryKey,
|
|
5011
5011
|
enabled: false
|
|
@@ -5159,49 +5159,52 @@ var many2oneButtonController = (props) => {
|
|
|
5159
5159
|
|
|
5160
5160
|
// src/widget/basic/many2many-field/controller.ts
|
|
5161
5161
|
var import_react15 = require("react");
|
|
5162
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
5162
5163
|
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
5163
5164
|
var many2manyFieldController = (props) => {
|
|
5164
5165
|
const {
|
|
5165
5166
|
relation,
|
|
5166
5167
|
domain,
|
|
5167
5168
|
context,
|
|
5168
|
-
options,
|
|
5169
5169
|
tab,
|
|
5170
|
+
model,
|
|
5171
|
+
aid,
|
|
5170
5172
|
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5173
|
+
fields,
|
|
5174
|
+
setFields,
|
|
5171
5175
|
groupByDomain,
|
|
5172
|
-
|
|
5173
|
-
|
|
5176
|
+
page,
|
|
5177
|
+
options,
|
|
5178
|
+
sessionStorageUtils
|
|
5174
5179
|
} = props;
|
|
5180
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
5181
|
+
const actionData = sessionStorageUtils.getActionData();
|
|
5182
|
+
const [debouncedPage] = useDebounce(page, 500);
|
|
5183
|
+
const [order, setOrder] = (0, import_react15.useState)();
|
|
5184
|
+
const [isLoadedData, setIsLoadedData] = (0, import_react15.useState)(false);
|
|
5185
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(domain);
|
|
5175
5186
|
const { env } = (0, provider_exports.useEnv)();
|
|
5176
5187
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5177
|
-
const [order, setOrder] = (0, import_react15.useState)();
|
|
5178
|
-
const [page, setPage] = (0, import_react15.useState)(0);
|
|
5179
|
-
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(null);
|
|
5180
|
-
const [debouncedPage] = useDebounce(page, 500);
|
|
5181
|
-
const contextObject = {
|
|
5182
|
-
...env.context,
|
|
5183
|
-
...context || {}
|
|
5184
|
-
};
|
|
5185
5188
|
const viewParams = {
|
|
5186
5189
|
model: relation,
|
|
5187
5190
|
views: [
|
|
5188
5191
|
[false, "list"],
|
|
5189
5192
|
[false, "search"]
|
|
5190
5193
|
],
|
|
5191
|
-
context
|
|
5194
|
+
context
|
|
5192
5195
|
};
|
|
5193
|
-
const { data: viewResponse } = useGetView2(viewParams,
|
|
5196
|
+
const { data: viewResponse } = useGetView2(viewParams, actionData);
|
|
5194
5197
|
const baseModel = (0, import_react15.useMemo)(
|
|
5195
5198
|
() => ({
|
|
5196
5199
|
name: String(relation),
|
|
5197
5200
|
view: viewResponse || {},
|
|
5198
|
-
actContext:
|
|
5201
|
+
actContext: context,
|
|
5199
5202
|
fields: [
|
|
5200
5203
|
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5201
5204
|
...tab?.fields ? tab.fields : []
|
|
5202
5205
|
]
|
|
5203
5206
|
}),
|
|
5204
|
-
[
|
|
5207
|
+
[model, viewResponse]
|
|
5205
5208
|
);
|
|
5206
5209
|
const initModel = (0, hooks_exports.useModel)();
|
|
5207
5210
|
const modelInstance = (0, import_react15.useMemo)(() => {
|
|
@@ -5220,15 +5223,26 @@ var many2manyFieldController = (props) => {
|
|
|
5220
5223
|
const optionsObject = tab?.options ? (0, import_utils6.evalJSONContext)(tab?.options) : (options ? (0, import_utils6.evalJSONContext)(options) : {}) || {};
|
|
5221
5224
|
const fetchData = async () => {
|
|
5222
5225
|
try {
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
+
setDomainMany2Many(domain);
|
|
5227
|
+
appDispatch((0, import_store8.setFirstDomain)(domain));
|
|
5228
|
+
appDispatch((0, import_store8.setViewDataStore)(viewResponse));
|
|
5229
|
+
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
5230
|
+
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
5231
|
+
...field
|
|
5232
|
+
}));
|
|
5233
|
+
if (!fields?.[`${aid}_${relation}_popupmany2many`] && modalData) {
|
|
5234
|
+
setFields({
|
|
5235
|
+
...fields,
|
|
5236
|
+
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
5237
|
+
});
|
|
5238
|
+
}
|
|
5239
|
+
appDispatch((0, import_store8.setPage)(0));
|
|
5226
5240
|
} catch (err) {
|
|
5227
5241
|
console.log(err);
|
|
5228
5242
|
}
|
|
5229
5243
|
};
|
|
5230
5244
|
const queryKey = [
|
|
5231
|
-
`view-${relation}`,
|
|
5245
|
+
`view-${relation}-${aid}`,
|
|
5232
5246
|
specification,
|
|
5233
5247
|
domainMany2Many,
|
|
5234
5248
|
debouncedPage,
|
|
@@ -5241,16 +5255,16 @@ var many2manyFieldController = (props) => {
|
|
|
5241
5255
|
domain: domainMany2Many,
|
|
5242
5256
|
offset: debouncedPage * 10,
|
|
5243
5257
|
limit: 10,
|
|
5244
|
-
context
|
|
5258
|
+
context,
|
|
5245
5259
|
fields: groupByDomain?.fields,
|
|
5246
5260
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5247
5261
|
sort: order ? order : default_order ? (0, import_utils6.formatSortingString)(default_order) : ""
|
|
5248
5262
|
};
|
|
5249
|
-
const enabled =
|
|
5263
|
+
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5250
5264
|
const {
|
|
5251
5265
|
data: dataResponse,
|
|
5252
|
-
isLoading,
|
|
5253
|
-
isFetched,
|
|
5266
|
+
isLoading: isDataLoading,
|
|
5267
|
+
isFetched: isDataResponseFetched,
|
|
5254
5268
|
isPlaceholderData
|
|
5255
5269
|
} = useGetListData3(data, queryKey, enabled);
|
|
5256
5270
|
(0, import_react15.useEffect)(() => {
|
|
@@ -5258,58 +5272,73 @@ var many2manyFieldController = (props) => {
|
|
|
5258
5272
|
fetchData();
|
|
5259
5273
|
}
|
|
5260
5274
|
return () => {
|
|
5261
|
-
|
|
5275
|
+
appDispatch((0, import_store8.setGroupByDomain)(null));
|
|
5276
|
+
setFields((prevFields) => ({
|
|
5277
|
+
...prevFields,
|
|
5278
|
+
[`${aid}_${relation}_popupmany2many`]: null
|
|
5279
|
+
}));
|
|
5280
|
+
appDispatch((0, import_store8.setPage)(0));
|
|
5262
5281
|
setSelectedRowKeys4([]);
|
|
5263
5282
|
setDomainMany2Many(null);
|
|
5283
|
+
setIsLoadedData(false);
|
|
5264
5284
|
};
|
|
5265
5285
|
}, [viewResponse]);
|
|
5266
|
-
const { rows, columns, typeTable
|
|
5286
|
+
const { rows, columns, typeTable } = tableController({
|
|
5267
5287
|
data: {
|
|
5268
|
-
fields: viewResponse?.views?.list?.fields,
|
|
5288
|
+
fields: fields?.[`${aid}_${relation}_popupmany2many`] || viewResponse?.views?.list?.fields,
|
|
5269
5289
|
records: dataResponse?.records ?? dataResponse?.groups,
|
|
5270
5290
|
dataModel: viewResponse?.models?.[String(relation)],
|
|
5271
|
-
context:
|
|
5291
|
+
context: { ...env.context, ...context },
|
|
5272
5292
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
5273
5293
|
}
|
|
5274
5294
|
});
|
|
5275
|
-
const
|
|
5276
|
-
|
|
5277
|
-
model: relation
|
|
5278
|
-
context
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5295
|
+
const dataFormView = {
|
|
5296
|
+
id: null,
|
|
5297
|
+
model: relation,
|
|
5298
|
+
context
|
|
5299
|
+
};
|
|
5300
|
+
const {
|
|
5301
|
+
refetch,
|
|
5302
|
+
data: dataFormViewResponse,
|
|
5303
|
+
isSuccess
|
|
5304
|
+
} = useGetFormView({
|
|
5305
|
+
data: dataFormView,
|
|
5306
|
+
queryKey: [`form-view-action-${relation}`],
|
|
5307
|
+
enabled: false
|
|
5285
5308
|
});
|
|
5309
|
+
(0, import_react15.useEffect)(() => {
|
|
5310
|
+
if (isSuccess && dataFormViewResponse) {
|
|
5311
|
+
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5312
|
+
window.location.href = `/form/menu?model=${relation}`;
|
|
5313
|
+
}
|
|
5314
|
+
}, [isSuccess]);
|
|
5315
|
+
(0, import_react15.useEffect)(() => {
|
|
5316
|
+
if (domainMany2Many && !isLoadedData) {
|
|
5317
|
+
setIsLoadedData(true);
|
|
5318
|
+
}
|
|
5319
|
+
}, [domainMany2Many]);
|
|
5286
5320
|
const handleCreateNewOnPage = async () => {
|
|
5321
|
+
try {
|
|
5322
|
+
refetch();
|
|
5323
|
+
} catch (error) {
|
|
5324
|
+
console.log(error);
|
|
5325
|
+
}
|
|
5287
5326
|
};
|
|
5288
5327
|
return {
|
|
5289
5328
|
handleCreateNewOnPage,
|
|
5290
5329
|
optionsObject,
|
|
5291
|
-
totalRows: dataResponse?.length ?? 0,
|
|
5292
5330
|
rows,
|
|
5293
5331
|
columns,
|
|
5294
|
-
onToggleColumnOptional,
|
|
5295
5332
|
typeTable,
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
isPlaceholderData
|
|
5299
|
-
setPage,
|
|
5300
|
-
page,
|
|
5301
|
-
viewData: viewResponse,
|
|
5302
|
-
domain: domainMany2Many,
|
|
5303
|
-
setDomain: setDomainMany2Many,
|
|
5304
|
-
searchController: searchControllers
|
|
5333
|
+
isDataLoading,
|
|
5334
|
+
isDataResponseFetched,
|
|
5335
|
+
isPlaceholderData
|
|
5305
5336
|
};
|
|
5306
5337
|
};
|
|
5307
5338
|
|
|
5308
5339
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5309
5340
|
var import_react16 = require("react");
|
|
5310
5341
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5311
|
-
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
5312
|
-
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5313
5342
|
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5314
5343
|
var many2manyTagsController = (props) => {
|
|
5315
5344
|
const {
|
|
@@ -5321,7 +5350,8 @@ var many2manyTagsController = (props) => {
|
|
|
5321
5350
|
placeholderNoOption
|
|
5322
5351
|
} = props;
|
|
5323
5352
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5324
|
-
const env = (0,
|
|
5353
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5354
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5325
5355
|
const addtionalFields = optionsFields ? (0, import_utils7.evalJSONContext)(optionsFields) : null;
|
|
5326
5356
|
const domainObject = (0, import_react16.useMemo)(
|
|
5327
5357
|
() => (0, import_utils7.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
@@ -5340,7 +5370,7 @@ var many2manyTagsController = (props) => {
|
|
|
5340
5370
|
enabled: true,
|
|
5341
5371
|
context: env.context
|
|
5342
5372
|
};
|
|
5343
|
-
const { data: dataOfSelection } = (
|
|
5373
|
+
const { data: dataOfSelection } = useGetSelection2({
|
|
5344
5374
|
data,
|
|
5345
5375
|
queryKey: [`data_${relation}`, domainObject]
|
|
5346
5376
|
});
|
|
@@ -5360,7 +5390,6 @@ var many2manyTagsController = (props) => {
|
|
|
5360
5390
|
options,
|
|
5361
5391
|
customNoOptionsMessage,
|
|
5362
5392
|
tranfer,
|
|
5363
|
-
dataOfSelection,
|
|
5364
5393
|
isUser
|
|
5365
5394
|
};
|
|
5366
5395
|
};
|
|
@@ -5369,7 +5398,7 @@ var many2manyTagsController = (props) => {
|
|
|
5369
5398
|
var import_react17 = require("react");
|
|
5370
5399
|
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5371
5400
|
var durationController = (props) => {
|
|
5372
|
-
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5401
|
+
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5373
5402
|
const specification = {
|
|
5374
5403
|
id: 0,
|
|
5375
5404
|
name: "",
|
|
@@ -5393,7 +5422,11 @@ var durationController = (props) => {
|
|
|
5393
5422
|
},
|
|
5394
5423
|
sort: ""
|
|
5395
5424
|
};
|
|
5396
|
-
const { data: dataResponse } = useGetListData3(
|
|
5425
|
+
const { data: dataResponse } = useGetListData3(
|
|
5426
|
+
listDataProps,
|
|
5427
|
+
queryKey,
|
|
5428
|
+
enabled
|
|
5429
|
+
);
|
|
5397
5430
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5398
5431
|
const handleClick = async (stage_id) => {
|
|
5399
5432
|
setDisabled(true);
|
|
@@ -5429,32 +5462,18 @@ var durationController = (props) => {
|
|
|
5429
5462
|
};
|
|
5430
5463
|
|
|
5431
5464
|
// src/widget/basic/priority-field/controller.ts
|
|
5432
|
-
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
5433
5465
|
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5434
5466
|
var priorityFieldController = (props) => {
|
|
5435
|
-
const {
|
|
5436
|
-
value,
|
|
5437
|
-
isForm,
|
|
5438
|
-
name,
|
|
5439
|
-
methods,
|
|
5440
|
-
onChange,
|
|
5441
|
-
model,
|
|
5442
|
-
selection,
|
|
5443
|
-
id,
|
|
5444
|
-
actionData,
|
|
5445
|
-
viewData,
|
|
5446
|
-
context
|
|
5447
|
-
} = props;
|
|
5467
|
+
const { name, model, id, actionData, context, onChange } = props;
|
|
5448
5468
|
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5449
5469
|
const contextObject = { ...context, ..._context };
|
|
5450
|
-
const
|
|
5451
|
-
const
|
|
5452
|
-
const { mutateAsync: fetchSave } = (0, import_hooks15.useSave)();
|
|
5470
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
5471
|
+
const { mutateAsync: fetchSave } = useSave2();
|
|
5453
5472
|
const savePriorities = async ({
|
|
5454
|
-
value
|
|
5473
|
+
value,
|
|
5455
5474
|
resetPriority
|
|
5456
5475
|
}) => {
|
|
5457
|
-
const priorityValue =
|
|
5476
|
+
const priorityValue = value <= 0 ? 0 : value - 1;
|
|
5458
5477
|
try {
|
|
5459
5478
|
fetchSave({
|
|
5460
5479
|
ids: id ? [id] : [],
|
|
@@ -5472,14 +5491,7 @@ var priorityFieldController = (props) => {
|
|
|
5472
5491
|
}
|
|
5473
5492
|
};
|
|
5474
5493
|
return {
|
|
5475
|
-
|
|
5476
|
-
isForm,
|
|
5477
|
-
methods,
|
|
5478
|
-
defaultPriority,
|
|
5479
|
-
savePriorities,
|
|
5480
|
-
label,
|
|
5481
|
-
id,
|
|
5482
|
-
onChange
|
|
5494
|
+
savePriorities
|
|
5483
5495
|
};
|
|
5484
5496
|
};
|
|
5485
5497
|
|
|
@@ -6442,11 +6454,11 @@ var import_utils11 = require("@fctc/interface-logic/utils");
|
|
|
6442
6454
|
var colorFieldController = (props) => {
|
|
6443
6455
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6444
6456
|
const { env } = (0, provider_exports.useEnv)();
|
|
6445
|
-
const { useSave:
|
|
6457
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
6446
6458
|
const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) || {} };
|
|
6447
6459
|
const contextObject = { ...env.context, ..._context };
|
|
6448
6460
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6449
|
-
const { mutate: onSave } =
|
|
6461
|
+
const { mutate: onSave } = useSave2();
|
|
6450
6462
|
const savePickColor = async (colorObject) => {
|
|
6451
6463
|
const { id } = colorObject;
|
|
6452
6464
|
if (value === id) return;
|
|
@@ -6569,20 +6581,20 @@ var binaryFieldController = (props) => {
|
|
|
6569
6581
|
};
|
|
6570
6582
|
|
|
6571
6583
|
// src/widget/advance/table/table-body/controller.ts
|
|
6572
|
-
var
|
|
6584
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6573
6585
|
var import_react21 = require("react");
|
|
6574
6586
|
var tableBodyController = (props) => {
|
|
6575
6587
|
const {
|
|
6576
6588
|
checkedAll,
|
|
6577
6589
|
checkboxRef,
|
|
6578
6590
|
setIsAutoSelect,
|
|
6579
|
-
selectedRowKeys,
|
|
6580
6591
|
row,
|
|
6581
6592
|
isAutoSelect,
|
|
6582
6593
|
selectedRowKeysRef,
|
|
6583
6594
|
onClickRow
|
|
6584
6595
|
} = props;
|
|
6585
|
-
const appDispatch = (0,
|
|
6596
|
+
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
6597
|
+
const { selectedRowKeys } = (0, import_store9.useAppSelector)(import_store9.selectList);
|
|
6586
6598
|
const checked = (0, import_react21.useMemo)(() => {
|
|
6587
6599
|
if (!row?.id) return false;
|
|
6588
6600
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6598,8 +6610,7 @@ var tableBodyController = (props) => {
|
|
|
6598
6610
|
return;
|
|
6599
6611
|
}
|
|
6600
6612
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6601
|
-
|
|
6602
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6613
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6603
6614
|
};
|
|
6604
6615
|
const handleClickRow = (col, row2) => {
|
|
6605
6616
|
onClickRow(col, row2);
|
|
@@ -6612,13 +6623,13 @@ var tableBodyController = (props) => {
|
|
|
6612
6623
|
(id) => id !== row.id
|
|
6613
6624
|
);
|
|
6614
6625
|
selectedRowKeysRef.current = filtered;
|
|
6615
|
-
appDispatch((0,
|
|
6626
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(filtered));
|
|
6616
6627
|
} else {
|
|
6617
6628
|
const unique = Array.from(
|
|
6618
6629
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6619
6630
|
);
|
|
6620
6631
|
selectedRowKeysRef.current = unique;
|
|
6621
|
-
appDispatch((0,
|
|
6632
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(unique));
|
|
6622
6633
|
}
|
|
6623
6634
|
}
|
|
6624
6635
|
}, [isAutoSelect]);
|
|
@@ -6636,35 +6647,35 @@ var tableBodyController = (props) => {
|
|
|
6636
6647
|
};
|
|
6637
6648
|
|
|
6638
6649
|
// src/widget/advance/table/table-head/controller.ts
|
|
6639
|
-
var
|
|
6650
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6640
6651
|
var tableHeadController = (props) => {
|
|
6641
6652
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6642
|
-
const appDispatch = (0,
|
|
6643
|
-
const { groupByDomain } = (0,
|
|
6653
|
+
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
6654
|
+
const { groupByDomain } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
6644
6655
|
const handleCheckBoxAll = (event) => {
|
|
6645
6656
|
if (event?.target?.checked && typeTable === "list") {
|
|
6646
6657
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6647
|
-
appDispatch((0,
|
|
6658
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(allRowKeys));
|
|
6648
6659
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6649
6660
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6650
6661
|
const ids = Array.from(rowsIDs)?.map(
|
|
6651
6662
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6652
6663
|
);
|
|
6653
6664
|
if (ids?.length > 0) {
|
|
6654
|
-
appDispatch((0,
|
|
6665
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(ids));
|
|
6655
6666
|
} else {
|
|
6656
6667
|
const sum = countSum(
|
|
6657
6668
|
rows,
|
|
6658
6669
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6659
6670
|
);
|
|
6660
6671
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6661
|
-
appDispatch((0,
|
|
6672
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(keys));
|
|
6662
6673
|
}
|
|
6663
6674
|
if (selectedRowKeysRef) {
|
|
6664
6675
|
selectedRowKeysRef.current = [];
|
|
6665
6676
|
}
|
|
6666
6677
|
} else {
|
|
6667
|
-
appDispatch((0,
|
|
6678
|
+
appDispatch((0, import_store10.setSelectedRowKeys)([]));
|
|
6668
6679
|
}
|
|
6669
6680
|
};
|
|
6670
6681
|
return {
|
|
@@ -6674,7 +6685,7 @@ var tableHeadController = (props) => {
|
|
|
6674
6685
|
|
|
6675
6686
|
// src/widget/advance/table/table-view/controller.ts
|
|
6676
6687
|
var import_react22 = require("react");
|
|
6677
|
-
var
|
|
6688
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
6678
6689
|
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6679
6690
|
var tableController = ({ data }) => {
|
|
6680
6691
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
@@ -6753,8 +6764,8 @@ var tableController = ({ data }) => {
|
|
|
6753
6764
|
|
|
6754
6765
|
// src/widget/advance/table/table-group/controller.ts
|
|
6755
6766
|
var import_react23 = require("react");
|
|
6756
|
-
var
|
|
6757
|
-
var
|
|
6767
|
+
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
6768
|
+
var import_store12 = require("@fctc/interface-logic/store");
|
|
6758
6769
|
|
|
6759
6770
|
// src/environment.ts
|
|
6760
6771
|
var environment_exports = {};
|
|
@@ -6782,10 +6793,10 @@ var tableGroupController = (props) => {
|
|
|
6782
6793
|
selectedRowKeysRef
|
|
6783
6794
|
} = props;
|
|
6784
6795
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
6785
|
-
const { groupByDomain, selectedTags } = (0,
|
|
6786
|
-
const { selectedRowKeys } = (0,
|
|
6787
|
-
const appDispatch = (0,
|
|
6788
|
-
const { toDataJS } = (0,
|
|
6796
|
+
const { groupByDomain, selectedTags } = (0, import_store12.useAppSelector)(import_store12.selectSearch);
|
|
6797
|
+
const { selectedRowKeys } = (0, import_store12.useAppSelector)(import_store12.selectList);
|
|
6798
|
+
const appDispatch = (0, import_store12.useAppDispatch)();
|
|
6799
|
+
const { toDataJS } = (0, import_hooks14.useOdooDataTransform)();
|
|
6789
6800
|
const initVal = toDataJS(row, viewData, model);
|
|
6790
6801
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
6791
6802
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -6832,7 +6843,7 @@ var tableGroupController = (props) => {
|
|
|
6832
6843
|
isPlaceholderData,
|
|
6833
6844
|
isLoading,
|
|
6834
6845
|
isFetching
|
|
6835
|
-
} = (0,
|
|
6846
|
+
} = (0, import_hooks14.useGetListData)(listDataProps, queryKey, enabled);
|
|
6836
6847
|
const {
|
|
6837
6848
|
columns: columnsGroup,
|
|
6838
6849
|
rows: rowsGroup,
|
|
@@ -6870,14 +6881,14 @@ var tableGroupController = (props) => {
|
|
|
6870
6881
|
const filteredIds = selectedRowKeys.filter(
|
|
6871
6882
|
(id) => !ids.includes(id)
|
|
6872
6883
|
);
|
|
6873
|
-
appDispatch((0,
|
|
6884
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredIds));
|
|
6874
6885
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6875
6886
|
const clonedKeys = [...selectedRowKeys];
|
|
6876
|
-
appDispatch((0,
|
|
6877
|
-
setTimeout(() => appDispatch((0,
|
|
6887
|
+
appDispatch((0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6888
|
+
setTimeout(() => appDispatch((0, import_store12.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6878
6889
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6879
6890
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6880
|
-
appDispatch((0,
|
|
6891
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredKeys));
|
|
6881
6892
|
}
|
|
6882
6893
|
toggleShowGroup();
|
|
6883
6894
|
};
|
|
@@ -6886,8 +6897,8 @@ var tableGroupController = (props) => {
|
|
|
6886
6897
|
return;
|
|
6887
6898
|
}
|
|
6888
6899
|
const clonedKeys = [...selectedRowKeys];
|
|
6889
|
-
(0,
|
|
6890
|
-
setTimeout(() => (0,
|
|
6900
|
+
(0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6901
|
+
setTimeout(() => (0, import_store12.setSelectedRowKeys)(clonedKeys), 500);
|
|
6891
6902
|
}, [isQueryFetched]);
|
|
6892
6903
|
return {
|
|
6893
6904
|
handleExpandChildGroup,
|
|
@@ -6927,21 +6938,20 @@ var import_moment2 = __toESM(require_moment());
|
|
|
6927
6938
|
var import_react24 = require("react");
|
|
6928
6939
|
var searchController = ({
|
|
6929
6940
|
viewData,
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6941
|
+
actionData,
|
|
6942
|
+
fieldsList,
|
|
6943
|
+
contextSearch,
|
|
6944
|
+
setSearchMap,
|
|
6945
|
+
searchMap
|
|
6934
6946
|
}) => {
|
|
6935
|
-
const { env } = (0, provider_exports.useEnv)();
|
|
6936
6947
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
6937
6948
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
6938
6949
|
const [groupBy, setGroupBy] = (0, import_react24.useState)(null);
|
|
6939
6950
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
6940
6951
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
6941
|
-
const [
|
|
6942
|
-
const
|
|
6943
|
-
const
|
|
6944
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
6952
|
+
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils14.evalJSONDomain)(actionData?.domain, contextSearch) : [];
|
|
6953
|
+
const aid = actionData?.id;
|
|
6954
|
+
const model = actionData?.res_model;
|
|
6945
6955
|
const clearSearch = () => {
|
|
6946
6956
|
setFilterBy([]);
|
|
6947
6957
|
setGroupBy([]);
|
|
@@ -6986,8 +6996,9 @@ var searchController = ({
|
|
|
6986
6996
|
}
|
|
6987
6997
|
};
|
|
6988
6998
|
(0, import_react24.useEffect)(() => {
|
|
6999
|
+
clearSearch();
|
|
6989
7000
|
fetchData();
|
|
6990
|
-
}, [model, viewData]);
|
|
7001
|
+
}, [aid, model, viewData]);
|
|
6991
7002
|
const onChangeSearchInput = (search_string) => {
|
|
6992
7003
|
setSearchString(search_string);
|
|
6993
7004
|
};
|
|
@@ -7024,28 +7035,27 @@ var searchController = ({
|
|
|
7024
7035
|
};
|
|
7025
7036
|
const formatDomain = () => {
|
|
7026
7037
|
if (domainAction) {
|
|
7027
|
-
|
|
7028
|
-
const domain2 = [];
|
|
7038
|
+
const domain = [];
|
|
7029
7039
|
if (domainAction?.length > 0) {
|
|
7030
7040
|
if (Object.keys(searchMap).length > 0) {
|
|
7031
|
-
|
|
7041
|
+
domain.push("&");
|
|
7032
7042
|
}
|
|
7033
7043
|
domainAction.forEach((domainItem) => {
|
|
7034
|
-
|
|
7044
|
+
domain.push(domainItem);
|
|
7035
7045
|
});
|
|
7036
7046
|
}
|
|
7037
7047
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7038
7048
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7039
7049
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7040
|
-
|
|
7050
|
+
domain.push("&");
|
|
7041
7051
|
}
|
|
7042
7052
|
const valuesOfKey = searchMap[key];
|
|
7043
7053
|
valuesOfKey.forEach((value, index) => {
|
|
7044
7054
|
if (index < valuesOfKey.length - 1) {
|
|
7045
|
-
|
|
7055
|
+
domain.push("|");
|
|
7046
7056
|
}
|
|
7047
7057
|
if (value.domain) {
|
|
7048
|
-
|
|
7058
|
+
domain.push(...value.domain);
|
|
7049
7059
|
return;
|
|
7050
7060
|
}
|
|
7051
7061
|
let valueDomainItem = value?.value;
|
|
@@ -7061,11 +7071,11 @@ var searchController = ({
|
|
|
7061
7071
|
}
|
|
7062
7072
|
}
|
|
7063
7073
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7064
|
-
|
|
7074
|
+
domain.push([value.name, operator, valueDomainItem]);
|
|
7065
7075
|
});
|
|
7066
7076
|
}
|
|
7067
7077
|
});
|
|
7068
|
-
return [...
|
|
7078
|
+
return [...domain];
|
|
7069
7079
|
}
|
|
7070
7080
|
};
|
|
7071
7081
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7096,16 +7106,16 @@ var searchController = ({
|
|
|
7096
7106
|
const contexts = [];
|
|
7097
7107
|
let groupValues = [];
|
|
7098
7108
|
objValues?.forEach((objValue) => {
|
|
7099
|
-
const { context
|
|
7109
|
+
const { context, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7100
7110
|
const indexAppend = groupIndex2 != null ? groupIndex2 : viewData?.views?.search?.filters_by?.length ?? 0;
|
|
7101
7111
|
contexts.push(
|
|
7102
|
-
...Array.isArray(
|
|
7112
|
+
...Array.isArray(context?.group_by) ? context.group_by.map((item) => ({ group_by: item })) : [context]
|
|
7103
7113
|
);
|
|
7104
7114
|
groupValues[indexAppend] = {
|
|
7105
7115
|
contexts: [
|
|
7106
|
-
...Array.isArray(
|
|
7116
|
+
...Array.isArray(context?.group_by) ? context.group_by.map((item) => ({
|
|
7107
7117
|
group_by: item
|
|
7108
|
-
})) : [
|
|
7118
|
+
})) : [context]
|
|
7109
7119
|
],
|
|
7110
7120
|
strings: isDefault ? [value] : [...groupValues[indexAppend]?.strings ?? [], value]
|
|
7111
7121
|
};
|
|
@@ -7132,38 +7142,39 @@ var searchController = ({
|
|
|
7132
7142
|
[searchMap]
|
|
7133
7143
|
);
|
|
7134
7144
|
(0, import_react24.useEffect)(() => {
|
|
7145
|
+
setSelectedTags(null);
|
|
7135
7146
|
setTagSearch(searchMap);
|
|
7136
7147
|
}, [searchMap]);
|
|
7137
7148
|
const handleAddTagSearch = (tag) => {
|
|
7138
7149
|
const {
|
|
7139
|
-
domain
|
|
7150
|
+
domain,
|
|
7140
7151
|
groupIndex,
|
|
7141
7152
|
value,
|
|
7142
7153
|
type,
|
|
7143
7154
|
title,
|
|
7144
|
-
context
|
|
7155
|
+
context,
|
|
7145
7156
|
active,
|
|
7146
7157
|
dataIndex
|
|
7147
7158
|
} = tag;
|
|
7148
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7159
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain);
|
|
7149
7160
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7150
7161
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7151
7162
|
...tag,
|
|
7152
|
-
domain:
|
|
7163
|
+
domain: domain ? domainFormat.toList(context) : null
|
|
7153
7164
|
});
|
|
7154
7165
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7155
7166
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7156
7167
|
...tag,
|
|
7157
|
-
domain:
|
|
7158
|
-
...
|
|
7168
|
+
domain: domain ? domainFormat.toList({
|
|
7169
|
+
...context,
|
|
7159
7170
|
self: value
|
|
7160
7171
|
}) : null
|
|
7161
7172
|
});
|
|
7162
7173
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7163
7174
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7164
7175
|
...tag,
|
|
7165
|
-
domain:
|
|
7166
|
-
context
|
|
7176
|
+
domain: domain ? domainFormat.toList({
|
|
7177
|
+
context,
|
|
7167
7178
|
self: value
|
|
7168
7179
|
}) : null
|
|
7169
7180
|
});
|
|
@@ -7183,8 +7194,7 @@ var searchController = ({
|
|
|
7183
7194
|
removeSearchItems,
|
|
7184
7195
|
onSearchString: onChangeSearchInput,
|
|
7185
7196
|
handleAddTagSearch,
|
|
7186
|
-
domain: formatDomain()
|
|
7187
|
-
context: contextSearch
|
|
7197
|
+
domain: formatDomain()
|
|
7188
7198
|
};
|
|
7189
7199
|
};
|
|
7190
7200
|
// Annotate the CommonJS export names for ESM import in node:
|