@fctc/widget-logic 1.7.9 → 1.8.1
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 +0 -1
- package/dist/hooks.mjs +0 -1
- package/dist/icons.d.mts +17 -1
- package/dist/icons.d.ts +17 -1
- package/dist/icons.js +136 -2
- package/dist/icons.mjs +130 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +559 -93
- package/dist/index.mjs +540 -69
- package/dist/widget.d.mts +17 -2
- package/dist/widget.d.ts +17 -2
- package/dist/widget.js +425 -81
- package/dist/widget.mjs +405 -55
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4038,10 +4038,15 @@ __export(index_exports, {
|
|
|
4038
4038
|
API_APP_URL: () => API_APP_URL,
|
|
4039
4039
|
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4040
4040
|
AppProvider: () => AppProvider,
|
|
4041
|
+
CheckIcon: () => CheckIcon,
|
|
4042
|
+
ChevronBottomIcon: () => ChevronBottomIcon,
|
|
4041
4043
|
CloseIcon: () => CloseIcon,
|
|
4042
4044
|
EyeIcon: () => EyeIcon,
|
|
4045
|
+
FilterIcon: () => FilterIcon,
|
|
4046
|
+
GroupByIcon: () => GroupByIcon,
|
|
4043
4047
|
LoadingIcon: () => LoadingIcon,
|
|
4044
4048
|
STORAGES: () => STORAGES,
|
|
4049
|
+
SearchIcon: () => SearchIcon,
|
|
4045
4050
|
binaryFieldController: () => binaryFieldController,
|
|
4046
4051
|
colorFieldController: () => colorFieldController,
|
|
4047
4052
|
combineContexts: () => combineContexts,
|
|
@@ -4062,6 +4067,7 @@ __export(index_exports, {
|
|
|
4062
4067
|
many2oneFieldController: () => many2oneFieldController,
|
|
4063
4068
|
mergeButtons: () => mergeButtons,
|
|
4064
4069
|
priorityFieldController: () => priorityFieldController,
|
|
4070
|
+
searchController: () => searchController,
|
|
4065
4071
|
setStorageItemAsync: () => setStorageItemAsync,
|
|
4066
4072
|
statusDropdownController: () => statusDropdownController,
|
|
4067
4073
|
tableBodyController: () => tableBodyController,
|
|
@@ -4679,7 +4685,6 @@ var useAuth = () => {
|
|
|
4679
4685
|
},
|
|
4680
4686
|
{
|
|
4681
4687
|
onSuccess: (res) => {
|
|
4682
|
-
setAccessToken(res.access_token);
|
|
4683
4688
|
},
|
|
4684
4689
|
onError: (err) => {
|
|
4685
4690
|
}
|
|
@@ -4986,6 +4991,130 @@ var CloseIcon = ({ className = "" }) => {
|
|
|
4986
4991
|
);
|
|
4987
4992
|
};
|
|
4988
4993
|
|
|
4994
|
+
// src/icons/filter-icon.tsx
|
|
4995
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4996
|
+
var FilterIcon = ({ className }) => {
|
|
4997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4998
|
+
"svg",
|
|
4999
|
+
{
|
|
5000
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5001
|
+
width: "16",
|
|
5002
|
+
height: "16",
|
|
5003
|
+
viewBox: "0 0 24 24",
|
|
5004
|
+
fill: "none",
|
|
5005
|
+
stroke: "currentColor",
|
|
5006
|
+
strokeWidth: "2",
|
|
5007
|
+
strokeLinecap: "round",
|
|
5008
|
+
strokeLinejoin: "round",
|
|
5009
|
+
className: `${className} h-4 w-4`,
|
|
5010
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" })
|
|
5011
|
+
}
|
|
5012
|
+
);
|
|
5013
|
+
};
|
|
5014
|
+
|
|
5015
|
+
// src/icons/check-icon.tsx
|
|
5016
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5017
|
+
var CheckIcon = () => {
|
|
5018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5019
|
+
"svg",
|
|
5020
|
+
{
|
|
5021
|
+
stroke: "currentColor",
|
|
5022
|
+
fill: "currentColor",
|
|
5023
|
+
strokeWidth: "0",
|
|
5024
|
+
viewBox: "0 0 512 512",
|
|
5025
|
+
height: "1em",
|
|
5026
|
+
width: "1em",
|
|
5027
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" })
|
|
5029
|
+
}
|
|
5030
|
+
);
|
|
5031
|
+
};
|
|
5032
|
+
|
|
5033
|
+
// src/icons/groupby-icon.tsx
|
|
5034
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5035
|
+
var GroupByIcon = ({ className }) => {
|
|
5036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5037
|
+
"svg",
|
|
5038
|
+
{
|
|
5039
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5040
|
+
width: "16",
|
|
5041
|
+
height: "16",
|
|
5042
|
+
viewBox: "0 0 24 24",
|
|
5043
|
+
fill: "none",
|
|
5044
|
+
stroke: "currentColor",
|
|
5045
|
+
strokeWidth: "2",
|
|
5046
|
+
strokeLinecap: "round",
|
|
5047
|
+
strokeLinejoin: "round",
|
|
5048
|
+
className: `${className} h-4 w-4`,
|
|
5049
|
+
children: [
|
|
5050
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polygon", { points: "12 2 2 7 12 12 22 7 12 2" }),
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "2 17 12 22 22 17" }),
|
|
5052
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "2 12 12 17 22 12" })
|
|
5053
|
+
]
|
|
5054
|
+
}
|
|
5055
|
+
);
|
|
5056
|
+
};
|
|
5057
|
+
|
|
5058
|
+
// src/icons/search-icon.tsx
|
|
5059
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5060
|
+
var SearchIcon = () => {
|
|
5061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5062
|
+
"svg",
|
|
5063
|
+
{
|
|
5064
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5065
|
+
width: "20",
|
|
5066
|
+
height: "20",
|
|
5067
|
+
viewBox: "0 0 20 20",
|
|
5068
|
+
fill: "none",
|
|
5069
|
+
children: [
|
|
5070
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5071
|
+
"path",
|
|
5072
|
+
{
|
|
5073
|
+
d: "M9.58334 18.1248C4.875 18.1248 1.04167 14.2915 1.04167 9.58317C1.04167 4.87484 4.875 1.0415 9.58334 1.0415C14.2917 1.0415 18.125 4.87484 18.125 9.58317C18.125 14.2915 14.2917 18.1248 9.58334 18.1248ZM9.58334 2.2915C5.55834 2.2915 2.29167 5.5665 2.29167 9.58317C2.29167 13.5998 5.55834 16.8748 9.58334 16.8748C13.6083 16.8748 16.875 13.5998 16.875 9.58317C16.875 5.5665 13.6083 2.2915 9.58334 2.2915Z",
|
|
5074
|
+
fill: "#525252"
|
|
5075
|
+
}
|
|
5076
|
+
),
|
|
5077
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5078
|
+
"path",
|
|
5079
|
+
{
|
|
5080
|
+
d: "M18.3333 18.9585C18.175 18.9585 18.0167 18.9002 17.8917 18.7752L16.225 17.1085C15.9833 16.8669 15.9833 16.4669 16.225 16.2252C16.4667 15.9835 16.8667 15.9835 17.1083 16.2252L18.775 17.8919C19.0167 18.1335 19.0167 18.5335 18.775 18.7752C18.65 18.9002 18.4917 18.9585 18.3333 18.9585Z",
|
|
5081
|
+
fill: "#525252"
|
|
5082
|
+
}
|
|
5083
|
+
)
|
|
5084
|
+
]
|
|
5085
|
+
}
|
|
5086
|
+
);
|
|
5087
|
+
};
|
|
5088
|
+
|
|
5089
|
+
// src/icons/chevron-bottom-icon.tsx
|
|
5090
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5091
|
+
var ChevronBottomIcon = ({
|
|
5092
|
+
className = ""
|
|
5093
|
+
}) => {
|
|
5094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5095
|
+
"svg",
|
|
5096
|
+
{
|
|
5097
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5098
|
+
width: "20",
|
|
5099
|
+
height: "20",
|
|
5100
|
+
viewBox: "0 0 20 20",
|
|
5101
|
+
fill: "none",
|
|
5102
|
+
className,
|
|
5103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5104
|
+
"path",
|
|
5105
|
+
{
|
|
5106
|
+
d: "M14 8L10.7071 11.6745C10.3182 12.1085 9.68182 12.1085 9.29293 11.6745L6 8",
|
|
5107
|
+
stroke: "#525252",
|
|
5108
|
+
strokeWidth: "1.5",
|
|
5109
|
+
strokeMiterlimit: "10",
|
|
5110
|
+
strokeLinecap: "round",
|
|
5111
|
+
strokeLinejoin: "round"
|
|
5112
|
+
}
|
|
5113
|
+
)
|
|
5114
|
+
}
|
|
5115
|
+
);
|
|
5116
|
+
};
|
|
5117
|
+
|
|
4989
5118
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
4990
5119
|
var import_react13 = require("react");
|
|
4991
5120
|
var import_environment5 = require("@fctc/interface-logic/environment");
|
|
@@ -5241,7 +5370,7 @@ var many2oneButtonController = (props) => {
|
|
|
5241
5370
|
};
|
|
5242
5371
|
|
|
5243
5372
|
// src/widget/basic/many2many-field/controller.ts
|
|
5244
|
-
var
|
|
5373
|
+
var import_react19 = require("react");
|
|
5245
5374
|
|
|
5246
5375
|
// src/widget/advance/table/table-body/controller.ts
|
|
5247
5376
|
var import_store7 = require("@fctc/interface-logic/store");
|
|
@@ -6363,10 +6492,353 @@ var tableGroupController = (props) => {
|
|
|
6363
6492
|
};
|
|
6364
6493
|
};
|
|
6365
6494
|
|
|
6495
|
+
// src/widget/advance/search/controller.ts
|
|
6496
|
+
var import_constants3 = require("@fctc/interface-logic/constants");
|
|
6497
|
+
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
6498
|
+
var import_moment = __toESM(require_moment());
|
|
6499
|
+
var import_react18 = require("react");
|
|
6500
|
+
|
|
6501
|
+
// src/provider.ts
|
|
6502
|
+
var provider_exports = {};
|
|
6503
|
+
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
6504
|
+
|
|
6505
|
+
// src/store.ts
|
|
6506
|
+
var store_exports = {};
|
|
6507
|
+
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
6508
|
+
|
|
6509
|
+
// src/widget/advance/search/controller.ts
|
|
6510
|
+
var searchController = ({
|
|
6511
|
+
viewData,
|
|
6512
|
+
actionData,
|
|
6513
|
+
fieldsList,
|
|
6514
|
+
setDomain
|
|
6515
|
+
}) => {
|
|
6516
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
6517
|
+
const { context } = actionData || {};
|
|
6518
|
+
const actionContext = typeof context === "string" ? (0, import_utils6.evalJSONContext)(context) : context;
|
|
6519
|
+
const contextSearch = { ...env.context, ...actionContext };
|
|
6520
|
+
const [filterBy, setFilterBy] = (0, import_react18.useState)(null);
|
|
6521
|
+
const [searchBy, setSearchBy] = (0, import_react18.useState)(null);
|
|
6522
|
+
const [groupBy, setGroupBy] = (0, import_react18.useState)(null);
|
|
6523
|
+
const [selectedTags, setSelectedTags] = (0, import_react18.useState)(null);
|
|
6524
|
+
const [searchString, setSearchString] = (0, import_react18.useState)("");
|
|
6525
|
+
const [searchMap, setSearchMap] = (0, import_react18.useState)({});
|
|
6526
|
+
const [isReadyFormatDomain, setIsReadyFormatDomain] = (0, import_react18.useState)(false);
|
|
6527
|
+
const [didInit, setDidInit] = (0, import_react18.useState)(false);
|
|
6528
|
+
const dispatch = (0, store_exports.useAppDispatch)();
|
|
6529
|
+
const aid = actionData?.id;
|
|
6530
|
+
const model = actionData?.res_model;
|
|
6531
|
+
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils6.evalJSONDomain)(actionData?.domain, contextSearch) : [];
|
|
6532
|
+
const clearSearch = () => {
|
|
6533
|
+
setFilterBy([]);
|
|
6534
|
+
setGroupBy([]);
|
|
6535
|
+
setSearchBy([]);
|
|
6536
|
+
setSelectedTags(null);
|
|
6537
|
+
setSearchString("");
|
|
6538
|
+
setSearchMap({});
|
|
6539
|
+
};
|
|
6540
|
+
const fetchData = async () => {
|
|
6541
|
+
if (viewData) {
|
|
6542
|
+
try {
|
|
6543
|
+
const dataModel = viewData?.models?.[model];
|
|
6544
|
+
const searchViews = viewData?.views?.search;
|
|
6545
|
+
const searchByItems = searchViews?.search_by?.filter(
|
|
6546
|
+
(item) => !import_utils6.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
6547
|
+
)?.map(
|
|
6548
|
+
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
6549
|
+
dataIndex: index,
|
|
6550
|
+
title: string ?? dataModel[name]?.string,
|
|
6551
|
+
name: name ?? dataModel[name]?.name,
|
|
6552
|
+
filter_domain,
|
|
6553
|
+
operator,
|
|
6554
|
+
widget,
|
|
6555
|
+
type: dataModel[name]?.type
|
|
6556
|
+
})
|
|
6557
|
+
);
|
|
6558
|
+
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
6559
|
+
return !import_utils6.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
6560
|
+
})?.map((item) => ({ ...item, active: false }));
|
|
6561
|
+
const groupByItems = searchViews?.group_by.filter(
|
|
6562
|
+
(item) => !import_utils6.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
6563
|
+
).map((item) => ({
|
|
6564
|
+
...item,
|
|
6565
|
+
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
6566
|
+
}));
|
|
6567
|
+
setSearchBy(searchByItems);
|
|
6568
|
+
setFilterBy(filterByItems);
|
|
6569
|
+
setGroupBy(groupByItems);
|
|
6570
|
+
} catch (error) {
|
|
6571
|
+
console.error("Error fetching data:", error);
|
|
6572
|
+
}
|
|
6573
|
+
}
|
|
6574
|
+
};
|
|
6575
|
+
(0, import_react18.useEffect)(() => {
|
|
6576
|
+
clearSearch();
|
|
6577
|
+
fetchData();
|
|
6578
|
+
}, [aid, model, viewData]);
|
|
6579
|
+
const onChangeSearchInput = (search_string) => {
|
|
6580
|
+
setSearchString(search_string);
|
|
6581
|
+
};
|
|
6582
|
+
const removeKeyFromSearchMap = ({
|
|
6583
|
+
key,
|
|
6584
|
+
item
|
|
6585
|
+
}) => {
|
|
6586
|
+
const values = searchMap[key];
|
|
6587
|
+
if (!values) return searchMap;
|
|
6588
|
+
const newSearchMap = { ...searchMap };
|
|
6589
|
+
if (item) {
|
|
6590
|
+
const filtered = values.filter((value) => value.name !== item.name);
|
|
6591
|
+
if (filtered.length > 0) {
|
|
6592
|
+
newSearchMap[key] = filtered;
|
|
6593
|
+
} else {
|
|
6594
|
+
delete newSearchMap[key];
|
|
6595
|
+
}
|
|
6596
|
+
} else {
|
|
6597
|
+
delete newSearchMap[key];
|
|
6598
|
+
}
|
|
6599
|
+
setSearchMap(newSearchMap);
|
|
6600
|
+
};
|
|
6601
|
+
const updateSearchMap = ({ key, item }) => {
|
|
6602
|
+
const newSearchMap = { ...searchMap };
|
|
6603
|
+
const currentValues = searchMap[key] ?? [];
|
|
6604
|
+
newSearchMap[key] = [...currentValues, item];
|
|
6605
|
+
setSearchMap(newSearchMap);
|
|
6606
|
+
};
|
|
6607
|
+
const removeSearchItems = (key, item) => {
|
|
6608
|
+
removeKeyFromSearchMap({ key: String(key), item });
|
|
6609
|
+
};
|
|
6610
|
+
const addSearchItems = (key, newItem) => {
|
|
6611
|
+
updateSearchMap({ key, item: newItem });
|
|
6612
|
+
};
|
|
6613
|
+
const setTagSearch = (0, import_react18.useCallback)(
|
|
6614
|
+
(updatedMap) => {
|
|
6615
|
+
if (!updatedMap) return;
|
|
6616
|
+
const tagsSearch = Object.entries(updatedMap).map(
|
|
6617
|
+
([key, objValues]) => {
|
|
6618
|
+
const {
|
|
6619
|
+
title,
|
|
6620
|
+
name,
|
|
6621
|
+
groupIndex,
|
|
6622
|
+
type,
|
|
6623
|
+
widget,
|
|
6624
|
+
modelType,
|
|
6625
|
+
dataIndex
|
|
6626
|
+
} = objValues[0];
|
|
6627
|
+
if (!key?.includes(import_constants3.SearchType.GROUP)) {
|
|
6628
|
+
const values = objValues?.map((objValue) => objValue.value);
|
|
6629
|
+
return {
|
|
6630
|
+
title,
|
|
6631
|
+
name: type === import_constants3.SearchType.SEARCH ? `${import_constants3.SearchType.SEARCH}_${String(dataIndex)}` : groupIndex ?? name,
|
|
6632
|
+
values,
|
|
6633
|
+
type,
|
|
6634
|
+
widget,
|
|
6635
|
+
modelType
|
|
6636
|
+
};
|
|
6637
|
+
} else {
|
|
6638
|
+
const contexts = [];
|
|
6639
|
+
let groupValues = [];
|
|
6640
|
+
objValues?.forEach((objValue) => {
|
|
6641
|
+
const { context: context2, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
6642
|
+
const indexAppend = groupIndex2 != null ? groupIndex2 : viewData?.views?.search?.filters_by?.length ?? 0;
|
|
6643
|
+
contexts.push(
|
|
6644
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({ group_by: item })) : [context2]
|
|
6645
|
+
);
|
|
6646
|
+
groupValues[indexAppend] = {
|
|
6647
|
+
contexts: [
|
|
6648
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({
|
|
6649
|
+
group_by: item
|
|
6650
|
+
})) : [context2]
|
|
6651
|
+
],
|
|
6652
|
+
strings: isDefault ? [value] : [...groupValues[indexAppend]?.strings ?? [], value]
|
|
6653
|
+
};
|
|
6654
|
+
});
|
|
6655
|
+
const fields = [
|
|
6656
|
+
...new Set(fieldsList?.map((item) => item?.name))
|
|
6657
|
+
];
|
|
6658
|
+
const groupByTag = {
|
|
6659
|
+
title,
|
|
6660
|
+
values: groupValues?.filter(
|
|
6661
|
+
(item) => item !== void 0
|
|
6662
|
+
),
|
|
6663
|
+
type,
|
|
6664
|
+
contexts,
|
|
6665
|
+
fields
|
|
6666
|
+
};
|
|
6667
|
+
dispatch((0, store_exports.setGroupByDomain)(groupByTag));
|
|
6668
|
+
return groupByTag;
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
);
|
|
6672
|
+
setSelectedTags(tagsSearch);
|
|
6673
|
+
setSearchString("");
|
|
6674
|
+
},
|
|
6675
|
+
[searchMap]
|
|
6676
|
+
);
|
|
6677
|
+
(0, import_react18.useEffect)(() => {
|
|
6678
|
+
setSelectedTags(null);
|
|
6679
|
+
setTagSearch(searchMap);
|
|
6680
|
+
}, [searchMap]);
|
|
6681
|
+
const formatDomain = () => {
|
|
6682
|
+
if (domainAction) {
|
|
6683
|
+
const domain = [];
|
|
6684
|
+
if (domainAction?.length > 0) {
|
|
6685
|
+
if (Object.keys(searchMap).length > 0) {
|
|
6686
|
+
domain.push("&");
|
|
6687
|
+
}
|
|
6688
|
+
domainAction.forEach((domainItem) => {
|
|
6689
|
+
domain.push(domainItem);
|
|
6690
|
+
});
|
|
6691
|
+
}
|
|
6692
|
+
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
6693
|
+
if (!key?.includes(import_constants3.SearchType.GROUP)) {
|
|
6694
|
+
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
6695
|
+
domain.push("&");
|
|
6696
|
+
}
|
|
6697
|
+
const valuesOfKey = searchMap[key];
|
|
6698
|
+
valuesOfKey.forEach((value, index) => {
|
|
6699
|
+
if (index < valuesOfKey.length - 1) {
|
|
6700
|
+
domain.push("|");
|
|
6701
|
+
}
|
|
6702
|
+
if (value.domain) {
|
|
6703
|
+
domain.push(...value.domain);
|
|
6704
|
+
return;
|
|
6705
|
+
}
|
|
6706
|
+
let valueDomainItem = value?.value;
|
|
6707
|
+
if (value?.modelType === "date") {
|
|
6708
|
+
valueDomainItem = (0, import_utils6.validateAndParseDate)(value?.value);
|
|
6709
|
+
} else if (value?.modelType === "datetime") {
|
|
6710
|
+
if (value?.operator === "<=" || value?.operator === "<") {
|
|
6711
|
+
const parsedDate = (0, import_utils6.validateAndParseDate)(value?.value, true);
|
|
6712
|
+
const hasTime = (0, import_moment.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
6713
|
+
valueDomainItem = hasTime ? (0, import_moment.default)(parsedDate).format("YYYY-MM-DD HH:mm:ss") : (0, import_moment.default)(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
6714
|
+
} else {
|
|
6715
|
+
valueDomainItem = (0, import_utils6.validateAndParseDate)(value?.value, true);
|
|
6716
|
+
}
|
|
6717
|
+
}
|
|
6718
|
+
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
6719
|
+
domain.push([value.name, operator, valueDomainItem]);
|
|
6720
|
+
});
|
|
6721
|
+
}
|
|
6722
|
+
});
|
|
6723
|
+
return [...domain];
|
|
6724
|
+
}
|
|
6725
|
+
};
|
|
6726
|
+
const handleAddTagSearch = (tag) => {
|
|
6727
|
+
const {
|
|
6728
|
+
domain,
|
|
6729
|
+
groupIndex,
|
|
6730
|
+
value,
|
|
6731
|
+
type,
|
|
6732
|
+
title,
|
|
6733
|
+
context: context2,
|
|
6734
|
+
active,
|
|
6735
|
+
dataIndex
|
|
6736
|
+
} = tag;
|
|
6737
|
+
const domainFormat = new import_utils6.domainHelper.Domain(domain);
|
|
6738
|
+
if (type === import_constants3.SearchType.FILTER) {
|
|
6739
|
+
addSearchItems(`${import_constants3.SearchType.FILTER}_${groupIndex}`, {
|
|
6740
|
+
...tag,
|
|
6741
|
+
domain: domain ? domainFormat.toList(context2) : null
|
|
6742
|
+
});
|
|
6743
|
+
} else if (type === import_constants3.SearchType.SEARCH) {
|
|
6744
|
+
addSearchItems(`${import_constants3.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
6745
|
+
...tag,
|
|
6746
|
+
domain: domain ? domainFormat.toList({
|
|
6747
|
+
...context2,
|
|
6748
|
+
self: value
|
|
6749
|
+
}) : null
|
|
6750
|
+
});
|
|
6751
|
+
} else if (type === import_constants3.SearchType.GROUP) {
|
|
6752
|
+
addSearchItems(`${import_constants3.SearchType.GROUP}`, {
|
|
6753
|
+
...tag,
|
|
6754
|
+
domain: domain ? domainFormat.toList({
|
|
6755
|
+
context: context2,
|
|
6756
|
+
self: value
|
|
6757
|
+
}) : null
|
|
6758
|
+
});
|
|
6759
|
+
}
|
|
6760
|
+
};
|
|
6761
|
+
(0, import_react18.useEffect)(() => {
|
|
6762
|
+
if (isReadyFormatDomain) {
|
|
6763
|
+
(0, store_exports.setPage)(0);
|
|
6764
|
+
(0, store_exports.setSelectedRowKeys)([]);
|
|
6765
|
+
const containSearchFilter = selectedTags?.length > 0 && selectedTags?.find(
|
|
6766
|
+
(item) => item?.type === import_constants3.SearchType.FILTER || item?.type === import_constants3.SearchType.SEARCH || item?.type === import_constants3.SearchType.GROUP
|
|
6767
|
+
);
|
|
6768
|
+
if (containSearchFilter || Array.isArray(selectedTags) && selectedTags?.length === 0) {
|
|
6769
|
+
setDomain(formatDomain());
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
return () => {
|
|
6773
|
+
setDidInit(false);
|
|
6774
|
+
setIsReadyFormatDomain(false);
|
|
6775
|
+
};
|
|
6776
|
+
}, [selectedTags, isReadyFormatDomain]);
|
|
6777
|
+
(0, import_react18.useEffect)(() => {
|
|
6778
|
+
if (didInit || selectedTags?.length > 0 || !fieldsList || fieldsList?.length === 0)
|
|
6779
|
+
return;
|
|
6780
|
+
const searchDefaults = Object.entries(actionContext || {}).filter(
|
|
6781
|
+
([key]) => key.startsWith("search_default_")
|
|
6782
|
+
);
|
|
6783
|
+
const hasGroupBy = viewData?.views?.search?.filters_by?.length > 0;
|
|
6784
|
+
if (searchDefaults.length === 0 && !hasGroupBy) {
|
|
6785
|
+
setIsReadyFormatDomain(true);
|
|
6786
|
+
setDidInit(true);
|
|
6787
|
+
return;
|
|
6788
|
+
}
|
|
6789
|
+
const updatedFilter = filterBy?.map((item) => {
|
|
6790
|
+
const matched = searchDefaults.find(
|
|
6791
|
+
([key]) => key.split("search_default_")[1] === item.name
|
|
6792
|
+
);
|
|
6793
|
+
if (matched && !item.active) {
|
|
6794
|
+
handleAddTagSearch?.({
|
|
6795
|
+
name: item?.name,
|
|
6796
|
+
value: item?.string ?? item?.help,
|
|
6797
|
+
domain: item?.domain,
|
|
6798
|
+
groupIndex: item?.group_index,
|
|
6799
|
+
type: import_constants3.SearchType.FILTER
|
|
6800
|
+
});
|
|
6801
|
+
return { ...item, active: true };
|
|
6802
|
+
}
|
|
6803
|
+
return item;
|
|
6804
|
+
});
|
|
6805
|
+
if (updatedFilter) setFilterBy(updatedFilter);
|
|
6806
|
+
if (hasGroupBy) {
|
|
6807
|
+
viewData?.views?.search?.filters_by?.forEach((item, idx) => {
|
|
6808
|
+
const groupCtx = (0, import_utils6.evalJSONContext)(item?.context);
|
|
6809
|
+
handleAddTagSearch?.({
|
|
6810
|
+
name: item?.name,
|
|
6811
|
+
value: item?.display_name,
|
|
6812
|
+
type: import_constants3.SearchType.GROUP,
|
|
6813
|
+
context: groupCtx,
|
|
6814
|
+
groupIndex: idx,
|
|
6815
|
+
isDefault: true
|
|
6816
|
+
});
|
|
6817
|
+
});
|
|
6818
|
+
setDidInit(true);
|
|
6819
|
+
}
|
|
6820
|
+
setIsReadyFormatDomain(true);
|
|
6821
|
+
}, [aid, fieldsList]);
|
|
6822
|
+
return {
|
|
6823
|
+
groupBy,
|
|
6824
|
+
searchBy,
|
|
6825
|
+
filterBy,
|
|
6826
|
+
selectedTags,
|
|
6827
|
+
searchString,
|
|
6828
|
+
setFilterBy,
|
|
6829
|
+
setGroupBy,
|
|
6830
|
+
setSearchBy,
|
|
6831
|
+
clearSearch,
|
|
6832
|
+
setSelectedTags,
|
|
6833
|
+
removeSearchItems,
|
|
6834
|
+
onSearchString: onChangeSearchInput
|
|
6835
|
+
};
|
|
6836
|
+
};
|
|
6837
|
+
|
|
6366
6838
|
// src/widget/basic/many2many-field/controller.ts
|
|
6367
6839
|
var import_environment8 = require("@fctc/interface-logic/environment");
|
|
6368
|
-
var
|
|
6369
|
-
var
|
|
6840
|
+
var import_store12 = require("@fctc/interface-logic/store");
|
|
6841
|
+
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
6370
6842
|
var many2manyFieldController = (props) => {
|
|
6371
6843
|
const {
|
|
6372
6844
|
relation,
|
|
@@ -6375,7 +6847,7 @@ var many2manyFieldController = (props) => {
|
|
|
6375
6847
|
tab,
|
|
6376
6848
|
model,
|
|
6377
6849
|
aid,
|
|
6378
|
-
setSelectedRowKeys:
|
|
6850
|
+
setSelectedRowKeys: setSelectedRowKeys5,
|
|
6379
6851
|
fields,
|
|
6380
6852
|
setFields,
|
|
6381
6853
|
groupByDomain,
|
|
@@ -6383,14 +6855,14 @@ var many2manyFieldController = (props) => {
|
|
|
6383
6855
|
options,
|
|
6384
6856
|
sessionStorageUtils
|
|
6385
6857
|
} = props;
|
|
6386
|
-
const appDispatch = (0,
|
|
6858
|
+
const appDispatch = (0, import_store12.useAppDispatch)();
|
|
6387
6859
|
const actionData = sessionStorageUtils.getActionData();
|
|
6388
6860
|
const [debouncedPage] = useDebounce(page, 500);
|
|
6389
|
-
const [order, setOrder] = (0,
|
|
6390
|
-
const [isLoadedData, setIsLoadedData] = (0,
|
|
6391
|
-
const [domainMany2Many, setDomainMany2Many] = (0,
|
|
6861
|
+
const [order, setOrder] = (0, import_react19.useState)();
|
|
6862
|
+
const [isLoadedData, setIsLoadedData] = (0, import_react19.useState)(false);
|
|
6863
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react19.useState)(domain);
|
|
6392
6864
|
const env = (0, import_environment8.getEnv)();
|
|
6393
|
-
const { selectedTags } = (0,
|
|
6865
|
+
const { selectedTags } = (0, import_store12.useAppSelector)(import_store12.selectSearch);
|
|
6394
6866
|
const viewParams = {
|
|
6395
6867
|
model: relation,
|
|
6396
6868
|
views: [
|
|
@@ -6403,7 +6875,7 @@ var many2manyFieldController = (props) => {
|
|
|
6403
6875
|
viewParams,
|
|
6404
6876
|
actionData
|
|
6405
6877
|
);
|
|
6406
|
-
const baseModel = (0,
|
|
6878
|
+
const baseModel = (0, import_react19.useMemo)(
|
|
6407
6879
|
() => ({
|
|
6408
6880
|
name: String(relation),
|
|
6409
6881
|
view: viewResponse || {},
|
|
@@ -6416,25 +6888,25 @@ var many2manyFieldController = (props) => {
|
|
|
6416
6888
|
[model, viewResponse]
|
|
6417
6889
|
);
|
|
6418
6890
|
const initModel = (0, hooks_exports.useModel)();
|
|
6419
|
-
const modelInstance = (0,
|
|
6891
|
+
const modelInstance = (0, import_react19.useMemo)(() => {
|
|
6420
6892
|
if (viewResponse) {
|
|
6421
6893
|
return initModel.initModel(baseModel);
|
|
6422
6894
|
}
|
|
6423
6895
|
return null;
|
|
6424
6896
|
}, [baseModel, viewResponse]);
|
|
6425
|
-
const specification = (0,
|
|
6897
|
+
const specification = (0, import_react19.useMemo)(() => {
|
|
6426
6898
|
if (modelInstance) {
|
|
6427
6899
|
return modelInstance.getSpecification();
|
|
6428
6900
|
}
|
|
6429
6901
|
return null;
|
|
6430
6902
|
}, [modelInstance]);
|
|
6431
6903
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
6432
|
-
const optionsObject = tab?.options ? (0,
|
|
6904
|
+
const optionsObject = tab?.options ? (0, import_utils7.evalJSONContext)(tab?.options) : (options ? (0, import_utils7.evalJSONContext)(options) : {}) || {};
|
|
6433
6905
|
const fetchData = async () => {
|
|
6434
6906
|
try {
|
|
6435
6907
|
setDomainMany2Many(domain);
|
|
6436
|
-
appDispatch((0,
|
|
6437
|
-
appDispatch((0,
|
|
6908
|
+
appDispatch((0, import_store12.setFirstDomain)(domain));
|
|
6909
|
+
appDispatch((0, import_store12.setViewDataStore)(viewResponse));
|
|
6438
6910
|
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
6439
6911
|
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
6440
6912
|
...field
|
|
@@ -6445,7 +6917,7 @@ var many2manyFieldController = (props) => {
|
|
|
6445
6917
|
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
6446
6918
|
});
|
|
6447
6919
|
}
|
|
6448
|
-
appDispatch((0,
|
|
6920
|
+
appDispatch((0, import_store12.setPage)(0));
|
|
6449
6921
|
} catch (err) {
|
|
6450
6922
|
console.log(err);
|
|
6451
6923
|
}
|
|
@@ -6467,7 +6939,7 @@ var many2manyFieldController = (props) => {
|
|
|
6467
6939
|
context,
|
|
6468
6940
|
fields: groupByDomain?.fields,
|
|
6469
6941
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
6470
|
-
sort: order ? order : default_order ? (0,
|
|
6942
|
+
sort: order ? order : default_order ? (0, import_utils7.formatSortingString)(default_order) : ""
|
|
6471
6943
|
};
|
|
6472
6944
|
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
6473
6945
|
const {
|
|
@@ -6476,18 +6948,18 @@ var many2manyFieldController = (props) => {
|
|
|
6476
6948
|
isFetched: isDataResponseFetched,
|
|
6477
6949
|
isPlaceholderData
|
|
6478
6950
|
} = (0, hooks_exports.useGetListData)(data, queryKey, enabled);
|
|
6479
|
-
(0,
|
|
6951
|
+
(0, import_react19.useEffect)(() => {
|
|
6480
6952
|
if (viewResponse) {
|
|
6481
6953
|
fetchData();
|
|
6482
6954
|
}
|
|
6483
6955
|
return () => {
|
|
6484
|
-
appDispatch((0,
|
|
6956
|
+
appDispatch((0, import_store12.setGroupByDomain)(null));
|
|
6485
6957
|
setFields((prevFields) => ({
|
|
6486
6958
|
...prevFields,
|
|
6487
6959
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
6488
6960
|
}));
|
|
6489
|
-
appDispatch((0,
|
|
6490
|
-
|
|
6961
|
+
appDispatch((0, import_store12.setPage)(0));
|
|
6962
|
+
setSelectedRowKeys5([]);
|
|
6491
6963
|
setDomainMany2Many(null);
|
|
6492
6964
|
setIsLoadedData(false);
|
|
6493
6965
|
};
|
|
@@ -6515,13 +6987,13 @@ var many2manyFieldController = (props) => {
|
|
|
6515
6987
|
queryKey: [`form-view-action-${relation}`],
|
|
6516
6988
|
enabled: false
|
|
6517
6989
|
});
|
|
6518
|
-
(0,
|
|
6990
|
+
(0, import_react19.useEffect)(() => {
|
|
6519
6991
|
if (isSuccess && dataFormViewResponse) {
|
|
6520
6992
|
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
6521
6993
|
window.location.href = `/form/menu?model=${relation}`;
|
|
6522
6994
|
}
|
|
6523
6995
|
}, [isSuccess]);
|
|
6524
|
-
(0,
|
|
6996
|
+
(0, import_react19.useEffect)(() => {
|
|
6525
6997
|
if (domainMany2Many && !isLoadedData) {
|
|
6526
6998
|
setIsLoadedData(true);
|
|
6527
6999
|
}
|
|
@@ -6537,11 +7009,11 @@ var many2manyFieldController = (props) => {
|
|
|
6537
7009
|
};
|
|
6538
7010
|
|
|
6539
7011
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
6540
|
-
var
|
|
6541
|
-
var
|
|
7012
|
+
var import_react20 = require("react");
|
|
7013
|
+
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
6542
7014
|
var import_environment9 = require("@fctc/interface-logic/environment");
|
|
6543
7015
|
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
6544
|
-
var
|
|
7016
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
6545
7017
|
var many2manyTagsController = (props) => {
|
|
6546
7018
|
const {
|
|
6547
7019
|
relation,
|
|
@@ -6553,9 +7025,9 @@ var many2manyTagsController = (props) => {
|
|
|
6553
7025
|
} = props;
|
|
6554
7026
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
6555
7027
|
const env = (0, import_environment9.getEnv)();
|
|
6556
|
-
const addtionalFields = optionsFields ? (0,
|
|
6557
|
-
const domainObject = (0,
|
|
6558
|
-
() => (0,
|
|
7028
|
+
const addtionalFields = optionsFields ? (0, import_utils8.evalJSONContext)(optionsFields) : null;
|
|
7029
|
+
const domainObject = (0, import_react20.useMemo)(
|
|
7030
|
+
() => (0, import_utils8.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
6559
7031
|
[domain, formValues]
|
|
6560
7032
|
);
|
|
6561
7033
|
const data = {
|
|
@@ -6565,8 +7037,8 @@ var many2manyTagsController = (props) => {
|
|
|
6565
7037
|
id: {},
|
|
6566
7038
|
name: {},
|
|
6567
7039
|
display_name: {},
|
|
6568
|
-
...widget &&
|
|
6569
|
-
...widget &&
|
|
7040
|
+
...widget && import_constants4.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
7041
|
+
...widget && import_constants4.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
6570
7042
|
},
|
|
6571
7043
|
enabled: true,
|
|
6572
7044
|
context: env.context
|
|
@@ -6597,10 +7069,10 @@ var many2manyTagsController = (props) => {
|
|
|
6597
7069
|
};
|
|
6598
7070
|
|
|
6599
7071
|
// src/widget/basic/status-bar-field/controller.ts
|
|
6600
|
-
var
|
|
7072
|
+
var import_react21 = require("react");
|
|
6601
7073
|
var import_hooks16 = require("@fctc/interface-logic/hooks");
|
|
6602
|
-
var
|
|
6603
|
-
var
|
|
7074
|
+
var import_store13 = require("@fctc/interface-logic/store");
|
|
7075
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
6604
7076
|
var durationController = (props) => {
|
|
6605
7077
|
const {
|
|
6606
7078
|
relation,
|
|
@@ -6617,14 +7089,14 @@ var durationController = (props) => {
|
|
|
6617
7089
|
name: "",
|
|
6618
7090
|
fold: ""
|
|
6619
7091
|
};
|
|
6620
|
-
const [disabled, setDisabled] = (0,
|
|
6621
|
-
const [modelStatus, setModalStatus] = (0,
|
|
6622
|
-
const { context } = (0,
|
|
7092
|
+
const [disabled, setDisabled] = (0, import_react21.useState)(false);
|
|
7093
|
+
const [modelStatus, setModalStatus] = (0, import_react21.useState)(false);
|
|
7094
|
+
const { context } = (0, import_store13.useAppSelector)(import_store13.selectEnv);
|
|
6623
7095
|
const queryKey = [`data-status-duration`, specification];
|
|
6624
7096
|
const listDataProps = {
|
|
6625
7097
|
model: relation,
|
|
6626
7098
|
specification,
|
|
6627
|
-
domain: (0,
|
|
7099
|
+
domain: (0, import_utils9.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
6628
7100
|
limit: 10,
|
|
6629
7101
|
offset: 0,
|
|
6630
7102
|
fields: "",
|
|
@@ -6672,7 +7144,7 @@ var durationController = (props) => {
|
|
|
6672
7144
|
|
|
6673
7145
|
// src/widget/basic/priority-field/controller.ts
|
|
6674
7146
|
var import_hooks17 = require("@fctc/interface-logic/hooks");
|
|
6675
|
-
var
|
|
7147
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
6676
7148
|
var priorityFieldController = (props) => {
|
|
6677
7149
|
const {
|
|
6678
7150
|
value,
|
|
@@ -6687,7 +7159,7 @@ var priorityFieldController = (props) => {
|
|
|
6687
7159
|
viewData,
|
|
6688
7160
|
context
|
|
6689
7161
|
} = props;
|
|
6690
|
-
const _context = { ...(0,
|
|
7162
|
+
const _context = { ...(0, import_utils10.evalJSONContext)(actionData?.context) };
|
|
6691
7163
|
const contextObject = { ...context, ..._context };
|
|
6692
7164
|
const defaultPriority = parseInt(value) + 1;
|
|
6693
7165
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
@@ -6726,8 +7198,8 @@ var priorityFieldController = (props) => {
|
|
|
6726
7198
|
};
|
|
6727
7199
|
|
|
6728
7200
|
// src/widget/basic/float-time-field/controller.ts
|
|
6729
|
-
var
|
|
6730
|
-
var
|
|
7201
|
+
var import_react22 = require("react");
|
|
7202
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
6731
7203
|
var floatTimeFiledController = ({
|
|
6732
7204
|
onChange: fieldOnChange,
|
|
6733
7205
|
onBlur,
|
|
@@ -6736,11 +7208,11 @@ var floatTimeFiledController = ({
|
|
|
6736
7208
|
props
|
|
6737
7209
|
}) => {
|
|
6738
7210
|
const { name, defaultValue = 0, onChange } = props;
|
|
6739
|
-
const [input, setInput] = (0,
|
|
6740
|
-
(0,
|
|
7211
|
+
const [input, setInput] = (0, import_react22.useState)(
|
|
7212
|
+
(0, import_utils11.convertFloatToTime)(value ?? defaultValue)
|
|
6741
7213
|
);
|
|
6742
|
-
const [formattedTime, setFormattedTime] = (0,
|
|
6743
|
-
const [errors, setErrors] = (0,
|
|
7214
|
+
const [formattedTime, setFormattedTime] = (0, import_react22.useState)("");
|
|
7215
|
+
const [errors, setErrors] = (0, import_react22.useState)("");
|
|
6744
7216
|
const handleInputChange = (e) => {
|
|
6745
7217
|
const raw = e.target.value.replace(/[^\d:]/g, "");
|
|
6746
7218
|
setInput(raw);
|
|
@@ -6770,7 +7242,7 @@ var floatTimeFiledController = ({
|
|
|
6770
7242
|
if (!isDirty) return;
|
|
6771
7243
|
if (formattedTime) {
|
|
6772
7244
|
setInput(formattedTime);
|
|
6773
|
-
const floatVal = (0,
|
|
7245
|
+
const floatVal = (0, import_utils11.convertTimeToFloat)(formattedTime);
|
|
6774
7246
|
fieldOnChange(floatVal);
|
|
6775
7247
|
if (onChange) {
|
|
6776
7248
|
onChange(name ?? "", floatVal);
|
|
@@ -6813,7 +7285,7 @@ var floatTimeFiledController = ({
|
|
|
6813
7285
|
};
|
|
6814
7286
|
|
|
6815
7287
|
// src/widget/basic/float-field/controller.ts
|
|
6816
|
-
var
|
|
7288
|
+
var import_react23 = require("react");
|
|
6817
7289
|
var floatController = ({
|
|
6818
7290
|
onChange,
|
|
6819
7291
|
value,
|
|
@@ -6821,10 +7293,10 @@ var floatController = ({
|
|
|
6821
7293
|
}) => {
|
|
6822
7294
|
const { name, required, methods, onChange: handleOnchange, string } = props;
|
|
6823
7295
|
const { setError, clearErrors } = methods;
|
|
6824
|
-
const [inputValue, setInputValue] = (0,
|
|
7296
|
+
const [inputValue, setInputValue] = (0, import_react23.useState)(
|
|
6825
7297
|
value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
|
|
6826
7298
|
);
|
|
6827
|
-
(0,
|
|
7299
|
+
(0, import_react23.useEffect)(() => {
|
|
6828
7300
|
if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
|
|
6829
7301
|
setInputValue(useFormatFloatNumber(value));
|
|
6830
7302
|
clearErrors(name);
|
|
@@ -6832,9 +7304,9 @@ var floatController = ({
|
|
|
6832
7304
|
setInputValue("");
|
|
6833
7305
|
}
|
|
6834
7306
|
}, [value, name, clearErrors]);
|
|
6835
|
-
const isDirtyRef = (0,
|
|
6836
|
-
const inputRef = (0,
|
|
6837
|
-
const lastCommittedValueRef = (0,
|
|
7307
|
+
const isDirtyRef = (0, import_react23.useRef)(false);
|
|
7308
|
+
const inputRef = (0, import_react23.useRef)(null);
|
|
7309
|
+
const lastCommittedValueRef = (0, import_react23.useRef)(null);
|
|
6838
7310
|
const handleInputChange = (e) => {
|
|
6839
7311
|
const newValue = e.target.value;
|
|
6840
7312
|
const valueWithoutCommas = newValue.replace(/,/g, "");
|
|
@@ -6935,10 +7407,10 @@ var useFormatFloatNumber = (value) => {
|
|
|
6935
7407
|
};
|
|
6936
7408
|
|
|
6937
7409
|
// src/widget/basic/download-file-field/controller.ts
|
|
6938
|
-
var
|
|
7410
|
+
var import_react24 = require("react");
|
|
6939
7411
|
var downloadFileController = () => {
|
|
6940
|
-
const inputId = (0,
|
|
6941
|
-
const [file, setFile] = (0,
|
|
7412
|
+
const inputId = (0, import_react24.useId)();
|
|
7413
|
+
const [file, setFile] = (0, import_react24.useState)(null);
|
|
6942
7414
|
const handleFileChange = (e) => {
|
|
6943
7415
|
setFile(e.target.files[0]);
|
|
6944
7416
|
};
|
|
@@ -6990,7 +7462,7 @@ var downLoadBinaryController = (props) => {
|
|
|
6990
7462
|
};
|
|
6991
7463
|
|
|
6992
7464
|
// src/widget/basic/date-field/controller.ts
|
|
6993
|
-
var
|
|
7465
|
+
var import_moment2 = __toESM(require_moment());
|
|
6994
7466
|
var DURATIONS = {
|
|
6995
7467
|
PAST: "past",
|
|
6996
7468
|
NOW: "now",
|
|
@@ -7017,8 +7489,8 @@ var dateFieldController = (props) => {
|
|
|
7017
7489
|
const formatDate = showTime ? "DD/MM/YYYY HH:mm:ss" : "DD/MM/YYYY";
|
|
7018
7490
|
const formatDateParse = showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
7019
7491
|
const fieldForCustom = widget === "datetime_custom" || widget === "date_custom";
|
|
7020
|
-
const minNowValue = fieldForCustom && (min === DURATIONS.NOW ? true : typeof min === "string" && Object.keys(formValues)?.includes(min) && formValues?.[min] ? (0,
|
|
7021
|
-
const maxNowValue = fieldForCustom && (max === DURATIONS.NOW ? true : typeof max === "string" && Object.keys(formValues)?.includes(max) && formValues?.[max] ? (0,
|
|
7492
|
+
const minNowValue = fieldForCustom && (min === DURATIONS.NOW ? true : typeof min === "string" && Object.keys(formValues)?.includes(min) && formValues?.[min] ? (0, import_moment2.default)(formValues?.[min], formatDateParse).add(7, "hours") : null);
|
|
7493
|
+
const maxNowValue = fieldForCustom && (max === DURATIONS.NOW ? true : typeof max === "string" && Object.keys(formValues)?.includes(max) && formValues?.[max] ? (0, import_moment2.default)(formValues?.[max], formatDateParse).add(7, "hours") : null);
|
|
7022
7494
|
const years = range(
|
|
7023
7495
|
minNowValue ? (/* @__PURE__ */ new Date()).getFullYear() : 1990,
|
|
7024
7496
|
(/* @__PURE__ */ new Date()).getFullYear() + 4,
|
|
@@ -7053,8 +7525,8 @@ var dateFieldController = (props) => {
|
|
|
7053
7525
|
"December"
|
|
7054
7526
|
];
|
|
7055
7527
|
const customValidateMinMax = (date) => {
|
|
7056
|
-
const selected = (0,
|
|
7057
|
-
const now = (0,
|
|
7528
|
+
const selected = (0, import_moment2.default)(date, formatDateParse);
|
|
7529
|
+
const now = (0, import_moment2.default)();
|
|
7058
7530
|
const compareSelected = showTime ? selected : selected.clone().startOf("day");
|
|
7059
7531
|
const compareNow = showTime ? now : now.clone().startOf("day");
|
|
7060
7532
|
if (minNowValue) {
|
|
@@ -7062,7 +7534,7 @@ var dateFieldController = (props) => {
|
|
|
7062
7534
|
return `${i18n_default.t("please_enter")} ${string} ${i18n_default.t(
|
|
7063
7535
|
"greater_or_equal_now"
|
|
7064
7536
|
)}`;
|
|
7065
|
-
} else if (
|
|
7537
|
+
} else if (import_moment2.default.isMoment(minNowValue)) {
|
|
7066
7538
|
const compareMin = showTime ? minNowValue : minNowValue.clone().startOf("day");
|
|
7067
7539
|
if (compareSelected.isBefore(compareMin)) {
|
|
7068
7540
|
const fieldRelationDate = viewData?.models?.[model]?.[min ?? ""];
|
|
@@ -7076,7 +7548,7 @@ var dateFieldController = (props) => {
|
|
|
7076
7548
|
return `${i18n_default.t("please_enter")} ${string} ${i18n_default.t(
|
|
7077
7549
|
"less_or_equal_now"
|
|
7078
7550
|
)}`;
|
|
7079
|
-
} else if (
|
|
7551
|
+
} else if (import_moment2.default.isMoment(maxNowValue)) {
|
|
7080
7552
|
const compareMax = showTime ? maxNowValue : maxNowValue.clone().startOf("day");
|
|
7081
7553
|
if (compareSelected.isAfter(compareMax)) {
|
|
7082
7554
|
const fieldRelationDate = viewData?.models?.[model]?.[max ?? ""];
|
|
@@ -7102,13 +7574,13 @@ var dateFieldController = (props) => {
|
|
|
7102
7574
|
};
|
|
7103
7575
|
|
|
7104
7576
|
// src/widget/basic/copy-link-button/controller.ts
|
|
7105
|
-
var
|
|
7106
|
-
var
|
|
7577
|
+
var import_react25 = require("react");
|
|
7578
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
7107
7579
|
var copyLinkButtonController = (props) => {
|
|
7108
7580
|
const { value, defaultValue } = props;
|
|
7109
|
-
const [isCopied, setIsCopied] = (0,
|
|
7581
|
+
const [isCopied, setIsCopied] = (0, import_react25.useState)(false);
|
|
7110
7582
|
const handleCopyToClipboard = async (value2) => {
|
|
7111
|
-
await (0,
|
|
7583
|
+
await (0, import_utils12.copyTextToClipboard)(value2);
|
|
7112
7584
|
setIsCopied(true);
|
|
7113
7585
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
7114
7586
|
};
|
|
@@ -7123,11 +7595,11 @@ var copyLinkButtonController = (props) => {
|
|
|
7123
7595
|
// src/widget/basic/color-field/color-controller.ts
|
|
7124
7596
|
var import_environment10 = require("@fctc/interface-logic/environment");
|
|
7125
7597
|
var import_hooks18 = require("@fctc/interface-logic/hooks");
|
|
7126
|
-
var
|
|
7598
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
7127
7599
|
var colorFieldController = (props) => {
|
|
7128
7600
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
7129
7601
|
const env = (0, import_environment10.getEnv)();
|
|
7130
|
-
const _context = { ...(0,
|
|
7602
|
+
const _context = { ...(0, import_utils13.evalJSONContext)(actionData?.context) || {} };
|
|
7131
7603
|
const contextObject = { ...env.context, ..._context };
|
|
7132
7604
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
7133
7605
|
const { mutate: onSave } = (0, import_hooks18.useSave)();
|
|
@@ -7155,16 +7627,16 @@ var colorFieldController = (props) => {
|
|
|
7155
7627
|
};
|
|
7156
7628
|
|
|
7157
7629
|
// src/widget/basic/binary-field/controller.ts
|
|
7158
|
-
var
|
|
7159
|
-
var
|
|
7630
|
+
var import_react26 = require("react");
|
|
7631
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
7160
7632
|
var binaryFieldController = (props) => {
|
|
7161
7633
|
const { name, methods, readonly = false, value } = props;
|
|
7162
|
-
const inputId = (0,
|
|
7163
|
-
const [selectedImage, setSelectedImage] = (0,
|
|
7164
|
-
const [initialImage, setInitialImage] = (0,
|
|
7165
|
-
const [isInsideTable, setIsInsideTable] = (0,
|
|
7634
|
+
const inputId = (0, import_react26.useId)();
|
|
7635
|
+
const [selectedImage, setSelectedImage] = (0, import_react26.useState)(null);
|
|
7636
|
+
const [initialImage, setInitialImage] = (0, import_react26.useState)(value || null);
|
|
7637
|
+
const [isInsideTable, setIsInsideTable] = (0, import_react26.useState)(false);
|
|
7166
7638
|
const { setValue } = methods;
|
|
7167
|
-
const binaryRef = (0,
|
|
7639
|
+
const binaryRef = (0, import_react26.useRef)(null);
|
|
7168
7640
|
const convertUrlToBase64 = async (url) => {
|
|
7169
7641
|
try {
|
|
7170
7642
|
const response = await fetch(url);
|
|
@@ -7213,11 +7685,11 @@ var binaryFieldController = (props) => {
|
|
|
7213
7685
|
};
|
|
7214
7686
|
const checkIsImageLink = (url) => {
|
|
7215
7687
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
7216
|
-
return imageExtensions.test(url) || (0,
|
|
7688
|
+
return imageExtensions.test(url) || (0, import_utils14.isBase64Image)(url) || isBlobUrl(url);
|
|
7217
7689
|
};
|
|
7218
7690
|
const getImageBase64WithMimeType = (base64) => {
|
|
7219
7691
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
7220
|
-
if ((0,
|
|
7692
|
+
if ((0, import_utils14.isBase64Image)(base64)) return base64;
|
|
7221
7693
|
let mimeType = null;
|
|
7222
7694
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
7223
7695
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -7226,14 +7698,14 @@ var binaryFieldController = (props) => {
|
|
|
7226
7698
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
7227
7699
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
7228
7700
|
};
|
|
7229
|
-
(0,
|
|
7701
|
+
(0, import_react26.useEffect)(() => {
|
|
7230
7702
|
return () => {
|
|
7231
7703
|
if (selectedImage) {
|
|
7232
7704
|
URL.revokeObjectURL(selectedImage);
|
|
7233
7705
|
}
|
|
7234
7706
|
};
|
|
7235
7707
|
}, [selectedImage]);
|
|
7236
|
-
(0,
|
|
7708
|
+
(0, import_react26.useEffect)(() => {
|
|
7237
7709
|
if (binaryRef.current) {
|
|
7238
7710
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
7239
7711
|
setIsInsideTable(isInsideTable2);
|
|
@@ -7272,12 +7744,6 @@ __reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
|
7272
7744
|
|
|
7273
7745
|
// src/index.ts
|
|
7274
7746
|
__reExport(index_exports, utils_exports, module.exports);
|
|
7275
|
-
|
|
7276
|
-
// src/store.ts
|
|
7277
|
-
var store_exports = {};
|
|
7278
|
-
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
7279
|
-
|
|
7280
|
-
// src/index.ts
|
|
7281
7747
|
__reExport(index_exports, store_exports, module.exports);
|
|
7282
7748
|
|
|
7283
7749
|
// src/constants.ts
|
|
@@ -7287,12 +7753,6 @@ __reExport(constants_exports, require("@fctc/interface-logic/constants"));
|
|
|
7287
7753
|
// src/index.ts
|
|
7288
7754
|
__reExport(index_exports, constants_exports, module.exports);
|
|
7289
7755
|
__reExport(index_exports, environment_exports, module.exports);
|
|
7290
|
-
|
|
7291
|
-
// src/provider.ts
|
|
7292
|
-
var provider_exports = {};
|
|
7293
|
-
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
7294
|
-
|
|
7295
|
-
// src/index.ts
|
|
7296
7756
|
__reExport(index_exports, provider_exports, module.exports);
|
|
7297
7757
|
|
|
7298
7758
|
// src/services.ts
|
|
@@ -7313,10 +7773,15 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
7313
7773
|
API_APP_URL,
|
|
7314
7774
|
API_PRESCHOOL_URL,
|
|
7315
7775
|
AppProvider,
|
|
7776
|
+
CheckIcon,
|
|
7777
|
+
ChevronBottomIcon,
|
|
7316
7778
|
CloseIcon,
|
|
7317
7779
|
EyeIcon,
|
|
7780
|
+
FilterIcon,
|
|
7781
|
+
GroupByIcon,
|
|
7318
7782
|
LoadingIcon,
|
|
7319
7783
|
STORAGES,
|
|
7784
|
+
SearchIcon,
|
|
7320
7785
|
binaryFieldController,
|
|
7321
7786
|
colorFieldController,
|
|
7322
7787
|
combineContexts,
|
|
@@ -7337,6 +7802,7 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
7337
7802
|
many2oneFieldController,
|
|
7338
7803
|
mergeButtons,
|
|
7339
7804
|
priorityFieldController,
|
|
7805
|
+
searchController,
|
|
7340
7806
|
setStorageItemAsync,
|
|
7341
7807
|
statusDropdownController,
|
|
7342
7808
|
tableBodyController,
|